Skip to contentSkip to conversation

rb532: use physical addresses for gpio and device controller registers

PATCH In review Florian Fainelli 2 participants 2 messages Aug 22, 2008 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 2/5 rb532: use physical addresses for gpio and device controller registers

This patch fixes the misuse of virtual addresses for the GPIO and third device controller which would lead to problems while accessing ioremap'd registers.

---

arch/mips/rb532/gpio.c +4 -4
index 00a1c78..0628d8d 100644
@@ -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 	= REGBASE + GPIOBASE,
+		.end 	= REGBASE + GPIOBASE + sizeof(struct rb532_gpio_reg) -1,
 		.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	= REGBASE + DEV3BASE,
+		.end	= REGBASE + DEV3BASE + sizeof(struct dev_reg) -1,
 		.flags	= IORESOURCE_MEM,
 	}
 };
include/asm-mips/mach-rc32434/rb.h +2 -1
index e0a76e3..62ac73c 100644
@@ -17,7 +17,8 @@
 
 #include <linux/genhd.h>
 
-#define IDT434_REG_BASE	((volatile void *) KSEG1ADDR(0x18000000))
+#define REGBASE		0x18000000
+#define IDT434_REG_BASE	((volatile void *) KSEG1ADDR(REGBASE))
 #define DEV0BASE	0x010000
 #define DEV0MASK	0x010004
 #define DEV0C		0x010008
#1 lore raw

Hello.

Quoted 22 lines · Florian Fainelli

This patch fixes the misuse of virtual addresses for the GPIO and third device controller which would lead to problems while accessing ioremap'd registers.

---

arch/mips/rb532/gpio.c +2 -2
index 00a1c78..0628d8d 100644
@@ -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 	= REGBASE + GPIOBASE,
+		.end 	= REGBASE + GPIOBASE + sizeof(struct rb532_gpio_reg) -1,
 		.flags 	= IORESOURCE_MEM,
 	}
 };

arch/mips/rb532/gpio.c static struct resource rb532_gpio_reg0_res[] = { · line 61

Quoted 8 lines
arch/mips/rb532/gpio.c +2 -2
@@ -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	= REGBASE + DEV3BASE,
+		.end	= REGBASE + DEV3BASE + sizeof(struct dev_reg) -1,
 

Hm, your spacing is inconsistent. Why no space after -?

WBR, Sergei