linux-mips
[Top] [All Lists]

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

To: Wim Van Sebroeck <wim@iguana.be>
Subject: Re: [PATCH][MIPS][5/7] AR7: watchdog timer
From: Matteo Croce <technoboy85@gmail.com>
Date: Sun, 9 Sep 2007 20:19:43 +0200
Cc: linux-mips@linux-mips.org, Nicolas Thill <nico@openwrt.org>, Enrik Berkhan <Enrik.Berkhan@akk.org>, Christer Weinigel <wingel@nano-system.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:from:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; bh=yu0GIeMpfdgp1EfeLwo0pDWwu3hfQb5Sz5ddMl73ghc=; b=iaZm8ZkWautiqSyxytdnB8y09kBKKVo/c1P2ORsKMpVUZyVPObu8+RNjy2ug2+TNztOFk3ulwptg7GGRYPxM/owJKei/YXAtjBCv9XLs1EX2YFN0wF5AxYdWpx/3g03qn0Row5Nq+gxdxXOHFJWXqSpxx+x6s5AC3fkRbkA2ZMI=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:from:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=chdYL//ocLhEXa5JXNkoUuoIAvMNls0+OLxfw65bmM1iMv9lbYoXKnQ9jBaf6eBL129f8WjZnFPV4dx9FEpuYijPZQANycMnac19gSUXXbQqADvoVQa/xVTD8jQuDkAvJAaiB1wF6gvkkdsb4TTDR7TYTglNh6GIVCU9poGv0Hg=
In-reply-to: <20070909084752.GB2654@infomag.infomag.iguana.be>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <200708201704.11529.technoboy85@gmail.com> <200709061731.26655.technoboy85@gmail.com> <20070909084752.GB2654@infomag.infomag.iguana.be>
Sender: linux-mips-bounce@linux-mips.org
User-agent: KMail/1.9.6 (enterprise 0.20070831.706792)
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

<Prev in Thread] Current Thread [Next in Thread>