diff options
author | Florian Fainelli <florian@openwrt.org> | 2007-08-07 09:12:09 +0000 |
---|---|---|
committer | Florian Fainelli <florian@openwrt.org> | 2007-08-07 09:12:09 +0000 |
commit | ce173e209444843060cc64cc22b5c7f612a9bf54 (patch) | |
tree | 2385d36d8cd1a962236327bce45361242955651a /target/linux/rdc-2.6/files/arch | |
parent | 9d2fc0c6607341cfb2f83795c3c5d9ec99c1b81d (diff) | |
download | upstream-ce173e209444843060cc64cc22b5c7f612a9bf54.tar.gz upstream-ce173e209444843060cc64cc22b5c7f612a9bf54.tar.bz2 upstream-ce173e209444843060cc64cc22b5c7f612a9bf54.zip |
Fix the gpio handling and flash resource declaration, thanks to Daniel Gimpelevich
SVN-Revision: 8366
Diffstat (limited to 'target/linux/rdc-2.6/files/arch')
-rw-r--r-- | target/linux/rdc-2.6/files/arch/i386/mach-rdc/gpio.c | 15 | ||||
-rw-r--r-- | target/linux/rdc-2.6/files/arch/i386/mach-rdc/platform.c | 5 |
2 files changed, 10 insertions, 10 deletions
diff --git a/target/linux/rdc-2.6/files/arch/i386/mach-rdc/gpio.c b/target/linux/rdc-2.6/files/arch/i386/mach-rdc/gpio.c index eadb15235e..28a33db076 100644 --- a/target/linux/rdc-2.6/files/arch/i386/mach-rdc/gpio.c +++ b/target/linux/rdc-2.6/files/arch/i386/mach-rdc/gpio.c @@ -22,14 +22,14 @@ static unsigned int rdc_gpio_read(unsigned gpio) { unsigned int val; - val = 0x80000000 | (7 << 11) | ((0x48)); + val = 0x80000000 | (7 << 11) | ((gpio&0x20?0x84:0x48)); outl(val, RDC3210_CFGREG_ADDR); udelay(10); val = inl(RDC3210_CFGREG_DATA); - val |= (0x1 << gpio); + val |= (0x1 << (gpio & 0x1F)); outl(val, RDC3210_CFGREG_DATA); udelay(10); - val = 0x80000000 | (7 << 11) | ((0x4C)); + val = 0x80000000 | (7 << 11) | ((gpio&0x20?0x88:0x4C)); outl(val, RDC3210_CFGREG_ADDR); udelay(10); val = inl(RDC3210_CFGREG_DATA); @@ -37,7 +37,7 @@ static unsigned int rdc_gpio_read(unsigned gpio) return val; } -void rdc_gpio_write(unsigned int val) +static void rdc_gpio_write(unsigned int val) { if (val) { outl(val, RDC3210_CFGREG_DATA); @@ -47,7 +47,7 @@ void rdc_gpio_write(unsigned int val) int rdc_gpio_get_value(unsigned gpio) { - return ((int)rdc_gpio_read(gpio)); + return (gpio>0x3A?-EINVAL:(int)rdc_gpio_read(gpio)); } EXPORT_SYMBOL(rdc_gpio_get_value); @@ -55,12 +55,13 @@ void rdc_gpio_set_value(unsigned gpio, int value) { unsigned int val; + if (gpio > 0x3A) return; val = rdc_gpio_read(gpio); if (value) - val &= ~(0x1 << gpio); + val &= ~(0x1 << (gpio & 0x1F)); else - val |= (0x1 << gpio); + val |= (0x1 << (gpio & 0x1F)); rdc_gpio_write(val); } diff --git a/target/linux/rdc-2.6/files/arch/i386/mach-rdc/platform.c b/target/linux/rdc-2.6/files/arch/i386/mach-rdc/platform.c index aa245a052b..96a9c9d37f 100644 --- a/target/linux/rdc-2.6/files/arch/i386/mach-rdc/platform.c +++ b/target/linux/rdc-2.6/files/arch/i386/mach-rdc/platform.c @@ -30,13 +30,12 @@ #include <linux/platform_device.h> #include <asm/gpio.h> -#include <asm/mach-rdc/rdc321x_defs.h> /* FIXME : Flash */ static struct resource rdc_flash_resource[] = { [0] = { - .start = RDC_FLASH_BASE, - .end = RDC_FLASH_BASE+CONFIG_MTD_RDC3210_SIZE-1, + .start = (u32)-CONFIG_MTD_RDC3210_SIZE, + .end = (u32)-1, .flags = IORESOURCE_MEM, }, }; |