summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2018-04-07 15:13:56 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-04-09 15:18:57 -0700
commit18096899bdd36a7bd8cc957e6d7aad9b9143e42d (patch)
tree3dc842396eb1f93bf4d74f722a6cfedf5c6350d0
parent32bbdbf88cf5422ac1ca8fe8121d3cec07c379c3 (diff)
downloadchrome-ec-18096899bdd36a7bd8cc957e6d7aad9b9143e42d.tar.gz
npcx: Touch watchdog during init
Touch the watchdog during init to prevent it from firing prematurely during HOOK_INIT processing before the tasks are started and watchdog_reload() will be called with HOOK_TICK. BUG=b:77336348 BRANCH=eve,poppy,fizz,reef,kevin TEST=run stress test for several days: while true ; do ectool reboot_ec RO ; ectool reboot_ec RW ; done Change-Id: I79e744a4678ab1808870d0e7647d2ce273ddeb8f Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://chromium-review.googlesource.com/1001532 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Mulin Chao <mlchao@nuvoton.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--chip/npcx/watchdog.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/chip/npcx/watchdog.c b/chip/npcx/watchdog.c
index 9a5369534f..12244d594c 100644
--- a/chip/npcx/watchdog.c
+++ b/chip/npcx/watchdog.c
@@ -123,6 +123,10 @@ DECLARE_HOOK(HOOK_TICK, watchdog_reload, HOOK_PRIO_DEFAULT);
int watchdog_init(void)
{
#if SUPPORT_WDG
+ /* Touch watchdog before init if it is already running */
+ if (IS_BIT_SET(NPCX_T0CSR, NPCX_T0CSR_WD_RUN))
+ NPCX_WDSDM = 0x5C;
+
/* Keep prescaler ratio timer0 clock to 1:1024 */
NPCX_TWCP = 0x0A;
/* Keep prescaler ratio watchdog clock to 1:1 */