summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWealian Liao <whliao@nuvoton.corp-partner.google.com>2021-09-24 10:57:41 +0800
committerCommit Bot <commit-bot@chromium.org>2021-09-28 14:35:07 +0000
commitb7a4de94f6c425b9c642b71da4cdc569c3351bc2 (patch)
treeae53c324de4f1b2c5ea821171f4c6b9982fc08bd
parent06bf75b0c46506e5a071cd93c93d43310f792e3d (diff)
downloadchrome-ec-b7a4de94f6c425b9c642b71da4cdc569c3351bc2.tar.gz
zephyr: Add watchdog reinstall mechanism
After the sysjump, the watchdog has been installed by the last image. The watchdog install function return -EBUSY while the watchdog has already been set up. This CL adds watchdog running check & reinstall watchdog for sysjump. BUG=none BRANCH=none TEST=RO/RW use the different timeout setting & test the timeout. Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: Ibe36d50c030afcfe79eb804ca05c7b426468cb07 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3180705 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
-rw-r--r--zephyr/shim/src/watchdog.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/zephyr/shim/src/watchdog.c b/zephyr/shim/src/watchdog.c
index 2895868757..4c78ac9b0f 100644
--- a/zephyr/shim/src/watchdog.c
+++ b/zephyr/shim/src/watchdog.c
@@ -44,6 +44,13 @@ int watchdog_init(void)
wdt_config.callback = wdt_warning_handler;
err = wdt_install_timeout(wdt, &wdt_config);
+
+ /* If watchdog is running, reinstall it. */
+ if (err == -EBUSY) {
+ wdt_disable(wdt);
+ err = wdt_install_timeout(wdt, &wdt_config);
+ }
+
if (err < 0) {
LOG_ERR("Watchdog install error");
return err;