summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2018-04-07 15:13:56 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-04-09 16:08:57 +0000
commit3f32c4157d9d8516b5640c57bd141c33a97d6f26 (patch)
tree9426bbabf0aa2625cf74a3e2e9ade00122652202
parent4eafe85810e8885f1a395008095101e3f5371594 (diff)
downloadchrome-ec-3f32c4157d9d8516b5640c57bd141c33a97d6f26.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 Original-change-id: I79e744a4678ab1808870d0e7647d2ce273ddeb8f Signed-off-by: Duncan Laurie <dlaurie@google.com> Change-Id: I45ff4a8c0ecec603d2bc7e77c1c865969fa517e8 Reviewed-on: https://chromium-review.googlesource.com/1002952
-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 bbc13c4616..dcc3b405cb 100644
--- a/chip/npcx/watchdog.c
+++ b/chip/npcx/watchdog.c
@@ -137,6 +137,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 */