diff options
author | Jett Rink <jettrink@chromium.org> | 2019-09-06 11:33:48 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-09-12 05:04:17 +0000 |
commit | 031c5d2d62dd891622ded885756c03021e934ef2 (patch) | |
tree | bddaeeeb33e89134f538795d050d5874649ef90f /chip/npcx/system.c | |
parent | 8d9ddb34ed3465e5172c6d950a155c83dd6d5aa9 (diff) | |
download | chrome-ec-031c5d2d62dd891622ded885756c03021e934ef2.tar.gz |
npcx: ensure we don't unlock watchdog too soon
We cannot unlock the watchdog timer with 3 watch dog ticks of touching
it per the datasheet. This is actually around 100ms so we should protect
against this.
BRANCH=none
BUG=b:140207603
TEST=eliminates cold reset issue.
Change-Id: Iaef59dad9f5640d64d5d430aea87bd16c2efd30d
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1790302
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: ML Chao <mlchao@nuvoton.corp-partner.google.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'chip/npcx/system.c')
-rw-r--r-- | chip/npcx/system.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/chip/npcx/system.c b/chip/npcx/system.c index ff18334533..e7895dc3dc 100644 --- a/chip/npcx/system.c +++ b/chip/npcx/system.c @@ -44,9 +44,7 @@ void system_watchdog_reset(void) { /* Unlock & stop watchdog registers */ - NPCX_WDSDM = 0x87; - NPCX_WDSDM = 0x61; - NPCX_WDSDM = 0x63; + watchdog_stop_and_unlock(); /* Reset TWCFG */ NPCX_TWCFG = 0; @@ -500,9 +498,7 @@ void __enter_hibernate(uint32_t seconds, uint32_t microseconds) CLEAR_BIT(NPCX_ITCTS(ITIM_WDG_NO), NPCX_ITCTS_ITEN); /* Unlock & stop watchdog */ - NPCX_WDSDM = 0x87; - NPCX_WDSDM = 0x61; - NPCX_WDSDM = 0x63; + watchdog_stop_and_unlock(); /* Initialize watchdog */ NPCX_TWCFG = 0; /* Select T0IN clock as watchdog prescaler clock */ |