From 9a5c4fefec14302ca70e8f1ac046ce03fcbb728b Mon Sep 17 00:00:00 2001 From: Lin Huang Date: Thu, 19 May 2016 11:11:23 +0800 Subject: rockchip: gru: pass poweroff gpio parameter to BL31 To support gpio power off SOC, we need to pass the power off gpio parameter to BL31. Gru reuse tsadc overtemp pin as power off gpio, so need to iomux to gpio function when use gpio power off function, either in bl31 or depthcharge. BRANCH=None BUG=chrome-os-partner:53448 TEST=Build gru Change-Id: Ibfe64042f39f6df1b87536b50fe432859bf74426 Signed-off-by: Martin Roth Original-Commit-Id: Original-Change-Id: Ie7a1bbea4a12753f0abac7a9142f2e032686ce31 Original-Signed-off-by: Lin Huang Original-Signed-off-by: Douglas Anderson Original-Reviewed-on: https://chromium-review.googlesource.com/349703 Original-Reviewed-by: Vadim Bendebury Reviewed-on: https://review.coreboot.org/15119 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/mainboard/google/gru/board.h | 1 + src/mainboard/google/gru/mainboard.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'src/mainboard/google/gru') diff --git a/src/mainboard/google/gru/board.h b/src/mainboard/google/gru/board.h index 6d80cdfba3..382c462dfa 100644 --- a/src/mainboard/google/gru/board.h +++ b/src/mainboard/google/gru/board.h @@ -22,6 +22,7 @@ #define GPIO_BACKLIGHT GPIO(1, C, 1) #define GPIO_EC_IN_RW GPIO(3, B, 0) #define GPIO_EC_IRQ GPIO(0, A, 1) +#define GPIO_POWEROFF GPIO(1, A, 6) #define GPIO_RESET GPIO(0, B, 3) #define GPIO_WP GPIO(1, C, 2) diff --git a/src/mainboard/google/gru/mainboard.c b/src/mainboard/google/gru/mainboard.c index 23051290a0..0c4489c9a3 100644 --- a/src/mainboard/google/gru/mainboard.c +++ b/src/mainboard/google/gru/mainboard.c @@ -62,6 +62,27 @@ static void register_reset_to_bl31(void) register_bl31_param(¶m_reset.h); } +static void register_poweroff_to_bl31(void) +{ + static struct bl31_gpio_param param_poweroff = { + .h = { + .type = PARAM_POWEROFF, + }, + .gpio = { + .polarity = 1, + }, + }; + + /* + * gru/kevin power off pin: gpio1a6, + * reuse with tsadc int pin, so iomux need set back to + * gpio in BL31 and depthcharge before you setting this gpio + */ + param_poweroff.gpio.index = GET_GPIO_NUM(GPIO_POWEROFF), + + register_bl31_param(¶m_poweroff.h); +} + static void configure_sdmmc(void) { gpio_output(GPIO(4, D, 5), 1); /* SDMMC_PWR_EN */ @@ -151,6 +172,7 @@ static void mainboard_init(device_t dev) configure_display(); setup_usb(); register_reset_to_bl31(); + register_poweroff_to_bl31(); } static void enable_backlight_booster(void) -- cgit v1.2.3