diff options
author | florian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2007-08-07 09:12:09 +0000 |
---|---|---|
committer | florian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2007-08-07 09:12:09 +0000 |
commit | 96455c222d2b7bc4033fc43ffd0411684faba4fc (patch) | |
tree | 930f467989f1e2507454640de05a859e481bc3e3 /target/linux/rdc-2.6 | |
parent | 8ae34a4329aab53b0f39a69241c81b9ac26618f1 (diff) |
Fix the gpio handling and flash resource declaration, thanks to Daniel Gimpelevich
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8366 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/rdc-2.6')
6 files changed, 19 insertions, 20 deletions
diff --git a/target/linux/rdc-2.6/Makefile b/target/linux/rdc-2.6/Makefile index 5953e06ee..4d7503786 100644 --- a/target/linux/rdc-2.6/Makefile +++ b/target/linux/rdc-2.6/Makefile @@ -22,12 +22,12 @@ include $(INCLUDE_DIR)/kernel-build.mk ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) define Kernel/SetInitramfs - echo "r6040 parent=wlan0" > $(BUILD_DIR)/root/etc/modules.d/99-r6040 - rm -f $(BUILD_DIR)/root/sbin/init - ln -s /etc/preinit $(BUILD_DIR)/root/sbin/init - sed -i 's,exec /sbin/init,exec /bin/busybox init,g' $(BUILD_DIR)/root/etc/preinit - sed -i 's,/sbin/init,/bin/busybox init,g' $(BUILD_DIR)/root/init - sed -i 's,eth0,eth1,g' $(BUILD_DIR)/root/etc/config/network + echo "r6040 parent=wlan0" > $(TARGET_DIR)/etc/modules.d/99-r6040 + $(RM) -f $(TARGET_DIR)/sbin/init + ln -s /etc/preinit $(TARGET_DIR)/sbin/init + sed -i 's,exec /sbin/init,exec /bin/busybox init,g' $(TARGET_DIR)/etc/preinit + sed -i 's,/sbin/init,/bin/busybox init,g' $(TARGET_DIR)/init + sed -i 's,eth0,eth1,g' $(TARGET_DIR)/etc/config/network endef endif 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 eadb15235..28a33db07 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 aa245a052..96a9c9d37 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, }, }; diff --git a/target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c b/target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c index 6a15a16ad..f29047340 100644 --- a/target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c +++ b/target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c @@ -19,7 +19,7 @@ #include <asm/gpio.h> /* This is just for testing purpose */ -int gpio; +int gpio=-1; module_param(gpio, int, 0444); MODULE_PARM_DESC(gpio, " GPIO line"); @@ -58,7 +58,7 @@ static int __init rdc321x_leds_init(void) { int ret; - ret = platform_driver_register(&rdc321x_leds_driver); + ret = gpio+1?platform_driver_register(&rdc321x_leds_driver):-EINVAL; return ret; } diff --git a/target/linux/rdc-2.6/files/include/asm-i386/mach-rdc/rdc321x_defs.h b/target/linux/rdc-2.6/files/include/asm-i386/mach-rdc/rdc321x_defs.h index c8e6355bc..e69de29bb 100644 --- a/target/linux/rdc-2.6/files/include/asm-i386/mach-rdc/rdc321x_defs.h +++ b/target/linux/rdc-2.6/files/include/asm-i386/mach-rdc/rdc321x_defs.h @@ -1 +0,0 @@ -#define RDC_FLASH_BASE 0xffc00000 diff --git a/target/linux/rdc-2.6/image/Makefile b/target/linux/rdc-2.6/image/Makefile index 0d53b26d0..74713e2d7 100644 --- a/target/linux/rdc-2.6/image/Makefile +++ b/target/linux/rdc-2.6/image/Makefile @@ -25,7 +25,7 @@ define Image/Build/ar525w touch $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-$(2).img mv $(KDIR)/root.$(1) $(KDIR)/root.tmp dd of=$(KDIR)/root.$(1) if=$(KDIR)/root.tmp $(call trxalign/$(1)) conv=sync - rm -f $(KDIR)/root.tmp + $(RM) -f $(KDIR)/root.tmp $(STAGING_DIR_HOST)/bin/airlink -b 1 -j $(shell bash -c 'echo $$[$(3)]') $(KDIR)/bzImage $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-$(2).img endef |