Răsfoiți Sursa

* add gigasx76x update
* rebase patches
* add arv752DPW arv7525PD
* fixes gpio_keys

Signed-off-by: Luka Perkov <[email protected]>
Signed-off-by: John Crispin <[email protected]>

SVN-Revision: 27665

John Crispin 14 ani în urmă
părinte
comite
5906377332

+ 0 - 41
target/linux/lantiq/config-default

@@ -1,7 +1,4 @@
-CONFIG_32BIT=y
 # CONFIG_64BIT is not set
-# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
-# CONFIG_AR7 is not set
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
 CONFIG_ARCH_HIBERNATION_POSSIBLE=y
@@ -10,12 +7,6 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y
 # CONFIG_ARCH_SUPPORTS_MSI is not set
 CONFIG_ARCH_SUPPORTS_OPROFILE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
-# CONFIG_BCM47XX is not set
-# CONFIG_BCM63XX is not set
-CONFIG_BITREVERSE=y
-CONFIG_BOOT_RAW=y
-# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
-# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
 CONFIG_CEVT_R4K=y
 CONFIG_CEVT_R4K_LIB=y
 CONFIG_CFG80211_DEFAULT_PS_VALUE=0
@@ -86,22 +77,12 @@ CONFIG_LANTIQ=y
 CONFIG_LANTIQ_WDT=y
 CONFIG_LEDS_GPIO=y
 # CONFIG_MACH_ALCHEMY is not set
-# CONFIG_MACH_DECSTATION is not set
-# CONFIG_MACH_JAZZ is not set
-# CONFIG_MACH_LOONGSON is not set
-# CONFIG_MACH_TX39XX is not set
-# CONFIG_MACH_TX49XX is not set
-# CONFIG_MACH_VR41XX is not set
-# CONFIG_MIKROTIK_RB532 is not set
 CONFIG_MIPS=y
-# CONFIG_MIPS_COBALT is not set
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 CONFIG_MIPS_MACHINE=y
-# CONFIG_MIPS_MALTA is not set
 CONFIG_MIPS_MT_DISABLED=y
 # CONFIG_MIPS_MT_SMP is not set
 # CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_SIM is not set
 # CONFIG_MIPS_VPE_LOADER is not set
 CONFIG_MTD_CFI_ADV_OPTIONS=y
 CONFIG_MTD_CFI_GEOMETRY=y
@@ -109,31 +90,11 @@ CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_LANTIQ=y
 CONFIG_MTD_UIMAGE_SPLIT=y
 CONFIG_NLS=y
-# CONFIG_NO_IOPORT is not set
-# CONFIG_NXP_STB220 is not set
-# CONFIG_NXP_STB225 is not set
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_PHYLIB=y
-# CONFIG_PMC_MSP is not set
-# CONFIG_PMC_YOSEMITE is not set
-# CONFIG_PNX8550_JBS is not set
-# CONFIG_PNX8550_STB810 is not set
-CONFIG_SCHED_OMIT_FRAME_POINTER=y
 # CONFIG_SCSI_DMA is not set
 # CONFIG_SERIAL_8250 is not set
 CONFIG_SERIAL_LANTIQ=y
-# CONFIG_SGI_IP22 is not set
-# CONFIG_SGI_IP27 is not set
-# CONFIG_SGI_IP28 is not set
-# CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_CRHINE is not set
-# CONFIG_SIBYTE_CRHONE is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_SWARM is not set
 CONFIG_SWAP_IO_SPACE=y
 CONFIG_SWCONFIG=y
 CONFIG_SYS_HAS_CPU_MIPS32_R1=y
@@ -143,7 +104,5 @@ CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
 CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
 CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
 CONFIG_SYS_SUPPORTS_MULTITHREADING=y
-CONFIG_TRAD_SIGNALS=y
-# CONFIG_TREE_PREEMPT_RCU is not set
 CONFIG_TREE_RCU=y
 CONFIG_ZONE_DMA_FLAG=0

+ 26 - 0
target/linux/lantiq/danube/profiles/002-arcadyan.mk

@@ -61,6 +61,19 @@ endef
 
 $(eval $(call Profile,ARV4525PW))
 
+define Profile/ARV7525PW
+  NAME:=ARV7525PW - Speedport W303V Typ A
+  PACKAGES:= kmod-usb-core kmod-usb-dwc-otg \
+  	kmod-ledtrig-netdev kmod-ledtrig-usbdev kmod-leds-gpio kmod-button-hotplug \
+	kmod-rt2800-pci wpad-mini kmod-ltq-dsl-firmware-b
+endef
+
+define Profile/ARV4525PW/Description
+	Package set optimized for the ARV4525PW
+endef
+
+$(eval $(call Profile,ARV7525PW))
+
 define Profile/ARV452CPW
   NAME:=ARV452CPW - Arcor Easybox 801
   PACKAGES:= kmod-usb-core kmod-usb-dwc-otg \
@@ -74,6 +87,19 @@ endef
 
 $(eval $(call Profile,ARV452CPW))
 
+define Profile/ARV752DPW
+  NAME:=ARV752DPW - Arcor Easybox 802
+  PACKAGES:= kmod-usb-core kmod-usb-dwc-otg \
+  	kmod-ledtrig-netdev kmod-ledtrig-usbdev kmod-leds-gpio kmod-button-hotplug \
+	kmod-rt2800-pci kmod-ltq-dsl-firmware-b
+endef
+
+define Profile/ARV752DPW/Description
+	Package set optimized for the ARV752PW
+endef
+
+$(eval $(call Profile,ARV752DPW))
+
 define Profile/ARV752DPW22
   NAME:=ARV752DPW22 - Arcor Easybox 803
   PACKAGES:= kmod-usb-core kmod-usb2 kmod-usb-uhci kmod-usb-dwc-otg \

+ 18 - 0
target/linux/lantiq/image/Makefile

@@ -112,6 +112,14 @@ define Image/Build/Profile/ARV4525PW
 	$(call Image/Build/$(1),$(1),ARV4525PW)
 endef
 
+define Image/BuildKernel/Profile/ARV7525PW
+	$(call Image/BuildKernel/Template,ARV7525PW,$(xway_cmdline))
+endef
+
+define Image/Build/Profile/ARV7525PW
+	$(call Image/Build/$(1),$(1),ARV7525PW)
+endef
+
 define Image/BuildKernel/Profile/ARV452CPW
 	$(call Image/BuildKernel/Template,ARV452CPW,$(xway_cmdline))
 endef
