summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormbm <mbm@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-04-14 22:11:32 +0000
committermbm <mbm@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-04-14 22:11:32 +0000
commit3855bdc4e0c3acf2496f36e3d4b696dd0b4deefc (patch)
tree079984da9bedbfce95f9edfb95b6e80e5b732d1a
parent2cd40a317e7be8fea237d2377105826a7ac56113 (diff)
hardware watchdog
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@3655 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--openwrt/target/linux/aruba-2.6/patches/000-aruba.patch41
-rw-r--r--openwrt/target/linux/aruba-2.6/patches/004-wdt.patch157
2 files changed, 159 insertions, 39 deletions
diff --git a/openwrt/target/linux/aruba-2.6/patches/000-aruba.patch b/openwrt/target/linux/aruba-2.6/patches/000-aruba.patch
index 34fbaf2de..0cf61f02e 100644
--- a/openwrt/target/linux/aruba-2.6/patches/000-aruba.patch
+++ b/openwrt/target/linux/aruba-2.6/patches/000-aruba.patch
@@ -45,7 +45,7 @@ diff -Nur linux-2.6.16/arch/mips/aruba/Makefile linux-2.6.16-owrt/arch/mips/arub
+# .S.o:
+# $(CC) $(CFLAGS) -c $< -o $*.o
+
-+obj-y := prom.o setup.o idtIRQ.o irq.o time.o flash_lock.o wdt_merlot.o
++obj-y := prom.o setup.o idtIRQ.o irq.o time.o flash_lock.o
+obj-$(CONFIG_SERIAL_8250) += serial.o
+
+subdir-y += nvram
@@ -783,7 +783,7 @@ diff -Nur linux-2.6.16/arch/mips/aruba/serial.c linux-2.6.16-owrt/arch/mips/arub
diff -Nur linux-2.6.16/arch/mips/aruba/setup.c linux-2.6.16-owrt/arch/mips/aruba/setup.c
--- linux-2.6.16/arch/mips/aruba/setup.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.16-owrt/arch/mips/aruba/setup.c 2006-03-20 14:30:00.000000000 +0100
-@@ -0,0 +1,125 @@
+@@ -0,0 +1,122 @@
+/**************************************************************************
+ *
+ * BRIEF MODULE DESCRIPTION
@@ -872,7 +872,6 @@ diff -Nur linux-2.6.16/arch/mips/aruba/setup.c linux-2.6.16-owrt/arch/mips/aruba
+
+extern char * getenv(char *e);
+extern void unlock_ap60_70_flash(void);
-+extern void wdt_merlot_disable(void);
+
+void __init plat_setup(void)
+{
@@ -895,8 +894,6 @@ diff -Nur linux-2.6.16/arch/mips/aruba/setup.c linux-2.6.16-owrt/arch/mips/aruba
+
+ printk("BOARD - %s\n",getenv("boardname"));
+
-+ wdt_merlot_disable();
-+
+ return 0;
+}
+
@@ -1021,40 +1018,6 @@ diff -Nur linux-2.6.16/arch/mips/aruba/time.c linux-2.6.16-owrt/arch/mips/aruba/
+ timer_interrupt(irq, NULL, regs);
+ irq_exit();
+}
-diff -Nur linux-2.6.16/arch/mips/aruba/wdt_merlot.c linux-2.6.16-owrt/arch/mips/aruba/wdt_merlot.c
---- linux-2.6.16/arch/mips/aruba/wdt_merlot.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.16-owrt/arch/mips/aruba/wdt_merlot.c 2006-03-20 14:25:10.000000000 +0100
-@@ -0,0 +1,30 @@
-+#include <linux/config.h>
-+#include <linux/kernel.h>
-+#include <asm/bootinfo.h>
-+
-+void wdt_merlot_disable()
-+{
-+ volatile __u32 *wdt_errcs;
-+ volatile __u32 *wdt_wtc;
-+ volatile __u32 *wdt_ctl;
-+ volatile __u32 val;
-+
-+ switch (mips_machtype) {
-+ case MACH_ARUBA_AP70:
-+ wdt_errcs = (__u32 *) 0xb8030030;
-+ wdt_wtc = (__u32 *) 0xb803003c;
-+ val = *wdt_errcs;
-+ val &= ~0x201;
-+ *wdt_errcs = val;
-+ val = *wdt_wtc;
-+ val &= ~0x1;
-+ *wdt_wtc = val;
-+ break;
-+ case MACH_ARUBA_AP65:
-+ case MACH_ARUBA_AP60:
-+ default:
-+ wdt_ctl = (__u32 *) 0xbc003008;
-+ *wdt_ctl = 0;
-+ break;
-+ }
-+}
diff -Nur linux-2.6.16/arch/mips/Kconfig linux-2.6.16-owrt/arch/mips/Kconfig
--- linux-2.6.16/arch/mips/Kconfig 2006-03-20 06:53:29.000000000 +0100
+++ linux-2.6.16-owrt/arch/mips/Kconfig 2006-03-20 14:25:10.000000000 +0100
diff --git a/openwrt/target/linux/aruba-2.6/patches/004-wdt.patch b/openwrt/target/linux/aruba-2.6/patches/004-wdt.patch
new file mode 100644
index 000000000..cb2e76e78
--- /dev/null
+++ b/openwrt/target/linux/aruba-2.6/patches/004-wdt.patch
@@ -0,0 +1,157 @@
+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
+--- linux-2.6.15.1/drivers/char/watchdog/wdt_merlot.c 2006-01-26 21:14:02.204626250 -0800
++++ linux-2.6.15.1-openwrt/drivers/char/watchdog/wdt_merlot.c 2006-02-02 20:31:43.000000000 -0800
+@@ -0,0 +1,141 @@
++#include <linux/config.h>
++#include <linux/module.h>
++#include <linux/types.h>
++#include <linux/miscdevice.h>
++#include <linux/watchdog.h>
++#include <linux/fs.h>
++
++#include <asm/io.h>
++#include <asm/uaccess.h>
++#include <asm/system.h>
++#include <asm/bootinfo.h>
++
++// refresh the watchdog timer for this many seconds in kernel
++// before letting the watchdog process take over.
++#define WDT_COUNT 60
++
++extern unsigned long mips_machtype;
++
++static unsigned long wdt_is_open;
++static struct timer_list wdt_timer;
++static int wdt_count = WDT_COUNT;
++
++static void wdt_merlot_refresh(void){
++ volatile __u32 *wdt;
++ switch (mips_machtype) {
++ case MACH_ARUBA_AP70:
++ wdt = (__u32 *)0xb8030034;
++ *wdt = 0x10000000;
++ break;
++ default:
++ wdt = (__u32 *)0xbc00300c;
++ *wdt = 0x40000000;
++ break;
++ }
++}
++
++static void wdt_merlot_disable()
++{
++ volatile __u32 *wdt_errcs;
++ volatile __u32 *wdt_wtc;
++ volatile __u32 *wdt_ctl;
++ volatile __u32 val ;
++
++ switch (mips_machtype) {
++ case MACH_ARUBA_AP70:
++ wdt_errcs = (__u32 *)0xb8030030 ;
++ wdt_wtc = (__u32 *)0xb803003c ;
++ val = *wdt_errcs ;
++ val &= ~0x201 ;
++ *wdt_errcs = val ;
++ val = *wdt_wtc ;
++ val &= ~0x1 ;
++ *wdt_wtc = val ;
++ break;
++ default:
++ wdt_ctl = (__u32 *)0xbc003008;
++ *wdt_ctl = 0 ;
++ break;
++ }
++}
++
++static void wdt_merlot_timer_fn(unsigned long data){
++
++ wdt_merlot_refresh();
++ if (--wdt_count >= 0)
++ mod_timer(&wdt_timer, jiffies + HZ);
++ else
++ wdt_merlot_disable();
++
++}
++
++static int wdt_merlot_setup_timer(void){
++
++ init_timer(&wdt_timer);
++ wdt_timer.function = wdt_merlot_timer_fn;
++ wdt_timer.data = 0;
++ wdt_timer.expires = jiffies + HZ;
++ add_timer(&wdt_timer);
++ return 0;
++}
++
++static int wdt_open(struct inode *inode, struct file *file)
++{
++ if(test_and_set_bit(0, &wdt_is_open))
++ return -EBUSY;
++ wdt_count=0;
++ return nonseekable_open(inode, file);
++}
++
++static ssize_t wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
++{
++ if (count) { /* something was written */
++ wdt_merlot_refresh();
++ }
++ return count;
++}
++
++static int wdt_release(struct inode *inode, struct file *file)
++{
++ clear_bit(0, &wdt_is_open);
++ return 0;
++}
++
++static struct file_operations wdt_fops = {
++ .owner = THIS_MODULE,
++ .llseek = no_llseek,
++ .write = wdt_write,
++ .open = wdt_open,
++ .release = wdt_release,
++};
++
++static struct miscdevice wdt_miscdev = {
++ .minor = WATCHDOG_MINOR,
++ .name = "watchdog",
++ .fops = &wdt_fops,
++};
++
++static void __exit wdt_exit(void)
++{
++ misc_deregister(&wdt_miscdev);
++}
++
++static int __init wdt_init(void)
++{
++ int ret;
++ ret = misc_register(&wdt_miscdev);
++ if (ret) {
++ printk(KERN_ERR "wdt: cannot register miscdev on minor=%d (err=%d)\n",
++ WATCHDOG_MINOR, ret);
++ misc_deregister(&wdt_miscdev);
++ goto out;
++ }
++ printk("wdt: registered with refresh\n");
++ wdt_merlot_refresh();
++ wdt_merlot_setup_timer();
++out:
++ return ret;
++}
++
++module_init(wdt_init);
++module_exit(wdt_exit);
+diff -Nur linux-2.6.15.3/drivers/char/watchdog/Makefile linux-2.6.15.3-openwrt/drivers/char/watchdog/Makefile
+--- linux-2.6.15.3/drivers/char/watchdog/Makefile 2006-02-22 10:04:18.596278000 -0800
++++ linux-2.6.15.3-openwrt/drivers/char/watchdog/Makefile 2006-02-22 10:06:21.400960000 -0800
+@@ -71,5 +71,8 @@
+
+ # SPARC64 Architecture
+
++# Aruba Architecture
++obj-$(CONFIG_MACH_ARUBA) += wdt_merlot.o
++
+ # Architecture Independant
+ obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o