summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Hesling <hesling@chromium.org>2020-03-12 11:05:11 -0700
committerCommit Bot <commit-bot@chromium.org>2020-03-17 17:49:39 +0000
commit07f65f5beb2dda74fb17ab5550cef3c823b188ef (patch)
tree16548922eef73b3c77fcd62f7605eeb65d464873
parent3e33e08af4ebd095bc74236a2f104d9b08d9f13e (diff)
downloadchrome-ec-07f65f5beb2dda74fb17ab5550cef3c823b188ef.tar.gz
stm32: Fix manual interrupt clearing function
This fixes a bug in gpio_clear_pending_interrupt, where all pending interrupts are unintentionally cleared. This is not in the code path for normal gpio interrupt handlers, since the normal interrupt clearing occurs in gpio_interrupt (right below this function). BRANCH=none BUG=chromium:1059520 TEST=none Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I4d6fe7947f4d76cf3b57dfbf3bb926e41851c80c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2101208 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> (cherry picked from commit c2c2c083fef813e3e3c70f8c13a1418717ba682d) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2107666
-rw-r--r--chip/stm32/gpio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/chip/stm32/gpio.c b/chip/stm32/gpio.c
index 69f3cadb4e..8c4ca4d02e 100644
--- a/chip/stm32/gpio.c
+++ b/chip/stm32/gpio.c
@@ -105,7 +105,8 @@ int gpio_clear_pending_interrupt(enum gpio_signal signal)
if (!g->mask || signal >= GPIO_IH_COUNT)
return EC_ERROR_INVAL;
- STM32_EXTI_PR |= g->mask;
+ /* Write 1 to clear interrupt */
+ STM32_EXTI_PR = g->mask;
return EC_SUCCESS;
}
@@ -120,6 +121,7 @@ void __keep gpio_interrupt(void)
uint32_t pending = STM32_EXTI_PR & 0xFFFF;
uint8_t signal;
+ /* Write 1 to clear interrupt */
STM32_EXTI_PR = pending;
while (pending) {