@@ -128,6 +136,14 @@ define Image/Build/Profile/ARV7518PW
 	$(call Image/Build/$(1),$(1),ARV7518PW)
 endef
 
+define Image/BuildKernel/Profile/ARV752DPW
+	$(call Image/BuildKernel/Template,ARV752DPW,$(xway_cmdline))
+endef
+
+define Image/Build/Profile/ARV752DPW
+	$(call Image/Build/$(1),$(1),ARV752DPW)
+endef
+
 define Image/BuildKernel/Profile/ARV752DPW22
 	$(call Image/BuildKernel/Template,ARV752DPW22,$(xway_cmdline))
 endef
@@ -154,6 +170,7 @@ define Image/BuildKernel/Profile/Generic
 	$(call Image/BuildKernel/Template,ARV4520PW,$(xway_cmdline))
 	$(call Image/BuildKernel/Template,ARV452CPW,$(xway_cmdline))
 	$(call Image/BuildKernel/Template,ARV4525PW,$(xway_cmdline))
+	$(call Image/BuildKernel/Template,ARV7525PW,$(xway_cmdline))
 	$(call Image/BuildKernel/Template,ARV7518PW,$(xway_cmdline))
 	$(call Image/BuildKernel/Template,ARV752DPW,$(xway_cmdline))
 	$(call Image/BuildKernel/Template,ARV752DPW22,$(xway_cmdline))
@@ -171,6 +188,7 @@ define Image/Build/Profile/Generic
 	$(call Image/Build/$(1),$(1),ARV4520PW)
 	$(call Image/Build/$(1),$(1),ARV452CPW)
 	$(call Image/Build/$(1),$(1),ARV4525PW)
+	$(call Image/Build/$(1),$(1),ARV7525PW)
 	$(call Image/Build/$(1),$(1),ARV7518PW)
 	$(call Image/Build/$(1),$(1),ARV752DPW)
 	$(call Image/Build/$(1),$(1),ARV752DPW22)

+ 2 - 2
target/linux/lantiq/patches-2.6.39/0014-fix_mtd.patch

@@ -1,6 +1,6 @@
 --- a/arch/mips/lantiq/xway/mach-easy50601.c
 +++ b/arch/mips/lantiq/xway/mach-easy50601.c
-@@ -32,12 +32,7 @@
+@@ -32,12 +32,7 @@ static struct mtd_partition easy50601_pa
  	{
  		.name	= "linux",
  		.offset	= 0x20000,
@@ -16,7 +16,7 @@
  
 --- a/arch/mips/lantiq/xway/mach-easy50712.c
 +++ b/arch/mips/lantiq/xway/mach-easy50712.c
-@@ -34,12 +34,7 @@
+@@ -34,12 +34,7 @@ static struct mtd_partition easy50712_pa
  	{
  		.name	= "linux",
  		.offset	= 0x20000,

+ 2 - 2
target/linux/lantiq/patches-2.6.39/150-falcon-easy98020.patch

@@ -133,8 +133,8 @@
  endif
 --- a/arch/mips/lantiq/falcon/Makefile
 +++ b/arch/mips/lantiq/falcon/Makefile
-@@ -2,3 +2,4 @@ obj-y := clk-falcon.o devices.o gpio.o p
- obj-y += softdog_vpe.o
+@@ -3,3 +3,4 @@ obj-y += softdog_vpe.o
+ obj-$(CONFIG_LANTIQ_MACH_EASY98000) += addon-easy98000.o
  obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
  obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o
 +obj-$(CONFIG_LANTIQ_MACH_EASY98020) += mach-easy98020.o

+ 3 - 3
target/linux/lantiq/patches-2.6.39/160-falcon-95C3AM1.patch

@@ -119,16 +119,16 @@
  endif
 --- a/arch/mips/lantiq/falcon/Makefile
 +++ b/arch/mips/lantiq/falcon/Makefile
-@@ -3,3 +3,4 @@ obj-y += softdog_vpe.o
+@@ -4,3 +4,4 @@ obj-$(CONFIG_LANTIQ_MACH_EASY98000) += a
  obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
  obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o
  obj-$(CONFIG_LANTIQ_MACH_EASY98020) += mach-easy98020.o
 +obj-$(CONFIG_LANTIQ_MACH_95C3AM1)   += mach-95C3AM1.o
 --- a/arch/mips/lantiq/machtypes.h
 +++ b/arch/mips/lantiq/machtypes.h
-@@ -20,6 +20,7 @@ enum lantiq_mach_type {
- 	LANTIQ_MACH_EASY98000,		/* Falcon Eval Board, NOR Flash */
+@@ -21,6 +21,7 @@ enum lantiq_mach_type {
  	LANTIQ_MACH_EASY98000SF,	/* Falcon Eval Board, Serial Flash */
+ 	LANTIQ_MACH_EASY98000NAND,	/* Falcon Eval Board, NAND Flash */
  	LANTIQ_MACH_EASY98020,		/* Falcon Reference Board */
 +	LANTIQ_MACH_95C3AM1,		/* Board 95C3AM1 */
  };

+ 159 - 28
target/linux/lantiq/patches-2.6.39/200-mach-arv45xx.patch

@@ -1,6 +1,6 @@
 --- a/arch/mips/lantiq/xway/Kconfig
 +++ b/arch/mips/lantiq/xway/Kconfig
-@@ -6,6 +6,10 @@ config LANTIQ_MACH_EASY50712
+@@ -6,6 +6,10 @@
  	bool "Easy50712 - Danube"
  	default y
  
@@ -13,14 +13,14 @@
  endif
 --- a/arch/mips/lantiq/xway/Makefile
 +++ b/arch/mips/lantiq/xway/Makefile
-@@ -5,3 +5,4 @@ obj-$(CONFIG_SOC_AMAZON_SE) += clk-ase.o
+@@ -5,3 +5,4 @@
  
  obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o
  obj-$(CONFIG_LANTIQ_MACH_EASY50601) += mach-easy50601.o
 +obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o
 --- /dev/null
 +++ b/arch/mips/lantiq/xway/mach-arv45xx.c
-@@ -0,0 +1,504 @@
+@@ -0,0 +1,634 @@
 +/*
 + *  This program is free software; you can redistribute it and/or modify it
 + *  under the terms of the GNU General Public License version 2 as published
@@ -33,7 +33,6 @@
 +#include <linux/platform_device.h>
 +#include <linux/leds.h>
 +#include <linux/gpio.h>
-+#include <linux/gpio_buttons.h>
 +#include <linux/mtd/mtd.h>
 +#include <linux/mtd/partitions.h>
 +#include <linux/mtd/physmap.h>
@@ -49,6 +48,7 @@
 +#include "devices.h"
 +#include "dev-leds-gpio.h"
 +#include "dev-dwc_otg.h"
++#include "../dev-gpio-buttons.h"
 +
 +#ifdef CONFIG_MTD_PARTITIONS
 +static struct mtd_partition arv4510_partitions[] =
@@ -123,6 +123,29 @@
 +	},
 +};
 +
++static struct mtd_partition arv7525_partitions[] =
++{
++	{
++		.name	= "uboot",
++		.offset	= 0x0,
++		.size	= 0x10000,
++	},
++	{
++		.name	= "uboot_env",
++		.offset	= 0x10000,
++		.size	= 0x10000,
++	},
++	{
++		.name	= "linux",
++		.offset	= 0x20000,
++		.size	= 0x3d0000,
++	},
++	{
++		.name	= "board_config",
++		.offset	= 0x3f0000,
++		.size	= 0x10000,
++	},
++};
 +#endif
 +
 +static struct physmap_flash_data arv4510_flash_data = {
@@ -146,6 +169,13 @@
 +#endif
 +};
 +
++static struct physmap_flash_data arv7525_flash_data = {
++#ifdef CONFIG_MTD_PARTITIONS
++	.nr_parts	= ARRAY_SIZE(arv7525_partitions),
++	.parts		= arv7525_partitions,
++#endif
++};
++
 +static struct ltq_pci_data ltq_pci_data = {
 +	.clock  = PCI_CLOCK_EXT,
 +	.gpio   = PCI_GNT1 | PCI_REQ1,
@@ -178,11 +208,32 @@
 +	{ .name = "soc:green:fxo", .gpio = 75, .active_low = 1, .default_trigger = "default-on" },
 +};
 +
-+static struct gpio_button
-+arv4518pw_gpio_buttons[] __initdata = {
-+	{ .desc = "wlan", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 28, .active_low = 1, },
-+	{ .desc = "wps", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 29, .active_low = 1, },
-+	{ .desc = "reset", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 30, .active_low = 1, },
++static struct gpio_keys_button
++arv4518pw_gpio_keys[] __initdata = {
++	{
++		.desc		= "wlan",
++		.type		= EV_KEY,
++		.code		= BTN_0,
++		.debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
++		.gpio	= 28,
++		.active_low	= 1,
++	},
++	{
++		.desc		= "wps",
++		.type		= EV_KEY,
++		.code		= BTN_1,
++		.debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
++		.gpio		= 29,
++		.active_low	= 1,
++	},
++	{
++		.desc		= "reset",
++		.type		= EV_KEY,
++		.code		= BTN_2,
++		.debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
++		.gpio		= 30,
++		.active_low	= 1,
++	},
 +};
 +
 +static struct gpio_led
@@ -249,11 +300,32 @@
 +	{ .name = "soc:green:eth4", .gpio = 86, .active_low = 1, .default_trigger = "default-on", },
 +};
 +
-+static struct gpio_button
-+arv752dpw22_gpio_buttons[] __initdata = {
-+	{ .desc = "btn0", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 12, .active_low = 1, },
-+	{ .desc = "btn1", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 13, .active_low = 1, },
-+	{ .desc = "btn2", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 28, .active_low = 1, },
++static struct gpio_keys_button
++arv752dpw22_gpio_keys[] __initdata = {
++	{
++		.desc = "btn0",
++		.type = EV_KEY,
++		.code = BTN_0,
++		.debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
++		.gpio = 12,
++		.active_low = 1,
++	},
++	{
++		.desc = "btn1",
++		.type = EV_KEY,
++		.code = BTN_1,
++		.debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
++		.gpio = 13,
++		.active_low = 1,
++	},
++	{
++		.desc = "btn2",
++		.type = EV_KEY,
++		.code = BTN_2,
++		.debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
++		.gpio = 28,
++		.active_low = 1,
++	},
 +};
 +
 +static struct gpio_led
@@ -266,10 +338,24 @@
 +	{ .name = "soc:green:usb", .gpio = 19, .active_low = 1, },
 +};
 +
-+static struct gpio_button
-+arv7518pw_gpio_buttons[] __initdata = {
-+	{ .desc = "reset", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 23, .active_low = 1, },
-+	{ .desc = "wlan", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 25, .active_low = 1, },
++static struct gpio_keys_button
++arv7518pw_gpio_keys[] __initdata = {
++	{
++		.desc = "reset",
++		.type = EV_KEY,
++		.code = BTN_0,
++		.debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
++		.gpio = 23,
++		.active_low = 1,
++	},
++	{
++		.desc = "wlan",
++		.type = EV_KEY,
++		.code = BTN_1,
++		.debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
++		.gpio = 25,
++		.active_low = 1,
++	},
 +};
 +
 +static void
@@ -328,7 +414,7 @@
 +		p[i] = ((eeprom_data[(i<<1)+1]&0xff)<<24)|((eeprom_data[(i<<1)+1]&0xff00)<<8)|((eeprom_data[i<<1]&0xff)<<8)|((eeprom_data[i<<1]&0xff00)>>8);
 +		if (i == 0xbf>>1){
 +			// printk ("regdomain: 0x%x --> 0x%x\n", p[i], (p[i] & 0xffff0000)|0x67);
-+			/* regdomain is invalid?? how did original fw convert 
++			/* regdomain is invalid?? how did original fw convert
 +			* value to 0x82d4 ??
 +			* for now, force to 0x67 */
 +			p[i] &= 0xffff0000;
@@ -378,14 +464,15 @@
 +#define ARV4518PW_EBU			0
 +#define ARV4518PW_USB			14
 +#define ARV4518PW_SWITCH_RESET		13
++#define ARV4518PW_MADWIFI_ADDR		0xb07f0400
 +
 +	ltq_register_gpio_ebu(ARV4518PW_EBU);
 +	ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv4518pw_leds_gpio), arv4518pw_leds_gpio);
-+	ltq_register_gpio_buttons(arv4518pw_gpio_buttons, ARRAY_SIZE(arv4518pw_gpio_buttons));
++	ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, ARRAY_SIZE(arv4518pw_gpio_keys), arv4518pw_gpio_keys);
 +	ltq_register_nor(&arv45xx_flash_data);
 +	ltq_pci_data.gpio = PCI_GNT2 | PCI_REQ2;
 +	ltq_register_pci(&ltq_pci_data);
