diff options
author | Aaron Durbin <adurbin@chromium.org> | 2015-08-26 14:06:20 -0500 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-08-26 21:50:29 -0700 |
commit | 6ebc6c493fdb79398820a3b521f496cca901ff4a (patch) | |
tree | f041e0c9ed3d85c8c4adfadff883105d855f247d | |
parent | 12cee554230f39f1066f9a37c720f30d7c34b426 (diff) | |
download | chrome-ec-6ebc6c493fdb79398820a3b521f496cca901ff4a.tar.gz |
glados: implement x86 power cycle on EC reset
On certain glados boards (board id >= 2) there is a
gpio conntected to the LDO_EN pin of the BD99992 pmic.
This is a requirement for pulling power from the x86
side of the system. Add a check at HOOK_INIT time to
check the current system reset flags. If a watchdog,
hard, or soft reboot occurred the LDO_EN is deasserted
to bring down the DSW and primary rails.
BUG=chrome-os-partner:44527
BRANCH=None
TEST='reboot', 'reboot ap-off', host cmd reboot.
Change-Id: I7e971a03c8894e1cbf20aaad67903db2057aad41
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295116
Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r-- | board/glados/board.c | 35 | ||||
-rw-r--r-- | board/glados/gpio.inc | 8 |
2 files changed, 41 insertions, 2 deletions
diff --git a/board/glados/board.c b/board/glados/board.c index 6d8d0c1a00..c70b17b36f 100644 --- a/board/glados/board.c +++ b/board/glados/board.c @@ -370,3 +370,38 @@ uint32_t board_get_gpio_hibernate_state(uint32_t port, uint32_t pin) /* Other GPIOs should be put in a low-power state */ return GPIO_INPUT | GPIO_PULL_UP; } + +/* Any glados boards post version 2 should have ROP_LDO_EN stuffed. */ +#define BOARD_MIN_ID_LOD_EN 2 +/* Make the pmic re-sequence the power rails under these conditions. */ +#define PMIC_RESET_FLAGS \ + (RESET_FLAG_WATCHDOG | RESET_FLAG_SOFT | RESET_FLAG_HARD) +static void board_handle_reboot(void) +{ + int flags; + const struct gpio_info *g = &gpio_list[GPIO_BATLOW_L_PMIC_LDO_EN]; + + if (system_jumped_to_this_image()) + return; + + if (system_get_board_version() < BOARD_MIN_ID_LOD_EN) + return; + + /* Interrogate current reset flags from previous reboot. */ + flags = system_get_reset_flags(); + + if (!(flags & PMIC_RESET_FLAGS)) + return; + + /* Preserve AP off request. */ + if (flags & RESET_FLAG_AP_OFF) + chip_save_reset_flags(RESET_FLAG_AP_OFF); + + ccprintf("Restarting system with PMIC.\n"); + /* Flush console */ + cflush(); + + /* Bring down all rails but RTC rail (including EC power). */ + gpio_set_flags_by_mask(g->port, g->mask, GPIO_OUT_HIGH); +} +DECLARE_HOOK(HOOK_INIT, board_handle_reboot, HOOK_PRIO_FIRST); diff --git a/board/glados/gpio.inc b/board/glados/gpio.inc index 59d886fe32..22b225ef9f 100644 --- a/board/glados/gpio.inc +++ b/board/glados/gpio.inc @@ -95,8 +95,12 @@ GPIO(SYS_RESET_L, PIN(121), GPIO_ODR_HIGH) GPIO(CHARGE_LED_1, PIN(155), GPIO_OUT_LOW) GPIO(CHARGE_LED_2, PIN(156), GPIO_OUT_LOW) -/* Inhibit the AP from booting until we can supply enough current */ -GPIO(PCH_BATLOW_L, PIN(55), GPIO_ODR_HIGH) +/* + * BATLOW_L and ROP_LDO_EN are stuffing options. Set as input to dynamically + * handle the stuffing option based on board id. As both signals have external + * pulls setting this pin as input won't harm anything. + */ +GPIO(BATLOW_L_PMIC_LDO_EN, PIN(55), GPIO_INPUT) GPIO(ACCEL4_INT, PIN(157), GPIO_INPUT) GPIO(PP1800_DX_AUDIO_EN, PIN(141), GPIO_OUT_LOW) /* NC / stuffing option */ |