aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2006-09-07 05:57:00 -0400
committerWim Van Sebroeck <wim@iguana.be>2006-10-04 16:46:00 -0400
commitfa69afd3c224252890cb30864dc648d1399dd9fe (patch)
tree7b9b3a780a5e8da3523b7caa33a11459506b2a02 /drivers/char/watchdog
parent089d8139f4c19c2f4d6984323e9d8a6e77cc92f7 (diff)
[WATCHDOG] w83697hf/hg WDT driver - patch 14
This is patch 14 in the series of patches that converts Marcus Junker's w83697hf watchdog driver to Samuel Tardieau's w83697hf/hg watchdog driver. This patch contains following changes: - Clean-up initialization code (part 1: remove w83697hf_select_wd_register() and w83697hf_unselect_wd_register() functions). - Make sure that the watchdog device is stopped as soon as we found it. Signed-off-by: Samuel Tardieu <sam@rfc1149.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/char/watchdog')
-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",