2 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
14 #include <plat_params.h>
15 #include <plat_private.h>
19 static struct gpio_info param_reset
;
20 static struct gpio_info param_poweroff
;
21 static struct bl31_apio_param param_apio
;
22 static struct gpio_info
*rst_gpio
;
23 static struct gpio_info
*poweroff_gpio
;
24 static struct gpio_info suspend_gpio
[10];
25 uint32_t suspend_gpio_cnt
;
26 static struct apio_info
*suspend_apio
;
28 struct gpio_info
*plat_get_rockchip_gpio_reset(void)
33 struct gpio_info
*plat_get_rockchip_gpio_poweroff(void)
38 struct gpio_info
*plat_get_rockchip_suspend_gpio(uint32_t *count
)
40 *count
= suspend_gpio_cnt
;
42 return &suspend_gpio
[0];
45 struct apio_info
*plat_get_rockchip_suspend_apio(void)
50 void params_early_setup(void *plat_param_from_bl2
)
52 struct bl31_plat_param
*bl2_param
;
53 struct bl31_gpio_param
*gpio_param
;
55 /* keep plat parameters for later processing if need */
56 bl2_param
= (struct bl31_plat_param
*)plat_param_from_bl2
;
58 switch (bl2_param
->type
) {
60 gpio_param
= (struct bl31_gpio_param
*)bl2_param
;
61 memcpy(¶m_reset
, &gpio_param
->gpio
,
62 sizeof(struct gpio_info
));
63 rst_gpio
= ¶m_reset
;
66 gpio_param
= (struct bl31_gpio_param
*)bl2_param
;
67 memcpy(¶m_poweroff
, &gpio_param
->gpio
,
68 sizeof(struct gpio_info
));
69 poweroff_gpio
= ¶m_poweroff
;
71 case PARAM_SUSPEND_GPIO
:
72 if (suspend_gpio_cnt
>= ARRAY_SIZE(suspend_gpio
)) {
73 ERROR("exceed support suspend gpio number\n");
76 gpio_param
= (struct bl31_gpio_param
*)bl2_param
;
77 memcpy(&suspend_gpio
[suspend_gpio_cnt
],
79 sizeof(struct gpio_info
));
82 case PARAM_SUSPEND_APIO
:
83 memcpy(¶m_apio
, bl2_param
,
84 sizeof(struct bl31_apio_param
));
85 suspend_apio
= ¶m_apio
.apio
;
88 case PARAM_COREBOOT_TABLE
:
89 coreboot_table_setup((void *)
90 ((struct bl31_u64_param
*)bl2_param
)->value
);
94 ERROR("not expected type found %lld\n",
98 bl2_param
= bl2_param
->next
;