16 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18 #include <linux/module.h>
20 #include <linux/types.h>
21 #include <linux/kernel.h>
24 #include <linux/watchdog.h>
26 #include <linux/bitops.h>
28 #include <mach/hardware.h>
32 static unsigned long wdt_status;
33 static unsigned long boot_status;
36 #define WDT_TICK_RATE (IXP4XX_PERIPHERAL_BUS_CLOCK * 1000000UL)
39 #define WDT_OK_TO_CLOSE 1
41 static void wdt_enable(
void)
49 spin_unlock(&wdt_lock);
52 static void wdt_disable(
void)
58 spin_unlock(&wdt_lock);
72 ixp4xx_wdt_write(
struct file *file,
const char *
data,
size_t len, loff_t *ppos)
80 for (i = 0; i != len; i++) {
97 .identity =
"IXP4xx Watchdog",
101 static long ixp4xx_wdt_ioctl(
struct file *file,
unsigned int cmd,
110 sizeof(ident)) ? -
EFAULT : 0;
118 ret =
put_user(boot_status, (
int *)arg);
131 if (time <= 0 || time > 60) {
147 static int ixp4xx_wdt_release(
struct inode *inode,
struct file *file)
152 pr_crit(
"Device closed unexpectedly - timer will not stop\n");
163 .write = ixp4xx_wdt_write,
164 .unlocked_ioctl = ixp4xx_wdt_ioctl,
165 .open = ixp4xx_wdt_open,
166 .release = ixp4xx_wdt_release,
169 static struct miscdevice ixp4xx_wdt_miscdev = {
172 .fops = &ixp4xx_wdt_fops,
175 static int __init ixp4xx_wdt_init(
void)
180 pr_err(
"Rev. A0 IXP42x CPU detected - watchdog disabled\n");
192 static void __exit ixp4xx_wdt_exit(
void)