Commit 28dd1b0b authored by Pdraig Brady's avatar Pdraig Brady Committed by Wim Van Sebroeck

[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: default avatarPádraig Brady <P@draigBrady.com>
Tested-by: default avatarTomas Hodek <tomas.hodek@volny.cz>
Signed-Off-By: default avatarWim Van Sebroeck <wim@iguana.be>
parent b430708a
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* (c) Copyright 2007 Vlad Drukker <vlad@storewiz.com> * (c) Copyright 2007 Vlad Drukker <vlad@storewiz.com>
* added support for W83627THF. * added support for W83627THF.
* *
* (c) Copyright 2003 Pdraig Brady <P@draigBrady.com> * (c) Copyright 2003,2007 Pdraig Brady <P@draigBrady.com>
* *
* Based on advantechwdt.c which is based on wdt.c. * Based on advantechwdt.c which is based on wdt.c.
* Original copyright messages: * Original copyright messages:
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/system.h> #include <asm/system.h>
#define WATCHDOG_NAME "w83627hf/thf WDT" #define WATCHDOG_NAME "w83627hf/thf/hg WDT"
#define PFX WATCHDOG_NAME ": " #define PFX WATCHDOG_NAME ": "
#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */
...@@ -57,7 +57,7 @@ MODULE_PARM_DESC(wdt_io, "w83627hf/thf WDT io port (default 0x2E)"); ...@@ -57,7 +57,7 @@ MODULE_PARM_DESC(wdt_io, "w83627hf/thf WDT io port (default 0x2E)");
static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
module_param(timeout, int, 0); module_param(timeout, int, 0);
MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
static int nowayout = WATCHDOG_NOWAYOUT; static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0); module_param(nowayout, int, 0);
...@@ -78,9 +78,9 @@ w83627hf_select_wd_register(void) ...@@ -78,9 +78,9 @@ w83627hf_select_wd_register(void)
outb_p(0x87, WDT_EFER); /* Enter extended function mode */ outb_p(0x87, WDT_EFER); /* Enter extended function mode */
outb_p(0x87, WDT_EFER); /* Again according to manual */ outb_p(0x87, WDT_EFER); /* Again according to manual */
outb(0x20, WDT_EFER); /* check chip version */ outb(0x20, WDT_EFER); /* check chip version */
c = inb(WDT_EFDR); c = inb(WDT_EFDR);
if (c == 0x82) { /* W83627THF */ if (c == 0x82) { /* W83627THF */
outb_p(0x2b, WDT_EFER); /* select GPIO3 */ outb_p(0x2b, WDT_EFER); /* select GPIO3 */
c = ((inb_p(WDT_EFDR) & 0xf7) | 0x04); /* select WDT0 */ c = ((inb_p(WDT_EFDR) & 0xf7) | 0x04); /* select WDT0 */
outb_p(0x2b, WDT_EFER); outb_p(0x2b, WDT_EFER);
...@@ -114,11 +114,17 @@ w83627hf_init(void) ...@@ -114,11 +114,17 @@ w83627hf_init(void)
printk (KERN_INFO PFX "Watchdog already running. Resetting timeout to %d sec\n", timeout); printk (KERN_INFO PFX "Watchdog already running. Resetting timeout to %d sec\n", timeout);
outb_p(timeout, WDT_EFDR); /* Write back to CRF6 */ outb_p(timeout, WDT_EFDR); /* Write back to CRF6 */
} }
outb_p(0xF5, WDT_EFER); /* Select CRF5 */ outb_p(0xF5, WDT_EFER); /* Select CRF5 */
t=inb_p(WDT_EFDR); /* read CRF5 */ t=inb_p(WDT_EFDR); /* read CRF5 */
t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */ t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */
outb_p(t, WDT_EFDR); /* Write back to CRF5 */ outb_p(t, WDT_EFDR); /* Write back to CRF5 */
outb_p(0xF7, WDT_EFER); /* Select CRF7 */
t=inb_p(WDT_EFDR); /* read CRF7 */
t&=~0xC0; /* disable keyboard & mouse turning off watchdog */
outb_p(t, WDT_EFDR); /* Write back to CRF7 */
w83627hf_unselect_wd_register(); w83627hf_unselect_wd_register();
} }
...@@ -126,7 +132,7 @@ static void ...@@ -126,7 +132,7 @@ static void
wdt_ctrl(int timeout) wdt_ctrl(int timeout)
{ {
spin_lock(&io_lock); spin_lock(&io_lock);
w83627hf_select_wd_register(); w83627hf_select_wd_register();
outb_p(0xF6, WDT_EFER); /* Select CRF6 */ outb_p(0xF6, WDT_EFER); /* Select CRF6 */
...@@ -154,7 +160,7 @@ wdt_disable(void) ...@@ -154,7 +160,7 @@ wdt_disable(void)
static int static int
wdt_set_heartbeat(int t) wdt_set_heartbeat(int t)
{ {
if ((t < 1) || (t > 63)) if ((t < 1) || (t > 255))
return -EINVAL; return -EINVAL;
timeout = t; timeout = t;
...@@ -324,11 +330,11 @@ wdt_init(void) ...@@ -324,11 +330,11 @@ wdt_init(void)
spin_lock_init(&io_lock); spin_lock_init(&io_lock);
printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF Super I/O chip initialising.\n"); printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF/HG Super I/O chip initialising.\n");
if (wdt_set_heartbeat(timeout)) { if (wdt_set_heartbeat(timeout)) {
wdt_set_heartbeat(WATCHDOG_TIMEOUT); wdt_set_heartbeat(WATCHDOG_TIMEOUT);
printk (KERN_INFO PFX "timeout value must be 1<=timeout<=63, using %d\n", printk (KERN_INFO PFX "timeout value must be 1<=timeout<=255, using %d\n",
WATCHDOG_TIMEOUT); WATCHDOG_TIMEOUT);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment