summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMulin Chao <mlchao@nuvoton.com>2017-03-03 09:48:25 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-03-03 01:32:21 -0800
commit9c24fac50542e2a391f509dad98303667c82c655 (patch)
treeaeae1370b0e9742238f699b4c4a7b2e9cf7da745
parentc45402564f732b4bd6e6f780d255223105d24163 (diff)
downloadchrome-ec-9c24fac50542e2a391f509dad98303667c82c655.tar.gz
npcx: gpio: Fixed bug GPIO's ISRs clear the other pending bits.
Since the interrupts of MIWU group E/F/G/H of table 0 are the same (interrupt 11), we need to handle LPCs' and GPIOs' events at the same ISR. But we also found there is a leak that ec has the chance to skip the other events which don't belong to GPIOs unexpectedly. (For example, LRESET and eSPI Reset) This CL fixed this issue by only clearing pending bits belong to GPIOs in their ISRs. BRANCH=none BUG=b:35648154 TEST=passed warm-reset testing on pyro over 12 hours. Change-Id: Ie626db00b54cff566798b4a593f6b0267a6fadc2 Signed-off-by: Mulin Chao <mlchao@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/449472 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r--chip/npcx/gpio.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/chip/npcx/gpio.c b/chip/npcx/gpio.c
index 57bd687c51..831c70e6de 100644
--- a/chip/npcx/gpio.c
+++ b/chip/npcx/gpio.c
@@ -790,14 +790,15 @@ static void gpio_interrupt(int int_no)
if (!wui_mask)
continue;
- /* Clear pending bits of WUI */
- NPCX_WKPCL(i, j) = wui_mask;
-
for (pin = 0; pin < 8; pin++, gpio++)
- /* If pending bit is high, execute ISR*/
- if (wui_mask & (1 << pin))
+ /* If GPIO's pending bit is set, execute ISR */
+ if ((wui_mask & (1 << pin)) && gpio->valid) {
+ /* Clear pending bit of GPIO */
+ NPCX_WKPCL(i, j) = (1 << pin);
+ /* Execute GPIO's ISR */
gpio_execute_isr(gpio->port,
1 << gpio->bit);
+ }
}
}
}