diff options
author | CHLin <CHLIN56@nuvoton.com> | 2017-12-28 10:26:30 +0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2018-01-22 16:28:55 +0000 |
commit | ef59d801d88604f6376d975c9195bedd4f209ac3 (patch) | |
tree | f1f5c8bd1b371670bcd12adf07cfe1f17be8f3cf | |
parent | 466b1a487774e9fe3d5228a00479f3830ec2f7e4 (diff) | |
download | chrome-ec-ef59d801d88604f6376d975c9195bedd4f209ac3.tar.gz |
Snappy: Extend the watchdog timeout to 500ms after wakeup from hibernate
Currently, when EC enters hibernation because of critical battery level,
upon AC plug-in, EC will wake up from hibernation and execute the
watchdog reset immediately. However, on Snappy, we observed
that there is a drop on the PP1800_EC power rail after AC is applied
when VBAT is ~5.8V. If the drop happens when the EC booter accesses
the SPI flash, it will cause EC to hang because booter may not find a
valid image and go to an endless loop. This CL extends the watchdog
reset timeout to 500 ms. This will delay the timing that EC's booter
accesses the SPI flash to the period where PP1800_EC is stable.
BUG=b:70183568
BRANCH=reef
TEST=No build errors for "make buildall".
TEST=Measure the F_CS pin and PP1800_EC after plugging AC;
Make sure the EC start to access SPI flash after PP1800_EC drops.
Snappy EC can reboot succesfuly and show the firmware screen
10 out of 10 attempts.
Change-Id: I49fccdc3e588cdc24759b137af52af355d9bb47f
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/862545
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r-- | chip/npcx/system.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/chip/npcx/system.c b/chip/npcx/system.c index 141e253596..b66032d9cc 100644 --- a/chip/npcx/system.c +++ b/chip/npcx/system.c @@ -459,7 +459,16 @@ void __enter_hibernate(uint32_t seconds, uint32_t microseconds) /* Initialize watchdog */ NPCX_TWCFG = 0; /* Select T0IN clock as watchdog prescaler clock */ SET_BIT(NPCX_TWCFG, NPCX_TWCFG_WDCT0I); +#if defined(BOARD_SNAPPY) + /* + * This will delay the watchdog reset after wake-up from hibernation + * to 500 ms. + */ + NPCX_TWCP = 0x0A; /* Set prescaler ratio for timer0 to 1:1024 */ + NPCX_WDCP = 0x03; /* Set prescaler ratio for watchdog clock to 1:8 */ +#else NPCX_TWCP = 0x00; /* Keep prescaler ratio timer0 clock to 1:1 */ +#endif NPCX_TWDT0 = 0x00; /* Set internal counter and prescaler */ /* Copy the __enter_hibernate_in_lpram instructions to LPRAM */ @@ -496,7 +505,6 @@ void __enter_hibernate(uint32_t seconds, uint32_t microseconds) /* execute hibernate func in LPRAM */ __hibernate_in_lpram(); - } static char system_to_hex(uint8_t x) |