Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Florian Fainelli <florian@openwrt.org>
To: "linux-mips" <linux-mips@linux-mips.org>
Cc: ralf@linux-mips.org
Subject: [PATCH 2/6] rb532: use physical addresses for gpio and device controller registers
Date: Fri, 22 Aug 2008 00:14:27 +0200	[thread overview]
Message-ID: <200808220014.27497.florian@openwrt.org> (raw)

This patch fixes the misuse of virtual address which would lead to
serious problems while accessing ioremap'd registers in the GPIO
code.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c
index 00a1c78..3d1632c 100644
--- a/arch/mips/rb532/gpio.c
+++ b/arch/mips/rb532/gpio.c
@@ -47,8 +47,8 @@ struct mpmc_device dev3;
 static struct resource rb532_gpio_reg0_res[] = {
 	{
 		.name 	= "gpio_reg0",
-		.start 	= (u32)(IDT434_REG_BASE + GPIOBASE),
-		.end 	= (u32)(IDT434_REG_BASE + GPIOBASE + sizeof(struct rb532_gpio_reg)),
+		.start 	= (REG_BASE + GPIOBASE),
+		.end 	= (REG_BASE + GPIOBASE + sizeof(struct rb532_gpio_reg)),
 		.flags 	= IORESOURCE_MEM,
 	}
 };
@@ -56,8 +56,8 @@ static struct resource rb532_gpio_reg0_res[] = {
 static struct resource rb532_dev3_ctl_res[] = {
 	{
 		.name	= "dev3_ctl",
-		.start	= (u32)(IDT434_REG_BASE + DEV3BASE),
-		.end	= (u32)(IDT434_REG_BASE + DEV3BASE + sizeof(struct dev_reg)),
+		.start	= (REG_BASE + DEV3BASE),
+		.end	= (REG_BASE + DEV3BASE + sizeof(struct dev_reg)),
 		.flags	= IORESOURCE_MEM,
 	}
 };
diff --git a/include/asm-mips/mach-rc32434/rb.h b/include/asm-mips/mach-rc32434/rb.h
index e0a76e3..f229da4 100644
--- a/include/asm-mips/mach-rc32434/rb.h
+++ b/include/asm-mips/mach-rc32434/rb.h
@@ -18,6 +18,7 @@
 #include <linux/genhd.h>
 
 #define IDT434_REG_BASE	((volatile void *) KSEG1ADDR(0x18000000))
+#define REG_BASE	0x18000000
 #define DEV0BASE	0x010000
 #define DEV0MASK	0x010004
 #define DEV0C		0x010008
@@ -43,6 +44,7 @@
 #define GPIOISTAT	0x050010
 #define GPIONMIEN	0x050014
 #define IMASK6		0x038038
+
 #define LO_WPX		(1 << 0)
 #define LO_ALE		(1 << 1)
 #define LO_CLE		(1 << 2)

             reply	other threads:[~2008-08-21 22:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-21 22:14 Florian Fainelli [this message]
2008-08-22  9:37 ` [PATCH 2/6] rb532: use physical addresses for gpio and device controller registers Sergei Shtylyov
2008-08-22 12:51 ` Sergei Shtylyov

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=200808220014.27497.florian@openwrt.org \
    --to=florian@openwrt.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /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