aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/Kconfig26
-rw-r--r--drivers/watchdog/Makefile1
-rw-r--r--drivers/watchdog/bfin_wdt.c19
-rw-r--r--drivers/watchdog/booke_wdt.c6
-rw-r--r--drivers/watchdog/cpwd.c9
-rw-r--r--drivers/watchdog/eurotechwdt.c1
-rw-r--r--drivers/watchdog/gef_wdt.c8
-rw-r--r--drivers/watchdog/iTCO_vendor_support.c11
-rw-r--r--drivers/watchdog/iTCO_wdt.c29
-rw-r--r--drivers/watchdog/imx2_wdt.c358
-rw-r--r--drivers/watchdog/mpc8xxx_wdt.c10
-rw-r--r--drivers/watchdog/pc87413_wdt.c9
-rw-r--r--drivers/watchdog/pnx833x_wdt.c11
-rw-r--r--drivers/watchdog/rdc321x_wdt.c53
-rw-r--r--drivers/watchdog/riowd.c7
-rw-r--r--drivers/watchdog/s3c2410_wdt.c9
-rw-r--r--drivers/watchdog/shwdt.c2
-rw-r--r--drivers/watchdog/twl4030_wdt.c2
-rw-r--r--drivers/watchdog/wdt.c2
-rw-r--r--drivers/watchdog/wdt977.c2
20 files changed, 489 insertions, 86 deletions
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index b87ba23442d2..afcfacc9bbe2 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -145,13 +145,19 @@ config KS8695_WATCHDOG
145 Watchdog timer embedded into KS8695 processor. This will reboot your 145 Watchdog timer embedded into KS8695 processor. This will reboot your
146 system when the timeout is reached. 146 system when the timeout is reached.
147 147
148config HAVE_S3C2410_WATCHDOG
149 bool
150 help
151 This will include watchdog timer support for Samsung SoCs. If
152 you want to include watchdog support for any machine, kindly
153 select this in the respective mach-XXXX/Kconfig file.
154
148config S3C2410_WATCHDOG 155config S3C2410_WATCHDOG
149 tristate "S3C2410 Watchdog" 156 tristate "S3C2410 Watchdog"
150 depends on ARCH_S3C2410 157 depends on ARCH_S3C2410 || HAVE_S3C2410_WATCHDOG
151 help 158 help
152 Watchdog timer block in the Samsung S3C2410 chips. This will 159 Watchdog timer block in the Samsung SoCs. This will reboot
153 reboot the system when the timer expires with the watchdog 160 the system when the timer expires with the watchdog enabled.
154 enabled.
155 161
156 The driver is limited by the speed of the system's PCLK 162 The driver is limited by the speed of the system's PCLK
157 signal, so with reasonably fast systems (PCLK around 50-66MHz) 163 signal, so with reasonably fast systems (PCLK around 50-66MHz)
@@ -306,6 +312,18 @@ config MAX63XX_WATCHDOG
306 help 312 help
307 Support for memory mapped max63{69,70,71,72,73,74} watchdog timer. 313 Support for memory mapped max63{69,70,71,72,73,74} watchdog timer.
308 314
315config IMX2_WDT
316 tristate "IMX2+ Watchdog"
317 depends on ARCH_MX2 || ARCH_MX25 || ARCH_MX3 || ARCH_MX5
318 help
319 This is the driver for the hardware watchdog
320 on the Freescale IMX2 and later processors.
321 If you have one of these processors and wish to have
322 watchdog support enabled, say Y, otherwise say N.
323
324 To compile this driver as a module, choose M here: the
325 module will be called imx2_wdt.
326
309# AVR32 Architecture 327# AVR32 Architecture
310 328
311config AT32AP700X_WDT 329config AT32AP700X_WDT
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 5e3cb95bb0e9..72f3e2073f8e 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -47,6 +47,7 @@ obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o
47obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o 47obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o
48obj-$(CONFIG_ADX_WATCHDOG) += adx_wdt.o 48obj-$(CONFIG_ADX_WATCHDOG) += adx_wdt.o
49obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o 49obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o
50obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o
50 51
51# AVR32 Architecture 52# AVR32 Architecture
52obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o 53obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c
index 9c7ccd1e9088..9042a95fc98c 100644
--- a/drivers/watchdog/bfin_wdt.c
+++ b/drivers/watchdog/bfin_wdt.c
@@ -23,6 +23,7 @@
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/uaccess.h> 24#include <linux/uaccess.h>
25#include <asm/blackfin.h> 25#include <asm/blackfin.h>
26#include <asm/bfin_watchdog.h>
26 27
27#define stamp(fmt, args...) \ 28#define stamp(fmt, args...) \
28 pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) 29 pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
@@ -49,24 +50,6 @@
49# define bfin_write_WDOG_STAT(x) bfin_write_WDOGA_STAT(x) 50# define bfin_write_WDOG_STAT(x) bfin_write_WDOGA_STAT(x)
50#endif 51#endif
51 52
52/* Bit in SWRST that indicates boot caused by watchdog */
53#define SWRST_RESET_WDOG 0x4000
54
55/* Bit in WDOG_CTL that indicates watchdog has expired (WDR0) */
56#define WDOG_EXPIRED 0x8000
57
58/* Masks for WDEV field in WDOG_CTL register */
59#define ICTL_RESET 0x0
60#define ICTL_NMI 0x2
61#define ICTL_GPI 0x4
62#define ICTL_NONE 0x6
63#define ICTL_MASK 0x6
64
65/* Masks for WDEN field in WDOG_CTL register */
66#define WDEN_MASK 0x0FF0
67#define WDEN_ENABLE 0x0000
68#define WDEN_DISABLE 0x0AD0
69
70/* some defaults */ 53/* some defaults */
71#define WATCHDOG_TIMEOUT 20 54#define WATCHDOG_TIMEOUT 20
72 55
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index 801ead191499..3d49671cdf5a 100644
--- a/drivers/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
@@ -137,12 +137,12 @@ static long booke_wdt_ioctl(struct file *file,
137 if (copy_to_user((void *)arg, &ident, sizeof(ident))) 137 if (copy_to_user((void *)arg, &ident, sizeof(ident)))
138 return -EFAULT; 138 return -EFAULT;
139 case WDIOC_GETSTATUS: 139 case WDIOC_GETSTATUS:
140 return put_user(ident.options, p); 140 return put_user(0, p);
141 case WDIOC_GETBOOTSTATUS: 141 case WDIOC_GETBOOTSTATUS:
142 /* XXX: something is clearing TSR */ 142 /* XXX: something is clearing TSR */
143 tmp = mfspr(SPRN_TSR) & TSR_WRS(3); 143 tmp = mfspr(SPRN_TSR) & TSR_WRS(3);
144 /* returns 1 if last reset was caused by the WDT */ 144 /* returns CARDRESET if last reset was caused by the WDT */
145 return (tmp ? 1 : 0); 145 return (tmp ? WDIOF_CARDRESET : 0);
146 case WDIOC_SETOPTIONS: 146 case WDIOC_SETOPTIONS:
147 if (get_user(tmp, p)) 147 if (get_user(tmp, p))
148 return -EINVAL; 148 return -EINVAL;
diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c
index ba2efce4b40e..d62b9ce8f773 100644
--- a/drivers/watchdog/cpwd.c
+++ b/drivers/watchdog/cpwd.c
@@ -577,7 +577,7 @@ static int __devinit cpwd_probe(struct of_device *op,
577 * interrupt_mask register cannot be written, so no timer 577 * interrupt_mask register cannot be written, so no timer
578 * interrupts can be masked within the PLD. 578 * interrupts can be masked within the PLD.
579 */ 579 */
580 str_prop = of_get_property(op->node, "model", NULL); 580 str_prop = of_get_property(op->dev.of_node, "model", NULL);
581 p->broken = (str_prop && !strcmp(str_prop, WD_BADMODEL)); 581 p->broken = (str_prop && !strcmp(str_prop, WD_BADMODEL));
582 582
583 if (!p->enabled) 583 if (!p->enabled)
@@ -677,8 +677,11 @@ static const struct of_device_id cpwd_match[] = {
677MODULE_DEVICE_TABLE(of, cpwd_match); 677MODULE_DEVICE_TABLE(of, cpwd_match);
678 678
679static struct of_platform_driver cpwd_driver = { 679static struct of_platform_driver cpwd_driver = {
680 .name = DRIVER_NAME, 680 .driver = {
681 .match_table = cpwd_match, 681 .name = DRIVER_NAME,
682 .owner = THIS_MODULE,
683 .of_match_table = cpwd_match,
684 },
682 .probe = cpwd_probe, 685 .probe = cpwd_probe,
683 .remove = __devexit_p(cpwd_remove), 686 .remove = __devexit_p(cpwd_remove),
684}; 687};
diff --git a/drivers/watchdog/eurotechwdt.c b/drivers/watchdog/eurotechwdt.c
index d1c4e55b1db0..3f3dc093ad68 100644
--- a/drivers/watchdog/eurotechwdt.c
+++ b/drivers/watchdog/eurotechwdt.c
@@ -68,7 +68,6 @@ static spinlock_t eurwdt_lock;
68 68
69/* 69/*
70 * You must set these - there is no sane way to probe for this board. 70 * You must set these - there is no sane way to probe for this board.
71 * You can use eurwdt=x,y to set these now.
72 */ 71 */
73 72
74static int io = 0x3f0; 73static int io = 0x3f0;
diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c
index abdbad034a6c..ca0f4c6cf5ab 100644
--- a/drivers/watchdog/gef_wdt.c
+++ b/drivers/watchdog/gef_wdt.c
@@ -303,9 +303,11 @@ static const struct of_device_id gef_wdt_ids[] = {
303}; 303};
304 304
305static struct of_platform_driver gef_wdt_driver = { 305static struct of_platform_driver gef_wdt_driver = {
306 .owner = THIS_MODULE, 306 .driver = {
307 .name = "gef_wdt", 307 .name = "gef_wdt",
308 .match_table = gef_wdt_ids, 308 .owner = THIS_MODULE,
309 .of_match_table = gef_wdt_ids,
310 },
309 .probe = gef_wdt_probe, 311 .probe = gef_wdt_probe,
310}; 312};
311 313
diff --git a/drivers/watchdog/iTCO_vendor_support.c b/drivers/watchdog/iTCO_vendor_support.c
index 5133bca5ccbe..481d1ad43464 100644
--- a/drivers/watchdog/iTCO_vendor_support.c
+++ b/drivers/watchdog/iTCO_vendor_support.c
@@ -101,13 +101,6 @@ static void supermicro_old_pre_stop(unsigned long acpibase)
101 outl(val32, SMI_EN); /* Needed to deactivate watchdog */ 101 outl(val32, SMI_EN); /* Needed to deactivate watchdog */
102} 102}
103 103
104static void supermicro_old_pre_keepalive(unsigned long acpibase)
105{
106 /* Reload TCO Timer (done in iTCO_wdt_keepalive) + */
107 /* Clear "Expire Flag" (Bit 3 of TC01_STS register) */
108 outb(0x08, TCO1_STS);
109}
110
111/* 104/*
112 * Vendor Support: 2 105 * Vendor Support: 2
113 * Board: Super Micro Computer Inc. P4SBx, P4DPx 106 * Board: Super Micro Computer Inc. P4SBx, P4DPx
@@ -337,9 +330,7 @@ EXPORT_SYMBOL(iTCO_vendor_pre_stop);
337 330
338void iTCO_vendor_pre_keepalive(unsigned long acpibase, unsigned int heartbeat) 331void iTCO_vendor_pre_keepalive(unsigned long acpibase, unsigned int heartbeat)
339{ 332{
340 if (vendorsupport == SUPERMICRO_OLD_BOARD) 333 if (vendorsupport == SUPERMICRO_NEW_BOARD)
341 supermicro_old_pre_keepalive(acpibase);
342 else if (vendorsupport == SUPERMICRO_NEW_BOARD)
343 supermicro_new_pre_set_heartbeat(heartbeat); 334 supermicro_new_pre_set_heartbeat(heartbeat);
344} 335}
345EXPORT_SYMBOL(iTCO_vendor_pre_keepalive); 336EXPORT_SYMBOL(iTCO_vendor_pre_keepalive);
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index 8da886035374..69de8713b8e4 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -40,7 +40,7 @@
40 40
41/* Module and version information */ 41/* Module and version information */
42#define DRV_NAME "iTCO_wdt" 42#define DRV_NAME "iTCO_wdt"
43#define DRV_VERSION "1.05" 43#define DRV_VERSION "1.06"
44#define PFX DRV_NAME ": " 44#define PFX DRV_NAME ": "
45 45
46/* Includes */ 46/* Includes */
@@ -391,8 +391,8 @@ static struct platform_device *iTCO_wdt_platform_device;
391#define WATCHDOG_HEARTBEAT 30 /* 30 sec default heartbeat */ 391#define WATCHDOG_HEARTBEAT 30 /* 30 sec default heartbeat */
392static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */ 392static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */
393module_param(heartbeat, int, 0); 393module_param(heartbeat, int, 0);
394MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. " 394MODULE_PARM_DESC(heartbeat, "Watchdog timeout in seconds. "
395 "(2<heartbeat<39 (TCO v1) or 613 (TCO v2), default=" 395 "5..76 (TCO v1) or 3..614 (TCO v2), default="
396 __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); 396 __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
397 397
398static int nowayout = WATCHDOG_NOWAYOUT; 398static int nowayout = WATCHDOG_NOWAYOUT;
@@ -523,8 +523,13 @@ static int iTCO_wdt_keepalive(void)
523 /* Reload the timer by writing to the TCO Timer Counter register */ 523 /* Reload the timer by writing to the TCO Timer Counter register */
524 if (iTCO_wdt_private.iTCO_version == 2) 524 if (iTCO_wdt_private.iTCO_version == 2)
525 outw(0x01, TCO_RLD); 525 outw(0x01, TCO_RLD);
526 else if (iTCO_wdt_private.iTCO_version == 1) 526 else if (iTCO_wdt_private.iTCO_version == 1) {
527 /* Reset the timeout status bit so that the timer
528 * needs to count down twice again before rebooting */
529 outw(0x0008, TCO1_STS); /* write 1 to clear bit */
530
527 outb(0x01, TCO_RLD); 531 outb(0x01, TCO_RLD);
532 }
528 533
529 spin_unlock(&iTCO_wdt_private.io_lock); 534 spin_unlock(&iTCO_wdt_private.io_lock);
530 return 0; 535 return 0;
@@ -537,6 +542,11 @@ static int iTCO_wdt_set_heartbeat(int t)
537 unsigned int tmrval; 542 unsigned int tmrval;
538 543
539 tmrval = seconds_to_ticks(t); 544 tmrval = seconds_to_ticks(t);
545
546 /* For TCO v1 the timer counts down twice before rebooting */
547 if (iTCO_wdt_private.iTCO_version == 1)
548 tmrval /= 2;
549
540 /* from the specs: */ 550 /* from the specs: */
541 /* "Values of 0h-3h are ignored and should not be attempted" */ 551 /* "Values of 0h-3h are ignored and should not be attempted" */
542 if (tmrval < 0x04) 552 if (tmrval < 0x04)
@@ -593,6 +603,8 @@ static int iTCO_wdt_get_timeleft(int *time_left)
593 spin_lock(&iTCO_wdt_private.io_lock); 603 spin_lock(&iTCO_wdt_private.io_lock);
594 val8 = inb(TCO_RLD); 604 val8 = inb(TCO_RLD);
595 val8 &= 0x3f; 605 val8 &= 0x3f;
606 if (!(inw(TCO1_STS) & 0x0008))
607 val8 += (inb(TCOv1_TMR) & 0x3f);
596 spin_unlock(&iTCO_wdt_private.io_lock); 608 spin_unlock(&iTCO_wdt_private.io_lock);
597 609
598 *time_left = (val8 * 6) / 10; 610 *time_left = (val8 * 6) / 10;
@@ -832,9 +844,9 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
832 TCOBASE); 844 TCOBASE);
833 845
834 /* Clear out the (probably old) status */ 846 /* Clear out the (probably old) status */
835 outb(8, TCO1_STS); /* Clear the Time Out Status bit */ 847 outw(0x0008, TCO1_STS); /* Clear the Time Out Status bit */
836 outb(2, TCO2_STS); /* Clear SECOND_TO_STS bit */ 848 outw(0x0002, TCO2_STS); /* Clear SECOND_TO_STS bit */
837 outb(4, TCO2_STS); /* Clear BOOT_STS bit */ 849 outw(0x0004, TCO2_STS); /* Clear BOOT_STS bit */
838 850
839 /* Make sure the watchdog is not running */ 851 /* Make sure the watchdog is not running */
840 iTCO_wdt_stop(); 852 iTCO_wdt_stop();
@@ -844,8 +856,7 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
844 if (iTCO_wdt_set_heartbeat(heartbeat)) { 856 if (iTCO_wdt_set_heartbeat(heartbeat)) {
845 iTCO_wdt_set_heartbeat(WATCHDOG_HEARTBEAT); 857 iTCO_wdt_set_heartbeat(WATCHDOG_HEARTBEAT);
846 printk(KERN_INFO PFX 858 printk(KERN_INFO PFX
847 "heartbeat value must be 2 < heartbeat < 39 (TCO v1) " 859 "timeout value out of range, using %d\n", heartbeat);
848 "or 613 (TCO v2), using %d\n", heartbeat);
849 } 860 }
850 861
851 ret = misc_register(&iTCO_wdt_miscdev); 862 ret = misc_register(&iTCO_wdt_miscdev);
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
new file mode 100644
index 000000000000..ea25885781bb
--- /dev/null
+++ b/drivers/watchdog/imx2_wdt.c
@@ -0,0 +1,358 @@
1/*
2 * Watchdog driver for IMX2 and later processors
3 *
4 * Copyright (C) 2010 Wolfram Sang, Pengutronix e.K. <w.sang@pengutronix.de>
5 *
6 * some parts adapted by similar drivers from Darius Augulis and Vladimir
7 * Zapolskiy, additional improvements by Wim Van Sebroeck.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published by
11 * the Free Software Foundation.
12 *
13 * NOTE: MX1 has a slightly different Watchdog than MX2 and later:
14 *
15 * MX1: MX2+:
16 * ---- -----
17 * Registers: 32-bit 16-bit
18 * Stopable timer: Yes No
19 * Need to enable clk: No Yes
20 * Halt on suspend: Manual Can be automatic
21 */
22
23#include <linux/init.h>
24#include <linux/kernel.h>
25#include <linux/miscdevice.h>
26#include <linux/module.h>
27#include <linux/moduleparam.h>
28#include <linux/platform_device.h>
29#include <linux/watchdog.h>
30#include <linux/clk.h>
31#include <linux/fs.h>
32#include <linux/io.h>
33#include <linux/uaccess.h>
34#include <linux/timer.h>
35#include <linux/jiffies.h>
36#include <mach/hardware.h>
37
38#define DRIVER_NAME "imx2-wdt"
39
40#define IMX2_WDT_WCR 0x00 /* Control Register */
41#define IMX2_WDT_WCR_WT (0xFF << 8) /* -> Watchdog Timeout Field */
42#define IMX2_WDT_WCR_WRE (1 << 3) /* -> WDOG Reset Enable */
43#define IMX2_WDT_WCR_WDE (1 << 2) /* -> Watchdog Enable */
44
45#define IMX2_WDT_WSR 0x02 /* Service Register */
46#define IMX2_WDT_SEQ1 0x5555 /* -> service sequence 1 */
47#define IMX2_WDT_SEQ2 0xAAAA /* -> service sequence 2 */
48
49#define IMX2_WDT_MAX_TIME 128
50#define IMX2_WDT_DEFAULT_TIME 60 /* in seconds */
51
52#define WDOG_SEC_TO_COUNT(s) ((s * 2 - 1) << 8)
53
54#define IMX2_WDT_STATUS_OPEN 0
55#define IMX2_WDT_STATUS_STARTED 1
56#define IMX2_WDT_EXPECT_CLOSE 2
57
58static struct {
59 struct clk *clk;
60 void __iomem *base;
61 unsigned timeout;
62 unsigned long status;
63 struct timer_list timer; /* Pings the watchdog when closed */
64} imx2_wdt;
65
66static struct miscdevice imx2_wdt_miscdev;
67
68static int nowayout = WATCHDOG_NOWAYOUT;
69module_param(nowayout, int, 0);
70MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
71 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
72
73
74static unsigned timeout = IMX2_WDT_DEFAULT_TIME;
75module_param(timeout, uint, 0);
76MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (default="
77 __MODULE_STRING(IMX2_WDT_DEFAULT_TIME) ")");
78
79static const struct watchdog_info imx2_wdt_info = {
80 .identity = "imx2+ watchdog",
81 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
82};
83
84static inline void imx2_wdt_setup(void)
85{
86 u16 val = __raw_readw(imx2_wdt.base + IMX2_WDT_WCR);
87
88 /* Strip the old watchdog Time-Out value */
89 val &= ~IMX2_WDT_WCR_WT;
90 /* Generate reset if WDOG times out */
91 val &= ~IMX2_WDT_WCR_WRE;
92 /* Keep Watchdog Disabled */
93 val &= ~IMX2_WDT_WCR_WDE;
94 /* Set the watchdog's Time-Out value */
95 val |= WDOG_SEC_TO_COUNT(imx2_wdt.timeout);
96
97 __raw_writew(val, imx2_wdt.base + IMX2_WDT_WCR);
98
99 /* enable the watchdog */
100 val |= IMX2_WDT_WCR_WDE;
101 __raw_writew(val, imx2_wdt.base + IMX2_WDT_WCR);
102}
103
104static inline void imx2_wdt_ping(void)
105{
106 __raw_writew(IMX2_WDT_SEQ1, imx2_wdt.base + IMX2_WDT_WSR);
107 __raw_writew(IMX2_WDT_SEQ2, imx2_wdt.base + IMX2_WDT_WSR);
108}
109
110static void imx2_wdt_timer_ping(unsigned long arg)
111{
112 /* ping it every imx2_wdt.timeout / 2 seconds to prevent reboot */
113 imx2_wdt_ping();
114 mod_timer(&imx2_wdt.timer, jiffies + imx2_wdt.timeout * HZ / 2);
115}
116
117static void imx2_wdt_start(void)
118{
119 if (!test_and_set_bit(IMX2_WDT_STATUS_STARTED, &imx2_wdt.status)) {
120 /* at our first start we enable clock and do initialisations */
121 clk_enable(imx2_wdt.clk);
122
123 imx2_wdt_setup();
124 } else /* delete the timer that pings the watchdog after close */
125 del_timer_sync(&imx2_wdt.timer);
126
127 /* Watchdog is enabled - time to reload the timeout value */
128 imx2_wdt_ping();
129}
130
131static void imx2_wdt_stop(void)
132{
133 /* we don't need a clk_disable, it cannot be disabled once started.
134 * We use a timer to ping the watchdog while /dev/watchdog is closed */
135 imx2_wdt_timer_ping(0);
136}
137
138static void imx2_wdt_set_timeout(int new_timeout)
139{
140 u16 val = __raw_readw(imx2_wdt.base + IMX2_WDT_WCR);
141
142 /* set the new timeout value in the WSR */
143 val &= ~IMX2_WDT_WCR_WT;
144 val |= WDOG_SEC_TO_COUNT(new_timeout);
145 __raw_writew(val, imx2_wdt.base + IMX2_WDT_WCR);
146}
147
148static int imx2_wdt_open(struct inode *inode, struct file *file)
149{
150 if (test_and_set_bit(IMX2_WDT_STATUS_OPEN, &imx2_wdt.status))
151 return -EBUSY;
152
153 imx2_wdt_start();
154 return nonseekable_open(inode, file);
155}
156
157static int imx2_wdt_close(struct inode *inode, struct file *file)
158{
159 if (test_bit(IMX2_WDT_EXPECT_CLOSE, &imx2_wdt.status) && !nowayout)
160 imx2_wdt_stop();
161 else {
162 dev_crit(imx2_wdt_miscdev.parent,
163 "Unexpected close: Expect reboot!\n");
164 imx2_wdt_ping();
165 }
166
167 clear_bit(IMX2_WDT_EXPECT_CLOSE, &imx2_wdt.status);
168 clear_bit(IMX2_WDT_STATUS_OPEN, &imx2_wdt.status);
169 return 0;
170}
171
172static long imx2_wdt_ioctl(struct file *file, unsigned int cmd,
173 unsigned long arg)
174{
175 void __user *argp = (void __user *)arg;
176 int __user *p = argp;
177 int new_value;
178
179 switch (cmd) {
180 case WDIOC_GETSUPPORT:
181 return copy_to_user(argp, &imx2_wdt_info,
182 sizeof(struct watchdog_info)) ? -EFAULT : 0;
183
184 case WDIOC_GETSTATUS:
185 case WDIOC_GETBOOTSTATUS:
186 return put_user(0, p);
187
188 case WDIOC_KEEPALIVE:
189 imx2_wdt_ping();
190 return 0;
191
192 case WDIOC_SETTIMEOUT:
193 if (get_user(new_value, p))
194 return -EFAULT;
195 if ((new_value < 1) || (new_value > IMX2_WDT_MAX_TIME))
196 return -EINVAL;
197 imx2_wdt_set_timeout(new_value);
198 imx2_wdt.timeout = new_value;
199 imx2_wdt_ping();
200
201 /* Fallthrough to return current value */
202 case WDIOC_GETTIMEOUT:
203 return put_user(imx2_wdt.timeout, p);
204
205 default:
206 return -ENOTTY;
207 }
208}
209
210static ssize_t imx2_wdt_write(struct file *file, const char __user *data,
211 size_t len, loff_t *ppos)
212{
213 size_t i;
214 char c;
215
216 if (len == 0) /* Can we see this even ? */
217 return 0;
218
219 clear_bit(IMX2_WDT_EXPECT_CLOSE, &imx2_wdt.status);
220 /* scan to see whether or not we got the magic character */
221 for (i = 0; i != len; i++) {
222 if (get_user(c, data + i))
223 return -EFAULT;
224 if (c == 'V')
225 set_bit(IMX2_WDT_EXPECT_CLOSE, &imx2_wdt.status);
226 }
227
228 imx2_wdt_ping();
229 return len;
230}
231
232static const struct file_operations imx2_wdt_fops = {
233 .owner = THIS_MODULE,
234 .llseek = no_llseek,
235 .unlocked_ioctl = imx2_wdt_ioctl,
236 .open = imx2_wdt_open,
237 .release = imx2_wdt_close,
238 .write = imx2_wdt_write,
239};
240
241static struct miscdevice imx2_wdt_miscdev = {
242 .minor = WATCHDOG_MINOR,
243 .name = "watchdog",
244 .fops = &imx2_wdt_fops,
245};
246
247static int __init imx2_wdt_probe(struct platform_device *pdev)
248{
249 int ret;
250 int res_size;
251 struct resource *res;
252
253 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
254 if (!res) {
255 dev_err(&pdev->dev, "can't get device resources\n");
256 return -ENODEV;
257 }
258
259 res_size = resource_size(res);
260 if (!devm_request_mem_region(&pdev->dev, res->start, res_size,
261 res->name)) {
262 dev_err(&pdev->dev, "can't allocate %d bytes at %d address\n",
263 res_size, res->start);
264 return -ENOMEM;
265 }
266
267 imx2_wdt.base = devm_ioremap_nocache(&pdev->dev, res->start, res_size);
268 if (!imx2_wdt.base) {
269 dev_err(&pdev->dev, "ioremap failed\n");
270 return -ENOMEM;
271 }
272
273 imx2_wdt.clk = clk_get_sys("imx-wdt.0", NULL);
274 if (IS_ERR(imx2_wdt.clk)) {
275 dev_err(&pdev->dev, "can't get Watchdog clock\n");
276 return PTR_ERR(imx2_wdt.clk);
277 }
278
279 imx2_wdt.timeout = clamp_t(unsigned, timeout, 1, IMX2_WDT_MAX_TIME);
280 if (imx2_wdt.timeout != timeout)
281 dev_warn(&pdev->dev, "Initial timeout out of range! "
282 "Clamped from %u to %u\n", timeout, imx2_wdt.timeout);
283
284 setup_timer(&imx2_wdt.timer, imx2_wdt_timer_ping, 0);
285
286 imx2_wdt_miscdev.parent = &pdev->dev;
287 ret = misc_register(&imx2_wdt_miscdev);
288 if (ret)
289 goto fail;
290
291 dev_info(&pdev->dev,
292 "IMX2+ Watchdog Timer enabled. timeout=%ds (nowayout=%d)\n",
293 imx2_wdt.timeout, nowayout);
294 return 0;
295
296fail:
297 imx2_wdt_miscdev.parent = NULL;
298 clk_put(imx2_wdt.clk);
299 return ret;
300}
301
302static int __exit imx2_wdt_remove(struct platform_device *pdev)
303{
304 misc_deregister(&imx2_wdt_miscdev);
305
306 if (test_bit(IMX2_WDT_STATUS_STARTED, &imx2_wdt.status)) {
307 del_timer_sync(&imx2_wdt.timer);
308
309 dev_crit(imx2_wdt_miscdev.parent,
310 "Device removed: Expect reboot!\n");
311 } else
312 clk_put(imx2_wdt.clk);
313
314 imx2_wdt_miscdev.parent = NULL;
315 return 0;
316}
317
318static void imx2_wdt_shutdown(struct platform_device *pdev)
319{
320 if (test_bit(IMX2_WDT_STATUS_STARTED, &imx2_wdt.status)) {
321 /* we are running, we need to delete the timer but will give
322 * max timeout before reboot will take place */
323 del_timer_sync(&imx2_wdt.timer);
324 imx2_wdt_set_timeout(IMX2_WDT_MAX_TIME);
325 imx2_wdt_ping();
326
327 dev_crit(imx2_wdt_miscdev.parent,
328 "Device shutdown: Expect reboot!\n");
329 }
330}
331
332static struct platform_driver imx2_wdt_driver = {
333 .probe = imx2_wdt_probe,
334 .remove = __exit_p(imx2_wdt_remove),
335 .shutdown = imx2_wdt_shutdown,
336 .driver = {
337 .name = DRIVER_NAME,
338 .owner = THIS_MODULE,
339 },
340};
341
342static int __init imx2_wdt_init(void)
343{
344 return platform_driver_probe(&imx2_wdt_driver, imx2_wdt_probe);
345}
346module_init(imx2_wdt_init);
347
348static void __exit imx2_wdt_exit(void)
349{
350 platform_driver_unregister(&imx2_wdt_driver);
351}
352module_exit(imx2_wdt_exit);
353
354MODULE_AUTHOR("Wolfram Sang");
355MODULE_DESCRIPTION("Watchdog driver for IMX2 and later");
356MODULE_LICENSE("GPL v2");
357MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
358MODULE_ALIAS("platform:" DRIVER_NAME);
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
index 4e3941c5e293..6622335773bb 100644
--- a/drivers/watchdog/mpc8xxx_wdt.c
+++ b/drivers/watchdog/mpc8xxx_wdt.c
@@ -53,7 +53,7 @@ static int mpc8xxx_wdt_init_late(void);
53static u16 timeout = 0xffff; 53static u16 timeout = 0xffff;
54module_param(timeout, ushort, 0); 54module_param(timeout, ushort, 0);
55MODULE_PARM_DESC(timeout, 55MODULE_PARM_DESC(timeout,
56 "Watchdog timeout in ticks. (0<timeout<65536, default=65535"); 56 "Watchdog timeout in ticks. (0<timeout<65536, default=65535)");
57 57
58static int reset = 1; 58static int reset = 1;
59module_param(reset, bool, 0); 59module_param(reset, bool, 0);
@@ -273,12 +273,12 @@ static const struct of_device_id mpc8xxx_wdt_match[] = {
273MODULE_DEVICE_TABLE(of, mpc8xxx_wdt_match); 273MODULE_DEVICE_TABLE(of, mpc8xxx_wdt_match);
274 274
275static struct of_platform_driver mpc8xxx_wdt_driver = { 275static struct of_platform_driver mpc8xxx_wdt_driver = {
276 .match_table = mpc8xxx_wdt_match,
277 .probe = mpc8xxx_wdt_probe, 276 .probe = mpc8xxx_wdt_probe,
278 .remove = __devexit_p(mpc8xxx_wdt_remove), 277 .remove = __devexit_p(mpc8xxx_wdt_remove),
279 .driver = { 278 .driver = {
280 .name = "mpc8xxx_wdt", 279 .name = "mpc8xxx_wdt",
281 .owner = THIS_MODULE, 280 .owner = THIS_MODULE,
281 .of_match_table = mpc8xxx_wdt_match,
282 }, 282 },
283}; 283};
284 284
diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c
index d3aa2f1fe61d..3a56bc360924 100644
--- a/drivers/watchdog/pc87413_wdt.c
+++ b/drivers/watchdog/pc87413_wdt.c
@@ -53,7 +53,9 @@
53#define WDTO 0x11 /* Watchdog timeout register */ 53#define WDTO 0x11 /* Watchdog timeout register */
54#define WDCFG 0x12 /* Watchdog config register */ 54#define WDCFG 0x12 /* Watchdog config register */
55 55
56static int io = 0x2E; /* Address used on Portwell Boards */ 56#define IO_DEFAULT 0x2E /* Address used on Portwell Boards */
57
58static int io = IO_DEFAULT;
57 59
58static int timeout = DEFAULT_TIMEOUT; /* timeout value */ 60static int timeout = DEFAULT_TIMEOUT; /* timeout value */
59static unsigned long timer_enabled; /* is the timer enabled? */ 61static unsigned long timer_enabled; /* is the timer enabled? */
@@ -583,12 +585,13 @@ MODULE_LICENSE("GPL");
583MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 585MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
584 586
585module_param(io, int, 0); 587module_param(io, int, 0);
586MODULE_PARM_DESC(io, MODNAME " I/O port (default: " __MODULE_STRING(io) ")."); 588MODULE_PARM_DESC(io, MODNAME " I/O port (default: "
589 __MODULE_STRING(IO_DEFAULT) ").");
587 590
588module_param(timeout, int, 0); 591module_param(timeout, int, 0);
589MODULE_PARM_DESC(timeout, 592MODULE_PARM_DESC(timeout,
590 "Watchdog timeout in minutes (default=" 593 "Watchdog timeout in minutes (default="
591 __MODULE_STRING(timeout) ")."); 594 __MODULE_STRING(DEFAULT_TIMEOUT) ").");
592 595
593module_param(nowayout, int, 0); 596module_param(nowayout, int, 0);
594MODULE_PARM_DESC(nowayout, 597MODULE_PARM_DESC(nowayout,
diff --git a/drivers/watchdog/pnx833x_wdt.c b/drivers/watchdog/pnx833x_wdt.c
index 09102f09e681..a7b5ad2a98bd 100644
--- a/drivers/watchdog/pnx833x_wdt.c
+++ b/drivers/watchdog/pnx833x_wdt.c
@@ -33,6 +33,8 @@
33#define PFX "pnx833x: " 33#define PFX "pnx833x: "
34#define WATCHDOG_TIMEOUT 30 /* 30 sec Maximum timeout */ 34#define WATCHDOG_TIMEOUT 30 /* 30 sec Maximum timeout */
35#define WATCHDOG_COUNT_FREQUENCY 68000000U /* Watchdog counts at 68MHZ. */ 35#define WATCHDOG_COUNT_FREQUENCY 68000000U /* Watchdog counts at 68MHZ. */
36#define PNX_WATCHDOG_TIMEOUT (WATCHDOG_TIMEOUT * WATCHDOG_COUNT_FREQUENCY)
37#define PNX_TIMEOUT_VALUE 2040000000U
36 38
37/** CONFIG block */ 39/** CONFIG block */
38#define PNX833X_CONFIG (0x07000U) 40#define PNX833X_CONFIG (0x07000U)
@@ -47,20 +49,21 @@
47static int pnx833x_wdt_alive; 49static int pnx833x_wdt_alive;
48 50
49/* Set default timeout in MHZ.*/ 51/* Set default timeout in MHZ.*/
50static int pnx833x_wdt_timeout = (WATCHDOG_TIMEOUT * WATCHDOG_COUNT_FREQUENCY); 52static int pnx833x_wdt_timeout = PNX_WATCHDOG_TIMEOUT;
51module_param(pnx833x_wdt_timeout, int, 0); 53module_param(pnx833x_wdt_timeout, int, 0);
52MODULE_PARM_DESC(timeout, "Watchdog timeout in Mhz. (68Mhz clock), default=" 54MODULE_PARM_DESC(timeout, "Watchdog timeout in Mhz. (68Mhz clock), default="
53 __MODULE_STRING(pnx833x_wdt_timeout) "(30 seconds)."); 55 __MODULE_STRING(PNX_TIMEOUT_VALUE) "(30 seconds).");
54 56
55static int nowayout = WATCHDOG_NOWAYOUT; 57static int nowayout = WATCHDOG_NOWAYOUT;
56module_param(nowayout, int, 0); 58module_param(nowayout, int, 0);
57MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" 59MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
58 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 60 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
59 61
60static int start_enabled = 1; 62#define START_DEFAULT 1
63static int start_enabled = START_DEFAULT;
61module_param(start_enabled, int, 0); 64module_param(start_enabled, int, 0);
62MODULE_PARM_DESC(start_enabled, "Watchdog is started on module insertion " 65MODULE_PARM_DESC(start_enabled, "Watchdog is started on module insertion "
63 "(default=" __MODULE_STRING(start_enabled) ")"); 66 "(default=" __MODULE_STRING(START_DEFAULT) ")");
64 67
65static void pnx833x_wdt_start(void) 68static void pnx833x_wdt_start(void)
66{ 69{
diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c
index 69c6adbd8205..428f8a1583e8 100644
--- a/drivers/watchdog/rdc321x_wdt.c
+++ b/drivers/watchdog/rdc321x_wdt.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * RDC321x watchdog driver 2 * RDC321x watchdog driver
3 * 3 *
4 * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org> 4 * Copyright (C) 2007-2010 Florian Fainelli <florian@openwrt.org>
5 * 5 *
6 * This driver is highly inspired from the cpu5_wdt driver 6 * This driver is highly inspired from the cpu5_wdt driver
7 * 7 *
@@ -36,8 +36,7 @@
36#include <linux/watchdog.h> 36#include <linux/watchdog.h>
37#include <linux/io.h> 37#include <linux/io.h>
38#include <linux/uaccess.h> 38#include <linux/uaccess.h>
39 39#include <linux/mfd/rdc321x.h>
40#include <asm/rdc321x_defs.h>
41 40
42#define RDC_WDT_MASK 0x80000000 /* Mask */ 41#define RDC_WDT_MASK 0x80000000 /* Mask */
43#define RDC_WDT_EN 0x00800000 /* Enable bit */ 42#define RDC_WDT_EN 0x00800000 /* Enable bit */
@@ -63,6 +62,8 @@ static struct {
63 int default_ticks; 62 int default_ticks;
64 unsigned long inuse; 63 unsigned long inuse;
65 spinlock_t lock; 64 spinlock_t lock;
65 struct pci_dev *sb_pdev;
66 int base_reg;
66} rdc321x_wdt_device; 67} rdc321x_wdt_device;
67 68
68/* generic helper functions */ 69/* generic helper functions */
@@ -70,14 +71,18 @@ static struct {
70static void rdc321x_wdt_trigger(unsigned long unused) 71static void rdc321x_wdt_trigger(unsigned long unused)
71{ 72{
72 unsigned long flags; 73 unsigned long flags;
74 u32 val;
73 75
74 if (rdc321x_wdt_device.running) 76 if (rdc321x_wdt_device.running)
75 ticks--; 77 ticks--;
76 78
77 /* keep watchdog alive */ 79 /* keep watchdog alive */
78 spin_lock_irqsave(&rdc321x_wdt_device.lock, flags); 80 spin_lock_irqsave(&rdc321x_wdt_device.lock, flags);
79 outl(RDC_WDT_EN | inl(RDC3210_CFGREG_DATA), 81 pci_read_config_dword(rdc321x_wdt_device.sb_pdev,
80 RDC3210_CFGREG_DATA); 82 rdc321x_wdt_device.base_reg, &val);
83 val |= RDC_WDT_EN;
84 pci_write_config_dword(rdc321x_wdt_device.sb_pdev,
85 rdc321x_wdt_device.base_reg, val);
81 spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags); 86 spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags);
82 87
83 /* requeue?? */ 88 /* requeue?? */
@@ -105,10 +110,13 @@ static void rdc321x_wdt_start(void)
105 110
106 /* Clear the timer */ 111 /* Clear the timer */
107 spin_lock_irqsave(&rdc321x_wdt_device.lock, flags); 112 spin_lock_irqsave(&rdc321x_wdt_device.lock, flags);
108 outl(RDC_CLS_TMR, RDC3210_CFGREG_ADDR); 113 pci_write_config_dword(rdc321x_wdt_device.sb_pdev,
114 rdc321x_wdt_device.base_reg, RDC_CLS_TMR);
109 115
110 /* Enable watchdog and set the timeout to 81.92 us */ 116 /* Enable watchdog and set the timeout to 81.92 us */
111 outl(RDC_WDT_EN | RDC_WDT_CNT, RDC3210_CFGREG_DATA); 117 pci_write_config_dword(rdc321x_wdt_device.sb_pdev,
118 rdc321x_wdt_device.base_reg,
119 RDC_WDT_EN | RDC_WDT_CNT);
112 spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags); 120 spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags);
113 121
114 mod_timer(&rdc321x_wdt_device.timer, 122 mod_timer(&rdc321x_wdt_device.timer,
@@ -148,7 +156,7 @@ static long rdc321x_wdt_ioctl(struct file *file, unsigned int cmd,
148 unsigned long arg) 156 unsigned long arg)
149{ 157{
150 void __user *argp = (void __user *)arg; 158 void __user *argp = (void __user *)arg;
151 unsigned int value; 159 u32 value;
152 static const struct watchdog_info ident = { 160 static const struct watchdog_info ident = {
153 .options = WDIOF_CARDRESET, 161 .options = WDIOF_CARDRESET,
154 .identity = "RDC321x WDT", 162 .identity = "RDC321x WDT",
@@ -162,9 +170,10 @@ static long rdc321x_wdt_ioctl(struct file *file, unsigned int cmd,
162 case WDIOC_GETSTATUS: 170 case WDIOC_GETSTATUS:
163 /* Read the value from the DATA register */ 171 /* Read the value from the DATA register */
164 spin_lock_irqsave(&rdc321x_wdt_device.lock, flags); 172 spin_lock_irqsave(&rdc321x_wdt_device.lock, flags);
165 value = inl(RDC3210_CFGREG_DATA); 173 pci_read_config_dword(rdc321x_wdt_device.sb_pdev,
174 rdc321x_wdt_device.base_reg, &value);
166 spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags); 175 spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags);
167 if (copy_to_user(argp, &value, sizeof(int))) 176 if (copy_to_user(argp, &value, sizeof(u32)))
168 return -EFAULT; 177 return -EFAULT;
169 break; 178 break;
170 case WDIOC_GETSUPPORT: 179 case WDIOC_GETSUPPORT:
@@ -219,17 +228,35 @@ static struct miscdevice rdc321x_wdt_misc = {
219static int __devinit rdc321x_wdt_probe(struct platform_device *pdev) 228static int __devinit rdc321x_wdt_probe(struct platform_device *pdev)
220{ 229{
221 int err; 230 int err;
231 struct resource *r;
232 struct rdc321x_wdt_pdata *pdata;
233
234 pdata = pdev->dev.platform_data;
235 if (!pdata) {
236 dev_err(&pdev->dev, "no platform data supplied\n");
237 return -ENODEV;
238 }
239
240 r = platform_get_resource_byname(pdev, IORESOURCE_IO, "wdt-reg");
241 if (!r) {
242 dev_err(&pdev->dev, "failed to get wdt-reg resource\n");
243 return -ENODEV;
244 }
245
246 rdc321x_wdt_device.sb_pdev = pdata->sb_pdev;
247 rdc321x_wdt_device.base_reg = r->start;
222 248
223 err = misc_register(&rdc321x_wdt_misc); 249 err = misc_register(&rdc321x_wdt_misc);
224 if (err < 0) { 250 if (err < 0) {
225 printk(KERN_ERR PFX "watchdog misc_register failed\n"); 251 dev_err(&pdev->dev, "misc_register failed\n");
226 return err; 252 return err;
227 } 253 }
228 254
229 spin_lock_init(&rdc321x_wdt_device.lock); 255 spin_lock_init(&rdc321x_wdt_device.lock);
230 256
231 /* Reset the watchdog */ 257 /* Reset the watchdog */
232 outl(RDC_WDT_RST, RDC3210_CFGREG_DATA); 258 pci_write_config_dword(rdc321x_wdt_device.sb_pdev,
259 rdc321x_wdt_device.base_reg, RDC_WDT_RST);
233 260
234 init_completion(&rdc321x_wdt_device.stop); 261 init_completion(&rdc321x_wdt_device.stop);
235 rdc321x_wdt_device.queue = 0; 262 rdc321x_wdt_device.queue = 0;
@@ -240,7 +267,7 @@ static int __devinit rdc321x_wdt_probe(struct platform_device *pdev)
240 267
241 rdc321x_wdt_device.default_ticks = ticks; 268 rdc321x_wdt_device.default_ticks = ticks;
242 269
243 printk(KERN_INFO PFX "watchdog init success\n"); 270 dev_info(&pdev->dev, "watchdog init success\n");
244 271
245 return 0; 272 return 0;
246} 273}
diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c
index ea7f803f6248..5dceeddc8859 100644
--- a/drivers/watchdog/riowd.c
+++ b/drivers/watchdog/riowd.c
@@ -239,8 +239,11 @@ static const struct of_device_id riowd_match[] = {
239MODULE_DEVICE_TABLE(of, riowd_match); 239MODULE_DEVICE_TABLE(of, riowd_match);
240 240
241static struct of_platform_driver riowd_driver = { 241static struct of_platform_driver riowd_driver = {
242 .name = DRIVER_NAME, 242 .driver = {
243 .match_table = riowd_match, 243 .name = DRIVER_NAME,
244 .owner = THIS_MODULE,
245 .of_match_table = riowd_match,
246 },
244 .probe = riowd_probe, 247 .probe = riowd_probe,
245 .remove = __devexit_p(riowd_remove), 248 .remove = __devexit_p(riowd_remove),
246}; 249};
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index e4cebef55177..300932580ded 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -63,7 +63,7 @@ module_param(nowayout, int, 0);
63module_param(soft_noboot, int, 0); 63module_param(soft_noboot, int, 0);
64module_param(debug, int, 0); 64module_param(debug, int, 0);
65 65
66MODULE_PARM_DESC(tmr_margin, "Watchdog tmr_margin in seconds. default=" 66MODULE_PARM_DESC(tmr_margin, "Watchdog tmr_margin in seconds. (default="
67 __MODULE_STRING(CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME) ")"); 67 __MODULE_STRING(CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME) ")");
68MODULE_PARM_DESC(tmr_atboot, 68MODULE_PARM_DESC(tmr_atboot,
69 "Watchdog is started at boot time if set to 1, default=" 69 "Watchdog is started at boot time if set to 1, default="
@@ -71,8 +71,8 @@ MODULE_PARM_DESC(tmr_atboot,
71MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" 71MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
72 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 72 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
73MODULE_PARM_DESC(soft_noboot, "Watchdog action, set to 1 to ignore reboots, " 73MODULE_PARM_DESC(soft_noboot, "Watchdog action, set to 1 to ignore reboots, "
74 "0 to reboot (default depends on ONLY_TESTING)"); 74 "0 to reboot (default 0)");
75MODULE_PARM_DESC(debug, "Watchdog debug, set to >1 for debug, (default 0)"); 75MODULE_PARM_DESC(debug, "Watchdog debug, set to >1 for debug (default 0)");
76 76
77static unsigned long open_lock; 77static unsigned long open_lock;
78static struct device *wdt_dev; /* platform device attached to */ 78static struct device *wdt_dev; /* platform device attached to */
@@ -426,8 +426,7 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
426 wdt_mem = request_mem_region(res->start, size, pdev->name); 426 wdt_mem = request_mem_region(res->start, size, pdev->name);
427 if (wdt_mem == NULL) { 427 if (wdt_mem == NULL) {
428 dev_err(dev, "failed to get memory region\n"); 428 dev_err(dev, "failed to get memory region\n");
429 ret = -ENOENT; 429 return -EBUSY;
430 goto err_req;
431 } 430 }
432 431
433 wdt_base = ioremap(res->start, size); 432 wdt_base = ioremap(res->start, size);
diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c
index a03f84e5ee1f..6fc74065abee 100644
--- a/drivers/watchdog/shwdt.c
+++ b/drivers/watchdog/shwdt.c
@@ -496,7 +496,7 @@ MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
496module_param(clock_division_ratio, int, 0); 496module_param(clock_division_ratio, int, 0);
497MODULE_PARM_DESC(clock_division_ratio, 497MODULE_PARM_DESC(clock_division_ratio,
498 "Clock division ratio. Valid ranges are from 0x5 (1.31ms) " 498 "Clock division ratio. Valid ranges are from 0x5 (1.31ms) "
499 "to 0x7 (5.25ms). (default=" __MODULE_STRING(clock_division_ratio) ")"); 499 "to 0x7 (5.25ms). (default=" __MODULE_STRING(WTCSR_CKS_4096) ")");
500 500
501module_param(heartbeat, int, 0); 501module_param(heartbeat, int, 0);
502MODULE_PARM_DESC(heartbeat, 502MODULE_PARM_DESC(heartbeat,
diff --git a/drivers/watchdog/twl4030_wdt.c b/drivers/watchdog/twl4030_wdt.c
index dcabe77ad141..b5045ca7e61c 100644
--- a/drivers/watchdog/twl4030_wdt.c
+++ b/drivers/watchdog/twl4030_wdt.c
@@ -190,6 +190,8 @@ static int __devinit twl4030_wdt_probe(struct platform_device *pdev)
190 190
191 twl4030_wdt_dev = pdev; 191 twl4030_wdt_dev = pdev;
192 192
193 twl4030_wdt_disable(wdt);
194
193 ret = misc_register(&wdt->miscdev); 195 ret = misc_register(&wdt->miscdev);
194 if (ret) { 196 if (ret) {
195 dev_err(wdt->miscdev.parent, 197 dev_err(wdt->miscdev.parent,
diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c
index bfda2e99dd89..552a4381e78f 100644
--- a/drivers/watchdog/wdt.c
+++ b/drivers/watchdog/wdt.c
@@ -91,7 +91,7 @@ MODULE_PARM_DESC(tachometer,
91static int type = 500; 91static int type = 500;
92module_param(type, int, 0); 92module_param(type, int, 0);
93MODULE_PARM_DESC(type, 93MODULE_PARM_DESC(type,
94 "WDT501-P Card type (500 or 501 , default=500)"); 94 "WDT501-P Card type (500 or 501, default=500)");
95 95
96/* 96/*
97 * Programming support 97 * Programming support
diff --git a/drivers/watchdog/wdt977.c b/drivers/watchdog/wdt977.c
index 90ef70eb47d7..5c2521fc836c 100644
--- a/drivers/watchdog/wdt977.c
+++ b/drivers/watchdog/wdt977.c
@@ -63,7 +63,7 @@ static char expect_close;
63static DEFINE_SPINLOCK(spinlock); 63static DEFINE_SPINLOCK(spinlock);
64 64
65module_param(timeout, int, 0); 65module_param(timeout, int, 0);
66MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (60..15300), default=" 66MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (60..15300, default="
67 __MODULE_STRING(DEFAULT_TIMEOUT) ")"); 67 __MODULE_STRING(DEFAULT_TIMEOUT) ")");
68module_param(testmode, int, 0); 68module_param(testmode, int, 0);
69MODULE_PARM_DESC(testmode, "Watchdog testmode (1 = no reboot), default=0"); 69MODULE_PARM_DESC(testmode, "Watchdog testmode (1 = no reboot), default=0");