-+	ltq_register_madwifi_eep();
++	ltq_register_madwifi_eep(ARV4518PW_MADWIFI_ADDR);
 +	xway_register_dwc(ARV4518PW_USB);
 +	arv45xx_register_ethernet();
 +	arv45xx_register_ath5k();
@@ -432,12 +519,13 @@
 +#define ARV452CPW_RELAY1		31
 +#define ARV452CPW_RELAY2		79
 +#define ARV452CPW_SWITCH_RESET		82
++#define ARV452CPW_MADWIFI_ADDR		0xb07f0400
 +
 +	ltq_register_gpio_ebu(ARV452CPW_EBU);
 +	ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv452cpw_leds_gpio), arv452cpw_leds_gpio);
 +	ltq_register_nor(&arv45xx_flash_data);
 +	ltq_register_pci(&ltq_pci_data);
-+	ltq_register_madwifi_eep();
++	ltq_register_madwifi_eep(ARV452CPW_MADWIFI_ADDR);
 +	xway_register_dwc(ARV452CPW_USB);
 +	arv45xx_register_ethernet();
 +	arv45xx_register_ath5k();
@@ -463,11 +551,13 @@
 +static void __init
 +arv4525pw_init(void)
 +{
++#define ARV4525PW_MADWIFI_ADDR	0xb07f0400
++
 +	ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv4525pw_leds_gpio), arv4525pw_leds_gpio);
 +	ltq_register_nor(&arv45xx_flash_data);
 +	ltq_pci_data.clock = PCI_CLOCK_INT;
 +	ltq_register_pci(&ltq_pci_data);
-+	ltq_register_madwifi_eep();
++	ltq_register_madwifi_eep(ARV4525PW_MADWIFI_ADDR);
 +	ltq_eth_data.mii_mode = PHY_INTERFACE_MODE_MII;
 +	arv45xx_register_ethernet();
 +}
@@ -478,6 +568,22 @@
 +			arv4525pw_init);
 +
 +static void __init
++arv7525pw_init(void)
++{
++	ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv4525pw_leds_gpio), arv4525pw_leds_gpio);
++	ltq_register_nor(&arv7525_flash_data);
++	ltq_register_pci(&ltq_pci_data);
++	ltq_eth_data.mii_mode = PHY_INTERFACE_MODE_MII;
++	ltq_register_tapi();
++	arv45xx_register_ethernet();
++}
++
++MIPS_MACHINE(LANTIQ_MACH_ARV7525PW,
++			"ARV7525PW",
++			"ARV7525PW - Speedport W303V",
++			arv7525pw_init);
++
++static void __init
 +arv7518pw_init(void)
 +{
 +#define ARV7518PW_EBU			0x2
@@ -485,7 +591,7 @@
 +
 +	ltq_register_gpio_ebu(ARV7518PW_EBU);
 +	ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv7518pw_leds_gpio), arv7518pw_leds_gpio);
-+	ltq_register_gpio_buttons(arv7518pw_gpio_buttons, ARRAY_SIZE(arv7518pw_gpio_buttons));
++	ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, ARRAY_SIZE(arv7518pw_gpio_keys), arv7518pw_gpio_keys);
 +	ltq_register_nor(&arv75xx_flash_data);
 +	ltq_register_pci(&ltq_pci_data);
 +	ltq_register_tapi();
@@ -499,6 +605,30 @@
 +			"ARV7518PW - ASTORIA",
 +			arv7518pw_init);
 +
++
++static void __init
++arv752dpw_init(void)
++{
++#define ARV752DPW22_EBU                 0x2
++#define ARV752DPW22_USB                 72
++#define ARV752DPW22_RELAY               73
++	ltq_register_gpio_ebu(ARV752DPW22_EBU);
++	ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv752dpw22_leds_gpio), arv752dpw22_leds_gpio);
++	ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, ARRAY_SIZE(arv752dpw22_gpio_keys), arv752dpw22_gpio_keys);
++	ltq_register_nor(&arv75xx_flash_data);
++	ltq_register_pci(&ltq_pci_data);
++	xway_register_dwc(ARV752DPW22_USB);
++	arv75xx_register_ethernet();
++	gpio_request(ARV752DPW22_RELAY, "relay");
++	gpio_set_value(ARV752DPW22_RELAY, 1);
++	gpio_export(ARV752DPW22_RELAY, 0);
++}
++
++MIPS_MACHINE(LANTIQ_MACH_ARV752DPW,
++                        "ARV752DPW",
++                        "ARV752DPW - Arcor A802",
++                        arv752dpw_init);
++
 +static void __init
 +arv752dpw22_init(void)
 +{
@@ -508,9 +638,9 @@
 +
 +	ltq_register_gpio_ebu(ARV752DPW22_EBU);
 +	ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv752dpw22_leds_gpio), arv752dpw22_leds_gpio);
-+	ltq_register_gpio_buttons(arv752dpw22_gpio_buttons, ARRAY_SIZE(arv752dpw22_gpio_buttons));
++	ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, ARRAY_SIZE(arv752dpw22_gpio_keys), arv752dpw22_gpio_keys);
 +	ltq_register_nor(&arv75xx_flash_data);
-+	ltq_pci_data.irq[15] = (INT_NUM_IM2_IRL0 + 31);
++	ltq_pci_data.irq[15] = (INT_NUM_IM3_IRL0 + 31);
 +	ltq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2;
 +	ltq_register_pci(&ltq_pci_data);
 +	xway_register_dwc(ARV752DPW22_USB);
@@ -527,8 +657,8 @@
 +			arv752dpw22_init);
 --- a/arch/mips/lantiq/machtypes.h
 +++ b/arch/mips/lantiq/machtypes.h
