Skip to contentSkip to conversation

Pull request for v2.6.32-rc

WATCHDOG Wim Van Sebroeck 1 participant 1 message Sep 18, 2009

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

Hi Linus,

Please pull from 'master' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog.git
or if master.kernel.org hasn't synced up yet:
master.kernel.org:/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog.git

This will update the following files:

 drivers/watchdog/Kconfig            |   38 +++
 drivers/watchdog/Makefile           |    3 
 drivers/watchdog/ar7_wdt.c          |  107 ++++----
 drivers/watchdog/booke_wdt.c        |   57 ++++
 drivers/watchdog/coh901327_wdt.c    |    2 
 drivers/watchdog/davinci_wdt.c      |   19 +
 drivers/watchdog/iop_wdt.c          |    2 
 drivers/watchdog/nuc900_wdt.c       |  353 ++++++++++++++++++++++++++++
 drivers/watchdog/rm9k_wdt.c         |    2 
 drivers/watchdog/sbc_fitpc2_wdt.c   |  267 +++++++++++++++++++++
 drivers/watchdog/sc1200wdt.c        |    2 
 drivers/watchdog/wdt_pci.c          |   21 -
 drivers/watchdog/wm831x_wdt.c       |  441 ++++++++++++++++++++++++++++++++++++
 include/linux/mfd/wm831x/watchdog.h |   52 ++++
 14 files changed, 1293 insertions(+), 73 deletions(-)

with these Changes:

Author: Wim Van Sebroeck <[email protected]>
Date:   Wed Sep 2 09:10:07 2009 +0000

[WATCHDOG] sizeof cleanup

Use sizeof(*) instead of sizeof * (See Codingstyle documentation).

Author: Randy Dunlap <[email protected]>
Date:   Fri Aug 7 15:02:00 2009 -0700

[WATCHDOG] wdt_pci: fix printk and variable type

Fix printk format warning:
drivers/watchdog/wdt_pci.c:652: warning: format '%04x' expects type 'unsigned int', but argument 2 has type 'resource_size_t'

and then use resource_size_t for the "io" variable as well so that it won't be truncated.

Author: Wim Van Sebroeck <[email protected]>
Date:   Thu Aug 6 18:57:49 2009 +0000

[WATCHDOG] wdt_pci - use pci_request_region

Use pci_request_region instead of request_region for this pci_driver.

Author: Wim Van Sebroeck <[email protected]>
Date:   Mon Aug 31 13:49:14 2009 +0000

[WATCHDOG] ar7_wdt: Fix error handling during probe.

Fix error handling in the probe function.

Author: Florian Fainelli <[email protected]>
Date:   Tue Jul 21 12:11:32 2009 +0200

[WATCHDOG] ar7_wdt: convert to become a platform driver

This patch converts the ar7_wdt driver to become a platform driver. The AR7 SoC specific identification and base register calculation is performed by the board code, therefore we no longer need to have access to ar7_chip_id. We also remove the reboot notifier code to use the platform shutdown method as Wim suggested.

Author: Chris Friesen <[email protected]>
Date:   Wed Aug 12 12:02:46 2009 -0600

[WATCHDOG] fix book E watchdog to take WDIOC_SETTIMEOUT arg in seconds

The WDIOC_SETTIMEOUT argument is supposed to be a "seconds" value. However, the book E wdt currently treats it as a "period" which is interpreted in a board-specific way.

This patch allows the user to pass in a "seconds" value and the driver will set the smallest timeout that is at least as large as specified by the user. It's been tested on e500 hardware and works as expected.

The patch only modifies the CONFIG_FSL_BOOKE case, the CONFIG_4xx case is left unmodified as I don't have any hardware to test it on.

Author: Kevin Hilman <[email protected]>
Date:   Tue Feb 10 20:30:37 2009 -0800

[WATCHDOG] davinci: use clock framework for timer frequency

Remove use of CLOCK_TICK_RATE in favor of using clock framework for getting timer frequency.

Author: Linus Walleij <[email protected]>
Date:   Mon Aug 10 00:04:35 2009 +0200

[WATCHDOG] Use DIV_ROUND_UP() macro in the coh901327 WDT

