diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2018-10-22 15:07:45 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-10-25 04:26:39 -0700 |
commit | 1044e1a5b50dbb0edf35aa178b7422715c0c458d (patch) | |
tree | 2a0f3871e1903eb25cddc0ff451e4523473d1261 /board/kukui | |
parent | a56ab7d4a3c7e05477f7e489db08de00c30da662 (diff) | |
download | chrome-ec-1044e1a5b50dbb0edf35aa178b7422715c0c458d.tar.gz |
power/mt8183: Implement watchdog-initiated reset
AP watchdog line can fall in either of 2 cases:
- AP asserts watchdog while the AP is on: this is a real
AP-initiated reset.
- EC asserted GPIO_AP_SYS_RST_L, so the AP is in reset and AP
watchdog falls as well. This is _not_ a watchdog reset. We
mask these cases by disabling the interrupt just before
shutting down the AP, and re-enabling it before starting the
AP.
Also, take the opportunity to move warm reset code out of board
file into generic MT8183 power code, as well as code to enable
interrupts.
BRANCH=none
BUG=b:109900671
TEST=apshutdown => EC understand this is an EC-initiated shutdown
TEST=Use test-wd from bug, see that EC detects it is a watchdog.
Change-Id: I02037e5be0254fef991ae2459be35e4561e0994c
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1293132
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'board/kukui')
-rw-r--r-- | board/kukui/board.c | 23 | ||||
-rw-r--r-- | board/kukui/gpio.inc | 6 |
2 files changed, 3 insertions, 26 deletions
diff --git a/board/kukui/board.c b/board/kukui/board.c index a14b4a6a76..15acdee112 100644 --- a/board/kukui/board.c +++ b/board/kukui/board.c @@ -54,24 +54,6 @@ static void tcpc_alert_event(enum gpio_signal signal) #endif } -static void warm_reset_request_interrupt(enum gpio_signal signal) -{ - CPRINTS("AP wants warm reset"); - chipset_reset(CHIPSET_RESET_AP_REQ); -} - -static void ap_watchdog_interrupt(enum gpio_signal signal) -{ - int level = gpio_get_level(GPIO_AP_EC_WATCHDOG_L); - - CPRINTS("AP watchdog level %d", level); - /* - * TODO(b:109900671): Handle AP watchdog, when necessary, for now, just - * mirror input to output. - */ - gpio_set_level(GPIO_PMIC_WATCHDOG_L, level); -} - #if BOARD_REV >= 1 static void hall_interrupt(enum gpio_signal signal) { @@ -230,11 +212,6 @@ static void board_init(void) /* Enable charger interrupts */ gpio_enable_interrupt(GPIO_CHARGER_INT_ODL); - /* Enable reboot / shutdown / sleep control inputs from AP */ - gpio_enable_interrupt(GPIO_WARM_RESET_REQ); - gpio_enable_interrupt(GPIO_AP_EC_WATCHDOG_L); - gpio_enable_interrupt(GPIO_AP_IN_SLEEP_L); - #ifdef SECTION_IS_RW /* Enable interrupts from BMI160 sensor. */ gpio_enable_interrupt(GPIO_ACCEL_INT_ODL); diff --git a/board/kukui/gpio.inc b/board/kukui/gpio.inc index 362f51f862..53a96f95c8 100644 --- a/board/kukui/gpio.inc +++ b/board/kukui/gpio.inc @@ -25,9 +25,9 @@ GPIO_INT(AP_IN_SLEEP_L, PIN(C, 12), GPIO_INT_BOTH | GPIO_PULL_DOWN, GPIO_INT(PMIC_EC_RESETB, PIN(B, 7), GPIO_INT_BOTH | GPIO_PULL_DOWN, power_signal_interrupt) GPIO_INT(WARM_RESET_REQ, PIN(A, 3), GPIO_INT_RISING | GPIO_PULL_DOWN, - warm_reset_request_interrupt) -GPIO_INT(AP_EC_WATCHDOG_L, PIN(C, 2), GPIO_INT_BOTH, - ap_watchdog_interrupt) + chipset_reset_request_interrupt) +GPIO_INT(AP_EC_WATCHDOG_L, PIN(C, 2), GPIO_INT_FALLING, + chipset_watchdog_interrupt) GPIO_INT_RW(ACCEL_INT_ODL, PIN(A, 4), GPIO_INT_FALLING | GPIO_SEL_1P8V | GPIO_PULL_UP, bmi160_interrupt) |