From 18096899bdd36a7bd8cc957e6d7aad9b9143e42d Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Sat, 7 Apr 2018 15:13:56 -0700 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/1001532 Reviewed-by: Furquan Shaikh Reviewed-by: Mulin Chao Reviewed-by: Vincent Palatin --- chip/npcx/watchdog.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'chip/npcx/watchdog.c') 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 */ -- cgit v1.2.1