I saw Julia Lawalls various commits fixing up the use of rounding macros and since my already submitted patch was not caught in this I took it upon myself to fix it up for this driver as well.

Author: Mark Brown <[email protected]>
Date:   Mon Jul 27 14:46:12 2009 +0100

[WATCHDOG] Add support for WM831x watchdog

The WM831x series of devices provide a watchdog with configurable behaviour on timer expiry.

Currently this driver support refreshes via a register or GPIO line and autonomous refreshes from a hardware source (eg, a clock).

Author: Wan ZongShun <[email protected]>
Date:   Mon Aug 17 18:00:01 2009 +0800

[WATCHDOG] Add watchdog driver for NUC900

Add watchdog device driver for the Nuvoton NUC900 series SoCs.

Author: Denis Turischev <[email protected]>
Date:   Tue Jul 21 13:13:29 2009 +0300

[WATCHDOG] add SBC-FITPC2 watchdog driver

Add support for watchdog found on SBC-FITPC2 board.

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.

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

drivers/watchdog/Kconfig +38 -0
index b1ccc04..ff3eb8f 100644
@@ -55,6 +55,13 @@ config SOFT_WATCHDOG
 	  To compile this driver as a module, choose M here: the
 	  module will be called softdog.
 
+config WM831X_WATCHDOG
+	tristate "WM831x watchdog"
+	depends on MFD_WM831X
+	help
+	  Support for the watchdog in the WM831x AudioPlus PMICs.  When
+	  the watchdog triggers the system will be reset.
+
 config WM8350_WATCHDOG
 	tristate "WM8350 watchdog"
 	depends on MFD_WM8350
@@ -266,6 +273,15 @@ config STMP3XXX_WATCHDOG
 	  To compile this driver as a module, choose M here: the
 	  module will be called stmp3xxx_wdt.
 
+config NUC900_WATCHDOG
+	tristate "Nuvoton NUC900 watchdog"
+	depends on ARCH_W90X900
+	help
+	  Say Y here if to include support for the watchdog timer
+	  for the Nuvoton NUC900 series SoCs.
+	  To compile this driver as a module, choose M here: the
+	  module will be called nuc900_wdt.
+
 # AVR32 Architecture
 
 config AT32AP700X_WDT
@@ -369,6 +385,28 @@ config SC520_WDT
 	  You can compile this driver directly into the kernel, or use
 	  it as a module.  The module will be called sc520_wdt.
 
