All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/5] rb532: use physical addresses for gpio and device controller registers
@ 2008-08-22 15:01 Florian Fainelli
  2008-08-22 21:42 ` Sergei Shtylyov
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2008-08-22 15:01 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

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.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c
index 00a1c78..0628d8d 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 	= 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,
 	}
 };
diff --git a/include/asm-mips/mach-rc32434/rb.h b/include/asm-mips/mach-rc32434/rb.h
index e0a76e3..62ac73c 100644
--- a/include/asm-mips/mach-rc32434/rb.h
+++ b/include/asm-mips/mach-rc32434/rb.h
@@ -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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/5] rb532: use physical addresses for gpio and device controller registers
  2008-08-22 15:01 [PATCH 2/5] rb532: use physical addresses for gpio and device controller registers Florian Fainelli
@ 2008-08-22 21:42 ` Sergei Shtylyov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2008-08-22 21:42 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: linux-mips, ralf

Hello.

Florian Fainelli wrote:

> 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.
>
> Signed-off-by: Florian Fainelli <florian@openwrt.org>
> ---
> diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c
> index 00a1c78..0628d8d 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 	= 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,
>   

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

WBR, Sergei

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-22 21:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-22 15:01 [PATCH 2/5] rb532: use physical addresses for gpio and device controller registers Florian Fainelli
2008-08-22 21:42 ` Sergei Shtylyov

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.