diff options
author | David S. Miller <davem@davemloft.net> | 2008-06-10 05:22:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-10 05:22:26 -0400 |
commit | 65b53e4cc90e59936733b3b95b9451d2ca47528d (patch) | |
tree | 29932718192962671c48c3fd1ea017a6112459e8 /drivers/watchdog | |
parent | 788c0a53164c05c5ccdb1472474372b72ba74644 (diff) | |
parent | 2e761e0532a784816e7e822dbaaece8c5d4be14d (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/tg3.c
drivers/net/wireless/rt2x00/rt2x00dev.c
net/mac80211/ieee80211_i.h
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/Kconfig | 13 | ||||
-rw-r--r-- | drivers/watchdog/Makefile | 1 | ||||
-rw-r--r-- | drivers/watchdog/bfin_wdt.c | 111 | ||||
-rw-r--r-- | drivers/watchdog/booke_wdt.c | 88 | ||||
-rw-r--r-- | drivers/watchdog/geodewdt.c | 308 | ||||
-rw-r--r-- | drivers/watchdog/hpwdt.c | 27 | ||||
-rw-r--r-- | drivers/watchdog/iTCO_wdt.c | 14 | ||||
-rw-r--r-- | drivers/watchdog/w83697hf_wdt.c | 38 |
8 files changed, 484 insertions, 116 deletions
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 254d115cafab..ccb78f66c2b6 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -295,6 +295,19 @@ config ALIM7101_WDT | |||
295 | 295 | ||
296 | Most people will say N. | 296 | Most people will say N. |
297 | 297 | ||
298 | config GEODE_WDT | ||
299 | tristate "AMD Geode CS5535/CS5536 Watchdog" | ||
300 | depends on MGEODE_LX | ||
301 | help | ||
302 | This driver enables a watchdog capability built into the | ||
303 | CS5535/CS5536 companion chips for the AMD Geode GX and LX | ||
304 | processors. This watchdog watches your kernel to make sure | ||
305 | it doesn't freeze, and if it does, it reboots your computer after | ||
306 | a certain amount of time. | ||
307 | |||
308 | You can compile this driver directly into the kernel, or use | ||
309 | it as a module. The module will be called geodewdt. | ||
310 | |||
298 | config SC520_WDT | 311 | config SC520_WDT |
299 | tristate "AMD Elan SC520 processor Watchdog" | 312 | tristate "AMD Elan SC520 processor Watchdog" |
300 | depends on X86 | 313 | depends on X86 |
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index f3fb170fe5c6..25b352b664d9 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile | |||
@@ -59,6 +59,7 @@ obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o | |||
59 | obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o | 59 | obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o |
60 | obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o | 60 | obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o |
61 | obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o | 61 | obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o |
62 | obj-$(CONFIG_GEODE_WDT) += geodewdt.o | ||
62 | obj-$(CONFIG_SC520_WDT) += sc520_wdt.o | 63 | obj-$(CONFIG_SC520_WDT) += sc520_wdt.o |
63 | obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o | 64 | obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o |
64 | obj-$(CONFIG_IB700_WDT) += ib700wdt.o | 65 | obj-$(CONFIG_IB700_WDT) += ib700wdt.o |
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c index 1237113dc14a..03b3e3d91e7c 100644 --- a/drivers/watchdog/bfin_wdt.c +++ b/drivers/watchdog/bfin_wdt.c | |||
@@ -29,7 +29,8 @@ | |||
29 | 29 | ||
30 | #define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) | 30 | #define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) |
31 | #define stampit() stamp("here i am") | 31 | #define stampit() stamp("here i am") |
32 | #define pr_init(fmt, args...) ({ static const __initdata char __fmt[] = fmt; printk(__fmt, ## args); }) | 32 | #define pr_devinit(fmt, args...) ({ static const __devinitconst char __fmt[] = fmt; printk(__fmt, ## args); }) |
33 | #define pr_init(fmt, args...) ({ static const __initconst char __fmt[] = fmt; printk(__fmt, ## args); }) | ||
33 | 34 | ||
34 | #define WATCHDOG_NAME "bfin-wdt" | 35 | #define WATCHDOG_NAME "bfin-wdt" |
35 | #define PFX WATCHDOG_NAME ": " | 36 | #define PFX WATCHDOG_NAME ": " |
@@ -377,20 +378,6 @@ static int bfin_wdt_resume(struct platform_device *pdev) | |||
377 | # define bfin_wdt_resume NULL | 378 | # define bfin_wdt_resume NULL |
378 | #endif | 379 | #endif |
379 | 380 | ||
380 | static struct platform_device bfin_wdt_device = { | ||
381 | .name = WATCHDOG_NAME, | ||
382 | .id = -1, | ||
383 | }; | ||
384 | |||
385 | static struct platform_driver bfin_wdt_driver = { | ||
386 | .driver = { | ||
387 | .name = WATCHDOG_NAME, | ||
388 | .owner = THIS_MODULE, | ||
389 | }, | ||
390 | .suspend = bfin_wdt_suspend, | ||
391 | .resume = bfin_wdt_resume, | ||
392 | }; | ||
393 | |||
394 | static const struct file_operations bfin_wdt_fops = { | 381 | static const struct file_operations bfin_wdt_fops = { |
395 | .owner = THIS_MODULE, | 382 | .owner = THIS_MODULE, |
396 | .llseek = no_llseek, | 383 | .llseek = no_llseek, |
@@ -418,11 +405,67 @@ static struct notifier_block bfin_wdt_notifier = { | |||
418 | }; | 405 | }; |
419 | 406 | ||
420 | /** | 407 | /** |
421 | * bfin_wdt_init - Initialize module | 408 | * bfin_wdt_probe - Initialize module |
422 | * | 409 | * |
423 | * Registers the device and notifier handler. Actual device | 410 | * Registers the misc device and notifier handler. Actual device |
424 | * initialization is handled by bfin_wdt_open(). | 411 | * initialization is handled by bfin_wdt_open(). |
425 | */ | 412 | */ |
413 | static int __devinit bfin_wdt_probe(struct platform_device *pdev) | ||
414 | { | ||
415 | int ret; | ||
416 | |||
417 | ret = register_reboot_notifier(&bfin_wdt_notifier); | ||
418 | if (ret) { | ||
419 | pr_devinit(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret); | ||
420 | return ret; | ||
421 | } | ||
422 | |||
423 | ret = misc_register(&bfin_wdt_miscdev); | ||
424 | if (ret) { | ||
425 | pr_devinit(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | ||
426 | WATCHDOG_MINOR, ret); | ||
427 | unregister_reboot_notifier(&bfin_wdt_notifier); | ||
428 | return ret; | ||
429 | } | ||
430 | |||
431 | pr_devinit(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n", | ||
432 | timeout, nowayout); | ||
433 | |||
434 | return 0; | ||
435 | } | ||
436 | |||
437 | /** | ||
438 | * bfin_wdt_remove - Initialize module | ||
439 | * | ||
440 | * Unregisters the misc device and notifier handler. Actual device | ||
441 | * deinitialization is handled by bfin_wdt_close(). | ||
442 | */ | ||
443 | static int __devexit bfin_wdt_remove(struct platform_device *pdev) | ||
444 | { | ||
445 | misc_deregister(&bfin_wdt_miscdev); | ||
446 | unregister_reboot_notifier(&bfin_wdt_notifier); | ||
447 | return 0; | ||
448 | } | ||
449 | |||
450 | static struct platform_device *bfin_wdt_device; | ||
451 | |||
452 | static struct platform_driver bfin_wdt_driver = { | ||
453 | .probe = bfin_wdt_probe, | ||
454 | .remove = __devexit_p(bfin_wdt_remove), | ||
455 | .suspend = bfin_wdt_suspend, | ||
456 | .resume = bfin_wdt_resume, | ||
457 | .driver = { | ||
458 | .name = WATCHDOG_NAME, | ||
459 | .owner = THIS_MODULE, | ||
460 | }, | ||
461 | }; | ||
462 | |||
463 | /** | ||
464 | * bfin_wdt_init - Initialize module | ||
465 | * | ||
466 | * Checks the module params and registers the platform device & driver. | ||
467 | * Real work is in the platform probe function. | ||
468 | */ | ||
426 | static int __init bfin_wdt_init(void) | 469 | static int __init bfin_wdt_init(void) |
427 | { | 470 | { |
428 | int ret; | 471 | int ret; |
@@ -436,44 +479,32 @@ static int __init bfin_wdt_init(void) | |||
436 | /* Since this is an on-chip device and needs no board-specific | 479 | /* Since this is an on-chip device and needs no board-specific |
437 | * resources, we'll handle all the platform device stuff here. | 480 | * resources, we'll handle all the platform device stuff here. |
438 | */ | 481 | */ |
439 | ret = platform_device_register(&bfin_wdt_device); | 482 | ret = platform_driver_register(&bfin_wdt_driver); |
440 | if (ret) | ||
441 | return ret; | ||
442 | |||
443 | ret = platform_driver_probe(&bfin_wdt_driver, NULL); | ||
444 | if (ret) | ||
445 | return ret; | ||
446 | |||
447 | ret = register_reboot_notifier(&bfin_wdt_notifier); | ||
448 | if (ret) { | 483 | if (ret) { |
449 | pr_init(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret); | 484 | pr_init(KERN_ERR PFX "unable to register driver\n"); |
450 | return ret; | 485 | return ret; |
451 | } | 486 | } |
452 | 487 | ||
453 | ret = misc_register(&bfin_wdt_miscdev); | 488 | bfin_wdt_device = platform_device_register_simple(WATCHDOG_NAME, -1, NULL, 0); |
454 | if (ret) { | 489 | if (IS_ERR(bfin_wdt_device)) { |
455 | pr_init(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | 490 | pr_init(KERN_ERR PFX "unable to register device\n"); |
456 | WATCHDOG_MINOR, ret); | 491 | platform_driver_unregister(&bfin_wdt_driver); |
457 | unregister_reboot_notifier(&bfin_wdt_notifier); | 492 | return PTR_ERR(bfin_wdt_device); |
458 | return ret; | ||
459 | } | 493 | } |
460 | 494 | ||
461 | pr_init(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n", | ||
462 | timeout, nowayout); | ||
463 | |||
464 | return 0; | 495 | return 0; |
465 | } | 496 | } |
466 | 497 | ||
467 | /** | 498 | /** |
468 | * bfin_wdt_exit - Deinitialize module | 499 | * bfin_wdt_exit - Deinitialize module |
469 | * | 500 | * |
470 | * Unregisters the device and notifier handler. Actual device | 501 | * Back out the platform device & driver steps. Real work is in the |
471 | * deinitialization is handled by bfin_wdt_close(). | 502 | * platform remove function. |
472 | */ | 503 | */ |
473 | static void __exit bfin_wdt_exit(void) | 504 | static void __exit bfin_wdt_exit(void) |
474 | { | 505 | { |
475 | misc_deregister(&bfin_wdt_miscdev); | 506 | platform_device_unregister(bfin_wdt_device); |
476 | unregister_reboot_notifier(&bfin_wdt_notifier); | 507 | platform_driver_unregister(&bfin_wdt_driver); |
477 | } | 508 | } |
478 | 509 | ||
479 | module_init(bfin_wdt_init); | 510 | module_init(bfin_wdt_init); |
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c index d362f5bf658a..c1ba0db48501 100644 --- a/drivers/watchdog/booke_wdt.c +++ b/drivers/watchdog/booke_wdt.c | |||
@@ -1,12 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/char/watchdog/booke_wdt.c | ||
3 | * | ||
4 | * Watchdog timer for PowerPC Book-E systems | 2 | * Watchdog timer for PowerPC Book-E systems |
5 | * | 3 | * |
6 | * Author: Matthew McClintock | 4 | * Author: Matthew McClintock |
7 | * Maintainer: Kumar Gala <galak@kernel.crashing.org> | 5 | * Maintainer: Kumar Gala <galak@kernel.crashing.org> |
8 | * | 6 | * |
9 | * Copyright 2005 Freescale Semiconductor Inc. | 7 | * Copyright 2005, 2008 Freescale Semiconductor Inc. |
10 | * | 8 | * |
11 | * This program is free software; you can redistribute it and/or modify it | 9 | * This program is free software; you can redistribute it and/or modify it |
12 | * under the terms of the GNU General Public License as published by the | 10 | * under the terms of the GNU General Public License as published by the |
@@ -16,6 +14,7 @@ | |||
16 | 14 | ||
17 | #include <linux/module.h> | 15 | #include <linux/module.h> |
18 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
17 | #include <linux/smp.h> | ||
19 | #include <linux/miscdevice.h> | 18 | #include <linux/miscdevice.h> |
20 | #include <linux/notifier.h> | 19 | #include <linux/notifier.h> |
21 | #include <linux/watchdog.h> | 20 | #include <linux/watchdog.h> |
@@ -38,7 +37,7 @@ | |||
38 | #define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */ | 37 | #define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */ |
39 | #endif /* for timing information */ | 38 | #endif /* for timing information */ |
40 | 39 | ||
41 | u32 booke_wdt_enabled = 0; | 40 | u32 booke_wdt_enabled; |
42 | u32 booke_wdt_period = WDT_PERIOD_DEFAULT; | 41 | u32 booke_wdt_period = WDT_PERIOD_DEFAULT; |
43 | 42 | ||
44 | #ifdef CONFIG_FSL_BOOKE | 43 | #ifdef CONFIG_FSL_BOOKE |
@@ -47,33 +46,31 @@ u32 booke_wdt_period = WDT_PERIOD_DEFAULT; | |||
47 | #define WDTP(x) (TCR_WP(x)) | 46 | #define WDTP(x) (TCR_WP(x)) |
48 | #endif | 47 | #endif |
49 | 48 | ||
50 | /* | 49 | static DEFINE_SPINLOCK(booke_wdt_lock); |
51 | * booke_wdt_ping: | 50 | |
52 | */ | 51 | static void __booke_wdt_ping(void *data) |
53 | static __inline__ void booke_wdt_ping(void) | ||
54 | { | 52 | { |
55 | mtspr(SPRN_TSR, TSR_ENW|TSR_WIS); | 53 | mtspr(SPRN_TSR, TSR_ENW|TSR_WIS); |
56 | } | 54 | } |
57 | 55 | ||
58 | /* | 56 | static void booke_wdt_ping(void) |
59 | * booke_wdt_enable: | 57 | { |
60 | */ | 58 | on_each_cpu(__booke_wdt_ping, NULL, 0, 0); |
61 | static __inline__ void booke_wdt_enable(void) | 59 | } |
60 | |||
61 | static void __booke_wdt_enable(void *data) | ||
62 | { | 62 | { |
63 | u32 val; | 63 | u32 val; |
64 | 64 | ||
65 | /* clear status before enabling watchdog */ | 65 | /* clear status before enabling watchdog */ |
66 | booke_wdt_ping(); | 66 | __booke_wdt_ping(NULL); |
67 | val = mfspr(SPRN_TCR); | 67 | val = mfspr(SPRN_TCR); |
68 | val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); | 68 | val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); |
69 | 69 | ||
70 | mtspr(SPRN_TCR, val); | 70 | mtspr(SPRN_TCR, val); |
71 | } | 71 | } |
72 | 72 | ||
73 | /* | 73 | static ssize_t booke_wdt_write(struct file *file, const char __user *buf, |
74 | * booke_wdt_write: | ||
75 | */ | ||
76 | static ssize_t booke_wdt_write (struct file *file, const char __user *buf, | ||
77 | size_t count, loff_t *ppos) | 74 | size_t count, loff_t *ppos) |
78 | { | 75 | { |
79 | booke_wdt_ping(); | 76 | booke_wdt_ping(); |
@@ -81,15 +78,11 @@ static ssize_t booke_wdt_write (struct file *file, const char __user *buf, | |||
81 | } | 78 | } |
82 | 79 | ||
83 | static struct watchdog_info ident = { | 80 | static struct watchdog_info ident = { |
84 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 81 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
85 | .firmware_version = 0, | 82 | .identity = "PowerPC Book-E Watchdog", |
86 | .identity = "PowerPC Book-E Watchdog", | ||
87 | }; | 83 | }; |
88 | 84 | ||
89 | /* | 85 | static int booke_wdt_ioctl(struct inode *inode, struct file *file, |
90 | * booke_wdt_ioctl: | ||
91 | */ | ||
92 | static int booke_wdt_ioctl (struct inode *inode, struct file *file, | ||
93 | unsigned int cmd, unsigned long arg) | 86 | unsigned int cmd, unsigned long arg) |
94 | { | 87 | { |
95 | u32 tmp = 0; | 88 | u32 tmp = 0; |
@@ -97,7 +90,7 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file, | |||
97 | 90 | ||
98 | switch (cmd) { | 91 | switch (cmd) { |
99 | case WDIOC_GETSUPPORT: | 92 | case WDIOC_GETSUPPORT: |
100 | if (copy_to_user ((struct watchdog_info __user *) arg, &ident, | 93 | if (copy_to_user((struct watchdog_info __user *)arg, &ident, |
101 | sizeof(struct watchdog_info))) | 94 | sizeof(struct watchdog_info))) |
102 | return -EFAULT; | 95 | return -EFAULT; |
103 | case WDIOC_GETSTATUS: | 96 | case WDIOC_GETSTATUS: |
@@ -132,33 +125,33 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file, | |||
132 | 125 | ||
133 | return 0; | 126 | return 0; |
134 | } | 127 | } |
135 | /* | 128 | |
136 | * booke_wdt_open: | 129 | static int booke_wdt_open(struct inode *inode, struct file *file) |
137 | */ | ||
138 | static int booke_wdt_open (struct inode *inode, struct file *file) | ||
139 | { | 130 | { |
131 | spin_lock(&booke_wdt_lock); | ||
140 | if (booke_wdt_enabled == 0) { | 132 | if (booke_wdt_enabled == 0) { |
141 | booke_wdt_enabled = 1; | 133 | booke_wdt_enabled = 1; |
142 | booke_wdt_enable(); | 134 | on_each_cpu(__booke_wdt_enable, NULL, 0, 0); |
143 | printk (KERN_INFO "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n", | 135 | printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled " |
144 | booke_wdt_period); | 136 | "(wdt_period=%d)\n", booke_wdt_period); |
145 | } | 137 | } |
138 | spin_unlock(&booke_wdt_lock); | ||
146 | 139 | ||
147 | return nonseekable_open(inode, file); | 140 | return nonseekable_open(inode, file); |
148 | } | 141 | } |
149 | 142 | ||
150 | static const struct file_operations booke_wdt_fops = { | 143 | static const struct file_operations booke_wdt_fops = { |
151 | .owner = THIS_MODULE, | 144 | .owner = THIS_MODULE, |
152 | .llseek = no_llseek, | 145 | .llseek = no_llseek, |
153 | .write = booke_wdt_write, | 146 | .write = booke_wdt_write, |
154 | .ioctl = booke_wdt_ioctl, | 147 | .ioctl = booke_wdt_ioctl, |
155 | .open = booke_wdt_open, | 148 | .open = booke_wdt_open, |
156 | }; | 149 | }; |
157 | 150 | ||
158 | static struct miscdevice booke_wdt_miscdev = { | 151 | static struct miscdevice booke_wdt_miscdev = { |
159 | .minor = WATCHDOG_MINOR, | 152 | .minor = WATCHDOG_MINOR, |
160 | .name = "watchdog", | 153 | .name = "watchdog", |
161 | .fops = &booke_wdt_fops, | 154 | .fops = &booke_wdt_fops, |
162 | }; | 155 | }; |
163 | 156 | ||
164 | static void __exit booke_wdt_exit(void) | 157 | static void __exit booke_wdt_exit(void) |
@@ -166,28 +159,27 @@ static void __exit booke_wdt_exit(void) | |||
166 | misc_deregister(&booke_wdt_miscdev); | 159 | misc_deregister(&booke_wdt_miscdev); |
167 | } | 160 | } |
168 | 161 | ||
169 | /* | ||
170 | * booke_wdt_init: | ||
171 | */ | ||
172 | static int __init booke_wdt_init(void) | 162 | static int __init booke_wdt_init(void) |
173 | { | 163 | { |
174 | int ret = 0; | 164 | int ret = 0; |
175 | 165 | ||
176 | printk (KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n"); | 166 | printk(KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n"); |
177 | ident.firmware_version = cur_cpu_spec->pvr_value; | 167 | ident.firmware_version = cur_cpu_spec->pvr_value; |
178 | 168 | ||
179 | ret = misc_register(&booke_wdt_miscdev); | 169 | ret = misc_register(&booke_wdt_miscdev); |
180 | if (ret) { | 170 | if (ret) { |
181 | printk (KERN_CRIT "Cannot register miscdev on minor=%d (err=%d)\n", | 171 | printk(KERN_CRIT "Cannot register miscdev on minor=%d: %d\n", |
182 | WATCHDOG_MINOR, ret); | 172 | WATCHDOG_MINOR, ret); |
183 | return ret; | 173 | return ret; |
184 | } | 174 | } |
185 | 175 | ||
176 | spin_lock(&booke_wdt_lock); | ||
186 | if (booke_wdt_enabled == 1) { | 177 | if (booke_wdt_enabled == 1) { |
187 | printk (KERN_INFO "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n", | 178 | printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled " |
188 | booke_wdt_period); | 179 | "(wdt_period=%d)\n", booke_wdt_period); |
189 | booke_wdt_enable(); | 180 | on_each_cpu(__booke_wdt_enable, NULL, 0, 0); |
190 | } | 181 | } |
182 | spin_unlock(&booke_wdt_lock); | ||
191 | 183 | ||
192 | return ret; | 184 | return ret; |
193 | } | 185 | } |
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c new file mode 100644 index 000000000000..30d09cbbad94 --- /dev/null +++ b/drivers/watchdog/geodewdt.c | |||
@@ -0,0 +1,308 @@ | |||
1 | /* Watchdog timer for the Geode GX/LX with the CS5535/CS5536 companion chip | ||
2 | * | ||
3 | * Copyright (C) 2006-2007, Advanced Micro Devices, Inc. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/moduleparam.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/miscdevice.h> | ||
16 | #include <linux/watchdog.h> | ||
17 | #include <linux/fs.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/reboot.h> | ||
20 | |||
21 | #include <asm/uaccess.h> | ||
22 | #include <asm/geode.h> | ||
23 | |||
24 | #define GEODEWDT_HZ 500 | ||
25 | #define GEODEWDT_SCALE 6 | ||
26 | #define GEODEWDT_MAX_SECONDS 131 | ||
27 | |||
28 | #define WDT_FLAGS_OPEN 1 | ||
29 | #define WDT_FLAGS_ORPHAN 2 | ||
30 | |||
31 | #define DRV_NAME "geodewdt" | ||
32 | #define WATCHDOG_NAME "Geode GX/LX WDT" | ||
33 | #define WATCHDOG_TIMEOUT 60 | ||
34 | |||
35 | static int timeout = WATCHDOG_TIMEOUT; | ||
36 | module_param(timeout, int, 0); | ||
37 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=131, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); | ||
38 | |||
39 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
40 | module_param(nowayout, int, 0); | ||
41 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | ||
42 | |||
43 | static struct platform_device *geodewdt_platform_device; | ||
44 | static unsigned long wdt_flags; | ||
45 | static int wdt_timer; | ||
46 | static int safe_close; | ||
47 | |||
48 | static void geodewdt_ping(void) | ||
49 | { | ||
50 | /* Stop the counter */ | ||
51 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | ||
52 | |||
53 | /* Reset the counter */ | ||
54 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | ||
55 | |||
56 | /* Enable the counter */ | ||
57 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); | ||
58 | } | ||
59 | |||
60 | static void geodewdt_disable(void) | ||
61 | { | ||
62 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | ||
63 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | ||
64 | } | ||
65 | |||
66 | static int geodewdt_set_heartbeat(int val) | ||
67 | { | ||
68 | if (val < 1 || val > GEODEWDT_MAX_SECONDS) | ||
69 | return -EINVAL; | ||
70 | |||
71 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | ||
72 | geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ); | ||
73 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | ||
74 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); | ||
75 | |||
76 | timeout = val; | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | static int | ||
81 | geodewdt_open(struct inode *inode, struct file *file) | ||
82 | { | ||
83 | if (test_and_set_bit(WDT_FLAGS_OPEN, &wdt_flags)) | ||
84 | return -EBUSY; | ||
85 | |||
86 | if (!test_and_clear_bit(WDT_FLAGS_ORPHAN, &wdt_flags)) | ||
87 | __module_get(THIS_MODULE); | ||
88 | |||
89 | geodewdt_ping(); | ||
90 | return nonseekable_open(inode, file); | ||
91 | } | ||
92 | |||
93 | static int | ||
94 | geodewdt_release(struct inode *inode, struct file *file) | ||
95 | { | ||
96 | if (safe_close) { | ||
97 | geodewdt_disable(); | ||
98 | module_put(THIS_MODULE); | ||
99 | } | ||
100 | else { | ||
101 | printk(KERN_CRIT "Unexpected close - watchdog is not stopping.\n"); | ||
102 | geodewdt_ping(); | ||
103 | |||
104 | set_bit(WDT_FLAGS_ORPHAN, &wdt_flags); | ||
105 | } | ||
106 | |||
107 | clear_bit(WDT_FLAGS_OPEN, &wdt_flags); | ||
108 | safe_close = 0; | ||
109 | return 0; | ||
110 | } | ||
111 | |||
112 | static ssize_t | ||
113 | geodewdt_write(struct file *file, const char __user *data, size_t len, | ||
114 | loff_t *ppos) | ||
115 | { | ||
116 | if(len) { | ||
117 | if (!nowayout) { | ||
118 | size_t i; | ||
119 | safe_close = 0; | ||
120 | |||
121 | for (i = 0; i != len; i++) { | ||
122 | char c; | ||
123 | |||
124 | if (get_user(c, data + i)) | ||
125 | return -EFAULT; | ||
126 | |||
127 | if (c == 'V') | ||
128 | safe_close = 1; | ||
129 | } | ||
130 | } | ||
131 | |||
132 | geodewdt_ping(); | ||
133 | } | ||
134 | return len; | ||
135 | } | ||
136 | |||
137 | static int | ||
138 | geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | ||
139 | unsigned long arg) | ||
140 | { | ||
141 | void __user *argp = (void __user *)arg; | ||
142 | int __user *p = argp; | ||
143 | int interval; | ||
144 | |||
145 | static struct watchdog_info ident = { | ||
146 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | ||
147 | | WDIOF_MAGICCLOSE, | ||
148 | .firmware_version = 1, | ||
149 | .identity = WATCHDOG_NAME, | ||
150 | }; | ||
151 | |||
152 | switch(cmd) { | ||
153 | case WDIOC_GETSUPPORT: | ||
154 | return copy_to_user(argp, &ident, | ||
155 | sizeof(ident)) ? -EFAULT : 0; | ||
156 | break; | ||
157 | |||
158 | case WDIOC_GETSTATUS: | ||
159 | case WDIOC_GETBOOTSTATUS: | ||
160 | return put_user(0, p); | ||
161 | |||
162 | case WDIOC_KEEPALIVE: | ||
163 | geodewdt_ping(); | ||
164 | return 0; | ||
165 | |||
166 | case WDIOC_SETTIMEOUT: | ||
167 | if (get_user(interval, p)) | ||
168 | return -EFAULT; | ||
169 | |||
170 | if (geodewdt_set_heartbeat(interval)) | ||
171 | return -EINVAL; | ||
172 | |||
173 | /* Fall through */ | ||
174 | |||
175 | case WDIOC_GETTIMEOUT: | ||
176 | return put_user(timeout, p); | ||
177 | |||
178 | case WDIOC_SETOPTIONS: | ||
179 | { | ||
180 | int options, ret = -EINVAL; | ||
181 | |||
182 | if (get_user(options, p)) | ||
183 | return -EFAULT; | ||
184 | |||
185 | if (options & WDIOS_DISABLECARD) { | ||
186 | geodewdt_disable(); | ||
187 | ret = 0; | ||
188 | } | ||
189 | |||
190 | if (options & WDIOS_ENABLECARD) { | ||
191 | geodewdt_ping(); | ||
192 | ret = 0; | ||
193 | } | ||
194 | |||
195 | return ret; | ||
196 | } | ||
197 | default: | ||
198 | return -ENOTTY; | ||
199 | } | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static const struct file_operations geodewdt_fops = { | ||
205 | .owner = THIS_MODULE, | ||
206 | .llseek = no_llseek, | ||
207 | .write = geodewdt_write, | ||
208 | .ioctl = geodewdt_ioctl, | ||
209 | .open = geodewdt_open, | ||
210 | .release = geodewdt_release, | ||
211 | }; | ||
212 | |||
213 | static struct miscdevice geodewdt_miscdev = { | ||
214 | .minor = WATCHDOG_MINOR, | ||
215 | .name = "watchdog", | ||
216 | .fops = &geodewdt_fops | ||
217 | }; | ||
218 | |||
219 | static int __devinit | ||
220 | geodewdt_probe(struct platform_device *dev) | ||
221 | { | ||
222 | int ret, timer; | ||
223 | |||
224 | timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING); | ||
225 | |||
226 | if (timer == -1) { | ||
227 | printk(KERN_ERR "geodewdt: No timers were available\n"); | ||
228 | return -ENODEV; | ||
229 | } | ||
230 | |||
231 | wdt_timer = timer; | ||
232 | |||
233 | /* Set up the timer */ | ||
234 | |||
235 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, | ||
236 | GEODEWDT_SCALE | (3 << 8)); | ||
237 | |||
238 | /* Set up comparator 2 to reset when the event fires */ | ||
239 | geode_mfgpt_toggle_event(wdt_timer, MFGPT_CMP2, MFGPT_EVENT_RESET, 1); | ||
240 | |||
241 | /* Set up the initial timeout */ | ||
242 | |||
243 | geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, | ||
244 | timeout * GEODEWDT_HZ); | ||
245 | |||
246 | ret = misc_register(&geodewdt_miscdev); | ||
247 | |||
248 | return ret; | ||
249 | } | ||
250 | |||
251 | static int __devexit | ||
252 | geodewdt_remove(struct platform_device *dev) | ||
253 | { | ||
254 | misc_deregister(&geodewdt_miscdev); | ||
255 | return 0; | ||
256 | } | ||
257 | |||
258 | static void | ||
259 | geodewdt_shutdown(struct platform_device *dev) | ||
260 | { | ||
261 | geodewdt_disable(); | ||
262 | } | ||
263 | |||
264 | static struct platform_driver geodewdt_driver = { | ||
265 | .probe = geodewdt_probe, | ||
266 | .remove = __devexit_p(geodewdt_remove), | ||
267 | .shutdown = geodewdt_shutdown, | ||
268 | .driver = { | ||
269 | .owner = THIS_MODULE, | ||
270 | .name = DRV_NAME, | ||
271 | }, | ||
272 | }; | ||
273 | |||
274 | static int __init | ||
275 | geodewdt_init(void) | ||
276 | { | ||
277 | int ret; | ||
278 | |||
279 | ret = platform_driver_register(&geodewdt_driver); | ||
280 | if (ret) | ||
281 | return ret; | ||
282 | |||
283 | geodewdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0); | ||
284 | if (IS_ERR(geodewdt_platform_device)) { | ||
285 | ret = PTR_ERR(geodewdt_platform_device); | ||
286 | goto err; | ||
287 | } | ||
288 | |||
289 | return 0; | ||
290 | err: | ||
291 | platform_driver_unregister(&geodewdt_driver); | ||
292 | return ret; | ||
293 | } | ||
294 | |||
295 | static void __exit | ||
296 | geodewdt_exit(void) | ||
297 | { | ||
298 | platform_device_unregister(geodewdt_platform_device); | ||
299 | platform_driver_unregister(&geodewdt_driver); | ||
300 | } | ||
301 | |||
302 | module_init(geodewdt_init); | ||
303 | module_exit(geodewdt_exit); | ||
304 | |||
305 | MODULE_AUTHOR("Advanced Micro Devices, Inc"); | ||
306 | MODULE_DESCRIPTION("Geode GX/LX Watchdog Driver"); | ||
307 | MODULE_LICENSE("GPL"); | ||
308 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index 6483d1066b95..6a63535fc04d 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -418,23 +418,20 @@ static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason, | |||
418 | static unsigned long rom_pl; | 418 | static unsigned long rom_pl; |
419 | static int die_nmi_called; | 419 | static int die_nmi_called; |
420 | 420 | ||
421 | if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI) | 421 | if (ulReason == DIE_NMI || ulReason == DIE_NMI_IPI) { |
422 | return NOTIFY_OK; | 422 | spin_lock_irqsave(&rom_lock, rom_pl); |
423 | 423 | if (!die_nmi_called) | |
424 | spin_lock_irqsave(&rom_lock, rom_pl); | 424 | asminline_call(&cmn_regs, cru_rom_addr); |
425 | if (!die_nmi_called) | 425 | die_nmi_called = 1; |
426 | asminline_call(&cmn_regs, cru_rom_addr); | 426 | spin_unlock_irqrestore(&rom_lock, rom_pl); |
427 | die_nmi_called = 1; | 427 | if (cmn_regs.u1.ral != 0) { |
428 | spin_unlock_irqrestore(&rom_lock, rom_pl); | 428 | panic("An NMI occurred, please see the Integrated " |
429 | if (cmn_regs.u1.ral == 0) { | 429 | "Management Log for details.\n"); |
430 | printk(KERN_WARNING "hpwdt: An NMI occurred, " | 430 | } |
431 | "but unable to determine source.\n"); | ||
432 | } else { | ||
433 | panic("An NMI occurred, please see the Integrated " | ||
434 | "Management Log for details.\n"); | ||
435 | } | 431 | } |
436 | 432 | ||
437 | return NOTIFY_STOP; | 433 | die_nmi_called = 0; |
434 | return NOTIFY_DONE; | ||
438 | } | 435 | } |
439 | 436 | ||
440 | /* | 437 | /* |
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index a0e6809e369f..95ba985bd341 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c | |||
@@ -41,9 +41,10 @@ | |||
41 | * 82801HH (ICH8DH) : document number 313056-003, 313057-009, | 41 | * 82801HH (ICH8DH) : document number 313056-003, 313057-009, |
42 | * 82801HO (ICH8DO) : document number 313056-003, 313057-009, | 42 | * 82801HO (ICH8DO) : document number 313056-003, 313057-009, |
43 | * 82801HEM (ICH8M-E) : document number 313056-003, 313057-009, | 43 | * 82801HEM (ICH8M-E) : document number 313056-003, 313057-009, |
44 | * 82801IB (ICH9) : document number 316972-001, 316973-001, | 44 | * 82801IB (ICH9) : document number 316972-001, 316973-006, |
45 | * 82801IR (ICH9R) : document number 316972-001, 316973-001, | 45 | * 82801IR (ICH9R) : document number 316972-001, 316973-006, |
46 | * 82801IH (ICH9DH) : document number 316972-001, 316973-001, | 46 | * 82801IH (ICH9DH) : document number 316972-001, 316973-006, |
47 | * 82801IO (ICH9DO) : document number 316972-001, 316973-006, | ||
47 | * 6300ESB (6300ESB) : document number 300641-003, 300884-010, | 48 | * 6300ESB (6300ESB) : document number 300641-003, 300884-010, |
48 | * 631xESB (631xESB) : document number 313082-001, 313075-005, | 49 | * 631xESB (631xESB) : document number 313082-001, 313075-005, |
49 | * 632xESB (632xESB) : document number 313082-001, 313075-005 | 50 | * 632xESB (632xESB) : document number 313082-001, 313075-005 |
@@ -55,8 +56,8 @@ | |||
55 | 56 | ||
56 | /* Module and version information */ | 57 | /* Module and version information */ |
57 | #define DRV_NAME "iTCO_wdt" | 58 | #define DRV_NAME "iTCO_wdt" |
58 | #define DRV_VERSION "1.02" | 59 | #define DRV_VERSION "1.03" |
59 | #define DRV_RELDATE "26-Jul-2007" | 60 | #define DRV_RELDATE "30-Apr-2008" |
60 | #define PFX DRV_NAME ": " | 61 | #define PFX DRV_NAME ": " |
61 | 62 | ||
62 | /* Includes */ | 63 | /* Includes */ |
@@ -104,6 +105,7 @@ enum iTCO_chipsets { | |||
104 | TCO_ICH9, /* ICH9 */ | 105 | TCO_ICH9, /* ICH9 */ |
105 | TCO_ICH9R, /* ICH9R */ | 106 | TCO_ICH9R, /* ICH9R */ |
106 | TCO_ICH9DH, /* ICH9DH */ | 107 | TCO_ICH9DH, /* ICH9DH */ |
108 | TCO_ICH9DO, /* ICH9DO */ | ||
107 | TCO_631XESB, /* 631xESB/632xESB */ | 109 | TCO_631XESB, /* 631xESB/632xESB */ |
108 | }; | 110 | }; |
109 | 111 | ||
@@ -136,6 +138,7 @@ static struct { | |||
136 | {"ICH9", 2}, | 138 | {"ICH9", 2}, |
137 | {"ICH9R", 2}, | 139 | {"ICH9R", 2}, |
138 | {"ICH9DH", 2}, | 140 | {"ICH9DH", 2}, |
141 | {"ICH9DO", 2}, | ||
139 | {"631xESB/632xESB", 2}, | 142 | {"631xESB/632xESB", 2}, |
140 | {NULL,0} | 143 | {NULL,0} |
141 | }; | 144 | }; |
@@ -181,6 +184,7 @@ static struct pci_device_id iTCO_wdt_pci_tbl[] = { | |||
181 | { ITCO_PCI_DEVICE(0x2918, TCO_ICH9 )}, | 184 | { ITCO_PCI_DEVICE(0x2918, TCO_ICH9 )}, |
182 | { ITCO_PCI_DEVICE(0x2916, TCO_ICH9R )}, | 185 | { ITCO_PCI_DEVICE(0x2916, TCO_ICH9R )}, |
183 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2, TCO_ICH9DH )}, | 186 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2, TCO_ICH9DH )}, |
187 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_4, TCO_ICH9DO )}, | ||
184 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB2_0, TCO_631XESB)}, | 188 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB2_0, TCO_631XESB)}, |
185 | { ITCO_PCI_DEVICE(0x2671, TCO_631XESB)}, | 189 | { ITCO_PCI_DEVICE(0x2671, TCO_631XESB)}, |
186 | { ITCO_PCI_DEVICE(0x2672, TCO_631XESB)}, | 190 | { ITCO_PCI_DEVICE(0x2672, TCO_631XESB)}, |
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c index c622a0e6c9ae..528b882420b6 100644 --- a/drivers/watchdog/w83697hf_wdt.c +++ b/drivers/watchdog/w83697hf_wdt.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #define WATCHDOG_NAME "w83697hf/hg WDT" | 44 | #define WATCHDOG_NAME "w83697hf/hg WDT" |
45 | #define PFX WATCHDOG_NAME ": " | 45 | #define PFX WATCHDOG_NAME ": " |
46 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ | 46 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ |
47 | #define WATCHDOG_EARLY_DISABLE 1 /* Disable until userland kicks in */ | ||
47 | 48 | ||
48 | static unsigned long wdt_is_open; | 49 | static unsigned long wdt_is_open; |
49 | static char expect_close; | 50 | static char expect_close; |
@@ -56,12 +57,16 @@ MODULE_PARM_DESC(wdt_io, "w83697hf/hg WDT io port (default 0x2e, 0 = autodetect) | |||
56 | 57 | ||
57 | static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ | 58 | static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ |
58 | module_param(timeout, int, 0); | 59 | module_param(timeout, int, 0); |
59 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); | 60 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255 (default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); |
60 | 61 | ||
61 | static int nowayout = WATCHDOG_NOWAYOUT; | 62 | static int nowayout = WATCHDOG_NOWAYOUT; |
62 | module_param(nowayout, int, 0); | 63 | module_param(nowayout, int, 0); |
63 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 64 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
64 | 65 | ||
66 | static int early_disable = WATCHDOG_EARLY_DISABLE; | ||
67 | module_param(early_disable, int, 0); | ||
68 | MODULE_PARM_DESC(early_disable, "Watchdog gets disabled at boot time (default=" __MODULE_STRING(WATCHDOG_EARLY_DISABLE) ")"); | ||
69 | |||
65 | /* | 70 | /* |
66 | * Kernel methods. | 71 | * Kernel methods. |
67 | */ | 72 | */ |
@@ -140,7 +145,7 @@ w83697hf_init(void) | |||
140 | w83697hf_deselect_wdt(); | 145 | w83697hf_deselect_wdt(); |
141 | } | 146 | } |
142 | 147 | ||
143 | static int | 148 | static void |
144 | wdt_ping(void) | 149 | wdt_ping(void) |
145 | { | 150 | { |
146 | spin_lock(&io_lock); | 151 | spin_lock(&io_lock); |
@@ -150,10 +155,9 @@ wdt_ping(void) | |||
150 | 155 | ||
151 | w83697hf_deselect_wdt(); | 156 | w83697hf_deselect_wdt(); |
152 | spin_unlock(&io_lock); | 157 | spin_unlock(&io_lock); |
153 | return 0; | ||
154 | } | 158 | } |
155 | 159 | ||
156 | static int | 160 | static void |
157 | wdt_enable(void) | 161 | wdt_enable(void) |
158 | { | 162 | { |
159 | spin_lock(&io_lock); | 163 | spin_lock(&io_lock); |
@@ -164,10 +168,9 @@ wdt_enable(void) | |||
164 | 168 | ||
165 | w83697hf_deselect_wdt(); | 169 | w83697hf_deselect_wdt(); |
166 | spin_unlock(&io_lock); | 170 | spin_unlock(&io_lock); |
167 | return 0; | ||
168 | } | 171 | } |
169 | 172 | ||
170 | static int | 173 | static void |
171 | wdt_disable(void) | 174 | wdt_disable(void) |
172 | { | 175 | { |
173 | spin_lock(&io_lock); | 176 | spin_lock(&io_lock); |
@@ -178,7 +181,22 @@ wdt_disable(void) | |||
178 | 181 | ||
179 | w83697hf_deselect_wdt(); | 182 | w83697hf_deselect_wdt(); |
180 | spin_unlock(&io_lock); | 183 | spin_unlock(&io_lock); |
181 | return 0; | 184 | } |
185 | |||
186 | static unsigned char | ||
187 | wdt_running(void) | ||
188 | { | ||
189 | unsigned char t; | ||
190 | |||
191 | spin_lock(&io_lock); | ||
192 | w83697hf_select_wdt(); | ||
193 | |||
194 | t = w83697hf_get_reg(0xF4); /* Read timer */ | ||
195 | |||
196 | w83697hf_deselect_wdt(); | ||
197 | spin_unlock(&io_lock); | ||
198 | |||
199 | return t; | ||
182 | } | 200 | } |
183 | 201 | ||
184 | static int | 202 | static int |
@@ -397,7 +415,11 @@ wdt_init(void) | |||
397 | } | 415 | } |
398 | 416 | ||
399 | w83697hf_init(); | 417 | w83697hf_init(); |
400 | wdt_disable(); /* Disable watchdog until first use */ | 418 | if (early_disable) { |
419 | if (wdt_running()) | ||
420 | printk (KERN_WARNING PFX "Stopping previously enabled watchdog until userland kicks in\n"); | ||
421 | wdt_disable(); | ||
422 | } | ||
401 | 423 | ||
402 | if (wdt_set_heartbeat(timeout)) { | 424 | if (wdt_set_heartbeat(timeout)) { |
403 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); | 425 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); |