+config SBC_FITPC2_WATCHDOG
+	tristate "Compulab SBC-FITPC2 watchdog"
+	depends on X86
+	---help---
+	  This is the driver for the built-in watchdog timer on the fit-PC2
+	  Single-board computer made by Compulab.
+
+	  It`s possible to enable watchdog timer either from BIOS (F2) or from booted Linux.
+	  When "Watchdog Timer Value" enabled one can set 31-255 s operational range.
+
+	  Entering BIOS setup temporary disables watchdog operation regardless to current state,
+	  so system will not be restarted while user in BIOS setup.
+
+	  Once watchdog was enabled the system will be restarted every
+	  "Watchdog Timer Value" period, so to prevent it user can restart or
+	  disable the watchdog.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called sbc_fitpc2_wdt.
+
+	  Most people will say N.
+
 config EUROTECH_WDT
 	tristate "Eurotech CPU-1220/1410 Watchdog Timer"
 	depends on X86
drivers/watchdog/Makefile +3 -0
index 3d77429..348b3b8 100644
@@ -44,6 +44,7 @@ obj-$(CONFIG_DAVINCI_WATCHDOG) += davinci_wdt.o
 obj-$(CONFIG_ORION_WATCHDOG) += orion_wdt.o
 obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o
 obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o
+obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o
 
 # AVR32 Architecture
 obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
@@ -64,6 +65,7 @@ obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o
 obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o
 obj-$(CONFIG_GEODE_WDT) += geodewdt.o
 obj-$(CONFIG_SC520_WDT) += sc520_wdt.o
+obj-$(CONFIG_SBC_FITPC2_WATCHDOG) += sbc_fitpc2_wdt.o
 obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o
 obj-$(CONFIG_IB700_WDT) += ib700wdt.o
 obj-$(CONFIG_IBMASR) += ibmasr.o
@@ -139,5 +141,6 @@ obj-$(CONFIG_WATCHDOG_CP1XXX)		+= cpwd.o
 # XTENSA Architecture
 
 # Architecture Independant
+obj-$(CONFIG_WM831X_WATCHDOG) += wm831x_wdt.o
 obj-$(CONFIG_WM8350_WATCHDOG) += wm8350_wdt.o
 obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
drivers/watchdog/ar7_wdt.c +54 -53

163 lines not on this page · raw message

drivers/watchdog/booke_wdt.c +53 -4

94 lines not on this page · raw message

drivers/watchdog/coh901327_wdt.c +1 -1
index aec7cef..381026c 100644
@@ -110,7 +110,7 @@ static void coh901327_enable(u16 timeout)
 	 * Wait 3 32 kHz cycles for it to take effect
 	 */
 	freq = clk_get_rate(clk);
-	delay_ns = (1000000000 + freq - 1) / freq; /* Freq to ns and round up */
+	delay_ns = DIV_ROUND_UP(1000000000, freq); /* Freq to ns and round up */
 	delay_ns = 3 * delay_ns; /* Wait 3 cycles */
 	ndelay(delay_ns);
 	/* Enable the watchdog interrupt */
drivers/watchdog/davinci_wdt.c +17 -2
index 83e22e7..9d7520f 100644
@@ -25,6 +25,7 @@
 #include <linux/uaccess.h>
 #include <linux/io.h>
 #include <linux/device.h>
+#include <linux/clk.h>
 
 #define MODULE_NAME "DAVINCI-WDT: "
 
@@ -69,6 +70,7 @@ static unsigned long wdt_status;
 
 static struct resource	*wdt_mem;
 static void __iomem	*wdt_base;
+struct clk		*wdt_clk;
 
 static void wdt_service(void)
 {
@@ -86,6 +88,9 @@ static void wdt_enable(void)
 {
 	u32 tgcr;
 	u32 timer_margin;
+	unsigned long wdt_freq;
+
+	wdt_freq = clk_get_rate(wdt_clk);
 
 	spin_lock(&io_lock);
 
@@ -99,9 +104,9 @@ static void wdt_enable(void)
 	iowrite32(0, wdt_base + TIM12);
 	iowrite32(0, wdt_base + TIM34);
 	/* set timeout period */
-	timer_margin = (((u64)heartbeat * CLOCK_TICK_RATE) & 0xffffffff);
+	timer_margin = (((u64)heartbeat * wdt_freq) & 0xffffffff);
 	iowrite32(timer_margin, wdt_base + PRD12);
-	timer_margin = (((u64)heartbeat * CLOCK_TICK_RATE) >> 32);
+	timer_margin = (((u64)heartbeat * wdt_freq) >> 32);
 	iowrite32(timer_margin, wdt_base + PRD34);
 	/* enable run continuously */
 	iowrite32(ENAMODE12_PERIODIC, wdt_base + TCR);
@@ -199,6 +204,12 @@ static int __devinit davinci_wdt_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct device *dev = &pdev->dev;
 
+	wdt_clk = clk_get(dev, NULL);
+	if (WARN_ON(IS_ERR(wdt_clk)))
+		return PTR_ERR(wdt_clk);
+
+	clk_enable(wdt_clk);
+
 	if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT)
 		heartbeat = DEFAULT_HEARTBEAT;
 
@@ -245,6 +256,10 @@ static int __devexit davinci_wdt_remove(struct platform_device *pdev)
 		kfree(wdt_mem);
 		wdt_mem = NULL;
 	}
+
+	clk_disable(wdt_clk);
+	clk_put(wdt_clk);
+
 	return 0;
 }
 
drivers/watchdog/iop_wdt.c +1 -1
index 0c90596..aef9478 100644
@@ -139,7 +139,7 @@ static long iop_wdt_ioctl(struct file *file,
 
 	switch (cmd) {
 	case WDIOC_GETSUPPORT:
-		if (copy_to_user(argp, &ident, sizeof ident))
+		if (copy_to_user(argp, &ident, sizeof(ident)))
 			ret = -EFAULT;
 		else
 			ret = 0;
drivers/watchdog/nuc900_wdt.c new file +353 -0

353 lines not on this page · raw message

drivers/watchdog/rm9k_wdt.c +1 -1
index 2e44426..bb66958 100644
@@ -340,7 +340,7 @@ static const struct resource *wdt_gpi_get_resource(struct platform_device *pdv,
 					const char *name, unsigned int type)
 {
 	char buf[80];
-	if (snprintf(buf, sizeof buf, "%s_0", name) >= sizeof buf)
+	if (snprintf(buf, sizeof(buf), "%s_0", name) >= sizeof(buf))
 		return NULL;
 	return platform_get_resource_byname(pdv, type, buf);
 }
drivers/watchdog/sbc_fitpc2_wdt.c new file +267 -0

267 lines not on this page · raw message

drivers/watchdog/sc1200wdt.c +1 -1
index b5e19c1..c01daca 100644
@@ -197,7 +197,7 @@ static long sc1200wdt_ioctl(struct file *file, unsigned int cmd,
 
 	switch (cmd) {
 	case WDIOC_GETSUPPORT:
-		if (copy_to_user(argp, &ident, sizeof ident))
+		if (copy_to_user(argp, &ident, sizeof(ident)))
 			return -EFAULT;
 		return 0;
 
drivers/watchdog/wdt_pci.c +11 -10
index 7a1bdc7..f368dd8 100644
@@ -80,7 +80,7 @@ static unsigned long open_lock;
 static DEFINE_SPINLOCK(wdtpci_lock);
 static char expect_close;
 
-static int io;
+static resource_size_t io;
 static int irq;
 
 /* Default timeout */
@@ -647,14 +647,15 @@ static int __devinit wdtpci_init_one(struct pci_dev *dev,
 		goto out_pci;
 	}
 
-	irq = dev->irq;
-	io = pci_resource_start(dev, 2);
-
-	if (request_region(io, 16, "wdt_pci") == NULL) {
-		printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", io);
+	if (pci_request_region(dev, 2, "wdt_pci")) {
+		printk(KERN_ERR PFX "I/O address 0x%llx already in use\n",
+			(unsigned long long)pci_resource_start(dev, 2));
 		goto out_pci;
 	}
 
+	irq = dev->irq;
+	io = pci_resource_start(dev, 2);
+
 	if (request_irq(irq, wdtpci_interrupt, IRQF_DISABLED | IRQF_SHARED,
 			 "wdt_pci", &wdtpci_miscdev)) {
 		printk(KERN_ERR PFX "IRQ %d is not free\n", irq);
@@ -662,8 +663,8 @@ static int __devinit wdtpci_init_one(struct pci_dev *dev,
 	}
 
 	printk(KERN_INFO
-	 "PCI-WDT500/501 (PCI-WDG-CSM) driver 0.10 at 0x%04x (Interrupt %d)\n",
-								io, irq);
+	 "PCI-WDT500/501 (PCI-WDG-CSM) driver 0.10 at 0x%llx (Interrupt %d)\n",
+					(unsigned long long)io, irq);
 
 	/* Check that the heartbeat value is within its range;
 	   if not reset to the default */
@@ -717,7 +718,7 @@ out_rbt:
 out_irq:
 	free_irq(irq, &wdtpci_miscdev);
 out_reg:
-	release_region(io, 16);
+	pci_release_region(dev, 2);
 out_pci:
 	pci_disable_device(dev);
 	goto out;
@@ -733,7 +734,7 @@ static void __devexit wdtpci_remove_one(struct pci_dev *pdev)
 		misc_deregister(&temp_miscdev);
 	unregister_reboot_notifier(&wdtpci_notifier);
 	free_irq(irq, &wdtpci_miscdev);
-	release_region(io, 16);
+	pci_release_region(pdev, 2);
 	pci_disable_device(pdev);
 	dev_count--;
 }
drivers/watchdog/wm831x_wdt.c new file +441 -0

441 lines not on this page · raw message

include/linux/mfd/wm831x/watchdog.h new file +52 -0

52 lines not on this page · raw message