diff options
Diffstat (limited to 'drivers/char/watchdog/w83627hf_wdt.c')
| -rw-r--r-- | drivers/char/watchdog/w83627hf_wdt.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/char/watchdog/w83627hf_wdt.c b/drivers/char/watchdog/w83627hf_wdt.c index b46e7f47d705..df33b3b5a53c 100644 --- a/drivers/char/watchdog/w83627hf_wdt.c +++ b/drivers/char/watchdog/w83627hf_wdt.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * (c) Copyright 2007 Vlad Drukker <vlad@storewiz.com> | 4 | * (c) Copyright 2007 Vlad Drukker <vlad@storewiz.com> |
| 5 | * added support for W83627THF. | 5 | * added support for W83627THF. |
| 6 | * | 6 | * |
| 7 | * (c) Copyright 2003 Pádraig Brady <P@draigBrady.com> | 7 | * (c) Copyright 2003,2007 Pádraig Brady <P@draigBrady.com> |
| 8 | * | 8 | * |
| 9 | * Based on advantechwdt.c which is based on wdt.c. | 9 | * Based on advantechwdt.c which is based on wdt.c. |
| 10 | * Original copyright messages: | 10 | * Original copyright messages: |
| @@ -42,7 +42,7 @@ | |||
| 42 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
| 43 | #include <asm/system.h> | 43 | #include <asm/system.h> |
| 44 | 44 | ||
| 45 | #define WATCHDOG_NAME "w83627hf/thf WDT" | 45 | #define WATCHDOG_NAME "w83627hf/thf/hg WDT" |
| 46 | #define PFX WATCHDOG_NAME ": " | 46 | #define PFX WATCHDOG_NAME ": " |
| 47 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ | 47 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ |
| 48 | 48 | ||
| @@ -57,7 +57,7 @@ MODULE_PARM_DESC(wdt_io, "w83627hf/thf WDT io port (default 0x2E)"); | |||
| 57 | 57 | ||
| 58 | static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ | 58 | static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ |
| 59 | module_param(timeout, int, 0); | 59 | module_param(timeout, int, 0); |
| 60 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); | 60 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); |
| 61 | 61 | ||
| 62 | static int nowayout = WATCHDOG_NOWAYOUT; | 62 | static int nowayout = WATCHDOG_NOWAYOUT; |
| 63 | module_param(nowayout, int, 0); | 63 | module_param(nowayout, int, 0); |
| @@ -78,9 +78,9 @@ w83627hf_select_wd_register(void) | |||
| 78 | outb_p(0x87, WDT_EFER); /* Enter extended function mode */ | 78 | outb_p(0x87, WDT_EFER); /* Enter extended function mode */ |
| 79 | outb_p(0x87, WDT_EFER); /* Again according to manual */ | 79 | outb_p(0x87, WDT_EFER); /* Again according to manual */ |
| 80 | 80 | ||
| 81 | outb(0x20, WDT_EFER); /* check chip version */ | 81 | outb(0x20, WDT_EFER); /* check chip version */ |
| 82 | c = inb(WDT_EFDR); | 82 | c = inb(WDT_EFDR); |
| 83 | if (c == 0x82) { /* W83627THF */ | 83 | if (c == 0x82) { /* W83627THF */ |
| 84 | outb_p(0x2b, WDT_EFER); /* select GPIO3 */ | 84 | outb_p(0x2b, WDT_EFER); /* select GPIO3 */ |
| 85 | c = ((inb_p(WDT_EFDR) & 0xf7) | 0x04); /* select WDT0 */ | 85 | c = ((inb_p(WDT_EFDR) & 0xf7) | 0x04); /* select WDT0 */ |
| 86 | outb_p(0x2b, WDT_EFER); | 86 | outb_p(0x2b, WDT_EFER); |
| @@ -114,11 +114,17 @@ w83627hf_init(void) | |||
| 114 | printk (KERN_INFO PFX "Watchdog already running. Resetting timeout to %d sec\n", timeout); | 114 | printk (KERN_INFO PFX "Watchdog already running. Resetting timeout to %d sec\n", timeout); |
| 115 | outb_p(timeout, WDT_EFDR); /* Write back to CRF6 */ | 115 | outb_p(timeout, WDT_EFDR); /* Write back to CRF6 */ |
| 116 | } | 116 | } |
| 117 | |||
| 117 | outb_p(0xF5, WDT_EFER); /* Select CRF5 */ | 118 | outb_p(0xF5, WDT_EFER); /* Select CRF5 */ |
| 118 | t=inb_p(WDT_EFDR); /* read CRF5 */ | 119 | t=inb_p(WDT_EFDR); /* read CRF5 */ |
| 119 | t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */ | 120 | t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */ |
| 120 | outb_p(t, WDT_EFDR); /* Write back to CRF5 */ | 121 | outb_p(t, WDT_EFDR); /* Write back to CRF5 */ |
| 121 | 122 | ||
| 123 | outb_p(0xF7, WDT_EFER); /* Select CRF7 */ | ||
| 124 | t=inb_p(WDT_EFDR); /* read CRF7 */ | ||
| 125 | t&=~0xC0; /* disable keyboard & mouse turning off watchdog */ | ||
| 126 | outb_p(t, WDT_EFDR); /* Write back to CRF7 */ | ||
| 127 | |||
| 122 | w83627hf_unselect_wd_register(); | 128 | w83627hf_unselect_wd_register(); |
| 123 | } | 129 | } |
| 124 | 130 | ||
| @@ -126,7 +132,7 @@ static void | |||
| 126 | wdt_ctrl(int timeout) | 132 | wdt_ctrl(int timeout) |
| 127 | { | 133 | { |
| 128 | spin_lock(&io_lock); | 134 | spin_lock(&io_lock); |
| 129 | 135 | ||
| 130 | w83627hf_select_wd_register(); | 136 | w83627hf_select_wd_register(); |
| 131 | 137 | ||
| 132 | outb_p(0xF6, WDT_EFER); /* Select CRF6 */ | 138 | outb_p(0xF6, WDT_EFER); /* Select CRF6 */ |
| @@ -154,7 +160,7 @@ wdt_disable(void) | |||
| 154 | static int | 160 | static int |
| 155 | wdt_set_heartbeat(int t) | 161 | wdt_set_heartbeat(int t) |
| 156 | { | 162 | { |
| 157 | if ((t < 1) || (t > 63)) | 163 | if ((t < 1) || (t > 255)) |
| 158 | return -EINVAL; | 164 | return -EINVAL; |
| 159 | 165 | ||
| 160 | timeout = t; | 166 | timeout = t; |
| @@ -324,11 +330,11 @@ wdt_init(void) | |||
| 324 | 330 | ||
| 325 | spin_lock_init(&io_lock); | 331 | spin_lock_init(&io_lock); |
| 326 | 332 | ||
| 327 | printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF Super I/O chip initialising.\n"); | 333 | printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF/HG Super I/O chip initialising.\n"); |
| 328 | 334 | ||
| 329 | if (wdt_set_heartbeat(timeout)) { | 335 | if (wdt_set_heartbeat(timeout)) { |
| 330 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); | 336 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); |
| 331 | printk (KERN_INFO PFX "timeout value must be 1<=timeout<=63, using %d\n", | 337 | printk (KERN_INFO PFX "timeout value must be 1<=timeout<=255, using %d\n", |
| 332 | WATCHDOG_TIMEOUT); | 338 | WATCHDOG_TIMEOUT); |
| 333 | } | 339 | } |
| 334 | 340 | ||
