* [PATCH] rb532: gpio register offsets are relatives to GPIOBASE
@ 2008-10-26 10:12 Florian Fainelli
2008-10-31 13:24 ` Phil Sutter
0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2008-10-26 10:12 UTC (permalink / raw)
To: Phil Sutter; +Cc: Ralf Baechle, linux-mips
This patch fixes the wrong use of GPIO register offsets
in devices.c. To avoid further problems, use gpio_get_value
to return the NAND status instead of our own expanded code.
Signef-off-by: Phil Sutter <n0-1@freewrt.org>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/arch/mips/include/asm/mach-rc32434/rb.h b/arch/mips/include/asm/mach-rc32434/rb.h
index 79e8ef6..0cb9466 100644
--- a/arch/mips/include/asm/mach-rc32434/rb.h
+++ b/arch/mips/include/asm/mach-rc32434/rb.h
@@ -40,12 +40,13 @@
#define BTCS 0x010040
#define BTCOMPARE 0x010044
#define GPIOBASE 0x050000
-#define GPIOCFG 0x050004
-#define GPIOD 0x050008
-#define GPIOILEVEL 0x05000C
-#define GPIOISTAT 0x050010
-#define GPIONMIEN 0x050014
-#define IMASK6 0x038038
+/* Offsets relative to GPIOBASE */
+#define GPIOCFG 0x04
+#define GPIOD 0x08
+#define GPIOILEVEL 0x0C
+#define GPIOISTAT 0x10
+#define GPIONMIEN 0x14
+#define IMASK6 0x38
#define LO_WPX (1 << 0)
#define LO_ALE (1 << 1)
#define LO_CLE (1 << 2)
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
index 31619c6..c40be04 100644
--- a/arch/mips/rb532/devices.c
+++ b/arch/mips/rb532/devices.c
@@ -118,7 +118,7 @@ static struct platform_device cf_slot0 = {
/* Resources and device for NAND */
static int rb532_dev_ready(struct mtd_info *mtd)
{
- return readl(IDT434_REG_BASE + GPIOD) & GPIO_RDY;
+ return gpio_get_value(GPIO_RDY);
}
static void rb532_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] rb532: gpio register offsets are relatives to GPIOBASE
2008-10-26 10:12 [PATCH] rb532: gpio register offsets are relatives to GPIOBASE Florian Fainelli
@ 2008-10-31 13:24 ` Phil Sutter
2008-10-31 14:47 ` Ralf Baechle
0 siblings, 1 reply; 3+ messages in thread
From: Phil Sutter @ 2008-10-31 13:24 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Florian Fainelli
From: Florian Fainelli <florian@openwrt.org>
This patch fixes the wrong use of GPIO register offsets
in devices.c. To avoid further problems, use gpio_get_value
to return the NAND status instead of our own expanded code.
Also define the zero offset of the alternate function register to allow
consistent access.
Signef-off-by: Phil Sutter <n0-1@freewrt.org>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/mips/include/asm/mach-rc32434/rb.h | 14 ++++++++------
arch/mips/rb532/devices.c | 2 +-
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/arch/mips/include/asm/mach-rc32434/rb.h b/arch/mips/include/asm/mach-rc32434/rb.h
index 79e8ef6..f25a849 100644
--- a/arch/mips/include/asm/mach-rc32434/rb.h
+++ b/arch/mips/include/asm/mach-rc32434/rb.h
@@ -40,12 +40,14 @@
#define BTCS 0x010040
#define BTCOMPARE 0x010044
#define GPIOBASE 0x050000
-#define GPIOCFG 0x050004
-#define GPIOD 0x050008
-#define GPIOILEVEL 0x05000C
-#define GPIOISTAT 0x050010
-#define GPIONMIEN 0x050014
-#define IMASK6 0x038038
+/* Offsets relative to GPIOBASE */
+#define GPIOFUNC 0x00
+#define GPIOCFG 0x04
+#define GPIOD 0x08
+#define GPIOILEVEL 0x0C
+#define GPIOISTAT 0x10
+#define GPIONMIEN 0x14
+#define IMASK6 0x38
#define LO_WPX (1 << 0)
#define LO_ALE (1 << 1)
#define LO_CLE (1 << 2)
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
index 31619c6..c40be04 100644
--- a/arch/mips/rb532/devices.c
+++ b/arch/mips/rb532/devices.c
@@ -118,7 +118,7 @@ static struct platform_device cf_slot0 = {
/* Resources and device for NAND */
static int rb532_dev_ready(struct mtd_info *mtd)
{
- return readl(IDT434_REG_BASE + GPIOD) & GPIO_RDY;
+ return gpio_get_value(GPIO_RDY);
}
static void rb532_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
--
1.5.6.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rb532: gpio register offsets are relatives to GPIOBASE
2008-10-31 13:24 ` Phil Sutter
@ 2008-10-31 14:47 ` Ralf Baechle
0 siblings, 0 replies; 3+ messages in thread
From: Ralf Baechle @ 2008-10-31 14:47 UTC (permalink / raw)
To: Phil Sutter; +Cc: linux-mips, Florian Fainelli
On Fri, Oct 31, 2008 at 02:24:29PM +0100, Phil Sutter wrote:
> From: Florian Fainelli <florian@openwrt.org>
>
> This patch fixes the wrong use of GPIO register offsets
> in devices.c. To avoid further problems, use gpio_get_value
> to return the NAND status instead of our own expanded code.
>
> Also define the zero offset of the alternate function register to allow
> consistent access.
>
> Signef-off-by: Phil Sutter <n0-1@freewrt.org>
> Signed-off-by: Florian Fainelli <florian@openwrt.org>
Thanks, applied - with the SOBs fixed up.
Ralf
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-01 8:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-26 10:12 [PATCH] rb532: gpio register offsets are relatives to GPIOBASE Florian Fainelli
2008-10-31 13:24 ` Phil Sutter
2008-10-31 14:47 ` Ralf Baechle
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.