1 diff -Nur linux-2.6.15.1/drivers/char/watchdog/wdt_merlot.c linux-2.6.15.1-openwrt/drivers/char/watchdog/wdt_merlot.c
2 --- linux-2.6.15.1/drivers/char/watchdog/wdt_merlot.c 2006-01-26 21:14:02.204626250 -0800
3 +++ linux-2.6.15.1-openwrt/drivers/char/watchdog/wdt_merlot.c 2006-02-02 20:31:43.000000000 -0800
5 +#include <linux/config.h>
6 +#include <linux/module.h>
7 +#include <linux/types.h>
8 +#include <linux/miscdevice.h>
9 +#include <linux/watchdog.h>
10 +#include <linux/fs.h>
13 +#include <asm/uaccess.h>
14 +#include <asm/system.h>
15 +#include <asm/bootinfo.h>
17 +extern unsigned long mips_machtype;
19 +static unsigned long wdt_is_open;
20 +static struct timer_list wdt_timer;
22 +static void wdt_merlot_refresh(void)
24 + volatile __u32 *wdt;
25 + switch (mips_machtype) {
26 + case MACH_ARUBA_AP70:
27 + wdt = (__u32 *) 0xb8030034;
31 + wdt = (__u32 *) 0xbc00300c;
37 +static void wdt_merlot_timer_fn(unsigned long data)
39 + wdt_merlot_refresh();
40 + if (!test_bit(1, &wdt_is_open))
41 + mod_timer(&wdt_timer, jiffies + HZ);
44 +static int wdt_merlot_setup_timer(void)
47 + init_timer(&wdt_timer);
48 + wdt_timer.function = wdt_merlot_timer_fn;
50 + wdt_timer.expires = jiffies + HZ;
51 + add_timer(&wdt_timer);
55 +static int wdt_open(struct inode *inode, struct file *file)
57 + if (test_and_set_bit(0, &wdt_is_open))
59 + set_bit(1, &wdt_is_open);
60 + return nonseekable_open(inode, file);
63 +static ssize_t wdt_write(struct file *file, const char __user * buf, size_t count, loff_t * ppos)
65 + if (count) /* something was written */
66 + wdt_merlot_refresh();
70 +static int wdt_release(struct inode *inode, struct file *file)
72 + clear_bit(0, &wdt_is_open);
76 +static struct file_operations wdt_fops = {
77 + .owner = THIS_MODULE,
78 + .llseek = no_llseek,
81 + .release = wdt_release,
84 +static struct miscdevice wdt_miscdev = {
85 + .minor = WATCHDOG_MINOR,
90 +static void __exit wdt_exit(void)
92 + misc_deregister(&wdt_miscdev);
95 +static int __init wdt_init(void)
98 + ret = misc_register(&wdt_miscdev);
101 + "wdt: cannot register miscdev on minor=%d (err=%d)\n",
102 + WATCHDOG_MINOR, ret);
103 + misc_deregister(&wdt_miscdev);
106 + printk("wdt: registered with refresh\n");
107 + wdt_merlot_refresh();
108 + wdt_merlot_setup_timer();
113 +module_init(wdt_init);
114 +module_exit(wdt_exit);
115 diff -Nur linux-2.6.15.3/drivers/char/watchdog/Makefile linux-2.6.15.3-openwrt/drivers/char/watchdog/Makefile
116 --- linux-2.6.15.3/drivers/char/watchdog/Makefile 2006-02-22 10:04:18.596278000 -0800
117 +++ linux-2.6.15.3-openwrt/drivers/char/watchdog/Makefile 2006-02-22 10:06:21.400960000 -0800
120 # SPARC64 Architecture
122 +# Aruba Architecture
123 +obj-$(CONFIG_MACH_ARUBA) += wdt_merlot.o
125 # Architecture Independant
126 obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o