From 1044e1a5b50dbb0edf35aa178b7422715c0c458d Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Mon, 22 Oct 2018 15:07:45 +0800 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/1293132 Reviewed-by: Jett Rink --- include/chipset.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/chipset.h b/include/chipset.h index fae0d4e3da..b4b630f032 100644 --- a/include/chipset.h +++ b/include/chipset.h @@ -68,6 +68,8 @@ enum chipset_reset_reason { CHIPSET_RESET_AP_REQ, /* Reset as side-effect of startup sequence */ CHIPSET_RESET_INIT, + /* EC detected an AP watchdog event. */ + CHIPSET_RESET_AP_WATCHDOG, CHIPSET_RESET_COUNT, }; @@ -183,6 +185,7 @@ static inline void power_interrupt(enum gpio_signal signal) { } static inline void chipset_handle_espi_reset_assert(void) { } static inline void chipset_handle_reboot(void) { } static inline void chipset_reset_request_interrupt(enum gpio_signal signal) { } +static inline void chipset_watchdog_interrupt(enum gpio_signal signal) { } static inline void chipset_power_signal_interrupt(enum gpio_signal signal) { } #endif /* !HAS_TASK_CHIPSET */ @@ -202,10 +205,18 @@ void chipset_handle_reboot(void); /** * GPIO interrupt handler of reset request from AP. * - * It is used in SDM845 chipset power sequence. + * It is used in SDM845/MT8183 chipset power sequence. */ void chipset_reset_request_interrupt(enum gpio_signal signal); +/** + * GPIO interrupt handler of watchdog from AP. + * + * It is used in MT8183 chipset, where it must be setup to trigger on falling + * edge only. + */ +void chipset_watchdog_interrupt(enum gpio_signal signal); + #ifdef CONFIG_CMD_AP_RESET_LOG /** -- cgit v1.2.1