diff options
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/Kconfig | 4 | ||||
-rw-r--r-- | drivers/watchdog/ar7_wdt.c | 18 | ||||
-rw-r--r-- | drivers/watchdog/bfin_wdt.c | 13 | ||||
-rw-r--r-- | drivers/watchdog/ixp2000_wdt.c | 1 | ||||
-rw-r--r-- | drivers/watchdog/sbc_fitpc2_wdt.c | 11 |
5 files changed, 30 insertions, 17 deletions
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 088f32f29a6e..050ee147592f 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -396,8 +396,8 @@ config SBC_FITPC2_WATCHDOG | |||
396 | tristate "Compulab SBC-FITPC2 watchdog" | 396 | tristate "Compulab SBC-FITPC2 watchdog" |
397 | depends on X86 | 397 | depends on X86 |
398 | ---help--- | 398 | ---help--- |
399 | This is the driver for the built-in watchdog timer on the fit-PC2 | 399 | This is the driver for the built-in watchdog timer on the fit-PC2, |
400 | Single-board computer made by Compulab. | 400 | fit-PC2i, CM-iAM single-board computers made by Compulab. |
401 | 401 | ||
402 | It`s possible to enable watchdog timer either from BIOS (F2) or from booted Linux. | 402 | It`s possible to enable watchdog timer either from BIOS (F2) or from booted Linux. |
403 | When "Watchdog Timer Value" enabled one can set 31-255 s operational range. | 403 | When "Watchdog Timer Value" enabled one can set 31-255 s operational range. |
diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c index 2e94b71b20d9..2bb95cd308c1 100644 --- a/drivers/watchdog/ar7_wdt.c +++ b/drivers/watchdog/ar7_wdt.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/ioport.h> | 34 | #include <linux/ioport.h> |
35 | #include <linux/io.h> | 35 | #include <linux/io.h> |
36 | #include <linux/uaccess.h> | 36 | #include <linux/uaccess.h> |
37 | #include <linux/clk.h> | ||
37 | 38 | ||
38 | #include <asm/addrspace.h> | 39 | #include <asm/addrspace.h> |
39 | #include <asm/mach-ar7/ar7.h> | 40 | #include <asm/mach-ar7/ar7.h> |
@@ -80,6 +81,8 @@ static struct resource *ar7_regs_wdt; | |||
80 | /* Pointer to the remapped WDT IO space */ | 81 | /* Pointer to the remapped WDT IO space */ |
81 | static struct ar7_wdt *ar7_wdt; | 82 | static struct ar7_wdt *ar7_wdt; |
82 | 83 | ||
84 | static struct clk *vbus_clk; | ||
85 | |||
83 | static void ar7_wdt_kick(u32 value) | 86 | static void ar7_wdt_kick(u32 value) |
84 | { | 87 | { |
85 | WRITE_REG(ar7_wdt->kick_lock, 0x5555); | 88 | WRITE_REG(ar7_wdt->kick_lock, 0x5555); |
@@ -138,17 +141,19 @@ static void ar7_wdt_disable(u32 value) | |||
138 | static void ar7_wdt_update_margin(int new_margin) | 141 | static void ar7_wdt_update_margin(int new_margin) |
139 | { | 142 | { |
140 | u32 change; | 143 | u32 change; |
144 | u32 vbus_rate; | ||
141 | 145 | ||
142 | change = new_margin * (ar7_vbus_freq() / prescale_value); | 146 | vbus_rate = clk_get_rate(vbus_clk); |
147 | change = new_margin * (vbus_rate / prescale_value); | ||
143 | if (change < 1) | 148 | if (change < 1) |
144 | change = 1; | 149 | change = 1; |
145 | if (change > 0xffff) | 150 | if (change > 0xffff) |
146 | change = 0xffff; | 151 | change = 0xffff; |
147 | ar7_wdt_change(change); | 152 | ar7_wdt_change(change); |
148 | margin = change * prescale_value / ar7_vbus_freq(); | 153 | margin = change * prescale_value / vbus_rate; |
149 | printk(KERN_INFO DRVNAME | 154 | printk(KERN_INFO DRVNAME |
150 | ": timer margin %d seconds (prescale %d, change %d, freq %d)\n", | 155 | ": timer margin %d seconds (prescale %d, change %d, freq %d)\n", |
151 | margin, prescale_value, change, ar7_vbus_freq()); | 156 | margin, prescale_value, change, vbus_rate); |
152 | } | 157 | } |
153 | 158 | ||
154 | static void ar7_wdt_enable_wdt(void) | 159 | static void ar7_wdt_enable_wdt(void) |
@@ -298,6 +303,13 @@ static int __devinit ar7_wdt_probe(struct platform_device *pdev) | |||
298 | goto out_mem_region; | 303 | goto out_mem_region; |
299 | } | 304 | } |
300 | 305 | ||
306 | vbus_clk = clk_get(NULL, "vbus"); | ||
307 | if (IS_ERR(vbus_clk)) { | ||
308 | printk(KERN_ERR DRVNAME ": could not get vbus clock\n"); | ||
309 | rc = PTR_ERR(vbus_clk); | ||
310 | goto out_mem_region; | ||
311 | } | ||
312 | |||
301 | ar7_wdt_disable_wdt(); | 313 | ar7_wdt_disable_wdt(); |
302 | ar7_wdt_prescale(prescale_value); | 314 | ar7_wdt_prescale(prescale_value); |
303 | ar7_wdt_update_margin(margin); | 315 | ar7_wdt_update_margin(margin); |
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c index c7b3f9df2317..2159e668751c 100644 --- a/drivers/watchdog/bfin_wdt.c +++ b/drivers/watchdog/bfin_wdt.c | |||
@@ -1,9 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Blackfin On-Chip Watchdog Driver | 2 | * Blackfin On-Chip Watchdog Driver |
3 | * Supports BF53[123]/BF53[467]/BF54[2489]/BF561 | ||
4 | * | 3 | * |
5 | * Originally based on softdog.c | 4 | * Originally based on softdog.c |
6 | * Copyright 2006-2007 Analog Devices Inc. | 5 | * Copyright 2006-2010 Analog Devices Inc. |
7 | * Copyright 2006-2007 Michele d'Amico | 6 | * Copyright 2006-2007 Michele d'Amico |
8 | * Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk> | 7 | * Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk> |
9 | * | 8 | * |
@@ -137,13 +136,15 @@ static int bfin_wdt_running(void) | |||
137 | */ | 136 | */ |
138 | static int bfin_wdt_set_timeout(unsigned long t) | 137 | static int bfin_wdt_set_timeout(unsigned long t) |
139 | { | 138 | { |
140 | u32 cnt; | 139 | u32 cnt, max_t, sclk; |
141 | unsigned long flags; | 140 | unsigned long flags; |
142 | 141 | ||
143 | stampit(); | 142 | sclk = get_sclk(); |
143 | max_t = -1 / sclk; | ||
144 | cnt = t * sclk; | ||
145 | stamp("maxtimeout=%us newtimeout=%lus (cnt=%#x)", max_t, t, cnt); | ||
144 | 146 | ||
145 | cnt = t * get_sclk(); | 147 | if (t > max_t) { |
146 | if (cnt < get_sclk()) { | ||
147 | printk(KERN_WARNING PFX "timeout value is too large\n"); | 148 | printk(KERN_WARNING PFX "timeout value is too large\n"); |
148 | return -EINVAL; | 149 | return -EINVAL; |
149 | } | 150 | } |
diff --git a/drivers/watchdog/ixp2000_wdt.c b/drivers/watchdog/ixp2000_wdt.c index 4f4b35a20d84..3c79dc587958 100644 --- a/drivers/watchdog/ixp2000_wdt.c +++ b/drivers/watchdog/ixp2000_wdt.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/moduleparam.h> | 20 | #include <linux/moduleparam.h> |
21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
22 | #include <linux/timer.h> | ||
22 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
23 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
24 | #include <linux/miscdevice.h> | 25 | #include <linux/miscdevice.h> |
diff --git a/drivers/watchdog/sbc_fitpc2_wdt.c b/drivers/watchdog/sbc_fitpc2_wdt.c index 91430a89107c..e6763d2a567b 100644 --- a/drivers/watchdog/sbc_fitpc2_wdt.c +++ b/drivers/watchdog/sbc_fitpc2_wdt.c | |||
@@ -46,9 +46,9 @@ static DEFINE_SPINLOCK(wdt_lock); | |||
46 | static void wdt_send_data(unsigned char command, unsigned char data) | 46 | static void wdt_send_data(unsigned char command, unsigned char data) |
47 | { | 47 | { |
48 | outb(command, COMMAND_PORT); | 48 | outb(command, COMMAND_PORT); |
49 | mdelay(100); | 49 | msleep(100); |
50 | outb(data, DATA_PORT); | 50 | outb(data, DATA_PORT); |
51 | mdelay(200); | 51 | msleep(200); |
52 | } | 52 | } |
53 | 53 | ||
54 | static void wdt_enable(void) | 54 | static void wdt_enable(void) |
@@ -202,11 +202,10 @@ static int __init fitpc2_wdt_init(void) | |||
202 | { | 202 | { |
203 | int err; | 203 | int err; |
204 | 204 | ||
205 | if (strcmp("SBC-FITPC2", dmi_get_system_info(DMI_BOARD_NAME))) { | 205 | if (!strstr(dmi_get_system_info(DMI_BOARD_NAME), "SBC-FITPC2")) |
206 | pr_info("board name is: %s. Should be SBC-FITPC2\n", | ||
207 | dmi_get_system_info(DMI_BOARD_NAME)); | ||
208 | return -ENODEV; | 206 | return -ENODEV; |
209 | } | 207 | |
208 | pr_info("%s found\n", dmi_get_system_info(DMI_BOARD_NAME)); | ||
210 | 209 | ||
211 | if (!request_region(COMMAND_PORT, 1, WATCHDOG_NAME)) { | 210 | if (!request_region(COMMAND_PORT, 1, WATCHDOG_NAME)) { |
212 | pr_err("I/O address 0x%04x already in use\n", COMMAND_PORT); | 211 | pr_err("I/O address 0x%04x already in use\n", COMMAND_PORT); |