-@@ -21,6 +21,17 @@ enum lantiq_mach_type {
- 	LANTIQ_MACH_EASY98000SF,	/* Falcon Eval Board, Serial Flash */
+@@ -22,6 +22,18 @@
+ 	LANTIQ_MACH_EASY98000NAND,	/* Falcon Eval Board, NAND Flash */
  	LANTIQ_MACH_EASY98020,		/* Falcon Reference Board */
  	LANTIQ_MACH_95C3AM1,		/* Board 95C3AM1 */
 +
@@ -539,6 +669,7 @@
 +	LANTIQ_MACH_ARV4520PW,		/* Airties WAV-281, Arcor EasyboxA800 */
 +	LANTIQ_MACH_ARV452CPW,		/* Arcor EasyboxA801 */
 +	LANTIQ_MACH_ARV4525PW,		/* Speedport W502V */
++	LANTIQ_MACH_ARV7525PW,		/* Speedport W303V Typ A */
 +	LANTIQ_MACH_ARV752DPW,		/* Arcor easybox a802 */
 +	LANTIQ_MACH_ARV752DPW22,	/* Arcor easybox a803 */
 +	LANTIQ_MACH_ARV7518PW,		/* ASTORIA */

+ 1 - 1
target/linux/lantiq/patches-2.6.39/280-netif_receive_skb.patch

@@ -1,6 +1,6 @@
 --- a/drivers/net/lantiq_etop.c
 +++ b/drivers/net/lantiq_etop.c
-@@ -155,8 +155,12 @@
+@@ -155,8 +155,12 @@ ltq_etop_hw_receive(struct ltq_etop_chan
  
  	skb_put(skb, len);
  	skb->dev = ch->netdev;

+ 2 - 2
target/linux/lantiq/patches-2.6.39/410-spi2.patch

@@ -10,7 +10,7 @@ Signed-off-by: Daniel Schwierzeck <[email protected]>
 
 --- a/drivers/spi/Kconfig
 +++ b/drivers/spi/Kconfig
-@@ -193,6 +193,14 @@
+@@ -193,6 +193,14 @@ config SPI_IMX
  	  This enables using the Freescale i.MX SPI controllers in master
  	  mode.
  
@@ -27,7 +27,7 @@ Signed-off-by: Daniel Schwierzeck <[email protected]>
  	depends on PARPORT && EXPERIMENTAL
 --- a/drivers/spi/Makefile
 +++ b/drivers/spi/Makefile
-@@ -26,6 +26,7 @@
+@@ -26,6 +26,7 @@ obj-$(CONFIG_SPI_EP93XX)		+= ep93xx_spi.
  obj-$(CONFIG_SPI_GPIO)			+= spi_gpio.o
  obj-$(CONFIG_SPI_GPIO_OLD)		+= spi_gpio_old.o
  obj-$(CONFIG_SPI_IMX)			+= spi_imx.o

+ 1 - 1
target/linux/lantiq/patches-2.6.39/420-spi3.patch

@@ -18,7 +18,7 @@ Signed-off-by: Daniel Schwierzeck <[email protected]>
  
  #include <asm/bootinfo.h>
  #include <asm/irq.h>
-@@ -119,3 +120,41 @@
+@@ -119,3 +120,41 @@ ltq_register_etop(struct ltq_eth_data *e
  		platform_device_register(&ltq_etop);
  	}
  }

+ 6 - 3
target/linux/lantiq/patches-2.6.39/510-register_madwifi.patch

@@ -1,17 +1,20 @@
 --- a/arch/mips/lantiq/xway/devices.c
 +++ b/arch/mips/lantiq/xway/devices.c
-@@ -144,6 +144,16 @@ ltq_register_gpio_ebu(unsigned int value
+@@ -144,6 +144,19 @@ ltq_register_gpio_ebu(unsigned int value
  	platform_device_register(&ltq_ebu);
  }
  
 +/* madwifi */
 +int lantiq_emulate_madwifi_eep = 0;
++unsigned long long lantiq_madwifi_eep_addr = 0;
 +EXPORT_SYMBOL(lantiq_emulate_madwifi_eep);
++EXPORT_SYMBOL(lantiq_madwifi_eep_addr);
 +
 +void __init
-+ltq_register_madwifi_eep(void)
++ltq_register_madwifi_eep(unsigned long long addr)
 +{
 +	lantiq_emulate_madwifi_eep = 1;
++	lantiq_madwifi_eep_addr = addr;
 +}
 +
  static struct resource ltq_spi_resources[] = {
@@ -23,6 +26,6 @@
  extern void ltq_register_ase_asc(void);
  extern void ltq_register_etop(struct ltq_eth_data *eth);
  extern void ltq_register_gpio_ebu(unsigned int value);
-+extern void ltq_register_madwifi_eep(void);
++extern void ltq_register_madwifi_eep(unsigned long long addr);
  
  #endif

+ 96 - 41
target/linux/lantiq/patches-2.6.39/520-register_buttons.patch

@@ -1,46 +1,101 @@
---- a/arch/mips/lantiq/xway/devices.c
-+++ b/arch/mips/lantiq/xway/devices.c
-@@ -154,6 +154,26 @@ ltq_register_madwifi_eep(void)
- 	lantiq_emulate_madwifi_eep = 1;
- }
+--- a/arch/mips/lantiq/Makefile
++++ b/arch/mips/lantiq/Makefile
+@@ -4,7 +4,7 @@
+ # under the terms of the GNU General Public License version 2 as published
+ # by the Free Software Foundation.
  
-+/* gpio buttons */
-+static struct gpio_buttons_platform_data ltq_gpio_buttons_platform_data;
+-obj-y := irq.o setup.o clk.o prom.o devices.o
++obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-buttons.o
+ 
+ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
+ 
+--- /dev/null
++++ b/arch/mips/lantiq/dev-gpio-buttons.c
+@@ -0,0 +1,58 @@
++/*
++ *  Lantiq GPIO button support
++ *
++ *  Copyright (C) 2008-2009 Gabor Juhos <[email protected]>
++ *  Copyright (C) 2008 Imre Kaloz <[email protected]>
++ *
++ *  This program is free software; you can redistribute it and/or modify it
++ *  under the terms of the GNU General Public License version 2 as published
++ *  by the Free Software Foundation.
++ */
 +
-+static struct platform_device ltq_gpio_buttons_platform_device =
-+{
-+	.name = "gpio-buttons",
-+	.id = 0,
-+	.dev = {
-+		.platform_data = (void *) &ltq_gpio_buttons_platform_data,
-+	},
-+};
-+
-+void __init
-+ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt)
++#include "linux/init.h"
++#include "linux/slab.h"
++#include <linux/platform_device.h>
++
++#include "dev-gpio-buttons.h"
++
++void __init ltq_register_gpio_keys_polled(int id,
++					     unsigned poll_interval,
++					     unsigned nbuttons,
++					     struct gpio_keys_button *buttons)
 +{
-+	ltq_gpio_buttons_platform_data.buttons = buttons;
-+	ltq_gpio_buttons_platform_data.nbuttons = cnt;
-+	platform_device_register(&ltq_gpio_buttons_platform_device);
++	struct platform_device *pdev;
++	struct gpio_keys_platform_data pdata;
++	struct gpio_keys_button *p;
++	int err;
++
++	p = kmalloc(nbuttons * sizeof(*p), GFP_KERNEL);
++	if (!p)
++		return;
++
++	memcpy(p, buttons, nbuttons * sizeof(*p));
++
++	pdev = platform_device_alloc("gpio-keys-polled", id);
++	if (!pdev)
++		goto err_free_buttons;
++
++	memset(&pdata, 0, sizeof(pdata));
++	pdata.poll_interval = poll_interval;
++	pdata.nbuttons = nbuttons;
++	pdata.buttons = p;
++
++	err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
++	if (err)
++		goto err_put_pdev;
++
++	err = platform_device_add(pdev);
++	if (err)
++		goto err_put_pdev;
++
++	return;
++
++err_put_pdev:
++	platform_device_put(pdev);
++
++err_free_buttons:
++	kfree(p);
 +}
+--- /dev/null
++++ b/arch/mips/lantiq/dev-gpio-buttons.h
+@@ -0,0 +1,26 @@
++/*
++ *  Lantiq GPIO button support
++ *
++ *  Copyright (C) 2008-2009 Gabor Juhos <[email protected]>
++ *  Copyright (C) 2008 Imre Kaloz <[email protected]>
++ *
++ *  This program is free software; you can redistribute it and/or modify it
++ *  under the terms of the GNU General Public License version 2 as published
++ *  by the Free Software Foundation.
++ */
 +
- static struct resource ltq_spi_resources[] = {
- 	{
- 		.start  = LTQ_SSC_BASE_ADDR,
---- a/arch/mips/lantiq/xway/devices.h
-+++ b/arch/mips/lantiq/xway/devices.h
-@@ -11,6 +11,7 @@
- 
- #include "../devices.h"
- #include <linux/phy.h>
-+#include <linux/gpio_buttons.h>
- 
- extern void ltq_register_gpio(void);
- extern void ltq_register_gpio_stp(void);
-@@ -18,5 +19,6 @@ extern void ltq_register_ase_asc(void);
- extern void ltq_register_etop(struct ltq_eth_data *eth);
- extern void ltq_register_gpio_ebu(unsigned int value);
- extern void ltq_register_madwifi_eep(void);
-+extern void ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt);
- 
- #endif
++#ifndef _LANTIQ_DEV_GPIO_BUTTONS_H
++#define _LANTIQ_DEV_GPIO_BUTTONS_H
++
++#include <linux/input.h>
++#include <linux/gpio_keys.h>
++
++#define LTQ_KEYS_POLL_INTERVAL		20 /* msecs */
++#define LTQ_KEYS_DEBOUNCE_INTERVAL	(3 * LTQ_KEYS_POLL_INTERVAL)
++
++void ltq_register_gpio_keys_polled(int id,
++				      unsigned poll_interval,
++				      unsigned nbuttons,
++				      struct gpio_keys_button *buttons);
++
++#endif /* _LANTIQ_DEV_GPIO_BUTTONS_H */

+ 1 - 1
target/linux/lantiq/patches-2.6.39/530-register_tapi.patch

@@ -32,7 +32,7 @@
  #endif
 --- a/arch/mips/lantiq/xway/mach-easy50712.c
 +++ b/arch/mips/lantiq/xway/mach-easy50712.c
-@@ -66,6 +66,7 @@ static void __init easy50712_init(void)
+@@ -61,6 +61,7 @@ static void __init easy50712_init(void)
  	ltq_register_nor(&easy50712_flash_data);
  	ltq_register_pci(&ltq_pci_data);
  	ltq_register_etop(&ltq_eth_data);

+ 1 - 1
target/linux/lantiq/patches-2.6.39/550-dwc_otg.patch

@@ -15613,7 +15613,7 @@
 +#endif
 --- a/drivers/usb/core/hub.c
 +++ b/drivers/usb/core/hub.c
-@@ -2812,11 +2812,11 @@ hub_port_init (struct usb_hub *hub, stru
+@@ -2814,11 +2814,11 @@ hub_port_init (struct usb_hub *hub, stru
  		udev->ttport = hdev->ttport;
  	} else if (udev->speed != USB_SPEED_HIGH
  			&& hdev->speed == USB_SPEED_HIGH) {

+ 2 - 2
target/linux/lantiq/patches-2.6.39/560-dev-leds-gpio.patch

@@ -88,8 +88,8 @@
  # under the terms of the GNU General Public License version 2 as published
  # by the Free Software Foundation.
  
--obj-y := irq.o setup.o clk.o prom.o devices.o
-+obj-y := irq.o setup.o clk.o prom.o devices.o dev-leds-gpio.o
+-obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-buttons.o
++obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-buttons.o dev-leds-gpio.o
  
  obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
  

+ 8 - 8
target/linux/lantiq/patches-2.6.39/600-mach-dgn3500.patch

@@ -1,6 +1,6 @@
 --- a/arch/mips/lantiq/machtypes.h
 +++ b/arch/mips/lantiq/machtypes.h
-@@ -32,6 +32,9 @@
+@@ -34,6 +34,9 @@ enum lantiq_mach_type {
  	LANTIQ_MACH_ARV752DPW,		/* Arcor easybox a802 */
  	LANTIQ_MACH_ARV752DPW22,	/* Arcor easybox a803 */
  	LANTIQ_MACH_ARV7518PW,		/* ASTORIA */
@@ -12,7 +12,7 @@
  #endif
 --- a/arch/mips/lantiq/xway/Kconfig
 +++ b/arch/mips/lantiq/xway/Kconfig
-@@ -10,6 +10,10 @@
+@@ -10,6 +10,10 @@ config LANTIQ_MACH_ARV45XX
  	bool "ARV45XX"
  	default y
  
@@ -25,7 +25,7 @@
  endif
 --- a/arch/mips/lantiq/xway/Makefile
 +++ b/arch/mips/lantiq/xway/Makefile
-@@ -6,4 +6,5 @@
+@@ -6,4 +6,5 @@ obj-$(CONFIG_SOC_AMAZON_SE) += clk-ase.o
  obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o
  obj-$(CONFIG_LANTIQ_MACH_EASY50601) += mach-easy50601.o
  obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o
@@ -33,18 +33,18 @@
  obj-y += dev-dwc_otg.o
 --- a/arch/mips/lantiq/xway/devices.h
 +++ b/arch/mips/lantiq/xway/devices.h
-@@ -12,6 +12,7 @@
+@@ -11,6 +11,7 @@
+ 
  #include "../devices.h"
  #include <linux/phy.h>
- #include <linux/gpio_buttons.h>
 +#include <linux/spi/spi.h>
  
  extern void ltq_register_gpio(void);
  extern void ltq_register_gpio_stp(void);
-@@ -20,5 +21,7 @@
+@@ -18,5 +19,7 @@ extern void ltq_register_ase_asc(void);
+ extern void ltq_register_etop(struct ltq_eth_data *eth);
  extern void ltq_register_gpio_ebu(unsigned int value);
- extern void ltq_register_madwifi_eep(void);
- extern void ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt);
+ extern void ltq_register_madwifi_eep(unsigned long long addr);
 +extern void ltq_register_spi(struct ltq_spi_platform_data *pdata,
 +		struct spi_board_info const *info, unsigned n);
  

+ 136 - 39
target/linux/lantiq/patches-2.6.39/601-mach-gigasx76x.patch

@@ -1,11 +1,12 @@
 --- a/arch/mips/lantiq/xway/Kconfig
 +++ b/arch/mips/lantiq/xway/Kconfig
-@@ -14,6 +14,10 @@
+@@ -14,6 +14,11 @@ config LANTIQ_MACH_NETGEAR
  	bool "Netgear"
  	default y
  
 +config LANTIQ_MACH_GIGASX76X
 +	bool "GIGASX76X"
++	select LTQ_DEV_GPIO_BUTTONS
 +	default y
 +
  endmenu
@@ -13,7 +14,7 @@
  endif
 --- a/arch/mips/lantiq/xway/Makefile
 +++ b/arch/mips/lantiq/xway/Makefile
-@@ -7,4 +7,5 @@
+@@ -7,4 +7,5 @@ obj-$(CONFIG_LANTIQ_MACH_EASY50712) += m
  obj-$(CONFIG_LANTIQ_MACH_EASY50601) += mach-easy50601.o
  obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o
  obj-$(CONFIG_LANTIQ_MACH_NETGEAR) += mach-netgear.o
@@ -21,7 +22,7 @@
  obj-y += dev-dwc_otg.o
 --- /dev/null
 +++ b/arch/mips/lantiq/xway/mach-gigasx76x.c
-@@ -0,0 +1,113 @@
+@@ -0,0 +1,209 @@
 +/*
 + *  This program is free software; you can redistribute it and/or modify it
 + *  under the terms of the GNU General Public License version 2 as published
@@ -32,11 +33,11 @@
 + *
 + */
 +
++#include <linux/kernel.h>
 +#include <linux/init.h>
 +#include <linux/platform_device.h>
 +#include <linux/leds.h>
 +#include <linux/gpio.h>
-+#include <linux/gpio_buttons.h>
 +#include <linux/mtd/mtd.h>
 +#include <linux/mtd/partitions.h>
 +#include <linux/mtd/physmap.h>
@@ -44,58 +45,71 @@
 +#include <linux/ath5k_platform.h>
 +#include <linux/pci.h>
 +#include <linux/phy.h>
++#include <linux/io.h>
++#include <linux/string.h>
 +
 +#include <irq.h>
 +
 +#include <lantiq_soc.h>
 +#include <lantiq_platform.h>
 +
-+#include "../machtypes.h"
 +#include "devices.h"
 +#include "dev-dwc_otg.h"
-+#include "dev-leds-gpio.h"
++#include "../machtypes.h"
++#include "../dev-leds-gpio.h"
++#include "../dev-gpio-buttons.h"
++
++#define UBOOT_ENV_OFFSET	0x010000
++#define UBOOT_ENV_SIZE		0x010000
 +
 +#ifdef CONFIG_MTD_PARTITIONS
 +static struct mtd_partition gigasx76x_partitions[] =
 +{
 +	{
-+		.name	= "secondary_env",
-+		.offset	= 0xe000,
-+		.size	= 0x2000,
-+	},
-+	{
-+		.name	= "secondary_boot",
-+		.offset	= 0x10000,
-+		.size	= 0x10000,
++		.name	= "uboot",
++		.offset	= 0x000000,
++		.size	= 0x010000,
 +	},
 +	{
-+		.name	= "uboot",
-+		.offset	= 0x20000,
-+		.size	= 0x30000,
++		.name	= "uboot_env",
++		.offset	= UBOOT_ENV_OFFSET,
++		.size	= UBOOT_ENV_SIZE,
 +	},
 +	{
 +		.name	= "linux",
-+		.offset	= 0x50000,
-+		.size	= 0x7a0000,
++		.offset	= 0x020000,
++		.size	= 0x7d0000,
 +	},
 +	{
 +		.name	= "board_config",
 +		.offset	= 0x7f0000,
-+		.size	= 0x10000,
++		.size	= 0x010000,
 +	},
 +};
 +#endif
 +
 +static struct gpio_led
-+gigasx76x_leds_gpio[] __initdata = {
++gigasx76x_gpio_leds[] __initdata = {
 +	{ .name = "soc:green:usb", .gpio = 50, },
 +	{ .name = "soc:green:wlan", .gpio = 51, },
 +	{ .name = "soc:green:phone2", .gpio = 52, },
 +	{ .name = "soc:green:phone1", .gpio = 53, },
 +	{ .name = "soc:green:line", .gpio = 54, },
 +	{ .name = "soc:green:online", .gpio = 55, },
++	{ .name = "soc:green:voip", .gpio = 56, },
 +};
 +
++static struct gpio_keys_button
++gigasx76x_gpio_keys[] __initdata = {
++		{
++			.desc		= "reset",
++			.type		= EV_KEY,
++			.code		= KEY_RESTART,
++			.debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
++			.gpio = 14,
++			.active_low = 1,
++		},
++};
 +
 +static struct physmap_flash_data gigasx76x_flash_data = {
 +#ifdef CONFIG_MTD_PARTITIONS
@@ -105,39 +119,122 @@
 +};
 +
 +static struct ltq_pci_data ltq_pci_data = {
-+	.clock      = PCI_CLOCK_INT,
-+	.gpio   = PCI_GNT1 | PCI_REQ1,
-+	.irq    = {
-+		[14] = INT_NUM_IM0_IRL0 + 22,
-+	},
++	.clock	= PCI_CLOCK_INT,
++	.gpio	= PCI_GNT1 | PCI_REQ1,
++	.irq	= { [14] = INT_NUM_IM0_IRL0 + 22, },
 +};
 +
 +static struct ltq_eth_data ltq_eth_data = {
-+  .mii_mode = PHY_INTERFACE_MODE_MII,
++  .mii_mode	= PHY_INTERFACE_MODE_MII,
 +};
 +
-+static void __init
-+gigasx76x_init(void)
-+{
-+#define GIGASX76X_USB			29
++static char __init *get_uboot_env_var(char *haystack, int haystack_len, char *needle, int needle_len) {
++	int i;
++	for (i = 0; i <= haystack_len - needle_len; i++) {
++		if (memcmp(haystack + i, needle, needle_len) == 0) {
++			return haystack + i + needle_len;
++		}
++	}
++	return NULL;
++}
++
++/*
++ * gigasx76x_parse_hex_* are not uniq. in arm/orion there are also duplicates:
++ * dns323_parse_hex_*
++ * TODO: one day write a patch for this :)
++ */
++static int __init gigasx76x_parse_hex_nibble(char n) {
++	if (n >= '0' && n <= '9')
++		return n - '0';
++
++	if (n >= 'A' && n <= 'F')
++		return n - 'A' + 10;
++
++	if (n >= 'a' && n <= 'f')
++		return n - 'a' + 10;
++
++	return -1;
++}
++
++static int __init gigasx76x_parse_hex_byte(const char *b) {
++	int hi;
++	int lo;
++
++	hi = gigasx76x_parse_hex_nibble(b[0]);
++	lo = gigasx76x_parse_hex_nibble(b[1]);
++
++	if (hi < 0 || lo < 0)
++		return -1;
++
++	return (hi << 4) | lo;
++}
++
++static int __init gigasx76x_register_ethernet(void) {
++	u_int8_t addr[6];
++	int i;
++	char *uboot_env_page;
++	char *mac;
++
++	uboot_env_page = ioremap(LTQ_FLASH_START + UBOOT_ENV_OFFSET, UBOOT_ENV_SIZE);
++	if (!uboot_env_page)
++		return -ENOMEM;
++
++	mac = get_uboot_env_var(uboot_env_page, UBOOT_ENV_SIZE, "\0ethaddr=", 9);
++
++	if (!mac) {
++	goto error_fail;
++	}
++
++	/* Sanity check the string we're looking at */
++	for (i = 0; i < 5; i++) {
++	if (*(mac + (i * 3) + 2) != ':') {
++		goto error_fail;
++		}
++	}
++
++	for (i = 0; i < 6; i++) {
++		int byte;
++		byte = gigasx76x_parse_hex_byte(mac + (i * 3));
++		if (byte < 0) {
++			goto error_fail;
++		}
++		addr[i] = byte;
++	}
++
++	iounmap(uboot_env_page);
++	printk("GIGASX76X: Found ethernet MAC address: ");
++	for (i = 0; i < 6; i++)
++		printk("%.2x%s", addr[i], (i < 5) ? ":" : ".\n");
++
++	memcpy(&ltq_eth_data.mac.sa_data, addr, 6);
++	ltq_register_etop(&ltq_eth_data);
++
++	return 0;
++
++	error_fail:
++		iounmap(uboot_env_page);
++		return -EINVAL;
++}
++
++static void __init gigasx76x_init(void) {
++#define GIGASX76X_USB		29
++#define GIGASX76X_MADWIFI_ADDR	0xb07f0000
 +
 +	ltq_register_gpio_stp();
 +	ltq_register_nor(&gigasx76x_flash_data);
 +	ltq_register_pci(&ltq_pci_data);
-+	ltq_register_etop(&ltq_eth_data);
++	gigasx76x_register_ethernet();
 +	xway_register_dwc(GIGASX76X_USB);
 +	ltq_register_tapi();
-+	ltq_register_madwifi_eep();
-+	ltq_add_device_leds_gpio(-1, ARRAY_SIZE(gigasx76x_leds_gpio), gigasx76x_leds_gpio);
++	ltq_register_madwifi_eep(GIGASX76X_MADWIFI_ADDR);
++	ltq_add_device_leds_gpio(-1, ARRAY_SIZE(gigasx76x_gpio_leds), gigasx76x_gpio_leds);
++	ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, ARRAY_SIZE(gigasx76x_gpio_keys), gigasx76x_gpio_keys);
 +}
 +
-+MIPS_MACHINE(LANTIQ_MACH_GIGASX76X,
-+			"GIGASX76X",
-+			"GIGASX76X - Gigaset SX761,SX762,SX763",
-+			gigasx76x_init);
++MIPS_MACHINE(LANTIQ_MACH_GIGASX76X, "GIGASX76X", "GIGASX76X - Gigaset SX761,SX762,SX763", gigasx76x_init);
 --- a/arch/mips/lantiq/machtypes.h
 +++ b/arch/mips/lantiq/machtypes.h
-@@ -35,6 +35,9 @@
+@@ -37,6 +37,9 @@ enum lantiq_mach_type {
  
  	/* Netgear */
  	LANTIQ_MACH_DGN3500B,		/* Netgear DGN3500 */