]> git.sur5r.net Git - u-boot/commitdiff
Adds WATCHDOG_RESET() function call to lib_m68k dtimer_interrupt.
authorRichard Retanubun <RichardRetanubun@RuggedCom.com>
Fri, 20 Mar 2009 19:30:10 +0000 (15:30 -0400)
committerWolfgang Denk <wd@denx.de>
Fri, 12 Jun 2009 18:45:46 +0000 (20:45 +0200)
Ported from lib_ppc/interrupts.c, this adds the ability for
the coldfire system timer to auto-reset the watchdog when
dtimer_interrupts is called.

Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com>
lib_m68k/time.c

index 697d67edc6966bbb86bf15f94b59c9fbb1306f9e..29269f655b9c1248ee9b91b2e5dee1d31e6791bc 100644 (file)
 
 #include <asm/timer.h>
 #include <asm/immap.h>
+#include <watchdog.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static ulong timestamp;
+static volatile ulong timestamp = 0;
+
+#ifndef CONFIG_SYS_WATCHDOG_FREQ
+#define CONFIG_SYS_WATCHDOG_FREQ (CONFIG_SYS_HZ / 2)
+#endif
 
 #if defined(CONFIG_MCFTMR)
 #ifndef CONFIG_SYS_UDELAY_BASE
@@ -76,6 +81,12 @@ void dtimer_interrupt(void *not_used)
        if ((CONFIG_SYS_TMRPND_REG & CONFIG_SYS_TMRINTR_MASK) == CONFIG_SYS_TMRINTR_PEND) {
                timerp->ter = (DTIM_DTER_CAP | DTIM_DTER_REF);
                timestamp++;
+
+               #if defined(CONFIG_WATCHDOG) || defined (CONFIG_HW_WATCHDOG)
+               if ((timestamp % (CONFIG_SYS_WATCHDOG_FREQ)) == 0) {
+                       WATCHDOG_RESET ();
+               }
+               #endif    /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */
                return;
        }
 }