diff options
author | Rasmus Villemoes <rasmus.villemoes@prevas.dk> | 2021-04-14 09:18:22 +0200 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2021-04-27 08:28:07 +0200 |
commit | 933ada560b678726835566fbff8a044fa9800175 (patch) | |
tree | 0fbfcea7cb96a5274b8af5556f17f048ccb77e87 /arch/m68k | |
parent | 2156016294c7cb005bba3d8b7c7f13bc09d7824c (diff) | |
download | u-boot-933ada560b678726835566fbff8a044fa9800175.tar.gz u-boot-933ada560b678726835566fbff8a044fa9800175.tar.bz2 u-boot-933ada560b678726835566fbff8a044fa9800175.zip |
allow opting out of WATCHDOG_RESET() from timer interrupt
Having WATCHDOG_RESET() called automatically from the timer interrupt
runs counter to the idea of a watchdog device - if the board runs into
an infinite loops with interrupts still enabled, the watchdog will
never fire.
When using CONFIG_(SPL_)WDT, the watchdog_reset function is a lot more
complicated than just poking a few SOC-specific registers - it
involves accessing all kinds of global data, and if the interrupt
happens at the wrong time (say, in the middle of an WATCHDOG_RESET()
call from ordinary code), that can end up corrupting said global data.
Allow the board to opt out of calling WATCHDOG_RESET() from the timer
interrupt handler by setting CONFIG_SYS_WATCHDOG_FREQ to 0 - as that
setting is currently nonsensical (it would be compile-time
divide-by-zero), it cannot affect any existing boards.
Add documentation for both the existing and extended meaning of
CONFIG_SYS_WATCHDOG_FREQ.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Diffstat (limited to 'arch/m68k')
-rw-r--r-- | arch/m68k/lib/time.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/m68k/lib/time.c b/arch/m68k/lib/time.c index cbe29e72a8..ebb2ac54db 100644 --- a/arch/m68k/lib/time.c +++ b/arch/m68k/lib/time.c @@ -71,7 +71,7 @@ void dtimer_interrupt(void *not_used) timestamp++; #if defined(CONFIG_WATCHDOG) || defined (CONFIG_HW_WATCHDOG) - if ((timestamp % (CONFIG_SYS_WATCHDOG_FREQ)) == 0) { + if (CONFIG_SYS_WATCHDOG_FREQ && (timestamp % (CONFIG_SYS_WATCHDOG_FREQ)) == 0) { WATCHDOG_RESET (); } #endif /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */ |