Re: [PATCH][MIPS][5/7] AR7: watchdog timer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Il Sunday 09 September 2007 10:47:52 hai scritto:
> Hi Matteo,
> 
> > Driver for the watchdog timer. It worked with 2.4, doesn't does with 2.6.
> > Apart that it doesn't reboots the device it works :)
> 
> Can you please explain this a bit more? Is this driver working under 2.4
> (and also rebooting the device) but not under 2.6?

Exactly.
A guy had it working with the attached patch but it doesn't works for me.

Cheers,
Matteo

Index: target/linux/ar7-2.6/files/drivers/char/watchdog/ar7_wdt.c
===================================================================
--- target/linux/ar7-2.6/files/drivers/char/watchdog/ar7_wdt.c	(revision 8520)
+++ target/linux/ar7-2.6/files/drivers/char/watchdog/ar7_wdt.c	(working copy)
@@ -76,7 +76,6 @@
 // Offset of the WDT registers
 static unsigned long ar7_regs_wdt;
 // Pointer to the remapped WDT IO space
-static ar7_wdt_t *ar7_wdt;
 static void ar7_wdt_get_regs(void)
 {
     u16 chip_id = ar7_chip_id();
@@ -94,6 +93,8 @@
                      
 static void ar7_wdt_kick(u32 value)
 {
+	volatile ar7_wdt_t *ar7_wdt = (ar7_wdt_t *)ioremap(ar7_regs_wdt, sizeof(ar7_wdt_t));
+
 	ar7_wdt->kick_lock = 0x5555;
 	if ((ar7_wdt->kick_lock & 3) == 1) {
 		ar7_wdt->kick_lock = 0xAAAA;
@@ -107,6 +108,8 @@
 
 static void ar7_wdt_prescale(u32 value)
 {
+	volatile ar7_wdt_t *ar7_wdt = (ar7_wdt_t *)ioremap(ar7_regs_wdt, sizeof(ar7_wdt_t));
+
 	ar7_wdt->prescale_lock = 0x5A5A;
 	if ((ar7_wdt->prescale_lock & 3) == 1) {
 		ar7_wdt->prescale_lock = 0xA5A5;
@@ -120,6 +123,8 @@
 
 static void ar7_wdt_change(u32 value)
 {
+	volatile ar7_wdt_t *ar7_wdt = (ar7_wdt_t *)ioremap(ar7_regs_wdt, sizeof(ar7_wdt_t));
+
 	ar7_wdt->change_lock = 0x6666;
 	if ((ar7_wdt->change_lock & 3) == 1) {
 		ar7_wdt->change_lock = 0xBBBB;
@@ -133,6 +138,8 @@
 
 static void ar7_wdt_disable(u32 value)
 {
+	volatile ar7_wdt_t *ar7_wdt = (ar7_wdt_t *)ioremap(ar7_regs_wdt, sizeof(ar7_wdt_t));
+
 	ar7_wdt->disable_lock = 0x7777;
 	if ((ar7_wdt->disable_lock & 3) == 1) {
 		ar7_wdt->disable_lock = 0xCCCC;
@@ -215,9 +222,6 @@
 static ssize_t ar7_wdt_write(struct file *file, const char *data, 
 			     size_t len, loff_t *ppos)
 {
-	if (ppos != &file->f_pos)
-		return -ESPIPE;
-
 	/* check for a magic close character */
 	if (len) {
 		size_t i;
@@ -304,8 +308,6 @@
 		return -EBUSY;
 	}
 
-	ar7_wdt = (ar7_wdt_t *)ioremap(ar7_regs_wdt, sizeof(ar7_wdt_t));
-
 	ar7_wdt_disable_wdt();
 	ar7_wdt_prescale(prescale_value);
 	ar7_wdt_update_margin(margin);
@@ -337,7 +339,6 @@
 {
         unregister_reboot_notifier(&ar7_wdt_notifier);
 	misc_deregister(&ar7_wdt_miscdev);
-    iounmap(ar7_wdt);
 	release_mem_region(ar7_regs_wdt, sizeof(ar7_wdt_t));
 }
 
Index: target/linux/ar7-2.6/config/default
===================================================================
--- target/linux/ar7-2.6/config/default	(revision 8520)
+++ target/linux/ar7-2.6/config/default	(working copy)
@@ -3,7 +3,7 @@
 # CONFIG_64BIT_PHYS_ADDR is not set
 CONFIG_AR7=y
 CONFIG_AR7_GPIO=y
-# CONFIG_AR7_WDT is not set
+CONFIG_AR7_WDT=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
 # CONFIG_ARCH_SUPPORTS_MSI is not set


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux