aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 09:00:45 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 09:00:45 -0400
commit67d2c36e901403bb97cb79ddb44d702c3284d0ba (patch)
tree872805a9402f8186584075f1a8cf804b9606efea /drivers/char/watchdog
parent94f8c66e5e543d79231abf203d6e514ecb668688 (diff)
parent1cc77248106aafc12ba529953f652d6f8db2c84d (diff)
Merge watchdog driver updates
Automated merge from master.kernel.org:/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog failed due to duplicate different changes to Kconfig file. Manually fixed up. Hopefully.
Diffstat (limited to 'drivers/char/watchdog')
-rw-r--r--drivers/char/watchdog/Makefile71
-rw-r--r--drivers/char/watchdog/ixp2000_wdt.c2
-rw-r--r--drivers/char/watchdog/ixp4xx_wdt.c2
-rw-r--r--drivers/char/watchdog/s3c2410_wdt.c87
-rw-r--r--drivers/char/watchdog/scx200_wdt.c2
-rw-r--r--drivers/char/watchdog/softdog.c13
-rw-r--r--drivers/char/watchdog/w83627hf_wdt.c6
7 files changed, 121 insertions, 62 deletions
diff --git a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile
index b16dfea28134..cfeac6f10137 100644
--- a/drivers/char/watchdog/Makefile
+++ b/drivers/char/watchdog/Makefile
@@ -2,43 +2,68 @@
2# Makefile for the WatchDog device drivers. 2# Makefile for the WatchDog device drivers.
3# 3#
4 4
5# Only one watchdog can succeed. We probe the ISA/PCI/USB based
6# watchdog-cards first, then the architecture specific watchdog
7# drivers and then the architecture independant "softdog" driver.
8# This means that if your ISA/PCI/USB card isn't detected that
9# you can fall back to an architecture specific driver and if
10# that also fails then you can fall back to the software watchdog
11# to give you some cover.
12
13# ISA-based Watchdog Cards
5obj-$(CONFIG_PCWATCHDOG) += pcwd.o 14obj-$(CONFIG_PCWATCHDOG) += pcwd.o
6obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
7obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o
8obj-$(CONFIG_IB700_WDT) += ib700wdt.o
9obj-$(CONFIG_MIXCOMWD) += mixcomwd.o 15obj-$(CONFIG_MIXCOMWD) += mixcomwd.o
10obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
11obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o
12obj-$(CONFIG_WDT) += wdt.o 16obj-$(CONFIG_WDT) += wdt.o
17
18# PCI-based Watchdog Cards
19obj-$(CONFIG_PCIPCWATCHDOG) += pcwd_pci.o
13obj-$(CONFIG_WDTPCI) += wdt_pci.o 20obj-$(CONFIG_WDTPCI) += wdt_pci.o
21
22# USB-based Watchdog Cards
23obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o
24
25# ARM Architecture
14obj-$(CONFIG_21285_WATCHDOG) += wdt285.o 26obj-$(CONFIG_21285_WATCHDOG) += wdt285.o
15obj-$(CONFIG_977_WATCHDOG) += wdt977.o 27obj-$(CONFIG_977_WATCHDOG) += wdt977.o
16obj-$(CONFIG_I8XX_TCO) += i8xx_tco.o 28obj-$(CONFIG_IXP2000_WATCHDOG) += ixp2000_wdt.o
17obj-$(CONFIG_MACHZ_WDT) += machzwd.o 29obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o
18obj-$(CONFIG_SH_WDT) += shwdt.o
19obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o 30obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o
20obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o 31obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o
21obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o 32
22obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o 33# X86 (i386 + ia64 + x86_64) Architecture
23obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o 34obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
24obj-$(CONFIG_SC520_WDT) += sc520_wdt.o 35obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o
25obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o
26obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o 36obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o
27obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o 37obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o
38obj-$(CONFIG_SC520_WDT) += sc520_wdt.o
39obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o
40obj-$(CONFIG_IB700_WDT) += ib700wdt.o
28obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o 41obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
42obj-$(CONFIG_I8XX_TCO) += i8xx_tco.o
43obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o
44obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
45obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o
29obj-$(CONFIG_CPU5_WDT) += cpu5wdt.o 46obj-$(CONFIG_CPU5_WDT) += cpu5wdt.o
30obj-$(CONFIG_INDYDOG) += indydog.o 47obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o
31obj-$(CONFIG_PCIPCWATCHDOG) += pcwd_pci.o 48obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o
32obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o 49obj-$(CONFIG_MACHZ_WDT) += machzwd.o
33obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o 50
34obj-$(CONFIG_IXP2000_WATCHDOG) += ixp2000_wdt.o 51# PowerPC Architecture
35obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o 52obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o
53
54# PPC64 Architecture
36obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o 55obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o
37obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o 56obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o
38 57
39# Only one watchdog can succeed. We probe the hardware watchdog 58# MIPS Architecture
40# drivers first, then the softdog driver. This means if your hardware 59obj-$(CONFIG_INDYDOG) += indydog.o
41# watchdog dies or is 'borrowed' for some reason the software watchdog 60
42# still gives you some cover. 61# S390 Architecture
62
63# SUPERH Architecture
64obj-$(CONFIG_SH_WDT) += shwdt.o
65
66# SPARC64 Architecture
43 67
68# Architecture Independant
44obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o 69obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
diff --git a/drivers/char/watchdog/ixp2000_wdt.c b/drivers/char/watchdog/ixp2000_wdt.c
index e7640bc4904b..0cfb9b9c4a4b 100644
--- a/drivers/char/watchdog/ixp2000_wdt.c
+++ b/drivers/char/watchdog/ixp2000_wdt.c
@@ -182,7 +182,7 @@ static struct file_operations ixp2000_wdt_fops =
182static struct miscdevice ixp2000_wdt_miscdev = 182static struct miscdevice ixp2000_wdt_miscdev =
183{ 183{
184 .minor = WATCHDOG_MINOR, 184 .minor = WATCHDOG_MINOR,
185 .name = "IXP2000 Watchdog", 185 .name = "watchdog",
186 .fops = &ixp2000_wdt_fops, 186 .fops = &ixp2000_wdt_fops,
187}; 187};
188 188
diff --git a/drivers/char/watchdog/ixp4xx_wdt.c b/drivers/char/watchdog/ixp4xx_wdt.c
index 8d916afbf4fa..b5be8b11104a 100644
--- a/drivers/char/watchdog/ixp4xx_wdt.c
+++ b/drivers/char/watchdog/ixp4xx_wdt.c
@@ -176,7 +176,7 @@ static struct file_operations ixp4xx_wdt_fops =
176static struct miscdevice ixp4xx_wdt_miscdev = 176static struct miscdevice ixp4xx_wdt_miscdev =
177{ 177{
178 .minor = WATCHDOG_MINOR, 178 .minor = WATCHDOG_MINOR,
179 .name = "IXP4xx Watchdog", 179 .name = "watchdog",
180 .fops = &ixp4xx_wdt_fops, 180 .fops = &ixp4xx_wdt_fops,
181}; 181};
182 182
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c
index f85ac898a49a..8b292bf343c4 100644
--- a/drivers/char/watchdog/s3c2410_wdt.c
+++ b/drivers/char/watchdog/s3c2410_wdt.c
@@ -27,7 +27,10 @@
27 * Fixed tmr_count / wdt_count confusion 27 * Fixed tmr_count / wdt_count confusion
28 * Added configurable debug 28 * Added configurable debug
29 * 29 *
30 * 11-Jan-2004 BJD Fixed divide-by-2 in timeout code 30 * 11-Jan-2005 BJD Fixed divide-by-2 in timeout code
31 *
32 * 25-Jan-2005 DA Added suspend/resume support
33 * Replaced reboot notifier with .shutdown method
31 * 34 *
32 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA 35 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
33*/ 36*/
@@ -40,8 +43,6 @@
40#include <linux/miscdevice.h> 43#include <linux/miscdevice.h>
41#include <linux/watchdog.h> 44#include <linux/watchdog.h>
42#include <linux/fs.h> 45#include <linux/fs.h>
43#include <linux/notifier.h>
44#include <linux/reboot.h>
45#include <linux/init.h> 46#include <linux/init.h>
46#include <linux/device.h> 47#include <linux/device.h>
47#include <linux/interrupt.h> 48#include <linux/interrupt.h>
@@ -317,20 +318,6 @@ static int s3c2410wdt_ioctl(struct inode *inode, struct file *file,
317 } 318 }
318} 319}
319 320
320/*
321 * Notifier for system down
322 */
323
324static int s3c2410wdt_notify_sys(struct notifier_block *this, unsigned long code,
325 void *unused)
326{
327 if(code==SYS_DOWN || code==SYS_HALT) {
328 /* Turn the WDT off */
329 s3c2410wdt_stop();
330 }
331 return NOTIFY_DONE;
332}
333
334/* kernel interface */ 321/* kernel interface */
335 322
336static struct file_operations s3c2410wdt_fops = { 323static struct file_operations s3c2410wdt_fops = {
@@ -348,10 +335,6 @@ static struct miscdevice s3c2410wdt_miscdev = {
348 .fops = &s3c2410wdt_fops, 335 .fops = &s3c2410wdt_fops,
349}; 336};
350 337
351static struct notifier_block s3c2410wdt_notifier = {
352 .notifier_call = s3c2410wdt_notify_sys,
353};
354
355/* interrupt handler code */ 338/* interrupt handler code */
356 339
357static irqreturn_t s3c2410wdt_irq(int irqno, void *param, 340static irqreturn_t s3c2410wdt_irq(int irqno, void *param,
@@ -432,18 +415,10 @@ static int s3c2410wdt_probe(struct device *dev)
432 } 415 }
433 } 416 }
434 417
435 ret = register_reboot_notifier(&s3c2410wdt_notifier);
436 if (ret) {
437 printk (KERN_ERR PFX "cannot register reboot notifier (%d)\n",
438 ret);
439 return ret;
440 }
441
442 ret = misc_register(&s3c2410wdt_miscdev); 418 ret = misc_register(&s3c2410wdt_miscdev);
443 if (ret) { 419 if (ret) {
444 printk (KERN_ERR PFX "cannot register miscdev on minor=%d (%d)\n", 420 printk (KERN_ERR PFX "cannot register miscdev on minor=%d (%d)\n",
445 WATCHDOG_MINOR, ret); 421 WATCHDOG_MINOR, ret);
446 unregister_reboot_notifier(&s3c2410wdt_notifier);
447 return ret; 422 return ret;
448 } 423 }
449 424
@@ -479,15 +454,63 @@ static int s3c2410wdt_remove(struct device *dev)
479 return 0; 454 return 0;
480} 455}
481 456
457static void s3c2410wdt_shutdown(struct device *dev)
458{
459 s3c2410wdt_stop();
460}
461
462#ifdef CONFIG_PM
463
464static unsigned long wtcon_save;
465static unsigned long wtdat_save;
466
467static int s3c2410wdt_suspend(struct device *dev, u32 state, u32 level)
468{
469 if (level == SUSPEND_POWER_DOWN) {
470 /* Save watchdog state, and turn it off. */
471 wtcon_save = readl(wdt_base + S3C2410_WTCON);
472 wtdat_save = readl(wdt_base + S3C2410_WTDAT);
473
474 /* Note that WTCNT doesn't need to be saved. */
475 s3c2410wdt_stop();
476 }
477
478 return 0;
479}
480
481static int s3c2410wdt_resume(struct device *dev, u32 level)
482{
483 if (level == RESUME_POWER_ON) {
484 /* Restore watchdog state. */
485
486 writel(wtdat_save, wdt_base + S3C2410_WTDAT);
487 writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */
488 writel(wtcon_save, wdt_base + S3C2410_WTCON);
489
490 printk(KERN_INFO PFX "watchdog %sabled\n",
491 (wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis");
492 }
493
494 return 0;
495}
496
497#else
498#define s3c2410wdt_suspend NULL
499#define s3c2410wdt_resume NULL
500#endif /* CONFIG_PM */
501
502
482static struct device_driver s3c2410wdt_driver = { 503static struct device_driver s3c2410wdt_driver = {
483 .name = "s3c2410-wdt", 504 .name = "s3c2410-wdt",
484 .bus = &platform_bus_type, 505 .bus = &platform_bus_type,
485 .probe = s3c2410wdt_probe, 506 .probe = s3c2410wdt_probe,
486 .remove = s3c2410wdt_remove, 507 .remove = s3c2410wdt_remove,
508 .shutdown = s3c2410wdt_shutdown,
509 .suspend = s3c2410wdt_suspend,
510 .resume = s3c2410wdt_resume,
487}; 511};
488 512
489 513
490
491static char banner[] __initdata = KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics\n"; 514static char banner[] __initdata = KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics\n";
492 515
493static int __init watchdog_init(void) 516static int __init watchdog_init(void)
@@ -499,13 +522,13 @@ static int __init watchdog_init(void)
499static void __exit watchdog_exit(void) 522static void __exit watchdog_exit(void)
500{ 523{
501 driver_unregister(&s3c2410wdt_driver); 524 driver_unregister(&s3c2410wdt_driver);
502 unregister_reboot_notifier(&s3c2410wdt_notifier);
503} 525}
504 526
505module_init(watchdog_init); 527module_init(watchdog_init);
506module_exit(watchdog_exit); 528module_exit(watchdog_exit);
507 529
508MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); 530MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>, "
531 "Dimitry Andric <dimitry.andric@tomtom.com>");
509MODULE_DESCRIPTION("S3C2410 Watchdog Device Driver"); 532MODULE_DESCRIPTION("S3C2410 Watchdog Device Driver");
510MODULE_LICENSE("GPL"); 533MODULE_LICENSE("GPL");
511MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 534MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
diff --git a/drivers/char/watchdog/scx200_wdt.c b/drivers/char/watchdog/scx200_wdt.c
index c4568569f3a8..b4a102a2d7e3 100644
--- a/drivers/char/watchdog/scx200_wdt.c
+++ b/drivers/char/watchdog/scx200_wdt.c
@@ -206,7 +206,7 @@ static struct file_operations scx200_wdt_fops = {
206 206
207static struct miscdevice scx200_wdt_miscdev = { 207static struct miscdevice scx200_wdt_miscdev = {
208 .minor = WATCHDOG_MINOR, 208 .minor = WATCHDOG_MINOR,
209 .name = NAME, 209 .name = "watchdog",
210 .fops = &scx200_wdt_fops, 210 .fops = &scx200_wdt_fops,
211}; 211};
212 212
diff --git a/drivers/char/watchdog/softdog.c b/drivers/char/watchdog/softdog.c
index 4d7ed931f5c6..20e5eb8667f2 100644
--- a/drivers/char/watchdog/softdog.c
+++ b/drivers/char/watchdog/softdog.c
@@ -77,7 +77,7 @@ static void watchdog_fire(unsigned long);
77 77
78static struct timer_list watchdog_ticktock = 78static struct timer_list watchdog_ticktock =
79 TIMER_INITIALIZER(watchdog_fire, 0, 0); 79 TIMER_INITIALIZER(watchdog_fire, 0, 0);
80static unsigned long timer_alive; 80static unsigned long driver_open, orphan_timer;
81static char expect_close; 81static char expect_close;
82 82
83 83
@@ -87,6 +87,9 @@ static char expect_close;
87 87
88static void watchdog_fire(unsigned long data) 88static void watchdog_fire(unsigned long data)
89{ 89{
90 if (test_and_clear_bit(0, &orphan_timer))
91 module_put(THIS_MODULE);
92
90 if (soft_noboot) 93 if (soft_noboot)
91 printk(KERN_CRIT PFX "Triggered - Reboot ignored.\n"); 94 printk(KERN_CRIT PFX "Triggered - Reboot ignored.\n");
92 else 95 else
@@ -128,9 +131,9 @@ static int softdog_set_heartbeat(int t)
128 131
129static int softdog_open(struct inode *inode, struct file *file) 132static int softdog_open(struct inode *inode, struct file *file)
130{ 133{
131 if(test_and_set_bit(0, &timer_alive)) 134 if (test_and_set_bit(0, &driver_open))
132 return -EBUSY; 135 return -EBUSY;
133 if (nowayout) 136 if (!test_and_clear_bit(0, &orphan_timer))
134 __module_get(THIS_MODULE); 137 __module_get(THIS_MODULE);
135 /* 138 /*
136 * Activate timer 139 * Activate timer
@@ -147,11 +150,13 @@ static int softdog_release(struct inode *inode, struct file *file)
147 */ 150 */
148 if (expect_close == 42) { 151 if (expect_close == 42) {
149 softdog_stop(); 152 softdog_stop();
153 module_put(THIS_MODULE);
150 } else { 154 } else {
151 printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); 155 printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
156 set_bit(0, &orphan_timer);
152 softdog_keepalive(); 157 softdog_keepalive();
153 } 158 }
154 clear_bit(0, &timer_alive); 159 clear_bit(0, &driver_open);
155 expect_close = 0; 160 expect_close = 0;
156 return 0; 161 return 0;
157} 162}
diff --git a/drivers/char/watchdog/w83627hf_wdt.c b/drivers/char/watchdog/w83627hf_wdt.c
index 465e0fd0423d..b5d821015421 100644
--- a/drivers/char/watchdog/w83627hf_wdt.c
+++ b/drivers/char/watchdog/w83627hf_wdt.c
@@ -93,6 +93,12 @@ w83627hf_init(void)
93 93
94 w83627hf_select_wd_register(); 94 w83627hf_select_wd_register();
95 95
96 outb_p(0xF6, WDT_EFER); /* Select CRF6 */
97 t=inb_p(WDT_EFDR); /* read CRF6 */
98 if (t != 0) {
99 printk (KERN_INFO PFX "Watchdog already running. Resetting timeout to %d sec\n", timeout);
100 outb_p(timeout, WDT_EFDR); /* Write back to CRF6 */
101 }
96 outb_p(0xF5, WDT_EFER); /* Select CRF5 */ 102 outb_p(0xF5, WDT_EFER); /* Select CRF5 */
97 t=inb_p(WDT_EFDR); /* read CRF5 */ 103 t=inb_p(WDT_EFDR); /* read CRF5 */
98 t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */ 104 t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */