summaryrefslogtreecommitdiff
path: root/chip/ish/watchdog.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2019-05-13 15:22:36 -0600
committerJack Rosenthal <jrosenth@chromium.org>2019-06-06 19:55:59 +0000
commit0c5985a74f66f89f05d6f26666c15229fc68d1df (patch)
tree99aaeabb8b1d4ac9cf302a170725876e715f5c2f /chip/ish/watchdog.c
parentc723e723392aabc35747a6678b4b7931d7aeddb7 (diff)
downloadchrome-ec-0c5985a74f66f89f05d6f26666c15229fc68d1df.tar.gz
ish: max-retries mechanism for watchdog timer
This adds a relevant config option, as well as implementation for a max-retries mechanism on the watchdog timer. Included is an implementation for ISH which counts persistent data storage and halts when the max-retries is exceeded. BUG=b:132059981 BRANCH=none TEST=observed system halt after 4 resets, then re-enable once we had a successful reset Change-Id: I7b443d9a20a474b294d494c5b6046a38eaf6ff12 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1609605 Reviewed-by: Jett Rink <jettrink@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Diffstat (limited to 'chip/ish/watchdog.c')
-rw-r--r--chip/ish/watchdog.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/chip/ish/watchdog.c b/chip/ish/watchdog.c
index 79f6e788df..2e83b57f25 100644
--- a/chip/ish/watchdog.c
+++ b/chip/ish/watchdog.c
@@ -21,6 +21,7 @@
#include "common.h"
#include "hooks.h"
+#include "ish_persistent_data.h"
#include "task.h"
#include "registers.h"
#include "system.h"
@@ -32,6 +33,13 @@
int watchdog_init(void)
{
+ /*
+ * Put reset counter back at zero if last reset was not caused
+ * by watchdog
+ */
+ if ((system_get_reset_flags() & RESET_FLAG_WATCHDOG) == 0)
+ ish_persistent_data.watchdog_counter = 0;
+
/* Initialize WDT clock divider */
CCU_WDT_CD = WDT_CLOCK_HZ / 10; /* 10 Hz => 100 ms period */