]> bbs.cooldavid.org Git - net-next-2.6.git/blame - drivers/watchdog/pc87413_wdt.c
bonding: fix a race in IGMP handling
[net-next-2.6.git] / drivers / watchdog / pc87413_wdt.c
CommitLineData
789fc0ad
SAMJ
1/*
2 * NS pc87413-wdt Watchdog Timer driver for Linux 2.6.x.x
3 *
00b3b3e6 4 * This code is based on wdt.c with original copyright.
789fc0ad 5 *
00b3b3e6
SAMJ
6 * (C) Copyright 2006 Sven Anders, <anders@anduras.de>
7 * and Marcus Junker, <junker@anduras.de>
789fc0ad
SAMJ
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
00b3b3e6 14 * Neither Sven Anders, Marcus Junker nor ANDURAS AG
789fc0ad
SAMJ
15 * admit liability nor provide warranty for any of this software.
16 * This material is provided "AS-IS" and at no charge.
17 *
00b3b3e6 18 * Release 1.1
789fc0ad
SAMJ
19 */
20
789fc0ad
SAMJ
21#include <linux/module.h>
22#include <linux/types.h>
23#include <linux/miscdevice.h>
24#include <linux/watchdog.h>
25#include <linux/ioport.h>
26#include <linux/delay.h>
27#include <linux/notifier.h>
28#include <linux/fs.h>
29#include <linux/reboot.h>
30#include <linux/init.h>
31#include <linux/spinlock.h>
32#include <linux/moduleparam.h>
aee334c2
AC
33#include <linux/io.h>
34#include <linux/uaccess.h>
789fc0ad 35
789fc0ad
SAMJ
36#include <asm/system.h>
37
00b3b3e6 38/* #define DEBUG 1 */
789fc0ad 39
7944d3a5 40#define DEFAULT_TIMEOUT 1 /* 1 minute */
00b3b3e6 41#define MAX_TIMEOUT 255
789fc0ad 42
00b3b3e6
SAMJ
43#define VERSION "1.1"
44#define MODNAME "pc87413 WDT"
45#define PFX MODNAME ": "
46#define DPFX MODNAME " - DEBUG: "
789fc0ad 47
7944d3a5 48#define WDT_INDEX_IO_PORT (io+0) /* I/O port base (index register) */
00b3b3e6
SAMJ
49#define WDT_DATA_IO_PORT (WDT_INDEX_IO_PORT+1)
50#define SWC_LDN 0x04
7944d3a5
WVS
51#define SIOCFG2 0x22 /* Serial IO register */
52#define WDCTL 0x10 /* Watchdog-Timer-Controll-Register */
53#define WDTO 0x11 /* Watchdog timeout register */
54#define WDCFG 0x12 /* Watchdog config register */
789fc0ad 55
76550d32
RD
56#define IO_DEFAULT 0x2E /* Address used on Portwell Boards */
57
58static int io = IO_DEFAULT;
789fc0ad 59
7944d3a5 60static int timeout = DEFAULT_TIMEOUT; /* timeout value */
aee334c2 61static unsigned long timer_enabled; /* is the timer enabled? */
789fc0ad 62
aee334c2 63static char expect_close; /* is the close expected? */
789fc0ad 64
aee334c2 65static DEFINE_SPINLOCK(io_lock); /* to guard us from io races */
789fc0ad 66
00b3b3e6 67static int nowayout = WATCHDOG_NOWAYOUT;
789fc0ad 68
00b3b3e6 69/* -- Low level function ----------------------------------------*/
789fc0ad 70
00b3b3e6 71/* Select pins for Watchdog output */
789fc0ad 72
aee334c2 73static inline void pc87413_select_wdt_out(void)
789fc0ad 74{
00b3b3e6 75 unsigned int cr_data = 0;
789fc0ad 76
00b3b3e6 77 /* Step 1: Select multiple pin,pin55,as WDT output */
789fc0ad
SAMJ
78
79 outb_p(SIOCFG2, WDT_INDEX_IO_PORT);
80
aee334c2 81 cr_data = inb(WDT_DATA_IO_PORT);
789fc0ad
SAMJ
82
83 cr_data |= 0x80; /* Set Bit7 to 1*/
84 outb_p(SIOCFG2, WDT_INDEX_IO_PORT);
85
86 outb_p(cr_data, WDT_DATA_IO_PORT);
87
00b3b3e6 88#ifdef DEBUG
aee334c2
AC
89 printk(KERN_INFO DPFX
90 "Select multiple pin,pin55,as WDT output: Bit7 to 1: %d\n",
91 cr_data);
00b3b3e6 92#endif
789fc0ad
SAMJ
93}
94
00b3b3e6 95/* Enable SWC functions */
789fc0ad 96
00b3b3e6
SAMJ
97static inline void pc87413_enable_swc(void)
98{
aee334c2 99 unsigned int cr_data = 0;
789fc0ad
SAMJ
100
101 /* Step 2: Enable SWC functions */
102
7944d3a5 103 outb_p(0x07, WDT_INDEX_IO_PORT); /* Point SWC_LDN (LDN=4) */
789fc0ad
SAMJ
104 outb_p(SWC_LDN, WDT_DATA_IO_PORT);
105
7944d3a5 106 outb_p(0x30, WDT_INDEX_IO_PORT); /* Read Index 0x30 First */
00b3b3e6 107 cr_data = inb(WDT_DATA_IO_PORT);
7944d3a5 108 cr_data |= 0x01; /* Set Bit0 to 1 */
789fc0ad 109 outb_p(0x30, WDT_INDEX_IO_PORT);
7944d3a5 110 outb_p(cr_data, WDT_DATA_IO_PORT); /* Index0x30_bit0P1 */
789fc0ad 111
00b3b3e6 112#ifdef DEBUG
789fc0ad 113 printk(KERN_INFO DPFX "pc87413 - Enable SWC functions\n");
00b3b3e6 114#endif
789fc0ad
SAMJ
115}
116
00b3b3e6
SAMJ
117/* Read SWC I/O base address */
118
119static inline unsigned int pc87413_get_swc_base(void)
789fc0ad 120{
00b3b3e6
SAMJ
121 unsigned int swc_base_addr = 0;
122 unsigned char addr_l, addr_h = 0;
789fc0ad
SAMJ
123
124 /* Step 3: Read SWC I/O Base Address */
125
7944d3a5 126 outb_p(0x60, WDT_INDEX_IO_PORT); /* Read Index 0x60 */
00b3b3e6 127 addr_h = inb(WDT_DATA_IO_PORT);
789fc0ad 128
7944d3a5 129 outb_p(0x61, WDT_INDEX_IO_PORT); /* Read Index 0x61 */
789fc0ad 130
00b3b3e6 131 addr_l = inb(WDT_DATA_IO_PORT);
789fc0ad
SAMJ
132
133 swc_base_addr = (addr_h << 8) + addr_l;
00b3b3e6 134#ifdef DEBUG
aee334c2
AC
135 printk(KERN_INFO DPFX
136 "Read SWC I/O Base Address: low %d, high %d, res %d\n",
137 addr_l, addr_h, swc_base_addr);
00b3b3e6 138#endif
789fc0ad
SAMJ
139 return swc_base_addr;
140}
141
00b3b3e6
SAMJ
142/* Select Bank 3 of SWC */
143
144static inline void pc87413_swc_bank3(unsigned int swc_base_addr)
789fc0ad
SAMJ
145{
146 /* Step 4: Select Bank3 of SWC */
00b3b3e6 147 outb_p(inb(swc_base_addr + 0x0f) | 0x03, swc_base_addr + 0x0f);
00b3b3e6 148#ifdef DEBUG
789fc0ad 149 printk(KERN_INFO DPFX "Select Bank3 of SWC\n");
00b3b3e6 150#endif
789fc0ad
SAMJ
151}
152
00b3b3e6
SAMJ
153/* Set watchdog timeout to x minutes */
154
155static inline void pc87413_programm_wdto(unsigned int swc_base_addr,
156 char pc87413_time)
789fc0ad
SAMJ
157{
158 /* Step 5: Programm WDTO, Twd. */
00b3b3e6 159 outb_p(pc87413_time, swc_base_addr + WDTO);
00b3b3e6 160#ifdef DEBUG
789fc0ad 161 printk(KERN_INFO DPFX "Set WDTO to %d minutes\n", pc87413_time);
00b3b3e6 162#endif
789fc0ad
SAMJ
163}
164
00b3b3e6
SAMJ
165/* Enable WDEN */
166
167static inline void pc87413_enable_wden(unsigned int swc_base_addr)
789fc0ad
SAMJ
168{
169 /* Step 6: Enable WDEN */
aee334c2 170 outb_p(inb(swc_base_addr + WDCTL) | 0x01, swc_base_addr + WDCTL);
00b3b3e6 171#ifdef DEBUG
789fc0ad 172 printk(KERN_INFO DPFX "Enable WDEN\n");
00b3b3e6 173#endif
789fc0ad
SAMJ
174}
175
00b3b3e6
SAMJ
176/* Enable SW_WD_TREN */
177static inline void pc87413_enable_sw_wd_tren(unsigned int swc_base_addr)
789fc0ad
SAMJ
178{
179 /* Enable SW_WD_TREN */
aee334c2 180 outb_p(inb(swc_base_addr + WDCFG) | 0x80, swc_base_addr + WDCFG);
00b3b3e6 181#ifdef DEBUG
789fc0ad 182 printk(KERN_INFO DPFX "Enable SW_WD_TREN\n");
00b3b3e6 183#endif
789fc0ad
SAMJ
184}
185
00b3b3e6
SAMJ
186/* Disable SW_WD_TREN */
187
188static inline void pc87413_disable_sw_wd_tren(unsigned int swc_base_addr)
789fc0ad
SAMJ
189{
190 /* Disable SW_WD_TREN */
aee334c2 191 outb_p(inb(swc_base_addr + WDCFG) & 0x7f, swc_base_addr + WDCFG);
00b3b3e6 192#ifdef DEBUG
789fc0ad 193 printk(KERN_INFO DPFX "pc87413 - Disable SW_WD_TREN\n");
00b3b3e6 194#endif
789fc0ad
SAMJ
195}
196
00b3b3e6 197/* Enable SW_WD_TRG */
789fc0ad 198
00b3b3e6 199static inline void pc87413_enable_sw_wd_trg(unsigned int swc_base_addr)
789fc0ad 200{
789fc0ad 201 /* Enable SW_WD_TRG */
aee334c2 202 outb_p(inb(swc_base_addr + WDCTL) | 0x80, swc_base_addr + WDCTL);
00b3b3e6 203#ifdef DEBUG
789fc0ad 204 printk(KERN_INFO DPFX "pc87413 - Enable SW_WD_TRG\n");
00b3b3e6 205#endif
789fc0ad
SAMJ
206}
207
00b3b3e6 208/* Disable SW_WD_TRG */
789fc0ad 209
00b3b3e6
SAMJ
210static inline void pc87413_disable_sw_wd_trg(unsigned int swc_base_addr)
211{
789fc0ad 212 /* Disable SW_WD_TRG */
aee334c2 213 outb_p(inb(swc_base_addr + WDCTL) & 0x7f, swc_base_addr + WDCTL);
00b3b3e6 214#ifdef DEBUG
789fc0ad 215 printk(KERN_INFO DPFX "Disable SW_WD_TRG\n");
00b3b3e6 216#endif
789fc0ad
SAMJ
217}
218
00b3b3e6 219/* -- Higher level functions ------------------------------------*/
789fc0ad 220
00b3b3e6 221/* Enable the watchdog */
789fc0ad 222
00b3b3e6 223static void pc87413_enable(void)
789fc0ad 224{
00b3b3e6
SAMJ
225 unsigned int swc_base_addr;
226
227 spin_lock(&io_lock);
789fc0ad
SAMJ
228
229 pc87413_select_wdt_out();
230 pc87413_enable_swc();
231 swc_base_addr = pc87413_get_swc_base();
232 pc87413_swc_bank3(swc_base_addr);
00b3b3e6
SAMJ
233 pc87413_programm_wdto(swc_base_addr, timeout);
234 pc87413_enable_wden(swc_base_addr);
235 pc87413_enable_sw_wd_tren(swc_base_addr);
236 pc87413_enable_sw_wd_trg(swc_base_addr);
237
238 spin_unlock(&io_lock);
789fc0ad
SAMJ
239}
240
00b3b3e6 241/* Disable the watchdog */
789fc0ad 242
00b3b3e6 243static void pc87413_disable(void)
789fc0ad 244{
00b3b3e6
SAMJ
245 unsigned int swc_base_addr;
246
247 spin_lock(&io_lock);
789fc0ad
SAMJ
248
249 pc87413_select_wdt_out();
250 pc87413_enable_swc();
251 swc_base_addr = pc87413_get_swc_base();
252 pc87413_swc_bank3(swc_base_addr);
253 pc87413_disable_sw_wd_tren(swc_base_addr);
254 pc87413_disable_sw_wd_trg(swc_base_addr);
00b3b3e6
SAMJ
255 pc87413_programm_wdto(swc_base_addr, 0);
256
257 spin_unlock(&io_lock);
789fc0ad
SAMJ
258}
259
00b3b3e6 260/* Refresh the watchdog */
789fc0ad 261
00b3b3e6 262static void pc87413_refresh(void)
789fc0ad 263{
00b3b3e6
SAMJ
264 unsigned int swc_base_addr;
265
266 spin_lock(&io_lock);
789fc0ad
SAMJ
267
268 pc87413_select_wdt_out();
269 pc87413_enable_swc();
270 swc_base_addr = pc87413_get_swc_base();
271 pc87413_swc_bank3(swc_base_addr);
00b3b3e6
SAMJ
272 pc87413_disable_sw_wd_tren(swc_base_addr);
273 pc87413_disable_sw_wd_trg(swc_base_addr);
274 pc87413_programm_wdto(swc_base_addr, timeout);
789fc0ad
SAMJ
275 pc87413_enable_wden(swc_base_addr);
276 pc87413_enable_sw_wd_tren(swc_base_addr);
277 pc87413_enable_sw_wd_trg(swc_base_addr);
278
00b3b3e6 279 spin_unlock(&io_lock);
789fc0ad
SAMJ
280}
281
00b3b3e6
SAMJ
282/* -- File operations -------------------------------------------*/
283
284/**
285 * pc87413_open:
286 * @inode: inode of device
287 * @file: file handle to device
288 *
289 */
290
291static int pc87413_open(struct inode *inode, struct file *file)
292{
293 /* /dev/watchdog can only be opened once */
294
295 if (test_and_set_bit(0, &timer_enabled))
296 return -EBUSY;
297
298 if (nowayout)
299 __module_get(THIS_MODULE);
789fc0ad 300
00b3b3e6
SAMJ
301 /* Reload and activate timer */
302 pc87413_refresh();
789fc0ad 303
aee334c2
AC
304 printk(KERN_INFO MODNAME
305 "Watchdog enabled. Timeout set to %d minute(s).\n", timeout);
00b3b3e6
SAMJ
306
307 return nonseekable_open(inode, file);
308}
789fc0ad
SAMJ
309
310/**
00b3b3e6
SAMJ
311 * pc87413_release:
312 * @inode: inode to board
313 * @file: file handle to board
789fc0ad 314 *
00b3b3e6
SAMJ
315 * The watchdog has a configurable API. There is a religious dispute
316 * between people who want their watchdog to be able to shut down and
317 * those who want to be sure if the watchdog manager dies the machine
318 * reboots. In the former case we disable the counters, in the latter
319 * case you have to open it again very soon.
789fc0ad
SAMJ
320 */
321
00b3b3e6 322static int pc87413_release(struct inode *inode, struct file *file)
789fc0ad 323{
00b3b3e6
SAMJ
324 /* Shut off the timer. */
325
326 if (expect_close == 42) {
327 pc87413_disable();
aee334c2
AC
328 printk(KERN_INFO MODNAME
329 "Watchdog disabled, sleeping again...\n");
00b3b3e6 330 } else {
aee334c2
AC
331 printk(KERN_CRIT MODNAME
332 "Unexpected close, not stopping watchdog!\n");
00b3b3e6
SAMJ
333 pc87413_refresh();
334 }
00b3b3e6
SAMJ
335 clear_bit(0, &timer_enabled);
336 expect_close = 0;
00b3b3e6 337 return 0;
789fc0ad
SAMJ
338}
339
00b3b3e6
SAMJ
340/**
341 * pc87413_status:
342 *
343 * return, if the watchdog is enabled (timeout is set...)
344 */
345
346
347static int pc87413_status(void)
789fc0ad 348{
0835caa2 349 return 0; /* currently not supported */
789fc0ad
SAMJ
350}
351
352/**
353 * pc87413_write:
354 * @file: file handle to the watchdog
00b3b3e6
SAMJ
355 * @data: data buffer to write
356 * @len: length in bytes
789fc0ad
SAMJ
357 * @ppos: pointer to the position to write. No seeks allowed
358 *
359 * A write to a watchdog device is defined as a keepalive signal. Any
360 * write of data will do, as we we don't define content meaning.
361 */
362
00b3b3e6
SAMJ
363static ssize_t pc87413_write(struct file *file, const char __user *data,
364 size_t len, loff_t *ppos)
789fc0ad 365{
00b3b3e6
SAMJ
366 /* See if we got the magic character 'V' and reload the timer */
367 if (len) {
368 if (!nowayout) {
369 size_t i;
370
371 /* reset expect flag */
372 expect_close = 0;
373
aee334c2
AC
374 /* scan to see whether or not we got the
375 magic character */
00b3b3e6
SAMJ
376 for (i = 0; i != len; i++) {
377 char c;
7944d3a5 378 if (get_user(c, data + i))
00b3b3e6
SAMJ
379 return -EFAULT;
380 if (c == 'V')
381 expect_close = 42;
382 }
383 }
384
385 /* someone wrote to us, we should reload the timer */
386 pc87413_refresh();
789fc0ad 387 }
00b3b3e6 388 return len;
789fc0ad
SAMJ
389}
390
00b3b3e6 391/**
789fc0ad 392 * pc87413_ioctl:
789fc0ad
SAMJ
393 * @file: file handle to the device
394 * @cmd: watchdog command
395 * @arg: argument pointer
396 *
397 * The watchdog API defines a common set of functions for all watchdogs
398 * according to their available features. We only actually usefully support
399 * querying capabilities and current status.
400 */
401
aee334c2
AC
402static long pc87413_ioctl(struct file *file, unsigned int cmd,
403 unsigned long arg)
789fc0ad 404{
00b3b3e6
SAMJ
405 int new_timeout;
406
407 union {
408 struct watchdog_info __user *ident;
409 int __user *i;
410 } uarg;
411
42747d71 412 static const struct watchdog_info ident = {
00b3b3e6 413 .options = WDIOF_KEEPALIVEPING |
aee334c2
AC
414 WDIOF_SETTIMEOUT |
415 WDIOF_MAGICCLOSE,
00b3b3e6 416 .firmware_version = 1,
7944d3a5 417 .identity = "PC87413(HF/F) watchdog",
789fc0ad
SAMJ
418 };
419
00b3b3e6 420 uarg.i = (int __user *)arg;
789fc0ad 421
aee334c2
AC
422 switch (cmd) {
423 case WDIOC_GETSUPPORT:
424 return copy_to_user(uarg.ident, &ident,
425 sizeof(ident)) ? -EFAULT : 0;
426 case WDIOC_GETSTATUS:
427 return put_user(pc87413_status(), uarg.i);
428 case WDIOC_GETBOOTSTATUS:
429 return put_user(0, uarg.i);
0c06090c
WVS
430 case WDIOC_SETOPTIONS:
431 {
432 int options, retval = -EINVAL;
433 if (get_user(options, uarg.i))
434 return -EFAULT;
435 if (options & WDIOS_DISABLECARD) {
436 pc87413_disable();
437 retval = 0;
438 }
439 if (options & WDIOS_ENABLECARD) {
440 pc87413_enable();
441 retval = 0;
442 }
443 return retval;
444 }
aee334c2
AC
445 case WDIOC_KEEPALIVE:
446 pc87413_refresh();
00b3b3e6 447#ifdef DEBUG
aee334c2 448 printk(KERN_INFO DPFX "keepalive\n");
00b3b3e6 449#endif
aee334c2
AC
450 return 0;
451 case WDIOC_SETTIMEOUT:
452 if (get_user(new_timeout, uarg.i))
453 return -EFAULT;
454 /* the API states this is given in secs */
455 new_timeout /= 60;
456 if (new_timeout < 0 || new_timeout > MAX_TIMEOUT)
457 return -EINVAL;
458 timeout = new_timeout;
459 pc87413_refresh();
460 /* fall through and return the new timeout... */
461 case WDIOC_GETTIMEOUT:
462 new_timeout = timeout * 60;
463 return put_user(new_timeout, uarg.i);
aee334c2
AC
464 default:
465 return -ENOTTY;
789fc0ad 466 }
789fc0ad
SAMJ
467}
468
00b3b3e6
SAMJ
469/* -- Notifier funtions -----------------------------------------*/
470
789fc0ad
SAMJ
471/**
472 * notify_sys:
473 * @this: our notifier block
474 * @code: the event being reported
475 * @unused: unused
476 *
477 * Our notifier is called on system shutdowns. We want to turn the card
478 * off at reboot otherwise the machine will reboot again during memory
479 * test or worse yet during the following fsck. This would suck, in fact
480 * trust me - if it happens it does suck.
481 */
482
00b3b3e6
SAMJ
483static int pc87413_notify_sys(struct notifier_block *this,
484 unsigned long code,
485 void *unused)
789fc0ad 486{
00b3b3e6 487 if (code == SYS_DOWN || code == SYS_HALT)
789fc0ad
SAMJ
488 /* Turn the card off */
489 pc87413_disable();
789fc0ad
SAMJ
490 return NOTIFY_DONE;
491}
492
00b3b3e6 493/* -- Module's structures ---------------------------------------*/
789fc0ad 494
2b8693c0 495static const struct file_operations pc87413_fops = {
789fc0ad 496 .owner = THIS_MODULE,
00b3b3e6 497 .llseek = no_llseek,
789fc0ad 498 .write = pc87413_write,
aee334c2 499 .unlocked_ioctl = pc87413_ioctl,
789fc0ad
SAMJ
500 .open = pc87413_open,
501 .release = pc87413_release,
502};
503
aee334c2 504static struct notifier_block pc87413_notifier = {
00b3b3e6 505 .notifier_call = pc87413_notify_sys,
789fc0ad
SAMJ
506};
507
aee334c2 508static struct miscdevice pc87413_miscdev = {
00b3b3e6
SAMJ
509 .minor = WATCHDOG_MINOR,
510 .name = "watchdog",
7944d3a5 511 .fops = &pc87413_fops,
789fc0ad
SAMJ
512};
513
00b3b3e6 514/* -- Module init functions -------------------------------------*/
789fc0ad
SAMJ
515
516/**
00b3b3e6 517 * pc87413_init: module's "constructor"
789fc0ad
SAMJ
518 *
519 * Set up the WDT watchdog board. All we have to do is grab the
520 * resources we require and bitch if anyone beat us to them.
521 * The open() function will actually kick the board off.
522 */
523
00b3b3e6 524static int __init pc87413_init(void)
789fc0ad
SAMJ
525{
526 int ret;
527
aee334c2
AC
528 printk(KERN_INFO PFX "Version " VERSION " at io 0x%X\n",
529 WDT_INDEX_IO_PORT);
789fc0ad
SAMJ
530
531 /* request_region(io, 2, "pc87413"); */
532
789fc0ad
SAMJ
533 ret = register_reboot_notifier(&pc87413_notifier);
534 if (ret != 0) {
aee334c2
AC
535 printk(KERN_ERR PFX
536 "cannot register reboot notifier (err=%d)\n", ret);
789fc0ad
SAMJ
537 }
538
789fc0ad 539 ret = misc_register(&pc87413_miscdev);
789fc0ad 540 if (ret != 0) {
143a2e54
WVS
541 printk(KERN_ERR PFX
542 "cannot register miscdev on minor=%d (err=%d)\n",
00b3b3e6 543 WATCHDOG_MINOR, ret);
789fc0ad
SAMJ
544 unregister_reboot_notifier(&pc87413_notifier);
545 return ret;
546 }
00b3b3e6 547 printk(KERN_INFO PFX "initialized. timeout=%d min \n", timeout);
00b3b3e6 548 pc87413_enable();
789fc0ad
SAMJ
549 return 0;
550}
551
00b3b3e6
SAMJ
552/**
553 * pc87413_exit: module's "destructor"
554 *
555 * Unload the watchdog. You cannot do this with any file handles open.
556 * If your watchdog is set to continue ticking on close and you unload
557 * it, well it keeps ticking. We won't get the interrupt but the board
558 * will not touch PC memory so all is fine. You just have to load a new
559 * module in 60 seconds or reboot.
560 */
561
562static void __exit pc87413_exit(void)
563{
564 /* Stop the timer before we leave */
aee334c2 565 if (!nowayout) {
00b3b3e6
SAMJ
566 pc87413_disable();
567 printk(KERN_INFO MODNAME "Watchdog disabled.\n");
568 }
569
570 misc_deregister(&pc87413_miscdev);
571 unregister_reboot_notifier(&pc87413_notifier);
7944d3a5 572 /* release_region(io, 2); */
00b3b3e6 573
7944d3a5 574 printk(KERN_INFO MODNAME " watchdog component driver removed.\n");
00b3b3e6 575}
789fc0ad
SAMJ
576
577module_init(pc87413_init);
578module_exit(pc87413_exit);
579
143a2e54
WVS
580MODULE_AUTHOR("Sven Anders <anders@anduras.de>, "
581 "Marcus Junker <junker@anduras.de>,");
789fc0ad 582MODULE_DESCRIPTION("PC87413 WDT driver");
00b3b3e6
SAMJ
583MODULE_LICENSE("GPL");
584
789fc0ad
SAMJ
585MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
586
00b3b3e6 587module_param(io, int, 0);
76550d32
RD
588MODULE_PARM_DESC(io, MODNAME " I/O port (default: "
589 __MODULE_STRING(IO_DEFAULT) ").");
00b3b3e6
SAMJ
590
591module_param(timeout, int, 0);
aee334c2
AC
592MODULE_PARM_DESC(timeout,
593 "Watchdog timeout in minutes (default="
76550d32 594 __MODULE_STRING(DEFAULT_TIMEOUT) ").");
00b3b3e6
SAMJ
595
596module_param(nowayout, int, 0);
aee334c2
AC
597MODULE_PARM_DESC(nowayout,
598 "Watchdog cannot be stopped once started (default="
599 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
00b3b3e6 600