aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/w83627hf_wdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/watchdog/w83627hf_wdt.c')
-rw-r--r--drivers/char/watchdog/w83627hf_wdt.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/char/watchdog/w83627hf_wdt.c b/drivers/char/watchdog/w83627hf_wdt.c
index 337ee42c90dd..b46e7f47d705 100644
--- a/drivers/char/watchdog/w83627hf_wdt.c
+++ b/drivers/char/watchdog/w83627hf_wdt.c
@@ -1,5 +1,8 @@
1/* 1/*
2 * w83627hf WDT driver 2 * w83627hf/thf WDT driver
3 *
4 * (c) Copyright 2007 Vlad Drukker <vlad@storewiz.com>
5 * added support for W83627THF.
3 * 6 *
4 * (c) Copyright 2003 Pádraig Brady <P@draigBrady.com> 7 * (c) Copyright 2003 Pádraig Brady <P@draigBrady.com>
5 * 8 *
@@ -39,7 +42,7 @@
39#include <asm/uaccess.h> 42#include <asm/uaccess.h>
40#include <asm/system.h> 43#include <asm/system.h>
41 44
42#define WATCHDOG_NAME "w83627hf WDT" 45#define WATCHDOG_NAME "w83627hf/thf WDT"
43#define PFX WATCHDOG_NAME ": " 46#define PFX WATCHDOG_NAME ": "
44#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ 47#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */
45 48
@@ -50,7 +53,7 @@ static spinlock_t io_lock;
50/* You must set this - there is no sane way to probe for this board. */ 53/* You must set this - there is no sane way to probe for this board. */
51static int wdt_io = 0x2E; 54static int wdt_io = 0x2E;
52module_param(wdt_io, int, 0); 55module_param(wdt_io, int, 0);
53MODULE_PARM_DESC(wdt_io, "w83627hf WDT io port (default 0x2E)"); 56MODULE_PARM_DESC(wdt_io, "w83627hf/thf WDT io port (default 0x2E)");
54 57
55static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ 58static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
56module_param(timeout, int, 0); 59module_param(timeout, int, 0);
@@ -71,9 +74,19 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" _
71static void 74static void
72w83627hf_select_wd_register(void) 75w83627hf_select_wd_register(void)
73{ 76{
77 unsigned char c;
74 outb_p(0x87, WDT_EFER); /* Enter extended function mode */ 78 outb_p(0x87, WDT_EFER); /* Enter extended function mode */
75 outb_p(0x87, WDT_EFER); /* Again according to manual */ 79 outb_p(0x87, WDT_EFER); /* Again according to manual */
76 80
81 outb(0x20, WDT_EFER); /* check chip version */
82 c = inb(WDT_EFDR);
83 if (c == 0x82) { /* W83627THF */
84 outb_p(0x2b, WDT_EFER); /* select GPIO3 */
85 c = ((inb_p(WDT_EFDR) & 0xf7) | 0x04); /* select WDT0 */
86 outb_p(0x2b, WDT_EFER);
87 outb_p(c, WDT_EFDR); /* set GPIO3 to WDT0 */
88 }
89
77 outb_p(0x07, WDT_EFER); /* point to logical device number reg */ 90 outb_p(0x07, WDT_EFER); /* point to logical device number reg */
78 outb_p(0x08, WDT_EFDR); /* select logical device 8 (GPIO2) */ 91 outb_p(0x08, WDT_EFDR); /* select logical device 8 (GPIO2) */
79 outb_p(0x30, WDT_EFER); /* select CR30 */ 92 outb_p(0x30, WDT_EFER); /* select CR30 */
@@ -311,7 +324,7 @@ wdt_init(void)
311 324
312 spin_lock_init(&io_lock); 325 spin_lock_init(&io_lock);
313 326
314 printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF Super I/O chip initialising.\n"); 327 printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF Super I/O chip initialising.\n");
315 328
316 if (wdt_set_heartbeat(timeout)) { 329 if (wdt_set_heartbeat(timeout)) {
317 wdt_set_heartbeat(WATCHDOG_TIMEOUT); 330 wdt_set_heartbeat(WATCHDOG_TIMEOUT);
@@ -367,5 +380,5 @@ module_exit(wdt_exit);
367 380
368MODULE_LICENSE("GPL"); 381MODULE_LICENSE("GPL");
369MODULE_AUTHOR("Pádraig Brady <P@draigBrady.com>"); 382MODULE_AUTHOR("Pádraig Brady <P@draigBrady.com>");
370MODULE_DESCRIPTION("w83627hf WDT driver"); 383MODULE_DESCRIPTION("w83627hf/thf WDT driver");
371MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 384MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);