Add WL-700gE support (based on work by jr) Includes kernel/diag patch and a new target profile

SVN-Revision: 6142
This commit is contained in:
Felix Fietkau 2007-01-20 12:35:00 +00:00
parent 297f2368ba
commit 2fb06d46d9
11 changed files with 183 additions and 5 deletions

View file

@ -26,7 +26,7 @@ endif
FEATURES:=$(sort $(FEATURES)) FEATURES:=$(sort $(FEATURES))
# For target profile selection - the default set # 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) ifeq ($(DUMP),1)
all: dumpinfo all: dumpinfo

View file

@ -63,6 +63,7 @@ enum {
WL500GD, WL500GD,
WL500GP, WL500GP,
ASUS_4702, ASUS_4702,
WL700GE,
/* Buffalo */ /* Buffalo */
WBR2_G54, WBR2_G54,
@ -101,6 +102,20 @@ enum {
TEW411BRPP, 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[] = { static struct platform_t __initdata platforms[] = {
/* Linksys */ /* Linksys */
[WAP54GV1] = { [WAP54GV1] = {
@ -244,6 +259,25 @@ static struct platform_t __initdata platforms[] = {
{ .name = "power", .gpio = 1 << 0, .polarity = REVERSE }, { .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 */ /* Buffalo */
[WHR_G54S] = { [WHR_G54S] = {
.name = "Buffalo WHR-G54S", .name = "Buffalo WHR-G54S",
@ -478,10 +512,14 @@ static struct platform_t __init *platform_detect(void)
boardnum = getvar("boardnum"); boardnum = getvar("boardnum");
boardtype = getvar("boardtype"); boardtype = getvar("boardtype");
if (strncmp(getvar("model_no"), "WL700",5) == 0) {
return &platforms[WL700GE]; }
if (strncmp(getvar("pmon_ver"), "CFE", 3) == 0) { if (strncmp(getvar("pmon_ver"), "CFE", 3) == 0) {
/* CFE based - newer hardware */ /* CFE based - newer hardware */
if (!strcmp(boardnum, "42")) { /* Linksys */ if (!strcmp(boardnum, "42")) { /* Linksys */
if (!strcmp(boardtype, "0x478") && !strcmp(getvar("cardbus"), 1)) if (!strcmp(boardtype, "0x478") && !strcmp(getvar("cardbus"), "1"))
return &platforms[WRT350N]; return &platforms[WRT350N];
if (!strcmp(boardtype, "0x0101") && !strcmp(getvar("boot_ver"), "v3.6")) 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)); memcpy(&platform, detected, sizeof(struct platform_t));
printk(MODULE_NAME ": Detected '%s'\n", platform.name); printk(MODULE_NAME ": Detected '%s'\n", platform.name);
if (platform.platform_init != NULL) {
platform.platform_init();
}
if (!(diag = proc_mkdir("diag", NULL))) { if (!(diag = proc_mkdir("diag", NULL))) {
printk(MODULE_NAME ": proc_mkdir on /proc/diag failed\n"); printk(MODULE_NAME ": proc_mkdir on /proc/diag failed\n");

View file

@ -66,6 +66,7 @@ struct platform_t {
struct button_t buttons[MAX_GPIO]; struct button_t buttons[MAX_GPIO];
u32 button_mask; u32 button_mask;
u32 button_polarity; u32 button_polarity;
void (*platform_init)(void);
struct led_t leds[MAX_GPIO]; struct led_t leds[MAX_GPIO];
}; };

View file

@ -87,7 +87,6 @@ $(eval $(call KernelPackage,ipt-nat))
define KernelPackage/ipt-nathelper define KernelPackage/ipt-nathelper
TITLE:=Default Conntrack and NAT helpers TITLE:=Default Conntrack and NAT helpers
DEFAULT:=y
DESCRIPTION:=\ DESCRIPTION:=\
Default Netfilter (IPv4) Conntrack and NAT helpers \\\ Default Netfilter (IPv4) Conntrack and NAT helpers \\\
\\\ \\\

View file

@ -64,6 +64,14 @@ define KernelPackage/ide-pdc202xx
endef endef
$(eval $(call KernelPackage,ide-pdc202xx)) $(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 define KernelPackage/lp
TITLE:=Parallel port and line printer support TITLE:=Parallel port and line printer support

View file

@ -297,8 +297,12 @@ config LINUX_$target->{conf}_$profile->{id}
bool "$profile->{name}" bool "$profile->{name}"
depends LINUX_$target->{conf} depends LINUX_$target->{conf}
EOF EOF
my %pkgs;
foreach my $pkg (@{$target->{packages}}, @{$profile->{packages}}) { 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"; print "\n";
} }

View file

@ -87,6 +87,8 @@ $(TOPDIR)/tmp/ipkg.conf: FORCE
BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $(PACKAGES) $($(PROFILE)_PACKAGES) kernel) BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $(PACKAGES) $($(PROFILE)_PACKAGES) kernel)
BUILD_PACKAGES:=$(patsubst base-files,base-files-$(BOARD)-$(KERNEL),$(BUILD_PACKAGES)) 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: image:
if [ -z "$($(PROFILE)_NAME)" ]; then \ if [ -z "$($(PROFILE)_NAME)" ]; then \

View file

@ -112,4 +112,15 @@ define Profile/WLHDD/Description
endef endef
$(eval $(call Profile,WLHDD)) $(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)) $(eval $(call BuildKernel))

View file

@ -101,6 +101,17 @@ start() {
c["wan_ifname"]="" 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 "#### VLAN configuration "
print "config switch eth0" print "config switch eth0"
p("vlan0", "vlan0ports") p("vlan0", "vlan0ports")

View file

@ -598,7 +598,7 @@ CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set # CONFIG_IDEDMA_PCI_WIP is not set
# CONFIG_BLK_DEV_ADMA100 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_BLK_DEV_ALI15X3 is not set
# CONFIG_WDC_ALI15X3 is not set # CONFIG_WDC_ALI15X3 is not set
# CONFIG_BLK_DEV_AMD74XX is not set # CONFIG_BLK_DEV_AMD74XX is not set

View file

@ -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);
}