From 2fb06d46d9c5a8fc6158bf88f985743e60be3afb Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 20 Jan 2007 12:35:00 +0000 Subject: [PATCH] Add WL-700gE support (based on work by jr) Includes kernel/diag patch and a new target profile SVN-Revision: 6142 --- include/kernel-build.mk | 2 +- package/broadcom-diag/src/diag.c | 43 +++++++- package/broadcom-diag/src/diag.h | 1 + package/kernel/modules/netfilter.mk | 1 - package/kernel/modules/other.mk | 8 ++ scripts/metadata.pl | 6 +- target/imagebuilder/files/Makefile | 2 + target/linux/brcm-2.4/Makefile | 11 ++ .../brcm-2.4/base-files/etc/init.d/netconfig | 11 ++ target/linux/brcm-2.4/config | 2 +- .../linux/brcm-2.4/patches/012-aec62xx.patch | 101 ++++++++++++++++++ 11 files changed, 183 insertions(+), 5 deletions(-) create mode 100644 target/linux/brcm-2.4/patches/012-aec62xx.patch diff --git a/include/kernel-build.mk b/include/kernel-build.mk index 9a1e36328b7..26f30549985 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -26,7 +26,7 @@ endif FEATURES:=$(sort $(FEATURES)) # For target profile selection - the default set -DEFAULT_PACKAGES:=base-files libgcc uclibc bridge busybox dnsmasq dropbear iptables mtd ppp ppp-mod-pppoe mtd +DEFAULT_PACKAGES:=base-files libgcc uclibc bridge busybox dnsmasq dropbear iptables mtd ppp ppp-mod-pppoe mtd kmod-ipt-nathelper ifeq ($(DUMP),1) all: dumpinfo diff --git a/package/broadcom-diag/src/diag.c b/package/broadcom-diag/src/diag.c index 66e86ccdc32..4dcc0bf15f2 100644 --- a/package/broadcom-diag/src/diag.c +++ b/package/broadcom-diag/src/diag.c @@ -63,6 +63,7 @@ enum { WL500GD, WL500GP, ASUS_4702, + WL700GE, /* Buffalo */ WBR2_G54, @@ -101,6 +102,20 @@ enum { TEW411BRPP, }; +static void __init wl700ge_init(void) { + int pin = 1 << 3; + + /* Enables GPIO 3 that controls HDD and led power on ASUS WL-700gE */ + printk(MODULE_NAME ": Spinning up HDD and enabling leds\n"); + gpio_outen(pin, pin); + gpio_control(pin, 0); + gpio_out(pin, pin); + + /* Wait 5s, so the HDD can spin up */ + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(HZ * 5); +} + static struct platform_t __initdata platforms[] = { /* Linksys */ [WAP54GV1] = { @@ -244,6 +259,25 @@ static struct platform_t __initdata platforms[] = { { .name = "power", .gpio = 1 << 0, .polarity = REVERSE }, }, }, + [WL700GE] = { + .name = "ASUS WL-700gE", + .buttons = { + { .name = "reset", .gpio = 1 << 7 }, // on back, hardwired, always resets device regardless OS state + { .name = "ses", .gpio = 1 << 4 }, // on back, actual name ezsetup + { .name = "power", .gpio = 1 << 0 }, // on front + { .name = "copy", .gpio = 1 << 6 }, // on front + }, + .leds = { +#if 0 + // GPIO that controls power led also enables/disables some essential functions + // - power to HDD + // - switch leds + { .name = "power", .gpio = 1 << 3, .polarity = NORMAL }, // actual name power +#endif + { .name = "diag", .gpio = 1 << 1, .polarity = REVERSE }, // actual name ready + }, + .platform_init = wl700ge_init, + }, /* Buffalo */ [WHR_G54S] = { .name = "Buffalo WHR-G54S", @@ -478,10 +512,14 @@ static struct platform_t __init *platform_detect(void) boardnum = getvar("boardnum"); boardtype = getvar("boardtype"); + + if (strncmp(getvar("model_no"), "WL700",5) == 0) { + return &platforms[WL700GE]; } + if (strncmp(getvar("pmon_ver"), "CFE", 3) == 0) { /* CFE based - newer hardware */ if (!strcmp(boardnum, "42")) { /* Linksys */ - if (!strcmp(boardtype, "0x478") && !strcmp(getvar("cardbus"), 1)) + if (!strcmp(boardtype, "0x478") && !strcmp(getvar("cardbus"), "1")) return &platforms[WRT350N]; if (!strcmp(boardtype, "0x0101") && !strcmp(getvar("boot_ver"), "v3.6")) @@ -873,6 +911,9 @@ static int __init diag_init(void) memcpy(&platform, detected, sizeof(struct platform_t)); printk(MODULE_NAME ": Detected '%s'\n", platform.name); + if (platform.platform_init != NULL) { + platform.platform_init(); + } if (!(diag = proc_mkdir("diag", NULL))) { printk(MODULE_NAME ": proc_mkdir on /proc/diag failed\n"); diff --git a/package/broadcom-diag/src/diag.h b/package/broadcom-diag/src/diag.h index 30791cffe35..af30823aae1 100644 --- a/package/broadcom-diag/src/diag.h +++ b/package/broadcom-diag/src/diag.h @@ -66,6 +66,7 @@ struct platform_t { struct button_t buttons[MAX_GPIO]; u32 button_mask; u32 button_polarity; + void (*platform_init)(void); struct led_t leds[MAX_GPIO]; }; diff --git a/package/kernel/modules/netfilter.mk b/package/kernel/modules/netfilter.mk index e14cdb80900..5f7efe61f52 100644 --- a/package/kernel/modules/netfilter.mk +++ b/package/kernel/modules/netfilter.mk @@ -87,7 +87,6 @@ $(eval $(call KernelPackage,ipt-nat)) define KernelPackage/ipt-nathelper TITLE:=Default Conntrack and NAT helpers - DEFAULT:=y DESCRIPTION:=\ Default Netfilter (IPv4) Conntrack and NAT helpers \\\ \\\ diff --git a/package/kernel/modules/other.mk b/package/kernel/modules/other.mk index a5cc4de8f93..d0975e01c72 100644 --- a/package/kernel/modules/other.mk +++ b/package/kernel/modules/other.mk @@ -64,6 +64,14 @@ define KernelPackage/ide-pdc202xx endef $(eval $(call KernelPackage,ide-pdc202xx)) +define KernelPackage/ide-aec62xx + TITLE:=AEC62xx IDE driver + SUBMENU:=$(EMENU) + KCONFIG:=$(CONFIG_BLK_DEV_AEC62XX) + FILES:=$(MODULES_DIR)/kernel/drivers/ide/pci/aec62xx.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,30,aec62xx) +endef +$(eval $(call KernelPackage,ide-aec62xx)) define KernelPackage/lp TITLE:=Parallel port and line printer support diff --git a/scripts/metadata.pl b/scripts/metadata.pl index 396954a2c7b..ded38058a4a 100755 --- a/scripts/metadata.pl +++ b/scripts/metadata.pl @@ -297,8 +297,12 @@ config LINUX_$target->{conf}_$profile->{id} bool "$profile->{name}" depends LINUX_$target->{conf} EOF + my %pkgs; foreach my $pkg (@{$target->{packages}}, @{$profile->{packages}}) { - print "\tselect DEFAULT_$pkg\n"; + $pkgs{$pkg} = 1; + } + foreach my $pkg (keys %pkgs) { + print "\tselect DEFAULT_$pkg\n" unless ($pkg =~ /^-/ or $pkgs{"-$pkg"}); } print "\n"; } diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index fbcfa0d49aa..7b35e545ddd 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -87,6 +87,8 @@ $(TOPDIR)/tmp/ipkg.conf: FORCE BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $(PACKAGES) $($(PROFILE)_PACKAGES) kernel) BUILD_PACKAGES:=$(patsubst base-files,base-files-$(BOARD)-$(KERNEL),$(BUILD_PACKAGES)) +# "-pkgname" in the package list means remove "pkgname" from the package list +BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES) image: if [ -z "$($(PROFILE)_NAME)" ]; then \ diff --git a/target/linux/brcm-2.4/Makefile b/target/linux/brcm-2.4/Makefile index 0091360c730..28ee7b92058 100644 --- a/target/linux/brcm-2.4/Makefile +++ b/target/linux/brcm-2.4/Makefile @@ -112,4 +112,15 @@ define Profile/WLHDD/Description endef $(eval $(call Profile,WLHDD)) +define Profile/WL700GE + NAME:=WL-700gE + PACKAGES:=-ppp -ppp-mod-pppoe -kmod-ipt-nathelper -iptables -dnsmasq -bridge kmod-ide-core kmod-ide-aec62xx kmod-fs-ext3 fdisk e2fsprogs +endef + +define Profile/WL700GE/Description + Minimal package set optimized for booting the WL-700gE from flash with a writable filesystem + and the utilities to create a new filesystem on the HDD +endef +$(eval $(call Profile,WL700GE)) + $(eval $(call BuildKernel)) diff --git a/target/linux/brcm-2.4/base-files/etc/init.d/netconfig b/target/linux/brcm-2.4/base-files/etc/init.d/netconfig index 7e3ebcdbf16..4cc23d233b8 100755 --- a/target/linux/brcm-2.4/base-files/etc/init.d/netconfig +++ b/target/linux/brcm-2.4/base-files/etc/init.d/netconfig @@ -101,6 +101,17 @@ start() { c["wan_ifname"]="" } + # ASUS WL-700gE + # These are actually same as defaults above. For some reason this script applies + # Generic BCM94704 settings instead so we revert to proper settings here. + # Hopefully someone will fix this properly soon. + if (model == "ASUS WL-700gE") { + c["lan_ifname"]="eth0.0" + c["wan_ifname"]="eth0.1" + c["vlan0ports"]="1 2 3 4 5*" + c["vlan1ports"]="0 5" + } + print "#### VLAN configuration " print "config switch eth0" p("vlan0", "vlan0ports") diff --git a/target/linux/brcm-2.4/config b/target/linux/brcm-2.4/config index 8ac37b10aa2..91bd41ac9db 100644 --- a/target/linux/brcm-2.4/config +++ b/target/linux/brcm-2.4/config @@ -598,7 +598,7 @@ CONFIG_IDEDMA_PCI_AUTO=y CONFIG_BLK_DEV_IDEDMA=y # CONFIG_IDEDMA_PCI_WIP is not set # CONFIG_BLK_DEV_ADMA100 is not set -# CONFIG_BLK_DEV_AEC62XX is not set +CONFIG_BLK_DEV_AEC62XX=m # CONFIG_BLK_DEV_ALI15X3 is not set # CONFIG_WDC_ALI15X3 is not set # CONFIG_BLK_DEV_AMD74XX is not set diff --git a/target/linux/brcm-2.4/patches/012-aec62xx.patch b/target/linux/brcm-2.4/patches/012-aec62xx.patch new file mode 100644 index 00000000000..75d7d72ac54 --- /dev/null +++ b/target/linux/brcm-2.4/patches/012-aec62xx.patch @@ -0,0 +1,101 @@ +--- linux-2.4.34/drivers/ide/pci/aec62xx.c.old 2006-12-23 22:34:20.000000000 +0200 ++++ linux-2.4.34/drivers/ide/pci/aec62xx.c 2007-01-14 12:06:05.000000000 +0200 +@@ -3,6 +3,8 @@ + * + * Copyright (C) 1999-2002 Andre Hedrick + * ++ * With Broadcom 4780 patches ++ * + */ + + #include +@@ -329,7 +331,11 @@ + ide_hwif_t *hwif = HWIF(drive); + struct hd_driveid *id = drive->id; + +- if ((id->capability & 1) && drive->autodma) { ++#ifndef CONFIG_BCM947XX ++ if ((id->capability & 1) && drive->autodma) { ++#else ++ if (1) { ++#endif + /* Consult the list of known "bad" drives */ + if (hwif->ide_dma_bad_drive(drive)) + goto fast_ata_pio; +@@ -414,10 +416,60 @@ + { + int bus_speed = system_bus_clock(); + ++#ifndef CONFIG_BCM947XX + if (dev->resource[PCI_ROM_RESOURCE].start) { + pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); + printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start); + } ++#else ++ if (dev->resource[PCI_ROM_RESOURCE].start) { ++ pci_write_config_dword(dev, PCI_ROM_ADDRESS, ++ dev->resource[PCI_ROM_RESOURCE]. ++ start | PCI_ROM_ADDRESS_ENABLE); ++ } else { ++ pci_write_config_dword(dev, PCI_ROM_ADDRESS, ++ dev->resource[PCI_ROM_RESOURCE]. ++ start); ++ } ++ ++ /* Set IDE controller parameters manually - FIXME: replace magic values */ ++ { ++ byte setting; ++ ++ pci_write_config_word(dev, PCI_COMMAND, 0x0007); ++ //pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x5A); ++ pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x13); ++ ++ pci_write_config_byte(dev, 0x40, 0x31); ++ pci_write_config_byte(dev, 0x41, 0x31); ++ pci_write_config_byte(dev, 0x42, 0x31); ++ pci_write_config_byte(dev, 0x43, 0x31); ++ // Set IDE Command Speed ++ pci_write_config_byte(dev, 0x48, 0x31); ++ ++ // Disable WriteSubSysID & PIOROM ++ pci_read_config_byte(dev, 0x49, &setting); ++ setting &= 0x07; ++ pci_write_config_byte(dev, 0x49, setting); ++ ++ // Enable PCI burst & INTA & PCI memory read multiple, FIFO threshold=80 ++ pci_read_config_byte(dev, 0x4A, &setting); ++ //setting = (setting & 0xFE) | 0xA8; ++ setting = (setting & 0xFE) | 0xD8; ++ setting = (setting & 0xF7); ++ pci_write_config_byte(dev, 0x4A, setting); ++ ++ //pci_write_config_byte(dev, 0x4B, 0x20); ++ pci_write_config_byte(dev, 0x4B, 0x2C); ++ //pci_write_config_byte(dev, 0x4B, 0x0C); ++ ++ // Set PreRead count: 512 byte ++ pci_write_config_byte(dev, 0x4C, 0); ++ pci_write_config_word(dev, 0x4D, 0x0002); ++ pci_write_config_byte(dev, 0x54, 0); ++ pci_write_config_word(dev, 0x55, 0x0002); ++ } ++#endif + + #if defined(DISPLAY_AEC62XX_TIMINGS) && defined(CONFIG_PROC_FS) + aec_devs[n_aec_devs++] = dev; +@@ -500,6 +552,7 @@ + + static void __init init_setup_aec6x80 (struct pci_dev *dev, ide_pci_device_t *d) + { ++#ifndef CONFIG_BCM947XX /* Causes OOPS on BCM4780 */ + unsigned long bar4reg = pci_resource_start(dev, 4); + + if (inb(bar4reg+2) & 0x10) { +@@ -512,6 +565,7 @@ + strcpy(d->name, "AEC6280R"); + } + ++#endif + ide_setup_pci_device(dev, d); + } +