All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matteo Croce <technoboy85@gmail.com>
To: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-mips@linux-mips.org, Nicolas Thill <nico@openwrt.org>,
	Enrik Berkhan <Enrik.Berkhan@akk.org>,
	Christer Weinigel <wingel@nano-system.com>
Subject: Re: [PATCH][MIPS][5/7] AR7: watchdog timer
Date: Sun, 9 Sep 2007 20:19:43 +0200	[thread overview]
Message-ID: <200709092019.43471.technoboy85@gmail.com> (raw)
In-Reply-To: <20070909084752.GB2654@infomag.infomag.iguana.be>

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

  reply	other threads:[~2007-09-09 18:20 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-20 15:04 [PATCH 1/1] AR7 port Matteo Croce
2007-08-22  8:10 ` Florian Fainelli
2007-09-03 12:15 ` [PATCH 0/7] AR7 port 2nd round Florian Fainelli
2007-09-06 15:16 ` [PATCH][MIPS][0/7] AR7: third chance Matteo Croce
2007-09-06 15:23 ` [PATCH][MIPS][2/7] AR7: mtd Matteo Croce
2007-09-06 15:23   ` Matteo Croce
2007-09-06 15:41   ` David Woodhouse
2007-09-06 15:41     ` David Woodhouse
2007-09-06 15:27 ` [PATCH][MIPS][3/7] AR7: gpio char device Matteo Croce
2007-09-06 15:30 ` [PATCH][MIPS][4/7] AR7: leds driver Matteo Croce
2007-09-06 15:31 ` [PATCH][MIPS][5/7] AR7: watchdog timer Matteo Croce
2007-09-09  8:47   ` Wim Van Sebroeck
2007-09-09 18:19     ` Matteo Croce [this message]
2007-09-09 18:27       ` Florian Fainelli
2007-09-10  8:06         ` Thomas Bogendoerfer
2007-09-10  9:00           ` Thomas Bogendoerfer
2007-09-11 19:54             ` Matteo Croce
2007-09-11 20:34               ` Thomas Bogendoerfer
2007-09-12 19:41       ` Wim Van Sebroeck
2007-09-06 15:33 ` [PATCH][MIPS][6/7] AR7: serial Matteo Croce
2007-09-06 15:34 ` [PATCH][MIPS][7/7] AR7: ethernet Matteo Croce
2007-09-06 22:30   ` Andrew Morton
2007-09-06 23:04     ` Randy Dunlap
2007-09-06 23:21     ` Matteo Croce
2007-09-07  0:41       ` Andrew Morton
2007-09-07 23:04       ` Jeff Garzik
2007-09-07  7:10     ` Geert Uytterhoeven
     [not found] <200709080143.12345.technoboy85@gmail.com>
2007-09-08  0:21 ` [PATCH][MIPS][5/7] AR7: watchdog timer Matteo Croce
  -- strict thread matches above, loose matches on Subject: below --
2007-09-20 15:28 [PATCH][MIPS][0/7] AR7: 4th effort Matteo Croce
2007-09-20 16:06 ` [PATCH][MIPS][5/7] AR7: watchdog timer Matteo Croce
2007-10-03 19:24   ` Wim Van Sebroeck
2007-10-03 20:17     ` Matteo Croce
2007-10-07 20:31       ` Wim Van Sebroeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200709092019.43471.technoboy85@gmail.com \
    --to=technoboy85@gmail.com \
    --cc=Enrik.Berkhan@akk.org \
    --cc=linux-mips@linux-mips.org \
    --cc=nico@openwrt.org \
    --cc=wim@iguana.be \
    --cc=wingel@nano-system.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.