aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/w83627hf_wdt.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2007-07-24 06:49:27 -0400
committerWim Van Sebroeck <wim@iguana.be>2007-07-24 13:08:54 -0400
commit28dd1b0b9191ac9cd0b96fa4d09d951498bfbadb (patch)
treee07a2f30c0d5c376ffbba171d6744189682513b7 /drivers/char/watchdog/w83627hf_wdt.c
parentb430708ad67f9325dadd7a86e007e353ab7e5acd (diff)
[WATCHDOG] ensure mouse and keyboard ignored in w83627hf_wdt
1. Ensure that the mouse and keyboard do not ping the watchdog. This is the default operation of the w83627, but some BIOSes change this. 2. Increase the max timeout from 63 seconds to 255 seconds as supported by the w83627 chip 3. Comment that the watchdog supports the w83627hg version of the chip Signed-Off-By: Pádraig Brady <P@draigBrady.com> Tested-by: Tomas Hodek <tomas.hodek@volny.cz> Signed-Off-By: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/char/watchdog/w83627hf_wdt.c')
-rw-r--r--drivers/char/watchdog/w83627hf_wdt.c24
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
58static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ 58static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
59module_param(timeout, int, 0); 59module_param(timeout, int, 0);
60MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); 60MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
61 61
62static int nowayout = WATCHDOG_NOWAYOUT; 62static int nowayout = WATCHDOG_NOWAYOUT;
63module_param(nowayout, int, 0); 63module_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
126wdt_ctrl(int timeout) 132wdt_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)
154static int 160static int
155wdt_set_heartbeat(int t) 161wdt_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