Skip to content

Commit 1b43284

Browse files
ffainelliralfbaechle
authored andcommitted
MIPS: RB532: GPIO register offsets are relative to GPIOBASE
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. Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: Phil Sutter <[email protected]> Signed-off-by: Ralf Baechle <[email protected]>
1 parent 9e86786 commit 1b43284

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

arch/mips/include/asm/mach-rc32434/rb.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@
4040
#define BTCS 0x010040
4141
#define BTCOMPARE 0x010044
4242
#define GPIOBASE 0x050000
43-
#define GPIOCFG 0x050004
44-
#define GPIOD 0x050008
45-
#define GPIOILEVEL 0x05000C
46-
#define GPIOISTAT 0x050010
47-
#define GPIONMIEN 0x050014
48-
#define IMASK6 0x038038
43+
/* Offsets relative to GPIOBASE */
44+
#define GPIOFUNC 0x00
45+
#define GPIOCFG 0x04
46+
#define GPIOD 0x08
47+
#define GPIOILEVEL 0x0C
48+
#define GPIOISTAT 0x10
49+
#define GPIONMIEN 0x14
50+
#define IMASK6 0x38
4951
#define LO_WPX (1 << 0)
5052
#define LO_ALE (1 << 1)
5153
#define LO_CLE (1 << 2)

arch/mips/rb532/devices.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static struct platform_device cf_slot0 = {
118118
/* Resources and device for NAND */
119119
static int rb532_dev_ready(struct mtd_info *mtd)
120120
{
121-
return readl(IDT434_REG_BASE + GPIOD) & GPIO_RDY;
121+
return gpio_get_value(GPIO_RDY);
122122
}
123123

124124
static void rb532_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)

0 commit comments

Comments
 (0)