aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/at91sam9_wdt.c22
-rw-r--r--drivers/watchdog/at91sam9_wdt.h6
-rw-r--r--drivers/watchdog/coh901327_wdt.c6
-rw-r--r--drivers/watchdog/hpwdt.c5
-rw-r--r--drivers/watchdog/iTCO_wdt.c6
-rw-r--r--drivers/watchdog/sp805_wdt.c2
6 files changed, 34 insertions, 13 deletions
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index 87445b2d72a..00562566ef5 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -35,6 +35,11 @@
35 35
36#define DRV_NAME "AT91SAM9 Watchdog" 36#define DRV_NAME "AT91SAM9 Watchdog"
37 37
38#define wdt_read(field) \
39 __raw_readl(at91wdt_private.base + field)
40#define wdt_write(field, val) \
41 __raw_writel((val), at91wdt_private.base + field)
42
38/* AT91SAM9 watchdog runs a 12bit counter @ 256Hz, 43/* AT91SAM9 watchdog runs a 12bit counter @ 256Hz,
39 * use this to convert a watchdog 44 * use this to convert a watchdog
40 * value from/to milliseconds. 45 * value from/to milliseconds.
@@ -63,6 +68,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started "
63static void at91_ping(unsigned long data); 68static void at91_ping(unsigned long data);
64 69
65static struct { 70static struct {
71 void __iomem *base;
66 unsigned long next_heartbeat; /* the next_heartbeat for the timer */ 72 unsigned long next_heartbeat; /* the next_heartbeat for the timer */
67 unsigned long open; 73 unsigned long open;
68 char expect_close; 74 char expect_close;
@@ -77,7 +83,7 @@ static struct {
77 */ 83 */
78static inline void at91_wdt_reset(void) 84static inline void at91_wdt_reset(void)
79{ 85{
80 at91_sys_write(AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT); 86 wdt_write(AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT);
81} 87}
82 88
83/* 89/*
@@ -132,7 +138,7 @@ static int at91_wdt_settimeout(unsigned int timeout)
132 unsigned int mr; 138 unsigned int mr;
133 139
134 /* Check if disabled */ 140 /* Check if disabled */
135 mr = at91_sys_read(AT91_WDT_MR); 141 mr = wdt_read(AT91_WDT_MR);
136 if (mr & AT91_WDT_WDDIS) { 142 if (mr & AT91_WDT_WDDIS) {
137 printk(KERN_ERR DRV_NAME": sorry, watchdog is disabled\n"); 143 printk(KERN_ERR DRV_NAME": sorry, watchdog is disabled\n");
138 return -EIO; 144 return -EIO;
@@ -149,7 +155,7 @@ static int at91_wdt_settimeout(unsigned int timeout)
149 | AT91_WDT_WDDBGHLT /* disabled in debug mode */ 155 | AT91_WDT_WDDBGHLT /* disabled in debug mode */
150 | AT91_WDT_WDD /* restart at any time */ 156 | AT91_WDT_WDD /* restart at any time */
151 | (timeout & AT91_WDT_WDV); /* timer value */ 157 | (timeout & AT91_WDT_WDV); /* timer value */
152 at91_sys_write(AT91_WDT_MR, reg); 158 wdt_write(AT91_WDT_MR, reg);
153 159
154 return 0; 160 return 0;
155} 161}
@@ -248,12 +254,22 @@ static struct miscdevice at91wdt_miscdev = {
248 254
249static int __init at91wdt_probe(struct platform_device *pdev) 255static int __init at91wdt_probe(struct platform_device *pdev)
250{ 256{
257 struct resource *r;
251 int res; 258 int res;
252 259
253 if (at91wdt_miscdev.parent) 260 if (at91wdt_miscdev.parent)
254 return -EBUSY; 261 return -EBUSY;
255 at91wdt_miscdev.parent = &pdev->dev; 262 at91wdt_miscdev.parent = &pdev->dev;
256 263
264 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
265 if (!r)
266 return -ENODEV;
267 at91wdt_private.base = ioremap(r->start, resource_size(r));
268 if (!at91wdt_private.base) {
269 dev_err(&pdev->dev, "failed to map registers, aborting.\n");
270 return -ENOMEM;
271 }
272
257 /* Set watchdog */ 273 /* Set watchdog */
258 res = at91_wdt_settimeout(ms_to_ticks(WDT_HW_TIMEOUT * 1000)); 274 res = at91_wdt_settimeout(ms_to_ticks(WDT_HW_TIMEOUT * 1000));
259 if (res) 275 if (res)
diff --git a/drivers/watchdog/at91sam9_wdt.h b/drivers/watchdog/at91sam9_wdt.h
index 757f9cab5c8..c6fbb2e6c41 100644
--- a/drivers/watchdog/at91sam9_wdt.h
+++ b/drivers/watchdog/at91sam9_wdt.h
@@ -16,11 +16,11 @@
16#ifndef AT91_WDT_H 16#ifndef AT91_WDT_H
17#define AT91_WDT_H 17#define AT91_WDT_H
18 18
19#define AT91_WDT_CR (AT91_WDT + 0x00) /* Watchdog Control Register */ 19#define AT91_WDT_CR 0x00 /* Watchdog Control Register */
20#define AT91_WDT_WDRSTT (1 << 0) /* Restart */ 20#define AT91_WDT_WDRSTT (1 << 0) /* Restart */
21#define AT91_WDT_KEY (0xa5 << 24) /* KEY Password */ 21#define AT91_WDT_KEY (0xa5 << 24) /* KEY Password */
22 22
23#define AT91_WDT_MR (AT91_WDT + 0x04) /* Watchdog Mode Register */ 23#define AT91_WDT_MR 0x04 /* Watchdog Mode Register */
24#define AT91_WDT_WDV (0xfff << 0) /* Counter Value */ 24#define AT91_WDT_WDV (0xfff << 0) /* Counter Value */
25#define AT91_WDT_WDFIEN (1 << 12) /* Fault Interrupt Enable */ 25#define AT91_WDT_WDFIEN (1 << 12) /* Fault Interrupt Enable */
26#define AT91_WDT_WDRSTEN (1 << 13) /* Reset Processor */ 26#define AT91_WDT_WDRSTEN (1 << 13) /* Reset Processor */
@@ -30,7 +30,7 @@
30#define AT91_WDT_WDDBGHLT (1 << 28) /* Debug Halt */ 30#define AT91_WDT_WDDBGHLT (1 << 28) /* Debug Halt */
31#define AT91_WDT_WDIDLEHLT (1 << 29) /* Idle Halt */ 31#define AT91_WDT_WDIDLEHLT (1 << 29) /* Idle Halt */
32 32
33#define AT91_WDT_SR (AT91_WDT + 0x08) /* Watchdog Status Register */ 33#define AT91_WDT_SR 0x08 /* Watchdog Status Register */
34#define AT91_WDT_WDUNF (1 << 0) /* Watchdog Underflow */ 34#define AT91_WDT_WDUNF (1 << 0) /* Watchdog Underflow */
35#define AT91_WDT_WDERR (1 << 1) /* Watchdog Error */ 35#define AT91_WDT_WDERR (1 << 1) /* Watchdog Error */
36 36
diff --git a/drivers/watchdog/coh901327_wdt.c b/drivers/watchdog/coh901327_wdt.c
index 03f449a430d..5b89f7d6cd0 100644
--- a/drivers/watchdog/coh901327_wdt.c
+++ b/drivers/watchdog/coh901327_wdt.c
@@ -76,8 +76,6 @@ static int irq;
76static void __iomem *virtbase; 76static void __iomem *virtbase;
77static unsigned long coh901327_users; 77static unsigned long coh901327_users;
78static unsigned long boot_status; 78static unsigned long boot_status;
79static u16 wdogenablestore;
80static u16 irqmaskstore;
81static struct device *parent; 79static struct device *parent;
82 80
83/* 81/*
@@ -461,6 +459,10 @@ out:
461} 459}
462 460
463#ifdef CONFIG_PM 461#ifdef CONFIG_PM
462
463static u16 wdogenablestore;
464static u16 irqmaskstore;
465
464static int coh901327_suspend(struct platform_device *pdev, pm_message_t state) 466static int coh901327_suspend(struct platform_device *pdev, pm_message_t state)
465{ 467{
466 irqmaskstore = readw(virtbase + U300_WDOG_IMR) & 0x0001U; 468 irqmaskstore = readw(virtbase + U300_WDOG_IMR) & 0x0001U;
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index 3774c9b8dac..8464ea1c36a 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -231,6 +231,7 @@ static int __devinit cru_detect(unsigned long map_entry,
231 231
232 cmn_regs.u1.reax = CRU_BIOS_SIGNATURE_VALUE; 232 cmn_regs.u1.reax = CRU_BIOS_SIGNATURE_VALUE;
233 233
234 set_memory_x((unsigned long)bios32_entrypoint, (2 * PAGE_SIZE));
234 asminline_call(&cmn_regs, bios32_entrypoint); 235 asminline_call(&cmn_regs, bios32_entrypoint);
235 236
236 if (cmn_regs.u1.ral != 0) { 237 if (cmn_regs.u1.ral != 0) {
@@ -248,8 +249,10 @@ static int __devinit cru_detect(unsigned long map_entry,
248 if ((physical_bios_base + physical_bios_offset)) { 249 if ((physical_bios_base + physical_bios_offset)) {
249 cru_rom_addr = 250 cru_rom_addr =
250 ioremap(cru_physical_address, cru_length); 251 ioremap(cru_physical_address, cru_length);
251 if (cru_rom_addr) 252 if (cru_rom_addr) {
253 set_memory_x((unsigned long)cru_rom_addr, cru_length);
252 retval = 0; 254 retval = 0;
255 }
253 } 256 }
254 257
255 printk(KERN_DEBUG "hpwdt: CRU Base Address: 0x%lx\n", 258 printk(KERN_DEBUG "hpwdt: CRU Base Address: 0x%lx\n",
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index ba6ad662635..99796c5d913 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -384,10 +384,10 @@ MODULE_PARM_DESC(nowayout,
384 "Watchdog cannot be stopped once started (default=" 384 "Watchdog cannot be stopped once started (default="
385 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 385 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
386 386
387static int turn_SMI_watchdog_clear_off = 0; 387static int turn_SMI_watchdog_clear_off = 1;
388module_param(turn_SMI_watchdog_clear_off, int, 0); 388module_param(turn_SMI_watchdog_clear_off, int, 0);
389MODULE_PARM_DESC(turn_SMI_watchdog_clear_off, 389MODULE_PARM_DESC(turn_SMI_watchdog_clear_off,
390 "Turn off SMI clearing watchdog (default=0)"); 390 "Turn off SMI clearing watchdog (depends on TCO-version)(default=1)");
391 391
392/* 392/*
393 * Some TCO specific functions 393 * Some TCO specific functions
@@ -813,7 +813,7 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
813 ret = -EIO; 813 ret = -EIO;
814 goto out_unmap; 814 goto out_unmap;
815 } 815 }
816 if (turn_SMI_watchdog_clear_off) { 816 if (turn_SMI_watchdog_clear_off >= iTCO_wdt_private.iTCO_version) {
817 /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */ 817 /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */
818 val32 = inl(SMI_EN); 818 val32 = inl(SMI_EN);
819 val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */ 819 val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */
diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index cc2cfbe33b3..bfaf9bb1ee0 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -351,7 +351,7 @@ static int __devexit sp805_wdt_remove(struct amba_device *adev)
351 return 0; 351 return 0;
352} 352}
353 353
354static struct amba_id sp805_wdt_ids[] __initdata = { 354static struct amba_id sp805_wdt_ids[] = {
355 { 355 {
356 .id = 0x00141805, 356 .id = 0x00141805,
357 .mask = 0x00ffffff, 357 .mask = 0x00ffffff,