aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/watchdog/w83697hf_wdt.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/drivers/char/watchdog/w83697hf_wdt.c b/drivers/char/watchdog/w83697hf_wdt.c
index 2b3ce434c196..1ea43bf2c35d 100644
--- a/drivers/char/watchdog/w83697hf_wdt.c
+++ b/drivers/char/watchdog/w83697hf_wdt.c
@@ -121,28 +121,13 @@ w83697hf_deselect_wdt(void)
121} 121}
122 122
123static void 123static void
124w83697hf_select_wd_register(void)
125{
126 w83697hf_unlock();
127
128 w83697hf_set_reg(0x29, 0x20); /* Set pin 119 to WDTO# mode (= CR29, WDT0) */
129
130 w83697hf_set_reg(0x07, 0x08); /* Switch to logic device 8 (GPIO2) */
131 w83697hf_set_reg(0x30, 0x01); /* Enable timer/activate GPIO2 via bit 0 */
132}
133
134static void
135w83697hf_unselect_wd_register(void)
136{
137 w83697hf_lock();
138}
139
140static void
141w83697hf_init(void) 124w83697hf_init(void)
142{ 125{
143 unsigned char t; 126 unsigned char t;
144 127
145 w83697hf_select_wd_register(); 128 w83697hf_select_wdt();
129
130 w83697hf_set_reg(0x29, 0x20); /* Set pin 119 to WDTO# mode (= CR29, WDT0) */
146 131
147 t = w83697hf_get_reg(0xF3); /* Read CRF3 */ 132 t = w83697hf_get_reg(0xF3); /* Read CRF3 */
148 if (t != 0) { 133 if (t != 0) {
@@ -153,7 +138,7 @@ w83697hf_init(void)
153 t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */ 138 t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */
154 w83697hf_set_reg(0xF4, t); /* Write back to CRF4 */ 139 w83697hf_set_reg(0xF4, t); /* Write back to CRF4 */
155 140
156 w83697hf_unselect_wd_register(); 141 w83697hf_deselect_wdt();
157} 142}
158 143
159static int 144static int
@@ -412,6 +397,8 @@ wdt_init(void)
412 goto out; 397 goto out;
413 398
414found: 399found:
400 w83697hf_init();
401 wdt_disable(); /* Disable watchdog until first use */
415 402
416 if (wdt_set_heartbeat(timeout)) { 403 if (wdt_set_heartbeat(timeout)) {
417 wdt_set_heartbeat(WATCHDOG_TIMEOUT); 404 wdt_set_heartbeat(WATCHDOG_TIMEOUT);
@@ -419,8 +406,6 @@ found:
419 WATCHDOG_TIMEOUT); 406 WATCHDOG_TIMEOUT);
420 } 407 }
421 408
422 w83697hf_init();
423
424 ret = register_reboot_notifier(&wdt_notifier); 409 ret = register_reboot_notifier(&wdt_notifier);
425 if (ret != 0) { 410 if (ret != 0) {
426 printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", 411 printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",