1 /*
2  * Copyright (c) 2019, MediaTek Inc. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <lib/bl_aux_params/bl_aux_params.h>
8 #include <common/debug.h>
9 #include <plat_params.h>
10 #include <string.h>
11 
12 static struct bl_aux_gpio_info rst_gpio;
13 
plat_get_mtk_gpio_reset(void)14 struct bl_aux_gpio_info *plat_get_mtk_gpio_reset(void)
15 {
16 	return &rst_gpio;
17 }
18 
mtk_aux_param_handler(struct bl_aux_param_header * param)19 static bool mtk_aux_param_handler(struct bl_aux_param_header *param)
20 {
21 	/* Store platform parameters for later processing if needed. */
22 	switch (param->type) {
23 	case BL_AUX_PARAM_MTK_RESET_GPIO:
24 		rst_gpio = ((struct bl_aux_param_gpio *)param)->gpio;
25 		return true;
26 	}
27 
28 	return false;
29 }
30 
params_early_setup(u_register_t plat_param_from_bl2)31 void params_early_setup(u_register_t plat_param_from_bl2)
32 {
33 	bl_aux_params_parse(plat_param_from_bl2, mtk_aux_param_handler);
34 }
35 
36