aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar7/patches-2.6.30/140-watchdog_bootcr.patch
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2009-08-04 21:05:55 +0000
committerFlorian Fainelli <florian@openwrt.org>2009-08-04 21:05:55 +0000
commitcbe91ce7403638af393a6ff5b174b947d9bd5daf (patch)
treee2a1c9835434d862712d9ea9acf035a2182cdb52 /target/linux/ar7/patches-2.6.30/140-watchdog_bootcr.patch
parent304fbfa8412f3db06b902becedfd9be171ce0622 (diff)
downloadupstream-cbe91ce7403638af393a6ff5b174b947d9bd5daf.tar.gz
upstream-cbe91ce7403638af393a6ff5b174b947d9bd5daf.tar.bz2
upstream-cbe91ce7403638af393a6ff5b174b947d9bd5daf.zip
register watchdog only if enabled in hardware (#2378)
SVN-Revision: 17125
Diffstat (limited to 'target/linux/ar7/patches-2.6.30/140-watchdog_bootcr.patch')
-rw-r--r--target/linux/ar7/patches-2.6.30/140-watchdog_bootcr.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/target/linux/ar7/patches-2.6.30/140-watchdog_bootcr.patch b/target/linux/ar7/patches-2.6.30/140-watchdog_bootcr.patch
new file mode 100644
index 0000000000..21c95a7652
--- /dev/null
+++ b/target/linux/ar7/patches-2.6.30/140-watchdog_bootcr.patch
@@ -0,0 +1,31 @@
+--- a/drivers/watchdog/ar7_wdt.c
++++ b/drivers/watchdog/ar7_wdt.c
+@@ -298,14 +298,28 @@ static struct miscdevice ar7_wdt_miscdev
+ .fops = &ar7_wdt_fops,
+ };
+
++#define AR7_WDT_HARDWARE_ENABLE 0x10
++
+ static int __init ar7_wdt_init(void)
+ {
+ int rc;
++ u32 *bootcr;
++ u32 bootcr_value;
+
+ spin_lock_init(&wdt_lock);
+
+ ar7_wdt_get_regs();
+
++ /* arch/mips/ar7/clocks.c is the only other thing that reads this */
++ bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4);
++ bootcr_value = *bootcr;
++ iounmap(bootcr);
++
++ if (!(bootcr_value & AR7_WDT_HARDWARE_ENABLE)) {
++ printk(KERN_INFO DRVNAME ": watchdog disabled in hardware (bootcr=%#x)\n", bootcr_value);
++ return -ENODEV;
++ }
++
+ if (!request_mem_region(ar7_regs_wdt, sizeof(struct ar7_wdt),
+ LONGNAME)) {
+ printk(KERN_WARNING DRVNAME ": watchdog I/O region busy\n");