diff options
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/Kconfig | 22 | ||||
-rw-r--r-- | drivers/watchdog/ar7_wdt.c | 1 | ||||
-rw-r--r-- | drivers/watchdog/booke_wdt.c | 47 | ||||
-rw-r--r-- | drivers/watchdog/cpwd.c | 16 | ||||
-rw-r--r-- | drivers/watchdog/ep93xx_wdt.c | 1 | ||||
-rw-r--r-- | drivers/watchdog/octeon-wdt-main.c | 1 | ||||
-rw-r--r-- | drivers/watchdog/omap_wdt.c | 1 |
7 files changed, 72 insertions, 17 deletions
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 24efd8ea41bb..c356146bd712 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -957,12 +957,32 @@ config PIKA_WDT | |||
957 | the Warp platform. | 957 | the Warp platform. |
958 | 958 | ||
959 | config BOOKE_WDT | 959 | config BOOKE_WDT |
960 | bool "PowerPC Book-E Watchdog Timer" | 960 | tristate "PowerPC Book-E Watchdog Timer" |
961 | depends on BOOKE || 4xx | 961 | depends on BOOKE || 4xx |
962 | ---help--- | 962 | ---help--- |
963 | Watchdog driver for PowerPC Book-E chips, such as the Freescale | ||
964 | MPC85xx SOCs and the IBM PowerPC 440. | ||
965 | |||
963 | Please see Documentation/watchdog/watchdog-api.txt for | 966 | Please see Documentation/watchdog/watchdog-api.txt for |
964 | more information. | 967 | more information. |
965 | 968 | ||
969 | config BOOKE_WDT_DEFAULT_TIMEOUT | ||
970 | int "PowerPC Book-E Watchdog Timer Default Timeout" | ||
971 | depends on BOOKE_WDT | ||
972 | default 38 if FSL_BOOKE | ||
973 | range 0 63 if FSL_BOOKE | ||
974 | default 3 if !FSL_BOOKE | ||
975 | range 0 3 if !FSL_BOOKE | ||
976 | help | ||
977 | Select the default watchdog timer period to be used by the PowerPC | ||
978 | Book-E watchdog driver. A watchdog "event" occurs when the bit | ||
979 | position represented by this number transitions from zero to one. | ||
980 | |||
981 | For Freescale Book-E processors, this is a number between 0 and 63. | ||
982 | For other Book-E processors, this is a number between 0 and 3. | ||
983 | |||
984 | The value can be overidden by the wdt_period command-line parameter. | ||
985 | |||
966 | # PPC64 Architecture | 986 | # PPC64 Architecture |
967 | 987 | ||
968 | config WATCHDOG_RTAS | 988 | config WATCHDOG_RTAS |
diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c index c764c52412e4..b29221783598 100644 --- a/drivers/watchdog/ar7_wdt.c +++ b/drivers/watchdog/ar7_wdt.c | |||
@@ -267,6 +267,7 @@ static const struct file_operations ar7_wdt_fops = { | |||
267 | .unlocked_ioctl = ar7_wdt_ioctl, | 267 | .unlocked_ioctl = ar7_wdt_ioctl, |
268 | .open = ar7_wdt_open, | 268 | .open = ar7_wdt_open, |
269 | .release = ar7_wdt_release, | 269 | .release = ar7_wdt_release, |
270 | .llseek = no_llseek, | ||
270 | }; | 271 | }; |
271 | 272 | ||
272 | static struct miscdevice ar7_wdt_miscdev = { | 273 | static struct miscdevice ar7_wdt_miscdev = { |
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c index 3d49671cdf5a..d11ffb091b0d 100644 --- a/drivers/watchdog/booke_wdt.c +++ b/drivers/watchdog/booke_wdt.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Author: Matthew McClintock | 4 | * Author: Matthew McClintock |
5 | * Maintainer: Kumar Gala <galak@kernel.crashing.org> | 5 | * Maintainer: Kumar Gala <galak@kernel.crashing.org> |
6 | * | 6 | * |
7 | * Copyright 2005, 2008 Freescale Semiconductor Inc. | 7 | * Copyright 2005, 2008, 2010 Freescale Semiconductor Inc. |
8 | * | 8 | * |
9 | * 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 |
10 | * 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 |
@@ -33,14 +33,8 @@ | |||
33 | * occur, and the final time the board will reset. | 33 | * occur, and the final time the board will reset. |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #ifdef CONFIG_FSL_BOOKE | ||
37 | #define WDT_PERIOD_DEFAULT 38 /* Ex. wdt_period=28 bus=333Mhz,reset=~40sec */ | ||
38 | #else | ||
39 | #define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */ | ||
40 | #endif /* for timing information */ | ||
41 | |||
42 | u32 booke_wdt_enabled; | 36 | u32 booke_wdt_enabled; |
43 | u32 booke_wdt_period = WDT_PERIOD_DEFAULT; | 37 | u32 booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT; |
44 | 38 | ||
45 | #ifdef CONFIG_FSL_BOOKE | 39 | #ifdef CONFIG_FSL_BOOKE |
46 | #define WDTP(x) ((((x)&0x3)<<30)|(((x)&0x3c)<<15)) | 40 | #define WDTP(x) ((((x)&0x3)<<30)|(((x)&0x3c)<<15)) |
@@ -114,6 +108,27 @@ static void __booke_wdt_enable(void *data) | |||
114 | mtspr(SPRN_TCR, val); | 108 | mtspr(SPRN_TCR, val); |
115 | } | 109 | } |
116 | 110 | ||
111 | /** | ||
112 | * booke_wdt_disable - disable the watchdog on the given CPU | ||
113 | * | ||
114 | * This function is called on each CPU. It disables the watchdog on that CPU. | ||
115 | * | ||
116 | * TCR[WRC] cannot be changed once it has been set to non-zero, but we can | ||
117 | * effectively disable the watchdog by setting its period to the maximum value. | ||
118 | */ | ||
119 | static void __booke_wdt_disable(void *data) | ||
120 | { | ||
121 | u32 val; | ||
122 | |||
123 | val = mfspr(SPRN_TCR); | ||
124 | val &= ~(TCR_WIE | WDTP_MASK); | ||
125 | mtspr(SPRN_TCR, val); | ||
126 | |||
127 | /* clear status to make sure nothing is pending */ | ||
128 | __booke_wdt_ping(NULL); | ||
129 | |||
130 | } | ||
131 | |||
117 | static ssize_t booke_wdt_write(struct file *file, const char __user *buf, | 132 | static ssize_t booke_wdt_write(struct file *file, const char __user *buf, |
118 | size_t count, loff_t *ppos) | 133 | size_t count, loff_t *ppos) |
119 | { | 134 | { |
@@ -193,12 +208,21 @@ static int booke_wdt_open(struct inode *inode, struct file *file) | |||
193 | return nonseekable_open(inode, file); | 208 | return nonseekable_open(inode, file); |
194 | } | 209 | } |
195 | 210 | ||
211 | static int booke_wdt_release(struct inode *inode, struct file *file) | ||
212 | { | ||
213 | on_each_cpu(__booke_wdt_disable, NULL, 0); | ||
214 | booke_wdt_enabled = 0; | ||
215 | |||
216 | return 0; | ||
217 | } | ||
218 | |||
196 | static const struct file_operations booke_wdt_fops = { | 219 | static const struct file_operations booke_wdt_fops = { |
197 | .owner = THIS_MODULE, | 220 | .owner = THIS_MODULE, |
198 | .llseek = no_llseek, | 221 | .llseek = no_llseek, |
199 | .write = booke_wdt_write, | 222 | .write = booke_wdt_write, |
200 | .unlocked_ioctl = booke_wdt_ioctl, | 223 | .unlocked_ioctl = booke_wdt_ioctl, |
201 | .open = booke_wdt_open, | 224 | .open = booke_wdt_open, |
225 | .release = booke_wdt_release, | ||
202 | }; | 226 | }; |
203 | 227 | ||
204 | static struct miscdevice booke_wdt_miscdev = { | 228 | static struct miscdevice booke_wdt_miscdev = { |
@@ -237,4 +261,9 @@ static int __init booke_wdt_init(void) | |||
237 | 261 | ||
238 | return ret; | 262 | return ret; |
239 | } | 263 | } |
240 | device_initcall(booke_wdt_init); | 264 | |
265 | module_init(booke_wdt_init); | ||
266 | module_exit(booke_wdt_exit); | ||
267 | |||
268 | MODULE_DESCRIPTION("PowerPC Book-E watchdog driver"); | ||
269 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c index 566343b3c131..eca855a55c0d 100644 --- a/drivers/watchdog/cpwd.c +++ b/drivers/watchdog/cpwd.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/ioport.h> | 25 | #include <linux/ioport.h> |
26 | #include <linux/timer.h> | 26 | #include <linux/timer.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/smp_lock.h> | 28 | #include <linux/mutex.h> |
29 | #include <linux/io.h> | 29 | #include <linux/io.h> |
30 | #include <linux/of.h> | 30 | #include <linux/of.h> |
31 | #include <linux/of_device.h> | 31 | #include <linux/of_device.h> |
@@ -89,6 +89,7 @@ struct cpwd { | |||
89 | } devs[WD_NUMDEVS]; | 89 | } devs[WD_NUMDEVS]; |
90 | }; | 90 | }; |
91 | 91 | ||
92 | static DEFINE_MUTEX(cpwd_mutex); | ||
92 | static struct cpwd *cpwd_device; | 93 | static struct cpwd *cpwd_device; |
93 | 94 | ||
94 | /* Sun uses Altera PLD EPF8820ATC144-4 | 95 | /* Sun uses Altera PLD EPF8820ATC144-4 |
@@ -368,7 +369,7 @@ static int cpwd_open(struct inode *inode, struct file *f) | |||
368 | { | 369 | { |
369 | struct cpwd *p = cpwd_device; | 370 | struct cpwd *p = cpwd_device; |
370 | 371 | ||
371 | lock_kernel(); | 372 | mutex_lock(&cpwd_mutex); |
372 | switch (iminor(inode)) { | 373 | switch (iminor(inode)) { |
373 | case WD0_MINOR: | 374 | case WD0_MINOR: |
374 | case WD1_MINOR: | 375 | case WD1_MINOR: |
@@ -376,7 +377,7 @@ static int cpwd_open(struct inode *inode, struct file *f) | |||
376 | break; | 377 | break; |
377 | 378 | ||
378 | default: | 379 | default: |
379 | unlock_kernel(); | 380 | mutex_unlock(&cpwd_mutex); |
380 | return -ENODEV; | 381 | return -ENODEV; |
381 | } | 382 | } |
382 | 383 | ||
@@ -386,13 +387,13 @@ static int cpwd_open(struct inode *inode, struct file *f) | |||
386 | IRQF_SHARED, DRIVER_NAME, p)) { | 387 | IRQF_SHARED, DRIVER_NAME, p)) { |
387 | printk(KERN_ERR PFX "Cannot register IRQ %d\n", | 388 | printk(KERN_ERR PFX "Cannot register IRQ %d\n", |
388 | p->irq); | 389 | p->irq); |
389 | unlock_kernel(); | 390 | mutex_unlock(&cpwd_mutex); |
390 | return -EBUSY; | 391 | return -EBUSY; |
391 | } | 392 | } |
392 | p->initialized = true; | 393 | p->initialized = true; |
393 | } | 394 | } |
394 | 395 | ||
395 | unlock_kernel(); | 396 | mutex_unlock(&cpwd_mutex); |
396 | 397 | ||
397 | return nonseekable_open(inode, f); | 398 | return nonseekable_open(inode, f); |
398 | } | 399 | } |
@@ -482,9 +483,9 @@ static long cpwd_compat_ioctl(struct file *file, unsigned int cmd, | |||
482 | case WIOCSTART: | 483 | case WIOCSTART: |
483 | case WIOCSTOP: | 484 | case WIOCSTOP: |
484 | case WIOCGSTAT: | 485 | case WIOCGSTAT: |
485 | lock_kernel(); | 486 | mutex_lock(&cpwd_mutex); |
486 | rval = cpwd_ioctl(file, cmd, arg); | 487 | rval = cpwd_ioctl(file, cmd, arg); |
487 | unlock_kernel(); | 488 | mutex_unlock(&cpwd_mutex); |
488 | break; | 489 | break; |
489 | 490 | ||
490 | /* everything else is handled by the generic compat layer */ | 491 | /* everything else is handled by the generic compat layer */ |
@@ -524,6 +525,7 @@ static const struct file_operations cpwd_fops = { | |||
524 | .write = cpwd_write, | 525 | .write = cpwd_write, |
525 | .read = cpwd_read, | 526 | .read = cpwd_read, |
526 | .release = cpwd_release, | 527 | .release = cpwd_release, |
528 | .llseek = no_llseek, | ||
527 | }; | 529 | }; |
528 | 530 | ||
529 | static int __devinit cpwd_probe(struct platform_device *op, | 531 | static int __devinit cpwd_probe(struct platform_device *op, |
diff --git a/drivers/watchdog/ep93xx_wdt.c b/drivers/watchdog/ep93xx_wdt.c index 59359c9a5e01..726b7df61fd0 100644 --- a/drivers/watchdog/ep93xx_wdt.c +++ b/drivers/watchdog/ep93xx_wdt.c | |||
@@ -188,6 +188,7 @@ static const struct file_operations ep93xx_wdt_fops = { | |||
188 | .unlocked_ioctl = ep93xx_wdt_ioctl, | 188 | .unlocked_ioctl = ep93xx_wdt_ioctl, |
189 | .open = ep93xx_wdt_open, | 189 | .open = ep93xx_wdt_open, |
190 | .release = ep93xx_wdt_release, | 190 | .release = ep93xx_wdt_release, |
191 | .llseek = no_llseek, | ||
191 | }; | 192 | }; |
192 | 193 | ||
193 | static struct miscdevice ep93xx_wdt_miscdev = { | 194 | static struct miscdevice ep93xx_wdt_miscdev = { |
diff --git a/drivers/watchdog/octeon-wdt-main.c b/drivers/watchdog/octeon-wdt-main.c index 2a410170eca6..909923800a02 100644 --- a/drivers/watchdog/octeon-wdt-main.c +++ b/drivers/watchdog/octeon-wdt-main.c | |||
@@ -64,6 +64,7 @@ | |||
64 | #include <linux/cpu.h> | 64 | #include <linux/cpu.h> |
65 | #include <linux/smp.h> | 65 | #include <linux/smp.h> |
66 | #include <linux/fs.h> | 66 | #include <linux/fs.h> |
67 | #include <linux/irq.h> | ||
67 | 68 | ||
68 | #include <asm/mipsregs.h> | 69 | #include <asm/mipsregs.h> |
69 | #include <asm/uasm.h> | 70 | #include <asm/uasm.h> |
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 76b58abf4451..81e3d6100894 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c | |||
@@ -258,6 +258,7 @@ static const struct file_operations omap_wdt_fops = { | |||
258 | .unlocked_ioctl = omap_wdt_ioctl, | 258 | .unlocked_ioctl = omap_wdt_ioctl, |
259 | .open = omap_wdt_open, | 259 | .open = omap_wdt_open, |
260 | .release = omap_wdt_release, | 260 | .release = omap_wdt_release, |
261 | .llseek = no_llseek, | ||
261 | }; | 262 | }; |
262 | 263 | ||
263 | static int __devinit omap_wdt_probe(struct platform_device *pdev) | 264 | static int __devinit omap_wdt_probe(struct platform_device *pdev) |