summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2019-12-02 13:40:21 -0700
committerCommit Bot <commit-bot@chromium.org>2019-12-03 17:25:30 +0000
commit4e8dbf5c9b1dee8e6ee1734af58f2ba204045e5c (patch)
treedbf0d95413f16abcc7b93631defffa230a73e666
parent186faa05d1edd661662a56f74ed09acf5006c076 (diff)
downloadchrome-ec-4e8dbf5c9b1dee8e6ee1734af58f2ba204045e5c.tar.gz
npcx: Disable ITIM after watchdog_stop_and_unlock()
watchdog_stop_and_unlock() depends upon the ITIM32 module to ensure that it has been at least 3 watchdog ticks since the last time the watchdog has been touched. If it has been > 100ms since then, there will be no problem, but if it has been less than 100ms, then because the ITIM32 module was disabled, then the system will get stuck in the while (time_since32() ...) loop. This will eventually cause the watchdog to kick in and reboot the EC, which will also cause the AP to reboot. BUG=b:145371494, b:140207603 BRANCH=firmware-hatch-12672.B TEST=sanity testing (alt+volup+h still works) and buildall (this bug was nearly impossible to reproduce) Change-Id: I5e32f4940f03fee90b3aa809b185c13ed66ce7f1 Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1946773 Reviewed-by: Andrew McRae <amcrae@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--chip/npcx/system.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/chip/npcx/system.c b/chip/npcx/system.c
index bac303afa0..10c42813cc 100644
--- a/chip/npcx/system.c
+++ b/chip/npcx/system.c
@@ -483,6 +483,9 @@ void __enter_hibernate(uint32_t seconds, uint32_t microseconds)
/* Disable interrupt */
interrupt_disable();
+ /* Unlock & stop watchdog */
+ watchdog_stop_and_unlock();
+
/* ITIM event module disable */
CLEAR_BIT(NPCX_ITCTS(ITIM_EVENT_NO), NPCX_ITCTS_ITEN);
/* ITIM time module disable */
@@ -490,9 +493,6 @@ void __enter_hibernate(uint32_t seconds, uint32_t microseconds)
/* ITIM watchdog warn module disable */
CLEAR_BIT(NPCX_ITCTS(ITIM_WDG_NO), NPCX_ITCTS_ITEN);
- /* Unlock & stop watchdog */
- watchdog_stop_and_unlock();
-
/* Initialize watchdog */
NPCX_TWCFG = 0; /* Select T0IN clock as watchdog prescaler clock */
SET_BIT(NPCX_TWCFG, NPCX_TWCFG_WDCT0I);