summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Anderson <dianders@chromium.org>2014-06-19 13:20:50 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-06-21 00:14:37 +0000
commit4702a1d19bef7da427dc05b3675d53b76b0c979b (patch)
treea90469f3e1f145e70d17378bba67ab1cb4fdee2b
parent323273daeb437387957c7f736b5764e3e38e1168 (diff)
downloadchrome-ec-4702a1d19bef7da427dc05b3675d53b76b0c979b.tar.gz
watchdog: Help ensure that the stm32 watchdog help prints
On stm32 we were programming the WATCHDOG_HELP timer with the same value as the independent watchdog (which automatically resets the CPU). That means we weren't guaranteed to see the WATCHDOG_HELP. It happened to work most of the time due to the the LSI oscillator fudge (we assumed the watchdog was on a 56 kHz oscillator when it was probably on a 38 kHz one), but let's give ourselves a guaranteed gap. It's unlikely that this extra gap will actually help on most machines (if we're running at 53 kHz or lower we already had this much margin), but it's nice to be safe. BRANCH=ToT BUG=chrome-os-partner:29162 TEST=Increase margin to 400 (instead of 50) and type "waitms 300". Sometimes hit watchdog warning. Change-Id: I7f876757c15d7775116720c408a4127b4b94adfa Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/204894 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--chip/mec1322/watchdog.c10
-rw-r--r--chip/stm32/hwtimer.c2
-rw-r--r--include/config.h6
3 files changed, 9 insertions, 9 deletions
diff --git a/chip/mec1322/watchdog.c b/chip/mec1322/watchdog.c
index 205ea9b39c..3d6c4fc89c 100644
--- a/chip/mec1322/watchdog.c
+++ b/chip/mec1322/watchdog.c
@@ -10,12 +10,6 @@
#include "task.h"
#include "watchdog.h"
-/*
- * Fire auxiliary timer 50ms before watchdog timer expires. This leaves
- * some time for debug trace to be printed.
- */
-#define AUX_TIMER_PERIOD_MS (CONFIG_WATCHDOG_PERIOD_MS - 50)
-
void watchdog_reload(void)
{
MEC1322_WDG_KICK = 1;
@@ -23,7 +17,7 @@ void watchdog_reload(void)
#ifdef CONFIG_WATCHDOG_HELP
/* Reload the auxiliary timer */
MEC1322_TMR16_CTL(0) &= ~(1 << 5);
- MEC1322_TMR16_CNT(0) = AUX_TIMER_PERIOD_MS;
+ MEC1322_TMR16_CNT(0) = CONFIG_AUX_TIMER_PERIOD_MS;
MEC1322_TMR16_CTL(0) |= 1 << 5;
#endif
}
@@ -65,7 +59,7 @@ int watchdog_init(void)
MEC1322_INT_BLK_EN |= 1 << 23;
/* Load and start the auxiliary timer */
- MEC1322_TMR16_CNT(0) = AUX_TIMER_PERIOD_MS;
+ MEC1322_TMR16_CNT(0) = CONFIG_AUX_TIMER_PERIOD_MS;
MEC1322_TMR16_CNT(0) |= 1 << 5;
#endif
diff --git a/chip/stm32/hwtimer.c b/chip/stm32/hwtimer.c
index 216ca895f7..87069c4f95 100644
--- a/chip/stm32/hwtimer.c
+++ b/chip/stm32/hwtimer.c
@@ -366,7 +366,7 @@ void hwtimer_setup_watchdog(void)
* to obtain the number of times TIM_CLOCK_LSB can overflow before we
* generate an interrupt.
*/
- timer->arr = timer->cnt = CONFIG_WATCHDOG_PERIOD_MS * MSEC / (1 << 16);
+ timer->arr = timer->cnt = CONFIG_AUX_TIMER_PERIOD_MS * MSEC / (1 << 16);
/* count on every TIM_CLOCK_LSB overflow */
timer->psc = 0;
diff --git a/include/config.h b/include/config.h
index 1dcb96fb8b..ef4bef2406 100644
--- a/include/config.h
+++ b/include/config.h
@@ -937,6 +937,12 @@
/* Watchdog period in ms; must be at least twice HOOK_TICK_INTERVAL */
#define CONFIG_WATCHDOG_PERIOD_MS 1100
+/*
+ * Fire auxiliary timer 50ms before watchdog timer expires. This leaves
+ * some time for debug trace to be printed.
+ */
+#define CONFIG_AUX_TIMER_PERIOD_MS (CONFIG_WATCHDOG_PERIOD_MS - 50)
+
/*****************************************************************************/
/*