mb/google/cherry: Pass reset gpio parameter to BL31

To support gpio reset SoC, we need to pass the reset gpio parameter to
BL31.

TEST=execute `echo b > /proc/sysrq-trigger` to reboot system

Change-Id: I1a55216c0d5a00bbdb373d931bd50ebe7ca5694f
Signed-off-by: Yidi Lin <yidi.lin@mediatek.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/54013
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
Yidi Lin 2021-04-08 09:55:11 +08:00 committed by Patrick Georgi
parent df3380c9db
commit 7c06dd9e26
1 changed files with 18 additions and 0 deletions

View File

@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
#include <bl31.h>
#include <bootmode.h> #include <bootmode.h>
#include <console/console.h> #include <console/console.h>
#include <delay.h> #include <delay.h>
@ -12,6 +13,10 @@
#include <soc/regulator.h> #include <soc/regulator.h>
#include <soc/usb.h> #include <soc/usb.h>
#include "gpio.h"
#include <arm-trusted-firmware/include/export/plat/mediatek/common/plat_params_exp.h>
DEFINE_BITFIELD(MSDC0_DRV, 29, 0) DEFINE_BITFIELD(MSDC0_DRV, 29, 0)
DEFINE_BITFIELD(MSDC1_DRV, 17, 0) DEFINE_BITFIELD(MSDC1_DRV, 17, 0)
DEFINE_BITFIELD(MSDC1_GPIO_MODE0_0, 26, 24) DEFINE_BITFIELD(MSDC1_GPIO_MODE0_0, 26, 24)
@ -31,6 +36,17 @@ enum {
MSDC1_GPIO_MODE1_BASE = 0x100053e0, MSDC1_GPIO_MODE1_BASE = 0x100053e0,
}; };
static void register_reset_to_bl31(void)
{
static struct bl_aux_param_gpio param_reset = {
.h = { .type = BL_AUX_PARAM_MTK_RESET_GPIO },
.gpio = { .polarity = ARM_TF_GPIO_LEVEL_HIGH },
};
param_reset.gpio.index = GPIO_RESET.id;
register_bl31_aux_param(&param_reset.h);
}
static void configure_emmc(void) static void configure_emmc(void)
{ {
void *gpio_base = (void *)IOCFG_TL_BASE; void *gpio_base = (void *)IOCFG_TL_BASE;
@ -107,6 +123,8 @@ static void mainboard_init(struct device *dev)
configure_emmc(); configure_emmc();
configure_sdcard(); configure_sdcard();
setup_usb_host(); setup_usb_host();
register_reset_to_bl31();
} }
static void mainboard_enable(struct device *dev) static void mainboard_enable(struct device *dev)