summaryrefslogtreecommitdiff
path: root/lib_m68k/time.c
diff options
context:
space:
mode:
authorRichard Retanubun <RichardRetanubun@RuggedCom.com>2009-03-20 15:30:10 -0400
committerWolfgang Denk <wd@denx.de>2009-06-12 20:45:46 +0200
commit42a83765d54f042b4079e05a3438789542429981 (patch)
treef1c95f1cb7d5db00a302449aae2e5b199d81e3d4 /lib_m68k/time.c
parenta24d96e40e1ca66dde6e6c158e7ecffafc5a2199 (diff)
downloadu-boot-imx-42a83765d54f042b4079e05a3438789542429981.zip
u-boot-imx-42a83765d54f042b4079e05a3438789542429981.tar.gz
u-boot-imx-42a83765d54f042b4079e05a3438789542429981.tar.bz2
Adds WATCHDOG_RESET() function call to lib_m68k dtimer_interrupt.
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>
Diffstat (limited to 'lib_m68k/time.c')
-rw-r--r--lib_m68k/time.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib_m68k/time.c b/lib_m68k/time.c
index 697d67e..29269f6 100644
--- a/lib_m68k/time.c
+++ b/lib_m68k/time.c
@@ -27,10 +27,15 @@
#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;
}
}