summaryrefslogtreecommitdiff
path: root/zephyr/shim/src/watchdog.c
diff options
context:
space:
mode:
authorMulin Chao <mlchao@nuvoton.com>2021-04-07 19:31:03 -0700
committerCommit Bot <commit-bot@chromium.org>2021-04-14 22:15:45 +0000
commit0e30757012ae4daaa97593a781f74d1bfd83e13d (patch)
tree5f973ca4da6106f85a08f9f7f5c84e6df94d9a3e /zephyr/shim/src/watchdog.c
parentfd16f618fa1e34a8c007f6a66a1ff4c9e9ef0424 (diff)
downloadchrome-ec-0e30757012ae4daaa97593a781f74d1bfd83e13d.tar.gz
zephyr: Adjust watchdog warning timer value and delay time
Adjusts the watchdog warning timer value and its delay time definitions to meet original chromium ec behavior. The system handles the warning event at CONFIG_AUX_TIMER_PERIOD_MS & issues the watchdog reset event at CONFIG_WATCHDOG_PERIOD_MS. Zephyr NPCX watchdog provides a config WDT_NPCX_DELAY_CYCLES for watchdog timeout delay. Set the zephyr timeout to CONFIG_AUX_TIMER_PERIOD_MS as warning time. So the NPCX watchdog hardware issue reset event at CONFIG_AUX_TIMER_PERIOD_MS + WDT_NPCX_DELAY_CYCLES. BUG=b:184683548 BRANCH=none TEST=Build & boot ec on volteer. TEST= `waitms 1000` warning doesn't issue & ec doesn't reboot `waitms 1200` warning issue & ec doesn't reboot `waitms 1500` warning issue & ec doesn't reboot `waitms 1700` warning issue & ec reboot Cq-Depend: chromium:2813911 Signed-off-by: Mulin Chao <mlchao@nuvoton.com> Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: Ibee9c18cd9d2bae6d34ee9366755dec99687c3d4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2814728 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr/shim/src/watchdog.c')
-rw-r--r--zephyr/shim/src/watchdog.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/zephyr/shim/src/watchdog.c b/zephyr/shim/src/watchdog.c
index 8487fd1d75..13d380bfcb 100644
--- a/zephyr/shim/src/watchdog.c
+++ b/zephyr/shim/src/watchdog.c
@@ -17,7 +17,7 @@ LOG_MODULE_REGISTER(watchdog_shim, LOG_LEVEL_ERR);
static void wdt_warning_handler(const struct device *wdt_dev, int channel_id)
{
/* TODO(b/176523207): watchdog warning message */
- LOG_INF("Watchdog is expired");
+ printk("Watchdog deadline is close!\n");
}
int watchdog_init(void)
@@ -36,12 +36,11 @@ int watchdog_init(void)
wdt_config.flags = WDT_FLAG_RESET_SOC;
/*
- * The Warning timer = CONFIG_WATCHDOG_PERIOD_MS.
- * The watchdog reset time
- * = CONFIG_WATCHDOG_PERIOD_MS + time of CONFIG_WDT_NPCX_DELAY_CYCLES
+ * Set the Warning timer as CONFIG_AUX_TIMER_PERIOD_MS.
+ * Then the watchdog reset time = CONFIG_WATCHDOG_PERIOD_MS.
*/
wdt_config.window.min = 0U;
- wdt_config.window.max = CONFIG_WATCHDOG_PERIOD_MS;
+ wdt_config.window.max = CONFIG_AUX_TIMER_PERIOD_MS;
wdt_config.callback = wdt_warning_handler;
err = wdt_install_timeout(wdt, &wdt_config);