12 #include <linux/module.h>
13 #include <linux/sched.h>
14 #include <linux/kernel.h>
20 #include <asm/processor.h>
24 #include <asm/div64.h>
26 #include <asm/gdb-stub.h>
27 #include <proc/clock.h>
31 static unsigned int watchdog_hz = 1;
47 static unsigned int last_irq_sums[
NR_CPUS];
57 mdelay((10 * 1000) / watchdog_hz);
60 if (
nmi_count(0) - tmp[0].__nmi_count <= 5) {
76 static int __init setup_watchdog(
char *
str)
89 ctr = WDCTR_WDCK_65536th;
90 WDCTR = WDCTR_WDRST | ctr;
94 tmp = __muldiv64u(1 << (16 + ctr * 2), 1000000,
MN10300_WDCLK);
95 tmp = 1000000000 /
tmp;
96 watchdog_hz = (tmp + 500) / 1000;
102 __setup(
"watchdog=", setup_watchdog);
110 wdt = WDCTR & ~WDCTR_WDCNE;
111 WDCTR = wdt | WDCTR_WDRST;
113 WDCTR = wdt | WDCTR_WDCNE;
121 static void watchdog_dump_register(
void *
dummy)
139 wdt = WDCTR & ~WDCTR_WDCNE;
151 if ((last_irq_sums[cpu] == sum)
152 #
if defined(CONFIG_GDBSTUB) && defined(
CONFIG_SMP)
153 && !(CHK_GDBSTUB_BUSY()
163 spin_lock(&watchdog_print_lock);
170 "NMI Watchdog detected LOCKUP on CPU%d,"
171 " pc %08lx, registers:\n",
175 "--- Register Dump (CPU%d) ---\n",
185 spin_unlock(&watchdog_print_lock);
187 #ifdef CONFIG_GDBSTUB
188 if (CHK_GDBSTUB_BUSY_AND_ACTIVE())
201 WDCTR = wdt | WDCTR_WDRST;
203 WDCTR = wdt | WDCTR_WDCNE;