Add WL-700gE support (based on work by jr) Includes kernel/diag patch and a new targe...
authorFelix Fietkau <nbd@openwrt.org>
Sat, 20 Jan 2007 12:35:00 +0000 (12:35 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 20 Jan 2007 12:35:00 +0000 (12:35 +0000)
SVN-Revision: 6142

include/kernel-build.mk
package/broadcom-diag/src/diag.c
package/broadcom-diag/src/diag.h
package/kernel/modules/netfilter.mk
package/kernel/modules/other.mk
scripts/metadata.pl
target/imagebuilder/files/Makefile
target/linux/brcm-2.4/Makefile
target/linux/brcm-2.4/base-files/etc/init.d/netconfig
target/linux/brcm-2.4/config
target/linux/brcm-2.4/patches/012-aec62xx.patch [new file with mode: 0644]

index 9a1e36328b74e0d605dd4b2365a7afdbf065806b..26f3054998554590bcd95e83fa3f8dd502e62e80 100644 (file)
@@ -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
index 66e86ccdc3257910561586cf8776632c77820ed0..4dcc0bf15f28de83fd70a6c7c7a4f5cbf441317d 100644 (file)
@@ -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");
index 30791cffe3575091d1f31e07f7a5043e35a968df..af30823aae1b2a0975eeea11cfd3cc06146975b2 100644 (file)
@@ -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];
 };
index e14cdb8090000aeeba5d20b48f90bc920c3810d5..5f7efe61f527373d70ca9dc54d53532f135ec9b7 100644 (file)
@@ -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 \\\
        \\\
index a5cc4de8f936bf7dd80f210f6207d6caeef48141..d0975e01c720ce6d9779c27e973009cbccc98537 100644 (file)
@@ -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
index 396954a2c7b24431be5a3be9f7f2ee1cb5ba04af..ded38058a4aec377e97cd82c5b93013edf74265b 100755 (executable)
@@ -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";
                }
index fbcfa0d49aa5a2a795f733483891ddb802fb8dbf..7b35e545dddcc30dca4a5a11d0ce1cc114a29718 100644 (file)
@@ -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 \
index 0091360c7308d7b3df350864bd0bffe169b04d59..28ee7b92058c6de07d62bc6c8f5899d927bdd80b 100644 (file)
@@ -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))
index 7e3ebcdbf16222546bb761e127fc2c42614325ff..4cc23d233b8f87f53e357b94833177ed64bc10e7 100755 (executable)
@@ -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")
index 8ac37b10aa238a15d437bc5432afa3358c1b6de5..91bd41ac9dbfdd132d4e639c595355063141d540 100644 (file)
@@ -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 (file)
index 0000000..75d7d72
--- /dev/null
@@ -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 <andre@linux-ide.org>
+  *
++ * With Broadcom 4780 patches
++ *
+  */
+ #include <linux/module.h>
+@@ -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);
+ }