mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Dale Farnsworth" <dale@farnsworth.org>
To: Wim Van Sebroeck <wim@iguana.be>, linux-kernel@vger.kernel.org
Subject: [PATCH 02/11] mv64x60_wdt: Get register address from platform data
Date: Tue, 24 Jul 2007 11:09:18 -0700	[thread overview]
Message-ID: <20070724180917.GB27445@xyzzy.farnsworth.org> (raw)
In-Reply-To: <20070724180738.GA27445@xyzzy.farnsworth.org>

Previously, the address of the watchdog timer registers was
retrieved by calling a global function, mv64x60_get_bridge_vbase().
That function doesn't exist in arch/powerpc.  Instead, we now get
the register address from a platform data resource and ioremap
the registers within the driver.

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
---
 drivers/char/watchdog/mv64x60_wdt.c |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

Index: linux-2.6-powerpc-wdt/drivers/char/watchdog/mv64x60_wdt.c
===================================================================
--- linux-2.6-powerpc-wdt.orig/drivers/char/watchdog/mv64x60_wdt.c	2007-07-18 23:12:48.000000000 +0000
+++ linux-2.6-powerpc-wdt/drivers/char/watchdog/mv64x60_wdt.c	2007-07-19 00:05:37.000000000 +0000
@@ -27,6 +27,8 @@
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
+#define MV64x60_WDT_WDC_OFFSET	0
+
 /* MV64x60 WDC (config) register access definitions */
 #define MV64x60_WDC_CTL1_MASK	(3 << 24)
 #define MV64x60_WDC_CTL1(val)	((val & 3) << 24)
@@ -39,7 +41,7 @@
 
 static unsigned long wdt_flags;
 static int wdt_status;
-static void __iomem *mv64x60_regs;
+static void __iomem *mv64x60_wdt_regs;
 static int mv64x60_wdt_timeout;
 
 static void mv64x60_wdt_reg_write(u32 val)
@@ -47,10 +49,10 @@ static void mv64x60_wdt_reg_write(u32 va
 	/* Allow write only to CTL1 / CTL2 fields, retaining values in
 	 * other fields.
 	 */
-	u32 data = readl(mv64x60_regs + MV64x60_WDT_WDC);
+	u32 data = readl(mv64x60_wdt_regs + MV64x60_WDT_WDC_OFFSET);
 	data &= ~(MV64x60_WDC_CTL1_MASK | MV64x60_WDC_CTL2_MASK);
 	data |= val;
-	writel(data, mv64x60_regs + MV64x60_WDT_WDC);
+	writel(data, mv64x60_wdt_regs + MV64x60_WDT_WDC_OFFSET);
 }
 
 static void mv64x60_wdt_service(void)
@@ -185,6 +187,7 @@ static int __devinit mv64x60_wdt_probe(s
 {
 	struct mv64x60_wdt_pdata *pdata = dev->dev.platform_data;
 	int bus_clk = 133;
+	struct resource *r;
 
 	mv64x60_wdt_timeout = 10;
 	if (pdata) {
@@ -192,10 +195,16 @@ static int __devinit mv64x60_wdt_probe(s
 		bus_clk = pdata->bus_clk;
 	}
 
-	mv64x60_regs = mv64x60_get_bridge_vbase();
+	r = platform_get_resource(dev, IORESOURCE_MEM, 0);
+	if (!r)
+		return -ENODEV;
+
+	mv64x60_wdt_regs = ioremap(r->start, r->end - r->start + 1);
+	if (mv64x60_wdt_regs == NULL)
+		return -ENOMEM;
 
 	writel((mv64x60_wdt_timeout * (bus_clk * 1000000)) >> 8,
-	       mv64x60_regs + MV64x60_WDT_WDC);
+	       mv64x60_wdt_regs + MV64x60_WDT_WDC_OFFSET);
 
 	return misc_register(&mv64x60_wdt_miscdev);
 }
@@ -207,6 +216,8 @@ static int __devexit mv64x60_wdt_remove(
 	mv64x60_wdt_service();
 	mv64x60_wdt_handler_disable();
 
+	iounmap(mv64x60_wdt_regs);
+
 	return 0;
 }
 


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

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-24 18:07 [PATCH 01/11] mv64x60_wdt: set up platform_device in platform code Dale Farnsworth
2007-07-24 18:09 ` Dale Farnsworth [this message]
2007-07-24 18:12 ` [PATCH 03/11] mv64x60_wdt: Add arch/powerpc platform support Dale Farnsworth
2007-07-24 18:13 ` [PATCH 04/11] mv64x60_wdt: Check return value of nonseekable_open Dale Farnsworth
2007-07-24 18:14 ` [PATCH 05/11] mv64x60_wdt: Fix WDIOC_GETTIMEOUT return value Dale Farnsworth
2007-07-24 18:15 ` [PATCH 06/11] mv64x60_wdt: Support for WDIOC_SETTIMEOUT ioctl Dale Farnsworth
2007-07-24 18:16 ` [PATCH 07/11] mv64x60_wdt: Add WDIOC_SETOPTIONS ioctl support Dale Farnsworth
2007-07-24 18:17 ` [PATCH 08/11] mv64x60_wdt: Add a module parameter to change nowayout setting Dale Farnsworth
2007-07-24 18:18 ` [PATCH 09/11] mv64x60_wdt: Support the WDIOF_MAGICCLOSE feature Dale Farnsworth
2007-07-24 18:19 ` [PATCH 10/11] mv64x60_wdt: disable watchdog timer when driver is probed Dale Farnsworth
2007-07-24 18:20 ` [PATCH 11/11] mv64x60_wdt_cleanup_low_level_wdt_code.patch Dale Farnsworth
2007-07-24 18:31   ` [PATCH 11/11, corrected] mv64x60_wdt: Rework the timeout register manipulation Dale Farnsworth

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=20070724180917.GB27445@xyzzy.farnsworth.org \
    --to=dale@farnsworth.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wim@iguana.be \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®