Skip to contentSkip to conversation

PATCH: Another mpc8xx watchdog driver !!

PATCH Robin Gilks 2 participants 2 messages Jan 6, 2004 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

Greetings

After looking at several WDT implementations I found that none of them really fitted my requirements - lean, 'prod' frequency greater than hardware watchdog period and able to operate on 8xx CPUs with no RTC.

This is the result as applied to 2.4.23.

It is based on the code of Florian Schirmer but using kernel timers rather than the RTC (as used by the DENX driver). The enable/disable functions have moved into the ARCH part of the code to hide all the timer and counter manipulation that allows the timeout period to be set from the kernel command line.

The API is as per the Linux definition (as already implemented by Florian Schirmer) so it works with the Busybox watchdog applet for example.

A potential bug (32 bit overflow) has also been fixed - a bit of a hack (I'm sure there are better ways of doing it) but it works for me - YMMV.

--
Robin Gilks

Senior Design Engineer          Phone: (+64)(3) 357 1569
Tait Electronics                Fax  :  (+64)(3) 359 4632
PO Box 1645 Christchurch        Email : [email protected]

New Zealand

packages/linux-2.4.23/arch/ppc/kernel/m8xx_setup.c renamed from arch/ppc/kernel/m8xx_setup.c +7 -0
diff -purN linux-2.4.23/arch/ppc/kernel/m8xx_setup.c ../packages/linux-2.4.23/arch/ppc/kernel/m8xx_setup.c
@@ -58,6 +58,7 @@ extern void m8xx_ide_init(void);
 
 extern unsigned long find_available_memory(void);
 extern void m8xx_cpm_reset(uint);
+extern void m8xx_wdt_handler_install(bd_t *bp);
 
 void __init
 m8xx_setup_arch(void)
@@ -184,6 +185,12 @@ void __init m8xx_calibrate_decr(void)
 	if (request_irq(DEC_INTERRUPT, timebase_interrupt, 0, "tbint",
 				NULL) != 0)
 		panic("Could not allocate timer IRQ!");
+#ifdef CONFIG_8xx_WDT
+	/* Install watchdog timer handler early because it might be
+	 * already enabled by the bootloader
+	 */
+	m8xx_wdt_handler_install(binfo);
+#endif
 }
 
 /* The RTC on the MPC8xx is an internal register.
packages/linux-2.4.23/arch/ppc/kernel/m8xx_wdt.c renamed from arch/ppc/kernel/m8xx_wdt.c +142 -0

142 lines not on this page · raw message

packages/linux-2.4.23/arch/ppc/kernel/Makefile renamed from arch/ppc/kernel/Makefile +3 -0
diff -purN linux-2.4.23/arch/ppc/kernel/Makefile ../packages/linux-2.4.23/arch/ppc/kernel/Makefile
@@ -64,6 +64,9 @@ obj-$(CONFIG_440GP)		+= ibm440gp_common.
 obj-$(CONFIG_PPC4xx_DMA)	+= ppc4xx_dma.o
 obj-$(CONFIG_PPC4xx_EDMA)	+= ppc4xx_sgdma.o
 obj-$(CONFIG_8xx)		+= m8xx_setup.o ppc8xx_pic.o
+ifdef CONFIG_8xx_WDT
+obj-y				+= m8xx_wdt.o
+endif
 ifeq ($(CONFIG_8xx),y)
 obj-$(CONFIG_PCI)		+= qspan_pci.o
 ifndef CONFIG_MATH_EMULATION
packages/linux-2.4.23/drivers/char/Config.in renamed from drivers/char/Config.in +3 -0
diff -purN linux-2.4.23/drivers/char/Config.in ../packages/linux-2.4.23/drivers/char/Config.in
@@ -257,6 +257,9 @@ if [ "$CONFIG_WATCHDOG" != "n" ]; then
    fi
    tristate '  ZF MachZ Watchdog' CONFIG_MACHZ_WDT
    dep_tristate '  AMD 766/768 TCO Timer/Watchdog' CONFIG_AMD7XX_TCO $CONFIG_EXPERIMENTAL
+   if [ "$CONFIG_8xx" = "y" ]; then
+      tristate '  MPC8xx Watchdog Timer' CONFIG_8xx_WDT
+   fi
 fi
 endmenu
 
packages/linux-2.4.23/drivers/char/Makefile renamed from drivers/char/Makefile +1 -0
diff -purN linux-2.4.23/drivers/char/Makefile ../packages/linux-2.4.23/drivers/char/Makefile
@@ -305,6 +305,7 @@ obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
 obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
 obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
 obj-$(CONFIG_AMD7XX_TCO) += amd7xx_tco.o
+obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o
 
 subdir-$(CONFIG_MWAVE) += mwave
 ifeq ($(CONFIG_MWAVE),y)
packages/linux-2.4.23/drivers/char/mpc8xx_wdt.c renamed from drivers/char/mpc8xx_wdt.c +174 -0

174 lines not on this page · raw message

#1 lore raw
Quoted 4 lines · In message <[email protected]> you wrote:

After looking at several WDT implementations I found that none of them really fitted my requirements - lean, 'prod' frequency greater than hardware watchdog period and able to operate on 8xx CPUs with no RTC.

Do you really mean RTC here???

Quoted 2 lines

It is based on the code of Florian Schirmer but using kernel timers rather than the RTC (as used by the DENX driver). The enable/disable

What do you mean? Our watchdog code does not use any RTC at all.

Best regards,

Wolfgang Denk

--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: [email protected]
You can observe a lot just by watchin'. - Yogi Berra

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/