Skip to contentSkip to conversation

v2.6.18-rc3 patches

WATCHDOG NAK Wim Van Sebroeck 2 participants 2 messages Aug 1, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi All,

The following watchdog patches are ready to be added to the linux-2.6 git tree. They contain typo fixes for drivers/char/watchdog/Kconfig and a new watchdog driver for the Philips PNX4008 ARM board inlined.
(So they shouldn't break anything for the 2.6.18 release)
Most of the patches have been a month into the -mm tree.

If there are problems with these patches, please let me know. If not I will sent them to Linus on sunday.

The patches will update the following files:

 arch/arm/mach-pnx4008/clock.c        |   11 +
 drivers/char/watchdog/Kconfig        |   19 +
 drivers/char/watchdog/Makefile       |    1 
 drivers/char/watchdog/pnx4008_wdt.c  |  349 +++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-pnx4008/clock.h |    1 
 5 files changed, 377 insertions(+), 4 deletions(-)

with these Changes:

Author: Vitaly Wool <[email protected]>
Date:   Mon Jun 26 19:31:49 2006 +0400

[WATCHDOG] pnx4008: add watchdog support

Add watchdog support for Philips PNX4008 ARM board inlined.

Author: Wim Van Sebroeck <[email protected]>
Date:   Mon Jul 3 09:03:47 2006 +0200

[WATCHDOG] pnx4008_wdt.c - nowayout patch

Change nowayout to: WATCHDOG_NOWAYOUT as defined in include/linux/watchdog.h .

Author: Matt LaPlante <[email protected]>
Date:   Wed Jul 5 01:20:51 2006 +0000

[WATCHDOG] Kconfig typos fix.

Three typos in drivers/char/watchdog/Kconfig...

Author: Wim Van Sebroeck <[email protected]>
Date:   Sun Jul 30 20:06:07 2006 +0200

[WATCHDOG] pnx4008_wdt.c - remove patch

Change remove code so that we first detach the driver from userspace, then clean up the clock and then clean up the memory we allocated.

The Changes can also be looked at on:

	http://www.kernel.org/git/?p=linux/kernel/git/wim/linux-2.6-watchdog.git;a=summary

For completeness, I added the overal diff below.

Greetings,
Wim.

================================================================================

arch/arm/mach-pnx4008/clock.c +11 -0
index f582ed2..daa8d3d 100644
@@ -735,6 +735,16 @@ static struct clk uart6_ck = {
 	.enable_reg = UARTCLKCTRL_REG,
 };
 
+static struct clk wdt_ck = {
+	.name = "wdt_ck",
+	.parent = &per_ck,
+	.flags = NEEDS_INITIALIZATION,
+	.round_rate = &on_off_round_rate,
+	.set_rate = &on_off_set_rate,
+	.enable_shift = 0,
+	.enable_reg = TIMCLKCTRL_REG,
+};
+
 /* These clocks are visible outside this module
  * and can be initialized
  */
@@ -765,6 +775,7 @@ static struct clk *onchip_clks[] = {
 	&uart4_ck,
 	&uart5_ck,
 	&uart6_ck,
+	&wdt_ck,
 };
 
 static int local_clk_enable(struct clk *clk)
drivers/char/watchdog/Kconfig +15 -4
index d53f664..508fe59 100644
@@ -45,7 +45,7 @@ #
 comment "Watchdog Device Drivers"
 	depends on WATCHDOG
 
-# Architecture Independant
+# Architecture Independent
 
 config SOFT_WATCHDOG
 	tristate "Software watchdog"
@@ -127,7 +127,7 @@ config S3C2410_WATCHDOG
 	  enabled.
 
 	  The driver is limited by the speed of the system's PCLK
-	  signal, so with reasonbaly fast systems (PCLK around 50-66MHz)
+	  signal, so with reasonably fast systems (PCLK around 50-66MHz)
 	  then watchdog intervals of over approximately 20seconds are
 	  unavailable.
 
@@ -165,6 +165,17 @@ config EP93XX_WATCHDOG
 	  To compile this driver as a module, choose M here: the
 	  module will be called ep93xx_wdt.
 
+config PNX4008_WATCHDOG
+	tristate "PNX4008 Watchdog"
+	depends on WATCHDOG && ARCH_PNX4008
+	help
+	  Say Y here if to include support for the watchdog timer
+	  in the PNX4008 processor.
+	  This driver can be built as a module by choosing M. The module
+	  will be called pnx4008_wdt.
+
+	  Say N if you are unsure.
+
 # X86 (i386 + ia64 + x86_64) Architecture
 
 config ACQUIRE_WDT
@@ -423,7 +434,7 @@ config SBC_EPX_C3_WATCHDOG
 	  is no way to know if writing to its IO address will corrupt
 	  your system or have any real effect.  The only way to be sure
 	  that this driver does what you want is to make sure you
-	  are runnning it on an EPX-C3 from Winsystems with the watchdog
+	  are running it on an EPX-C3 from Winsystems with the watchdog
 	  timer at IO address 0x1ee and 0x1ef.  It will write to both those
 	  IO ports.  Basically, the assumption is made that if you compile
 	  this driver into your kernel and/or load it as a module, that you
@@ -472,7 +483,7 @@ config INDYDOG
 	tristate "Indy/I2 Hardware Watchdog"
 	depends on WATCHDOG && SGI_IP22
 	help
-	  Hardwaredriver for the Indy's/I2's watchdog. This is a
+	  Hardware driver for the Indy's/I2's watchdog. This is a
 	  watchdog timer that will reboot the machine after a 60 second
 	  timer expired and no process has written to /dev/watchdog during
 	  that time.
drivers/char/watchdog/Makefile +1 -0
index 6ab77b6..9d4c2fb 100644
@@ -32,6 +32,7 @@ obj-$(CONFIG_S3C2410_WATCHDOG) += s3c241
 obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o
 obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o
 obj-$(CONFIG_EP93XX_WATCHDOG) += ep93xx_wdt.o
+obj-$(CONFIG_PNX4008_WATCHDOG) += pnx4008_wdt.o
 
 # X86 (i386 + ia64 + x86_64) Architecture
 obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
drivers/char/watchdog/pnx4008_wdt.c new file +349 -0

349 lines not on this page · raw message

include/asm-arm/arch-pnx4008/clock.h +1 -0
index 91ae003..ce155e1 100644
@@ -32,6 +32,7 @@ #define I2CCLKCTRL_REG		(PWRMAN_VA_BASE 
 #define KEYCLKCTRL_REG		(PWRMAN_VA_BASE + 0xb0)
 #define TSCLKCTRL_REG		(PWRMAN_VA_BASE + 0xb4)
 #define PWMCLKCTRL_REG		(PWRMAN_VA_BASE + 0xb8)
+#define TIMCLKCTRL_REG		(PWRMAN_VA_BASE + 0xbc)
 #define SPICTRL_REG		(PWRMAN_VA_BASE + 0xc4)
 #define FLASHCLKCTRL_REG	(PWRMAN_VA_BASE + 0xc8)
 #define UART3CLK_REG		(PWRMAN_VA_BASE + 0xd0)
#1 lore raw

Ar Maw, 2006-08-01 am 22:09 +0200, ysgrifennodd Wim Van Sebroeck:

Quoted 2 lines

If there are problems with these patches, please let me know. If not I will sent them to Linus on sunday.

NAK

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+static void wdt_enable(void)

Open, fork and write from both processes. This needs a semaphore

drivers/char/watchdog/pnx4008_wdt.c line 103

Quoted 8 lines
drivers/char/watchdog/pnx4008_wdt.c new file +8 -0
+{
+	if (wdt_clk)
+		clk_set_rate(wdt_clk, 1);
+
+	/* stop counter, initiate counter reset */
+	__raw_writel(RESET_COUNT, WDTIM_CTRL(wdt_base));
+	/*wait for reset to complete. 100% guarantee event */
+	while (__raw_readl(WDTIM_COUNTER(wdt_base)));

Should have cpu_relax() and really ought to have a timeout in case it fails. In fact it needs one or a barrier as you are using __raw and that may not reload if the compiler is overclever.

Review

Quoted 2 lines
(quoted diff) +2 -0
+static void wdt_disable(void)
+{

Ditto - open, fork write the close sequence in parallel on both ?

drivers/char/watchdog/pnx4008_wdt.c line 292

Quoted 3 lines
drivers/char/watchdog/pnx4008_wdt.c new file +3 -0
+		wdt_disable();		/*disable for now */
+		set_bit(WDT_DEVICE_INITED, &wdt_status);
+	}

Races an open occuring when misc_register is done and before we hit wdt_disable.