Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 133767
b: refs/heads/master
c: 63bad14
h: refs/heads/master
i:
  133765: 7a8891a
  133763: 2195fbe
  133759: d58655d
v: v3
  • Loading branch information
Eric Lammerts authored and Wim Van Sebroeck committed Mar 25, 2009
1 parent c811dd9 commit 2880fa0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9626dd75c57360666f4cdcb660c1672ee9f952e8
refs/heads/master: 63bad1452e9087e6f130316c005eb38a8758a267
21 changes: 15 additions & 6 deletions trunk/drivers/watchdog/w83697ug_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ MODULE_PARM_DESC(nowayout,
(same as EFER) */
#define WDT_EFDR (WDT_EFIR+1) /* Extended Function Data Register */

static void w83697ug_select_wd_register(void)
static int w83697ug_select_wd_register(void)
{
unsigned char c;
unsigned char version;
Expand All @@ -102,26 +102,31 @@ static void w83697ug_select_wd_register(void)

} else {
printk(KERN_ERR PFX "No W83697UG/UF could be found\n");
return;
return -ENODEV;
}

outb_p(0x07, WDT_EFER); /* point to logical device number reg */
outb_p(0x08, WDT_EFDR); /* select logical device 8 (GPIO2) */
outb_p(0x30, WDT_EFER); /* select CR30 */
c = inb_p(WDT_EFDR);
outb_p(c || 0x01, WDT_EFDR); /* set bit 0 to activate GPIO2 */

return 0;
}

static void w83697ug_unselect_wd_register(void)
{
outb_p(0xAA, WDT_EFER); /* Leave extended function mode */
}

static void w83697ug_init(void)
static int w83697ug_init(void)
{
int ret;
unsigned char t;

w83697ug_select_wd_register();
ret = w83697ug_select_wd_register();
if (ret != 0)
return ret;

outb_p(0xF6, WDT_EFER); /* Select CRF6 */
t = inb_p(WDT_EFDR); /* read CRF6 */
Expand All @@ -137,13 +142,15 @@ static void w83697ug_init(void)
outb_p(t, WDT_EFDR); /* Write back to CRF5 */

w83697ug_unselect_wd_register();
return 0;
}

static void wdt_ctrl(int timeout)
{
spin_lock(&io_lock);

w83697ug_select_wd_register();
if (w83697ug_select_wd_register() < 0)
return;

outb_p(0xF4, WDT_EFER); /* Select CRF4 */
outb_p(timeout, WDT_EFDR); /* Write Timeout counter to CRF4 */
Expand Down Expand Up @@ -347,7 +354,9 @@ static int __init wdt_init(void)
goto out;
}

w83697ug_init();
ret = w83697ug_init();
if (ret != 0)
goto unreg_regions;

ret = register_reboot_notifier(&wdt_notifier);
if (ret != 0) {
Expand Down

0 comments on commit 2880fa0

Please sign in to comment.