From 980e781552164e54485b13e03ab9897fefc2a45d Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Mon, 24 Jun 2019 15:48:38 +0800 Subject: chip/stm32/gpio: Disable external interrupts in gpio_pre_init After a sysjump, external interrupts are left enabled. However, exti_events is reset to 0, so upon receiving an interrupt, gpio_interrupt will call the handler for signal 0 (the first GPIO_INT defined in gpio.inc) for these sources. This is obviously very wrong, and the easiest (and most robust) way to fix this is to disable all interrupts on sysjump, and let the new code re-enable if desired. BRANCH=none BUG=chromium:977950 TEST=On kukui, with following CL, trigger a watchdog (stop daisydog; echo > /dev/watchdog), see that no interrupt is generated. Change-Id: Ic55262f8b8dd9d154619cb0620e1889b3da3feec Signed-off-by: Nicolas Boichat Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1673950 Reviewed-by: Yilun Lin Reviewed-by: Daisuke Nojiri --- chip/stm32/gpio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chip/stm32/gpio.c b/chip/stm32/gpio.c index d3fb6b2797..fe79ca5aad 100644 --- a/chip/stm32/gpio.c +++ b/chip/stm32/gpio.c @@ -36,6 +36,9 @@ void gpio_pre_init(void) /* Delay 1 APB clock cycle after the clock is enabled */ clock_wait_bus_cycles(BUS_APB, 1); + /* Disable all GPIO EXTINTs (EXTINT0..15) left enabled after sysjump. */ + STM32_EXTI_IMR &= ~0xFFFF; + if (!is_warm) gpio_enable_clocks(); -- cgit v1.2.1