Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
- Som code taken from:
+ Some code taken from:
National Semiconductor PC87307/PC97307 (ala SC1200) WDT driver
(c) Copyright 2002 Zwane Mwaikambo <zwane@commfireservices.com>
MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
-#ifndef CONFIG_WATCHDOG_NOWAYOUT
-#define CONFIG_WATCHDOG_NOWAYOUT 0
-#endif
-
static int margin = 60; /* in seconds */
module_param(margin, int, 0);
MODULE_PARM_DESC(margin, "Watchdog margin in seconds");
-static int nowayout = CONFIG_WATCHDOG_NOWAYOUT;
+static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close");
static void scx200_wdt_ping(void)
{
- outw(wdto_restart, SCx200_CB_BASE + SCx200_WDT_WDTO);
+ outw(wdto_restart, scx200_cb_base + SCx200_WDT_WDTO);
}
static void scx200_wdt_update_margin(void)
printk(KERN_DEBUG NAME ": enabling watchdog timer, wdto_restart = %d\n",
wdto_restart);
- outw(0, SCx200_CB_BASE + SCx200_WDT_WDTO);
- outb(SCx200_WDT_WDSTS_WDOVF, SCx200_CB_BASE + SCx200_WDT_WDSTS);
- outw(W_ENABLE, SCx200_CB_BASE + SCx200_WDT_WDCNFG);
+ outw(0, scx200_cb_base + SCx200_WDT_WDTO);
+ outb(SCx200_WDT_WDSTS_WDOVF, scx200_cb_base + SCx200_WDT_WDSTS);
+ outw(W_ENABLE, scx200_cb_base + SCx200_WDT_WDCNFG);
scx200_wdt_ping();
}
{
printk(KERN_DEBUG NAME ": disabling watchdog timer\n");
- outw(0, SCx200_CB_BASE + SCx200_WDT_WDTO);
- outb(SCx200_WDT_WDSTS_WDOVF, SCx200_CB_BASE + SCx200_WDT_WDSTS);
- outw(W_DISABLE, SCx200_CB_BASE + SCx200_WDT_WDCNFG);
+ outw(0, scx200_cb_base + SCx200_WDT_WDTO);
+ outb(SCx200_WDT_WDSTS_WDOVF, scx200_cb_base + SCx200_WDT_WDSTS);
+ outw(W_DISABLE, scx200_cb_base + SCx200_WDT_WDCNFG);
}
static int scx200_wdt_open(struct inode *inode, struct file *file)
static struct file_operations scx200_wdt_fops = {
.owner = THIS_MODULE,
+ .llseek = no_llseek,
.write = scx200_wdt_write,
.ioctl = scx200_wdt_ioctl,
.open = scx200_wdt_open,
static struct miscdevice scx200_wdt_miscdev = {
.minor = WATCHDOG_MINOR,
- .name = NAME,
+ .name = "watchdog",
.fops = &scx200_wdt_fops,
};
printk(KERN_DEBUG NAME ": NatSemi SCx200 Watchdog Driver\n");
- /*
- * First check that this really is a NatSemi SCx200 CPU or a Geode
- * SC1100 processor
- */
- if ((pci_find_device(PCI_VENDOR_ID_NS,
- PCI_DEVICE_ID_NS_SCx200_BRIDGE,
- NULL)) == NULL
- && (pci_find_device(PCI_VENDOR_ID_NS,
- PCI_DEVICE_ID_NS_SC1100_BRIDGE,
- NULL)) == NULL)
- return -ENODEV;
-
- /* More sanity checks, verify that the configuration block is there */
- if (!scx200_cb_probe(SCx200_CB_BASE)) {
- printk(KERN_WARNING NAME ": no configuration block found\n");
+ /* check that we have found the configuration block */
+ if (!scx200_cb_present())
return -ENODEV;
- }
- if (!request_region(SCx200_CB_BASE + SCx200_WDT_OFFSET,
+ if (!request_region(scx200_cb_base + SCx200_WDT_OFFSET,
SCx200_WDT_SIZE,
"NatSemi SCx200 Watchdog")) {
printk(KERN_WARNING NAME ": watchdog I/O region busy\n");
r = misc_register(&scx200_wdt_miscdev);
if (r) {
- release_region(SCx200_CB_BASE + SCx200_WDT_OFFSET,
+ release_region(scx200_cb_base + SCx200_WDT_OFFSET,
SCx200_WDT_SIZE);
return r;
}
if (r) {
printk(KERN_ERR NAME ": unable to register reboot notifier");
misc_deregister(&scx200_wdt_miscdev);
- release_region(SCx200_CB_BASE + SCx200_WDT_OFFSET,
+ release_region(scx200_cb_base + SCx200_WDT_OFFSET,
SCx200_WDT_SIZE);
return r;
}
{
unregister_reboot_notifier(&scx200_wdt_notifier);
misc_deregister(&scx200_wdt_miscdev);
- release_region(SCx200_CB_BASE + SCx200_WDT_OFFSET,
+ release_region(scx200_cb_base + SCx200_WDT_OFFSET,
SCx200_WDT_SIZE);
}