diff options
author | Doug Anderson <dianders@chromium.org> | 2014-06-19 13:20:50 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-06-20 18:34:09 +0000 |
commit | 2476adf0604a20c59e41793f4b488c72c645be8c (patch) | |
tree | 4cce5124d5f1d26b06c20a1bf6a6b916aa11eab3 | |
parent | 82f03dedef8adf9f247ebfff133397751b053914 (diff) | |
download | chrome-ec-2476adf0604a20c59e41793f4b488c72c645be8c.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/204715
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | chip/mec1322/watchdog.c | 6 | ||||
-rw-r--r-- | chip/stm32/hwtimer.c | 2 | ||||
-rw-r--r-- | include/watchdog.h | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/chip/mec1322/watchdog.c b/chip/mec1322/watchdog.c index 87533ac571..83b1ea4de5 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 (WATCHDOG_PERIOD_MS - 50) - void watchdog_reload(void) { MEC1322_WDG_KICK = 1; diff --git a/chip/stm32/hwtimer.c b/chip/stm32/hwtimer.c index 0a53cfb4bc..cefd650653 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 = WATCHDOG_PERIOD_MS * MSEC / (1 << 16); + timer->arr = timer->cnt = AUX_TIMER_PERIOD_MS * MSEC / (1 << 16); /* count on every TIM_CLOCK_LSB overflow */ timer->psc = 0; diff --git a/include/watchdog.h b/include/watchdog.h index 1981e3ce10..a0e76df5a4 100644 --- a/include/watchdog.h +++ b/include/watchdog.h @@ -11,6 +11,12 @@ /* Watchdog period in ms; must be at least twice HOOK_TICK_INTERVAL */ #define WATCHDOG_PERIOD_MS 1100 +/* + * Fire auxiliary timer 50ms before watchdog timer expires. This leaves + * some time for debug trace to be printed. + */ +#define AUX_TIMER_PERIOD_MS (WATCHDOG_PERIOD_MS - 50) + /** * Initialize the watchdog. * |