summaryrefslogtreecommitdiff
path: root/target/linux/adm5120
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-04-25 12:57:33 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-04-25 12:57:33 +0000
commit671361c7ea8a260f414046317769d502aaf00d51 (patch)
tree637d9699223fbb75ccd3de8dd0456ff2c97e7350 /target/linux/adm5120
parent43d67fa995bb1b4073d345a08f23b25cf2ee62a1 (diff)
downloadmtk-20170518-671361c7ea8a260f414046317769d502aaf00d51.zip
mtk-20170518-671361c7ea8a260f414046317769d502aaf00d51.tar.gz
mtk-20170518-671361c7ea8a260f414046317769d502aaf00d51.tar.bz2
adm5120: add 3.3 support
Partially based on the 3.1 patches by Hartmut Knaack <knaack.h [at] gmx.de> SVN-Revision: 31474
Diffstat (limited to 'target/linux/adm5120')
-rw-r--r--target/linux/adm5120/patches-3.3/001-adm5120.patch43
-rw-r--r--target/linux/adm5120/patches-3.3/002-adm5120_flash.patch21
-rw-r--r--target/linux/adm5120/patches-3.3/003-adm5120_switch.patch23
-rw-r--r--target/linux/adm5120/patches-3.3/005-adm5120_usb.patch33
-rw-r--r--target/linux/adm5120/patches-3.3/007-adm5120_pci.patch22
-rw-r--r--target/linux/adm5120/patches-3.3/009-adm5120_leds_switch_trigger.patch22
-rw-r--r--target/linux/adm5120/patches-3.3/101-cfi_fixup_macronix_bootloc.patch84
-rw-r--r--target/linux/adm5120/patches-3.3/102-jedec_pmc_39lvxxx_chips.patch68
-rw-r--r--target/linux/adm5120/patches-3.3/103-mtd_trxsplit.patch23
-rw-r--r--target/linux/adm5120/patches-3.3/120-rb153_cf_driver.patch28
-rw-r--r--target/linux/adm5120/patches-3.3/200-amba_pl010_hacks.patch378
-rw-r--r--target/linux/adm5120/patches-3.3/201-amba_bus_hacks.patch13
-rw-r--r--target/linux/adm5120/patches-3.3/203-gpio_leds_brightness.patch27
-rw-r--r--target/linux/adm5120/patches-3.3/310-adm5120_wdt.patch31
-rw-r--r--target/linux/adm5120/patches-3.3/a00-adm5120-add-Platform-file.patch22
-rw-r--r--target/linux/adm5120/patches-3.3/a01-adm5120-core-build-error-fixes.patch110
-rw-r--r--target/linux/adm5120/patches-3.3/a03-adm5120-remove-CONFIG_MTD_PARTITIONS.patch306
-rw-r--r--target/linux/adm5120/patches-3.3/a04-use-gpio-keys-polled-driver.patch263
-rw-r--r--target/linux/adm5120/patches-3.3/a10-pata-rb150-cf-3.3-fix.patch33
-rw-r--r--target/linux/adm5120/patches-3.3/a11-adm5120_wdt-3.3-fixes.patch21
-rw-r--r--target/linux/adm5120/patches-3.3/a12-adm5120sw-3.3-fixes.patch84
-rw-r--r--target/linux/adm5120/patches-3.3/a13-adm5120_flash-3.3-fixes.patch166
-rw-r--r--target/linux/adm5120/patches-3.3/a14-mtd-trxsplit-fixes.patch20
-rw-r--r--target/linux/adm5120/patches-3.3/a15-adm5120-usb-driver-cleanup.patch582
-rw-r--r--target/linux/adm5120/router_be/config-3.3191
-rw-r--r--target/linux/adm5120/router_le/config-3.3227
26 files changed, 2841 insertions, 0 deletions
diff --git a/target/linux/adm5120/patches-3.3/001-adm5120.patch b/target/linux/adm5120/patches-3.3/001-adm5120.patch
new file mode 100644
index 0000000..edb3979
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/001-adm5120.patch
@@ -0,0 +1,43 @@
+--- a/arch/mips/Kconfig
++++ b/arch/mips/Kconfig
+@@ -39,6 +39,23 @@ choice
+ prompt "System type"
+ default SGI_IP22
+
++config ADM5120
++ bool "Infineon/ADMtek ADM5120 SoC based machines"
++ select BOOT_RAW
++ select NO_EXCEPT_FILL
++ select CEVT_R4K
++ select CSRC_R4K
++ select SYS_HAS_CPU_MIPS32_R1
++ select SYS_HAS_EARLY_PRINTK
++ select DMA_NONCOHERENT
++ select IRQ_CPU
++ select SYS_SUPPORTS_LITTLE_ENDIAN
++ select SYS_SUPPORTS_BIG_ENDIAN
++ select SYS_SUPPORTS_32BIT_KERNEL
++ select ARCH_REQUIRE_GPIOLIB
++ select SWAP_IO_SPACE if CPU_BIG_ENDIAN
++ select MIPS_MACHINE
++
+ config MIPS_ALCHEMY
+ bool "Alchemy processor based machines"
+ select 64BIT_PHYS_ADDR
+@@ -813,6 +830,7 @@ config NLM_XLP_BOARD
+
+ endchoice
+
++source "arch/mips/adm5120/Kconfig"
+ source "arch/mips/alchemy/Kconfig"
+ source "arch/mips/ath79/Kconfig"
+ source "arch/mips/bcm47xx/Kconfig"
+--- a/arch/mips/Kbuild.platforms
++++ b/arch/mips/Kbuild.platforms
+@@ -1,5 +1,6 @@
+ # All platforms listed in alphabetic order
+
++platforms += adm5120
+ platforms += alchemy
+ platforms += ar7
+ platforms += ath79
diff --git a/target/linux/adm5120/patches-3.3/002-adm5120_flash.patch b/target/linux/adm5120/patches-3.3/002-adm5120_flash.patch
new file mode 100644
index 0000000..98b1f2a
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/002-adm5120_flash.patch
@@ -0,0 +1,21 @@
+--- a/drivers/mtd/maps/Kconfig
++++ b/drivers/mtd/maps/Kconfig
+@@ -526,4 +526,8 @@ config MTD_LATCH_ADDR
+
+ If compiled as a module, it will be called latch-addr-flash.
+
++config MTD_ADM5120
++ tristate "Map driver for ADM5120 based boards"
++ depends on ADM5120
++
+ endmenu
+--- a/drivers/mtd/maps/Makefile
++++ b/drivers/mtd/maps/Makefile
+@@ -38,6 +38,7 @@ obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx2
+ obj-$(CONFIG_MTD_DBOX2) += dbox2-flash.o
+ obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o
+ obj-$(CONFIG_MTD_PCI) += pci.o
++obj-$(CONFIG_MTD_ADM5120) += adm5120-flash.o
+ obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o
+ obj-$(CONFIG_MTD_IMPA7) += impa7.o
+ obj-$(CONFIG_MTD_FORTUNET) += fortunet.o
diff --git a/target/linux/adm5120/patches-3.3/003-adm5120_switch.patch b/target/linux/adm5120/patches-3.3/003-adm5120_switch.patch
new file mode 100644
index 0000000..ef9d692
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/003-adm5120_switch.patch
@@ -0,0 +1,23 @@
+--- a/drivers/net/Kconfig
++++ b/drivers/net/Kconfig
+@@ -247,6 +247,10 @@ source "drivers/net/dsa/Kconfig"
+
+ source "drivers/net/ethernet/Kconfig"
+
++config ADM5120_ENET
++ tristate "ADM5120 Ethernet switch support"
++ depends on ADM5120
++
+ source "drivers/net/fddi/Kconfig"
+
+ source "drivers/net/hippi/Kconfig"
+--- a/drivers/net/Makefile
++++ b/drivers/net/Makefile
+@@ -32,6 +32,7 @@ obj-$(CONFIG_CAN) += can/
+ obj-$(CONFIG_ETRAX_ETHERNET) += cris/
+ obj-$(CONFIG_NET_DSA) += dsa/
+ obj-$(CONFIG_ETHERNET) += ethernet/
++obj-$(CONFIG_ADM5120_ENET) += adm5120sw.o
+ obj-$(CONFIG_FDDI) += fddi/
+ obj-$(CONFIG_HIPPI) += hippi/
+ obj-$(CONFIG_HAMRADIO) += hamradio/
diff --git a/target/linux/adm5120/patches-3.3/005-adm5120_usb.patch b/target/linux/adm5120/patches-3.3/005-adm5120_usb.patch
new file mode 100644
index 0000000..fd809da
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/005-adm5120_usb.patch
@@ -0,0 +1,33 @@
+--- a/drivers/usb/Makefile
++++ b/drivers/usb/Makefile
+@@ -13,6 +13,7 @@ obj-$(CONFIG_USB_DWC3) += dwc3/
+ obj-$(CONFIG_USB_MON) += mon/
+
+ obj-$(CONFIG_PCI) += host/
++obj-$(CONFIG_USB_ADM5120_HCD) += host/
+ obj-$(CONFIG_USB_EHCI_HCD) += host/
+ obj-$(CONFIG_USB_ISP116X_HCD) += host/
+ obj-$(CONFIG_USB_OHCI_HCD) += host/
+--- a/drivers/usb/host/Kconfig
++++ b/drivers/usb/host/Kconfig
+@@ -4,6 +4,10 @@
+ comment "USB Host Controller Drivers"
+ depends on USB
+
++config USB_ADM5120_HCD
++ tristate "ADM5120 HCD support (EXPERIMENTAL)"
++ depends on USB && ADM5120 && EXPERIMENTAL
++
+ config USB_C67X00_HCD
+ tristate "Cypress C67x00 HCD support"
+ depends on USB
+--- a/drivers/usb/host/Makefile
++++ b/drivers/usb/host/Makefile
+@@ -19,6 +19,7 @@ obj-$(CONFIG_USB_WHCI_HCD) += whci/
+
+ obj-$(CONFIG_PCI) += pci-quirks.o
+
++obj-$(CONFIG_USB_ADM5120_HCD) += adm5120-hcd.o
+ obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
+ obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o
+ obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
diff --git a/target/linux/adm5120/patches-3.3/007-adm5120_pci.patch b/target/linux/adm5120/patches-3.3/007-adm5120_pci.patch
new file mode 100644
index 0000000..e757bb5
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/007-adm5120_pci.patch
@@ -0,0 +1,22 @@
+--- a/arch/mips/pci/Makefile
++++ b/arch/mips/pci/Makefile
+@@ -20,6 +20,7 @@ obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o
+ ops-bcm63xx.o
+ obj-$(CONFIG_MIPS_ALCHEMY) += pci-alchemy.o
+ obj-$(CONFIG_SOC_AR724X) += pci-ath724x.o
++obj-$(CONFIG_ADM5120) += pci-adm5120.o
+
+ #
+ # These are still pretty much in the old state, watch, go blind.
+--- a/include/linux/pci_ids.h
++++ b/include/linux/pci_ids.h
+@@ -1803,6 +1803,9 @@
+ #define PCI_VENDOR_ID_ESDGMBH 0x12fe
+ #define PCI_DEVICE_ID_ESDGMBH_CPCIASIO4 0x0111
+
++#define PCI_VENDOR_ID_ADMTEK 0x1317
++#define PCI_DEVICE_ID_ADMTEK_ADM5120 0x5120
++
+ #define PCI_VENDOR_ID_SIIG 0x131f
+ #define PCI_SUBVENDOR_ID_SIIG 0x131f
+ #define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000
diff --git a/target/linux/adm5120/patches-3.3/009-adm5120_leds_switch_trigger.patch b/target/linux/adm5120/patches-3.3/009-adm5120_leds_switch_trigger.patch
new file mode 100644
index 0000000..5d896e6
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/009-adm5120_leds_switch_trigger.patch
@@ -0,0 +1,22 @@
+--- a/drivers/leds/Kconfig
++++ b/drivers/leds/Kconfig
+@@ -498,4 +498,12 @@ config LEDS_TRIGGER_USBDEV
+ This allows LEDs to be controlled by the presence/activity of
+ an USB device. If unsure, say N.
+
++config LEDS_TRIGGER_ADM5120_SWITCH
++ tristate "LED ADM5120 Switch Port Status Trigger"
++ depends on LEDS_TRIGGERS && ADM5120
++ help
++ This allows LEDs to be controlled by the port states of
++ the ADM5120 built-in Ethernet Switch
++ If unsure, say N.
++
+ endif # NEW_LEDS
+--- a/drivers/leds/Makefile
++++ b/drivers/leds/Makefile
+@@ -60,3 +60,4 @@ obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) +=
+ obj-$(CONFIG_LEDS_TRIGGER_MORSE) += ledtrig-morse.o
+ obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o
+ obj-$(CONFIG_LEDS_TRIGGER_USBDEV) += ledtrig-usbdev.o
++obj-$(CONFIG_LEDS_TRIGGER_ADM5120_SWITCH) += ledtrig-adm5120-switch.o
diff --git a/target/linux/adm5120/patches-3.3/101-cfi_fixup_macronix_bootloc.patch b/target/linux/adm5120/patches-3.3/101-cfi_fixup_macronix_bootloc.patch
new file mode 100644
index 0000000..5a7cc8e
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/101-cfi_fixup_macronix_bootloc.patch
@@ -0,0 +1,84 @@
+--- a/drivers/mtd/chips/cfi_cmdset_0002.c
++++ b/drivers/mtd/chips/cfi_cmdset_0002.c
+@@ -48,6 +48,12 @@
+ #define SST49LF008A 0x005a
+ #define AT49BV6416 0x00d6
+
++/* Macronix */
++#define MX29LV160B 0x2249 /* MX29LV160 Bottom-boot chip */
++#define MX29LV160T 0x22C4 /* MX29LV160 Top-boot chip */
++#define MX29LV320B 0x22A8 /* MX29LV320 Bottom-boot chip */
++#define MX29LV320T 0x22A7 /* MX29LV320 Top-boot chip */
++
+ static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
+ static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
+ static int cfi_amdstd_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
+@@ -342,6 +348,41 @@ static struct cfi_fixup cfi_nopri_fixup_
+ { 0, 0, NULL }
+ };
+
++#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC
++/*
++ * Some Macronix chips has no/bad bootblock information in the CFI table
++ */
++static void fixup_macronix_bootloc(struct mtd_info *mtd, void* param)
++{
++ struct map_info *map = mtd->priv;
++ struct cfi_private *cfi = map->fldrv_priv;
++ struct cfi_pri_amdstd *extp = cfi->cmdset_priv;
++ __u8 t;
++
++ switch (cfi->id) {
++ /* TODO: put affected chip ids here */
++ case MX29LV160B:
++ case MX29LV320B:
++ t = 2; /* Bottom boot */
++ break;
++ case MX29LV160T:
++ case MX29LV320T:
++ t = 3; /* Top boot */
++ break;
++ default:
++ return;
++ }
++
++ if (extp->TopBottom == t)
++ /* boot location detected by the CFI layer is correct */
++ return;
++
++ extp->TopBottom = t;
++ printk("%s: Macronix chip detected, id:0x%04X, boot location forced "
++ "to %s\n", map->name, cfi->id, (t == 2) ? "bottom" : "top");
++}
++#endif /* CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC */
++
+ static struct cfi_fixup cfi_fixup_table[] = {
+ { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri },
+ #ifdef AMD_BOOTLOC_BUG
+@@ -383,6 +424,9 @@ static struct cfi_fixup fixup_table[] =
+ */
+ { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_erase_chip },
+ { CFI_MFR_ATMEL, AT49BV6416, fixup_use_atmel_lock },
++#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC
++ { CFI_MFR_MACRONIX, CFI_ID_ANY, fixup_macronix_bootloc, NULL, },
++#endif
+ { 0, 0, NULL }
+ };
+
+--- a/drivers/mtd/chips/Kconfig
++++ b/drivers/mtd/chips/Kconfig
+@@ -196,6 +196,14 @@ config MTD_CFI_AMDSTD
+ provides support for one of those command sets, used on chips
+ including the AMD Am29LV320.
+
++config MTD_CFI_FIXUP_MACRONIX_BOOTLOC
++ bool "Fix boot-block location for Macronix flash chips"
++ depends on MTD_CFI_AMDSTD
++ help
++ Some Macronix flash chips have no/wrong boot-block location in the
++ CFI table, and the driver may detect the type incorrectly. Select
++ this if your board has such chip.
++
+ config MTD_CFI_STAA
+ tristate "Support for ST (Advanced Architecture) flash chips"
+ depends on MTD_GEN_PROBE
diff --git a/target/linux/adm5120/patches-3.3/102-jedec_pmc_39lvxxx_chips.patch b/target/linux/adm5120/patches-3.3/102-jedec_pmc_39lvxxx_chips.patch
new file mode 100644
index 0000000..00148fa
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/102-jedec_pmc_39lvxxx_chips.patch
@@ -0,0 +1,68 @@
+--- a/drivers/mtd/chips/jedec_probe.c
++++ b/drivers/mtd/chips/jedec_probe.c
+@@ -115,6 +115,10 @@
+ #define UPD29F064115 0x221C
+
+ /* PMC */
++#define PM39LV512 0x001B
++#define PM39LV010 0x001C
++#define PM39LV020 0x003D
++#define PM39LV040 0x003E
+ #define PM49FL002 0x006D
+ #define PM49FL004 0x006E
+ #define PM49FL008 0x006A
+@@ -1259,6 +1263,54 @@ static const struct amd_flash_info jedec
+ ERASEINFO(0x02000,2),
+ ERASEINFO(0x04000,1),
+ }
++ }, {
++ .mfr_id = CFI_MFR_PMC,
++ .dev_id = PM39LV512,
++ .name = "PMC Pm39LV512",
++ .devtypes = CFI_DEVICETYPE_X8,
++ .uaddr = MTD_UADDR_0x0555_0x02AA,
++ .dev_size = SIZE_64KiB,
++ .cmd_set = P_ID_AMD_STD,
++ .nr_regions = 1,
++ .regions = {
++ ERASEINFO(0x01000,16),
++ }
++ }, {
++ .mfr_id = CFI_MFR_PMC,
++ .dev_id = PM39LV010,
++ .name = "PMC Pm39LV010",
++ .devtypes = CFI_DEVICETYPE_X8,
++ .uaddr = MTD_UADDR_0x0555_0x02AA,
++ .dev_size = SIZE_128KiB,
++ .cmd_set = P_ID_AMD_STD,
++ .nr_regions = 1,
++ .regions = {
++ ERASEINFO(0x01000,32),
++ }
++ }, {
++ .mfr_id = CFI_MFR_PMC,
++ .dev_id = PM39LV020,
++ .name = "PMC Pm39LV020",
++ .devtypes = CFI_DEVICETYPE_X8,
++ .uaddr = MTD_UADDR_0x0555_0x02AA,
++ .dev_size = SIZE_256KiB,
++ .cmd_set = P_ID_AMD_STD,
++ .nr_regions = 1,
++ .regions = {
++ ERASEINFO(0x01000,64),
++ }
++ }, {
++ .mfr_id = CFI_MFR_PMC,
++ .dev_id = PM39LV040,
++ .name = "PMC Pm39LV040",
++ .devtypes = CFI_DEVICETYPE_X8,
++ .uaddr = MTD_UADDR_0x0555_0x02AA,
++ .dev_size = SIZE_512KiB,
++ .cmd_set = P_ID_AMD_STD,
++ .nr_regions = 1,
++ .regions = {
++ ERASEINFO(0x01000,128),
++ }
+ }, {
+ .mfr_id = CFI_MFR_PMC,
+ .dev_id = PM49FL002,
diff --git a/target/linux/adm5120/patches-3.3/103-mtd_trxsplit.patch b/target/linux/adm5120/patches-3.3/103-mtd_trxsplit.patch
new file mode 100644
index 0000000..421dcaa
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/103-mtd_trxsplit.patch
@@ -0,0 +1,23 @@
+--- a/drivers/mtd/Kconfig
++++ b/drivers/mtd/Kconfig
+@@ -31,6 +31,10 @@ config MTD_ROOTFS_SPLIT
+ bool "Automatically split 'rootfs' partition for squashfs"
+ default y
+
++config MTD_TRXSPLIT
++ bool "Automatically find and split TRX partitions"
++ default n
++
+ config MTD_REDBOOT_PARTS
+ tristate "RedBoot partition table parsing"
+ ---help---
+--- a/drivers/mtd/Makefile
++++ b/drivers/mtd/Makefile
+@@ -13,6 +13,7 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o
+ obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o
+ obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o
+ obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o
++obj-$(CONFIG_MTD_TRXSPLIT) += trxsplit.o
+
+ # 'Users' - code which presents functionality to userspace.
+ obj-$(CONFIG_MTD_CHAR) += mtdchar.o
diff --git a/target/linux/adm5120/patches-3.3/120-rb153_cf_driver.patch b/target/linux/adm5120/patches-3.3/120-rb153_cf_driver.patch
new file mode 100644
index 0000000..cc2caf5
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/120-rb153_cf_driver.patch
@@ -0,0 +1,28 @@
+--- a/drivers/ata/Makefile
++++ b/drivers/ata/Makefile
+@@ -88,6 +88,7 @@ obj-$(CONFIG_PATA_PCMCIA) += pata_pcmcia
+ obj-$(CONFIG_PATA_PALMLD) += pata_palmld.o
+ obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o
+ obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o
++obj-$(CONFIG_PATA_RB153_CF) += pata_rb153_cf.o
+ obj-$(CONFIG_PATA_RB532) += pata_rb532_cf.o
+ obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o
+ obj-$(CONFIG_PATA_SAMSUNG_CF) += pata_samsung_cf.o
+--- a/drivers/ata/Kconfig
++++ b/drivers/ata/Kconfig
+@@ -835,6 +835,15 @@ config PATA_QDI
+ help
+ Support for QDI 6500 and 6580 PATA controllers on VESA local bus.
+
++config PATA_RB153_CF
++ tristate "RouterBOARD 153 Compact Flash support"
++ depends on ADM5120_MACH_RB_153
++ help
++ This option enables support for a Compact Flash connected on
++ the RouterBOARD 153.
++
++ If unsure, say N.
++
+ config PATA_RB532
+ tristate "RouterBoard 532 PATA CompactFlash support"
+ depends on MIKROTIK_RB532
diff --git a/target/linux/adm5120/patches-3.3/200-amba_pl010_hacks.patch b/target/linux/adm5120/patches-3.3/200-amba_pl010_hacks.patch
new file mode 100644
index 0000000..3c4ea35
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/200-amba_pl010_hacks.patch
@@ -0,0 +1,378 @@
+--- a/drivers/tty/serial/amba-pl010.c
++++ b/drivers/tty/serial/amba-pl010.c
+@@ -49,11 +49,10 @@
+
+ #include <asm/io.h>
+
+-#define UART_NR 8
+-
+ #define SERIAL_AMBA_MAJOR 204
+ #define SERIAL_AMBA_MINOR 16
+-#define SERIAL_AMBA_NR UART_NR
++#define SERIAL_AMBA_NR CONFIG_SERIAL_AMBA_PL010_NUMPORTS
++#define SERIAL_AMBA_NAME CONFIG_SERIAL_AMBA_PL010_PORTNAME
+
+ #define AMBA_ISR_PASS_LIMIT 256
+
+@@ -79,9 +78,9 @@ static void pl010_stop_tx(struct uart_po
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+ unsigned int cr;
+
+- cr = readb(uap->port.membase + UART010_CR);
++ cr = __raw_readl(uap->port.membase + UART010_CR);
+ cr &= ~UART010_CR_TIE;
+- writel(cr, uap->port.membase + UART010_CR);
++ __raw_writel(cr, uap->port.membase + UART010_CR);
+ }
+
+ static void pl010_start_tx(struct uart_port *port)
+@@ -89,9 +88,9 @@ static void pl010_start_tx(struct uart_p
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+ unsigned int cr;
+
+- cr = readb(uap->port.membase + UART010_CR);
++ cr = __raw_readl(uap->port.membase + UART010_CR);
+ cr |= UART010_CR_TIE;
+- writel(cr, uap->port.membase + UART010_CR);
++ __raw_writel(cr, uap->port.membase + UART010_CR);
+ }
+
+ static void pl010_stop_rx(struct uart_port *port)
+@@ -99,9 +98,9 @@ static void pl010_stop_rx(struct uart_po
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+ unsigned int cr;
+
+- cr = readb(uap->port.membase + UART010_CR);
++ cr = __raw_readl(uap->port.membase + UART010_CR);
+ cr &= ~(UART010_CR_RIE | UART010_CR_RTIE);
+- writel(cr, uap->port.membase + UART010_CR);
++ __raw_writel(cr, uap->port.membase + UART010_CR);
+ }
+
+ static void pl010_enable_ms(struct uart_port *port)
+@@ -109,9 +108,9 @@ static void pl010_enable_ms(struct uart_
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+ unsigned int cr;
+
+- cr = readb(uap->port.membase + UART010_CR);
++ cr = __raw_readl(uap->port.membase + UART010_CR);
+ cr |= UART010_CR_MSIE;
+- writel(cr, uap->port.membase + UART010_CR);
++ __raw_writel(cr, uap->port.membase + UART010_CR);
+ }
+
+ static void pl010_rx_chars(struct uart_amba_port *uap)
+@@ -119,9 +118,9 @@ static void pl010_rx_chars(struct uart_a
+ struct tty_struct *tty = uap->port.state->port.tty;
+ unsigned int status, ch, flag, rsr, max_count = 256;
+
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ while (UART_RX_DATA(status) && max_count--) {
+- ch = readb(uap->port.membase + UART01x_DR);
++ ch = __raw_readl(uap->port.membase + UART01x_DR);
+ flag = TTY_NORMAL;
+
+ uap->port.icount.rx++;
+@@ -130,9 +129,9 @@ static void pl010_rx_chars(struct uart_a
+ * Note that the error handling code is
+ * out of the main execution path
+ */
+- rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
++ rsr = __raw_readl(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
+ if (unlikely(rsr & UART01x_RSR_ANY)) {
+- writel(0, uap->port.membase + UART01x_ECR);
++ __raw_writel(0, uap->port.membase + UART01x_ECR);
+
+ if (rsr & UART01x_RSR_BE) {
+ rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE);
+@@ -162,7 +161,7 @@ static void pl010_rx_chars(struct uart_a
+ uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag);
+
+ ignore_char:
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ }
+ spin_unlock(&uap->port.lock);
+ tty_flip_buffer_push(tty);
+@@ -175,7 +174,7 @@ static void pl010_tx_chars(struct uart_a
+ int count;
+
+ if (uap->port.x_char) {
+- writel(uap->port.x_char, uap->port.membase + UART01x_DR);
++ __raw_writel(uap->port.x_char, uap->port.membase + UART01x_DR);
+ uap->port.icount.tx++;
+ uap->port.x_char = 0;
+ return;
+@@ -187,7 +186,7 @@ static void pl010_tx_chars(struct uart_a
+
+ count = uap->port.fifosize >> 1;
+ do {
+- writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR);
++ __raw_writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR);
+ xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
+ uap->port.icount.tx++;
+ if (uart_circ_empty(xmit))
+@@ -205,9 +204,9 @@ static void pl010_modem_status(struct ua
+ {
+ unsigned int status, delta;
+
+- writel(0, uap->port.membase + UART010_ICR);
++ __raw_writel(0, uap->port.membase + UART010_ICR);
+
+- status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
++ status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
+
+ delta = status ^ uap->old_status;
+ uap->old_status = status;
+@@ -235,7 +234,7 @@ static irqreturn_t pl010_int(int irq, vo
+
+ spin_lock(&uap->port.lock);
+
+- status = readb(uap->port.membase + UART010_IIR);
++ status = __raw_readl(uap->port.membase + UART010_IIR);
+ if (status) {
+ do {
+ if (status & (UART010_IIR_RTIS | UART010_IIR_RIS))
+@@ -248,7 +247,7 @@ static irqreturn_t pl010_int(int irq, vo
+ if (pass_counter-- == 0)
+ break;
+
+- status = readb(uap->port.membase + UART010_IIR);
++ status = __raw_readl(uap->port.membase + UART010_IIR);
+ } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS |
+ UART010_IIR_TIS));
+ handled = 1;
+@@ -262,7 +261,7 @@ static irqreturn_t pl010_int(int irq, vo
+ static unsigned int pl010_tx_empty(struct uart_port *port)
+ {
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+- unsigned int status = readb(uap->port.membase + UART01x_FR);
++ unsigned int status = __raw_readl(uap->port.membase + UART01x_FR);
+ return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT;
+ }
+
+@@ -272,7 +271,7 @@ static unsigned int pl010_get_mctrl(stru
+ unsigned int result = 0;
+ unsigned int status;
+
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ if (status & UART01x_FR_DCD)
+ result |= TIOCM_CAR;
+ if (status & UART01x_FR_DSR)
+@@ -298,12 +297,12 @@ static void pl010_break_ctl(struct uart_
+ unsigned int lcr_h;
+
+ spin_lock_irqsave(&uap->port.lock, flags);
+- lcr_h = readb(uap->port.membase + UART010_LCRH);
++ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH);
+ if (break_state == -1)
+ lcr_h |= UART01x_LCRH_BRK;
+ else
+ lcr_h &= ~UART01x_LCRH_BRK;
+- writel(lcr_h, uap->port.membase + UART010_LCRH);
++ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH);
+ spin_unlock_irqrestore(&uap->port.lock, flags);
+ }
+
+@@ -335,12 +334,12 @@ static int pl010_startup(struct uart_por
+ /*
+ * initialise the old status of the modem signals
+ */
+- uap->old_status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
++ uap->old_status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
+
+ /*
+ * Finally, enable interrupts
+ */
+- writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE,
++ __raw_writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE,
+ uap->port.membase + UART010_CR);
+
+ return 0;
+@@ -365,10 +364,10 @@ static void pl010_shutdown(struct uart_p
+ /*
+ * disable all interrupts, disable the port
+ */
+- writel(0, uap->port.membase + UART010_CR);
++ __raw_writel(0, uap->port.membase + UART010_CR);
+
+ /* disable break condition and fifos */
+- writel(readb(uap->port.membase + UART010_LCRH) &
++ __raw_writel(__raw_readl(uap->port.membase + UART010_LCRH) &
+ ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN),
+ uap->port.membase + UART010_LCRH);
+
+@@ -391,7 +390,7 @@ pl010_set_termios(struct uart_port *port
+ /*
+ * Ask the core to calculate the divisor for us.
+ */
+- baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);
++ baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);
+ quot = uart_get_divisor(port, baud);
+
+ switch (termios->c_cflag & CSIZE) {
+@@ -454,25 +453,25 @@ pl010_set_termios(struct uart_port *port
+ uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX;
+
+ /* first, disable everything */
+- old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
++ old_cr = __raw_readl(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
+
+ if (UART_ENABLE_MS(port, termios->c_cflag))
+ old_cr |= UART010_CR_MSIE;
+
+- writel(0, uap->port.membase + UART010_CR);
++ __raw_writel(0, uap->port.membase + UART010_CR);
+
+ /* Set baud rate */
+ quot -= 1;
+- writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM);
+- writel(quot & 0xff, uap->port.membase + UART010_LCRL);
++ __raw_writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM);
++ __raw_writel(quot & 0xff, uap->port.membase + UART010_LCRL);
+
+ /*
+ * ----------v----------v----------v----------v-----
+ * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L
+ * ----------^----------^----------^----------^-----
+ */
+- writel(lcr_h, uap->port.membase + UART010_LCRH);
+- writel(old_cr, uap->port.membase + UART010_CR);
++ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH);
++ __raw_writel(old_cr, uap->port.membase + UART010_CR);
+
+ spin_unlock_irqrestore(&uap->port.lock, flags);
+ }
+@@ -554,7 +553,7 @@ static struct uart_ops amba_pl010_pops =
+ .verify_port = pl010_verify_port,
+ };
+
+-static struct uart_amba_port *amba_ports[UART_NR];
++static struct uart_amba_port *amba_ports[SERIAL_AMBA_NR];
+
+ #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE
+
+@@ -564,10 +563,10 @@ static void pl010_console_putchar(struct
+ unsigned int status;
+
+ do {
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ barrier();
+ } while (!UART_TX_READY(status));
+- writel(ch, uap->port.membase + UART01x_DR);
++ __raw_writel(ch, uap->port.membase + UART01x_DR);
+ }
+
+ static void
+@@ -581,8 +580,8 @@ pl010_console_write(struct console *co,
+ /*
+ * First save the CR then disable the interrupts
+ */
+- old_cr = readb(uap->port.membase + UART010_CR);
+- writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR);
++ old_cr = __raw_readl(uap->port.membase + UART010_CR);
++ __raw_writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR);
+
+ uart_console_write(&uap->port, s, count, pl010_console_putchar);
+
+@@ -591,10 +590,10 @@ pl010_console_write(struct console *co,
+ * and restore the TCR
+ */
+ do {
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ barrier();
+ } while (status & UART01x_FR_BUSY);
+- writel(old_cr, uap->port.membase + UART010_CR);
++ __raw_writel(old_cr, uap->port.membase + UART010_CR);
+
+ clk_disable(uap->clk);
+ }
+@@ -603,9 +602,9 @@ static void __init
+ pl010_console_get_options(struct uart_amba_port *uap, int *baud,
+ int *parity, int *bits)
+ {
+- if (readb(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
++ if (__raw_readl(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
+ unsigned int lcr_h, quot;
+- lcr_h = readb(uap->port.membase + UART010_LCRH);
++ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH);
+
+ *parity = 'n';
+ if (lcr_h & UART01x_LCRH_PEN) {
+@@ -620,8 +619,8 @@ pl010_console_get_options(struct uart_am
+ else
+ *bits = 8;
+
+- quot = readb(uap->port.membase + UART010_LCRL) |
+- readb(uap->port.membase + UART010_LCRM) << 8;
++ quot = __raw_readl(uap->port.membase + UART010_LCRL) |
++ __raw_readl(uap->port.membase + UART010_LCRM) << 8;
+ *baud = uap->port.uartclk / (16 * (quot + 1));
+ }
+ }
+@@ -640,7 +639,7 @@ static int __init pl010_console_setup(st
+ * if so, search for the first available port that does have
+ * console support.
+ */
+- if (co->index >= UART_NR)
++ if (co->index >= SERIAL_AMBA_NR)
+ co->index = 0;
+ uap = amba_ports[co->index];
+ if (!uap)
+@@ -662,7 +661,7 @@ static int __init pl010_console_setup(st
+
+ static struct uart_driver amba_reg;
+ static struct console amba_console = {
+- .name = "ttyAM",
++ .name = SERIAL_AMBA_NAME,
+ .write = pl010_console_write,
+ .device = uart_console_device,
+ .setup = pl010_console_setup,
+@@ -678,11 +677,11 @@ static struct console amba_console = {
+
+ static struct uart_driver amba_reg = {
+ .owner = THIS_MODULE,
+- .driver_name = "ttyAM",
+- .dev_name = "ttyAM",
++ .driver_name = SERIAL_AMBA_NAME,
++ .dev_name = SERIAL_AMBA_NAME,
+ .major = SERIAL_AMBA_MAJOR,
+ .minor = SERIAL_AMBA_MINOR,
+- .nr = UART_NR,
++ .nr = SERIAL_AMBA_NR,
+ .cons = AMBA_CONSOLE,
+ };
+
+--- a/drivers/tty/serial/Kconfig
++++ b/drivers/tty/serial/Kconfig
+@@ -16,10 +16,25 @@ config SERIAL_AMBA_PL010
+ help
+ This selects the ARM(R) AMBA(R) PrimeCell PL010 UART. If you have
+ an Integrator/AP or Integrator/PP2 platform, or if you have a
+- Cirrus Logic EP93xx CPU, say Y or M here.
++ Cirrus Logic EP93xx CPU or an Infineon ADM5120 SOC, say Y or M here.
+
+ If unsure, say N.
+
++config SERIAL_AMBA_PL010_NUMPORTS
++ int "Maximum number of AMBA PL010 serial ports"
++ depends on SERIAL_AMBA_PL010
++ default "8"
++ ---help---
++ Set this to the number of serial ports you want the AMBA PL010 driver
++ to support.
++
++config SERIAL_AMBA_PL010_PORTNAME
++ string "Name of the AMBA PL010 serial ports"
++ depends on SERIAL_AMBA_PL010
++ default "ttyAM"
++ ---help---
++ ::: To be written :::
++
+ config SERIAL_AMBA_PL010_CONSOLE
+ bool "Support for console on AMBA serial port"
+ depends on SERIAL_AMBA_PL010=y
diff --git a/target/linux/adm5120/patches-3.3/201-amba_bus_hacks.patch b/target/linux/adm5120/patches-3.3/201-amba_bus_hacks.patch
new file mode 100644
index 0000000..2364d2a
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/201-amba_bus_hacks.patch
@@ -0,0 +1,13 @@
+--- a/drivers/amba/bus.c
++++ b/drivers/amba/bus.c
+@@ -20,6 +20,10 @@
+ #include <asm/irq.h>
+ #include <asm/sizes.h>
+
++#ifndef NO_IRQ
++#define NO_IRQ (-1)
++#endif
++
+ #define to_amba_driver(d) container_of(d, struct amba_driver, drv)
+
+ static const struct amba_id *
diff --git a/target/linux/adm5120/patches-3.3/203-gpio_leds_brightness.patch b/target/linux/adm5120/patches-3.3/203-gpio_leds_brightness.patch
new file mode 100644
index 0000000..5345022
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/203-gpio_leds_brightness.patch
@@ -0,0 +1,27 @@
+--- a/drivers/leds/leds-gpio.c
++++ b/drivers/leds/leds-gpio.c
+@@ -55,13 +55,17 @@ static void gpio_led_set(struct led_clas
+ container_of(led_cdev, struct gpio_led_data, cdev);
+ int level;
+
+- if (value == LED_OFF)
+- level = 0;
+- else
+- level = 1;
+-
+- if (led_dat->active_low)
+- level = !level;
++ switch (value) {
++ case LED_OFF:
++ level = led_dat->active_low ? 1 : 0;
++ break;
++ case LED_FULL:
++ level = led_dat->active_low ? 0 : 1;
++ break;
++ default:
++ level = value;
++ break;
++ }
+
+ /* Setting GPIOs with I2C/etc requires a task context, and we don't
+ * seem to have a reliable way to know if we're already in one; so
diff --git a/target/linux/adm5120/patches-3.3/310-adm5120_wdt.patch b/target/linux/adm5120/patches-3.3/310-adm5120_wdt.patch
new file mode 100644
index 0000000..ca537ec
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/310-adm5120_wdt.patch
@@ -0,0 +1,31 @@
+--- a/drivers/watchdog/Kconfig
++++ b/drivers/watchdog/Kconfig
+@@ -943,6 +943,18 @@ config RC32434_WDT
+ To compile this driver as a module, choose M here: the
+ module will be called rc32434_wdt.
+
++config ADM5120_WDT
++ tristate "Infineon ADM5120 SoC hardware watchdog"
++ depends on WATCHDOG && ADM5120
++ help
++ This is a driver for hardware watchdog integrated in Infineon
++ ADM5120 SoC. This watchdog simply watches your kernel to make sure
++ it doesn't freeze, and if it does, it reboots your computer after a
++ certain amount of time.
++
++ To compile this driver as a module, choose M here: the module will be
++ called adm5120_wdt.
++
+ config INDYDOG
+ tristate "Indy/I2 Hardware Watchdog"
+ depends on SGI_HAS_INDYDOG
+--- a/drivers/watchdog/Makefile
++++ b/drivers/watchdog/Makefile
+@@ -122,6 +122,7 @@ obj-$(CONFIG_ATH79_WDT) += ath79_wdt.o
+ obj-$(CONFIG_BCM47XX_WDT) += bcm47xx_wdt.o
+ obj-$(CONFIG_BCM63XX_WDT) += bcm63xx_wdt.o
+ obj-$(CONFIG_RC32434_WDT) += rc32434_wdt.o
++obj-$(CONFIG_ADM5120_WDT) += adm5120_wdt.o
+ obj-$(CONFIG_INDYDOG) += indydog.o
+ obj-$(CONFIG_JZ4740_WDT) += jz4740_wdt.o
+ obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
diff --git a/target/linux/adm5120/patches-3.3/a00-adm5120-add-Platform-file.patch b/target/linux/adm5120/patches-3.3/a00-adm5120-add-Platform-file.patch
new file mode 100644
index 0000000..ddfbff4
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/a00-adm5120-add-Platform-file.patch
@@ -0,0 +1,22 @@
+--- /dev/null
++++ b/arch/mips/adm5120/Platform
+@@ -0,0 +1,19 @@
++#
++# Infineon/ADMtek ADM5120
++#
++
++platform-$(CONFIG_ADM5120) += adm5120/common/
++
++platform-$(CONFIG_ADM5120_OEM_CELLVISION) += adm5120/cellvision/
++platform-$(CONFIG_ADM5120_OEM_COMPEX) += adm5120/compex/
++platform-$(CONFIG_ADM5120_OEM_EDIMAX) += adm5120/edimax/
++platform-$(CONFIG_ADM5120_OEM_GENERIC) += adm5120/generic/
++platform-$(CONFIG_ADM5120_OEM_INFINEON) += adm5120/infineon/
++platform-$(CONFIG_ADM5120_OEM_MIKROTIK) += adm5120/mikrotik/
++platform-$(CONFIG_ADM5120_OEM_MOTOROLA) += adm5120/motorola/
++platform-$(CONFIG_ADM5120_OEM_OSBRIDGE) += adm5120/osbridge/
++platform-$(CONFIG_ADM5120_OEM_ZYXEL) += adm5120/zyxel/
++
++cflags-$(CONFIG_ADM5120) += -I$(srctree)/arch/mips/include/asm/mach-adm5120
++libs-$(CONFIG_ADM5120) += arch/mips/adm5120/prom/
++load-$(CONFIG_ADM5120) += 0xffffffff80001000
diff --git a/target/linux/adm5120/patches-3.3/a01-adm5120-core-build-error-fixes.patch b/target/linux/adm5120/patches-3.3/a01-adm5120-core-build-error-fixes.patch
new file mode 100644
index 0000000..bf0022d
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/a01-adm5120-core-build-error-fixes.patch
@@ -0,0 +1,110 @@
+--- a/arch/mips/adm5120/common/platform.c
++++ b/arch/mips/adm5120/common/platform.c
+@@ -18,6 +18,7 @@
+ #include <linux/gpio.h>
+ #include <linux/irq.h>
+ #include <linux/slab.h>
++#include <linux/export.h>
+
+ #include <asm/bootinfo.h>
+
+--- a/arch/mips/adm5120/common/clock.c
++++ b/arch/mips/adm5120/common/clock.c
+@@ -33,7 +33,7 @@ static struct clk uart_clk = {
+
+ struct clk *clk_get(struct device *dev, const char *id)
+ {
+- char *name = dev_name(dev);
++ const char *name = dev_name(dev);
+
+ if (!strcmp(name, "apb:uart0") || !strcmp(name, "apb:uart1"))
+ return &uart_clk;
+--- a/arch/mips/pci/pci-adm5120.c
++++ b/arch/mips/pci/pci-adm5120.c
+@@ -49,7 +49,7 @@
+ static unsigned int adm5120_pci_nr_irqs __initdata;
+ static struct adm5120_pci_irq *adm5120_pci_irq_map __initdata;
+
+-static spinlock_t pci_lock = SPIN_LOCK_UNLOCKED;
++static DEFINE_SPINLOCK(pci_lock);
+
+ /* -------------------------------------------------------------------------*/
+
+--- a/arch/mips/adm5120/common/irq.c
++++ b/arch/mips/adm5120/common/irq.c
+@@ -23,9 +23,9 @@
+
+ #include <asm/mach-adm5120/adm5120_defs.h>
+
+-static void adm5120_intc_irq_unmask(unsigned int irq);
+-static void adm5120_intc_irq_mask(unsigned int irq);
+-static int adm5120_intc_irq_set_type(unsigned int irq, unsigned int flow_type);
++static void adm5120_intc_irq_unmask(struct irq_data *d);
++static void adm5120_intc_irq_mask(struct irq_data *d);
++static int adm5120_intc_irq_set_type(struct irq_data *d, unsigned int flow_type);
+
+ static inline void intc_write_reg(unsigned int reg, u32 val)
+ {
+@@ -43,10 +43,10 @@ static inline u32 intc_read_reg(unsigned
+
+ static struct irq_chip adm5120_intc_irq_chip = {
+ .name = "INTC",
+- .unmask = adm5120_intc_irq_unmask,
+- .mask = adm5120_intc_irq_mask,
+- .mask_ack = adm5120_intc_irq_mask,
+- .set_type = adm5120_intc_irq_set_type
++ .irq_unmask = adm5120_intc_irq_unmask,
++ .irq_mask = adm5120_intc_irq_mask,
++ .irq_mask_ack = adm5120_intc_irq_mask,
++ .irq_set_type = adm5120_intc_irq_set_type
+ };
+
+ static struct irqaction adm5120_intc_irq_action = {
+@@ -54,20 +54,19 @@ static struct irqaction adm5120_intc_irq
+ .name = "cascade [INTC]"
+ };
+
+-static void adm5120_intc_irq_unmask(unsigned int irq)
++static void adm5120_intc_irq_unmask(struct irq_data *d)
+ {
+- irq -= ADM5120_INTC_IRQ_BASE;
+- intc_write_reg(INTC_REG_IRQ_ENABLE, 1 << irq);
++ intc_write_reg(INTC_REG_IRQ_ENABLE, 1 << (d->irq - ADM5120_INTC_IRQ_BASE));
+ }
+
+-static void adm5120_intc_irq_mask(unsigned int irq)
++static void adm5120_intc_irq_mask(struct irq_data *d)
+ {
+- irq -= ADM5120_INTC_IRQ_BASE;
+- intc_write_reg(INTC_REG_IRQ_DISABLE, 1 << irq);
++ intc_write_reg(INTC_REG_IRQ_DISABLE, 1 << (d->irq - ADM5120_INTC_IRQ_BASE));
+ }
+
+-static int adm5120_intc_irq_set_type(unsigned int irq, unsigned int flow_type)
++static int adm5120_intc_irq_set_type(struct irq_data *d, unsigned int flow_type)
+ {
++ unsigned int irq = d->irq;
+ unsigned int sense;
+ unsigned long mode;
+ int err = 0;
+@@ -105,10 +104,6 @@ static int adm5120_intc_irq_set_type(uns
+ mode &= ~(1 << (irq - ADM5120_INTC_IRQ_BASE));
+
+ intc_write_reg(INTC_REG_INT_MODE, mode);
+- /* fallthrough */
+- default:
+- irq_desc[irq].status &= ~IRQ_TYPE_SENSE_MASK;
+- irq_desc[irq].status |= sense;
+ break;
+ }
+
+@@ -162,8 +157,7 @@ static void __init adm5120_intc_irq_init
+ for (i = ADM5120_INTC_IRQ_BASE;
+ i <= ADM5120_INTC_IRQ_BASE + INTC_IRQ_LAST;
+ i++) {
+- irq_desc[i].status = INTC_IRQ_STATUS;
+- set_irq_chip_and_handler(i, &adm5120_intc_irq_chip,
++ irq_set_chip_and_handler(i, &adm5120_intc_irq_chip,
+ handle_level_irq);
+ }
+
diff --git a/target/linux/adm5120/patches-3.3/a03-adm5120-remove-CONFIG_MTD_PARTITIONS.patch b/target/linux/adm5120/patches-3.3/a03-adm5120-remove-CONFIG_MTD_PARTITIONS.patch
new file mode 100644
index 0000000..4ee4af6
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/a03-adm5120-remove-CONFIG_MTD_PARTITIONS.patch
@@ -0,0 +1,306 @@
+--- a/arch/mips/include/asm/mach-adm5120/adm5120_platform.h
++++ b/arch/mips/include/asm/mach-adm5120/adm5120_platform.h
+@@ -28,10 +28,8 @@ struct adm5120_flash_platform_data {
+ void (*set_vpp)(struct map_info *, int);
+ void (*switch_bank)(unsigned);
+ u32 window_size;
+-#ifdef CONFIG_MTD_PARTITIONS
+ unsigned int nr_parts;
+ struct mtd_partition *parts;
+-#endif
+ };
+
+ struct adm5120_switch_platform_data {
+--- a/arch/mips/adm5120/infineon/infineon.c
++++ b/arch/mips/adm5120/infineon/infineon.c
+@@ -16,7 +16,6 @@
+ #define EASY_CONFIG_OFFSET 0x10000
+ #define EASY_CONFIG_SIZE 0x1000
+
+-#ifdef CONFIG_MTD_PARTITIONS
+ static struct mtd_partition easy_partitions[] = {
+ {
+ .name = "admboot",
+@@ -33,7 +32,6 @@ static struct mtd_partition easy_partiti
+ .size = MTDPART_SIZ_FULL,
+ }
+ };
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ static __init void easy_setup_mac(void)
+ {
+@@ -68,10 +66,8 @@ void __init easy_setup_pqfp(void)
+ gpio_direction_output(ADM5120_GPIO_PIN3, 0);
+ adm5120_flash0_data.switch_bank = switch_bank_gpio3;
+
+-#ifdef CONFIG_MTD_PARTITIONS
+ adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
+ adm5120_flash0_data.parts = easy_partitions;
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ adm5120_add_device_uart(0);
+ adm5120_add_device_uart(1);
+@@ -100,10 +96,8 @@ void __init easy_setup_bga(void)
+ gpio_direction_output(ADM5120_GPIO_PIN5, 0);
+ adm5120_flash0_data.switch_bank = switch_bank_gpio5;
+
+-#ifdef CONFIG_MTD_PARTITIONS
+ adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
+ adm5120_flash0_data.parts = easy_partitions;
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ adm5120_add_device_uart(0);
+ adm5120_add_device_uart(1);
+--- a/arch/mips/adm5120/cellvision/cellvision.c
++++ b/arch/mips/adm5120/cellvision/cellvision.c
+@@ -19,7 +19,6 @@
+ #define CELLVISION_CONFIG_OFFSET 0x8000
+ #define CELLVISION_CONFIG_SIZE 0x1000
+
+-#ifdef CONFIG_MTD_PARTITIONS
+ static struct mtd_partition cas6xx_partitions[] = {
+ {
+ .name = "admboot",
+@@ -65,7 +64,6 @@ static struct mtd_partition cas7xx_parti
+ .size = MTDPART_SIZ_FULL,
+ }
+ };
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ static void switch_bank_gpio5(unsigned bank)
+ {
+@@ -105,20 +103,16 @@ void __init cellvision_mac_setup(void)
+
+ void __init cas6xx_flash_setup(void)
+ {
+-#ifdef CONFIG_MTD_PARTITIONS
+ adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas6xx_partitions);
+ adm5120_flash0_data.parts = cas6xx_partitions;
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ cellvision_flash_setup();
+ }
+
+ void __init cas7xx_flash_setup(void)
+ {
+-#ifdef CONFIG_MTD_PARTITIONS
+ adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas7xx_partitions);
+ adm5120_flash0_data.parts = cas7xx_partitions;
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ cellvision_flash_setup();
+ }
+--- a/arch/mips/adm5120/edimax/br-61xx.c
++++ b/arch/mips/adm5120/edimax/br-61xx.c
+@@ -18,7 +18,6 @@
+ #define BR61XX_CONFIG_OFFSET 0x8000
+ #define BR61XX_CONFIG_SIZE 0x1000
+
+-#ifdef CONFIG_MTD_PARTITIONS
+ static struct mtd_partition br61xx_partitions[] = {
+ {
+ .name = "admboot",
+@@ -35,7 +34,6 @@ static struct mtd_partition br61xx_parti
+ .size = MTDPART_SIZ_FULL,
+ }
+ };
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ static struct gpio_button br61xx_gpio_buttons[] __initdata = {
+ {
+@@ -68,10 +66,8 @@ static void __init br61xx_mac_setup(void
+ void __init br61xx_generic_setup(void)
+ {
+
+-#ifdef CONFIG_MTD_PARTITIONS
+ adm5120_flash0_data.nr_parts = ARRAY_SIZE(br61xx_partitions);
+ adm5120_flash0_data.parts = br61xx_partitions;
+-#endif /* CONFIG_MTD_PARTITIONS */
+ adm5120_add_device_flash(0);
+
+ adm5120_add_device_gpio(BR61XX_GPIO_DEV_MASK);
+--- a/arch/mips/adm5120/mikrotik/rb-1xx.c
++++ b/arch/mips/adm5120/mikrotik/rb-1xx.c
+@@ -25,7 +25,6 @@ static struct adm5120_pci_irq rb1xx_pci_
+ PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI2)
+ };
+
+-#ifdef CONFIG_MTD_PARTITIONS
+ static struct mtd_partition rb1xx_nor_parts[] = {
+ {
+ .name = "booter",
+@@ -50,7 +49,6 @@ static struct mtd_partition rb1xx_nand_p
+ .size = MTDPART_SIZ_FULL
+ }
+ };
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ /*
+ * We need to use the OLD Yaffs-1 OOB layout, otherwise the RB bootloader
+@@ -79,10 +77,8 @@ static int rb1xx_nand_fixup(struct mtd_i
+ struct platform_nand_data rb1xx_nand_data __initdata = {
+ .chip = {
+ .nr_chips = 1,
+-#ifdef CONFIG_MTD_PARTITIONS
+ .nr_partitions = ARRAY_SIZE(rb1xx_nand_parts),
+ .partitions = rb1xx_nand_parts,
+-#endif /* CONFIG_MTD_PARTITIONS */
+ .chip_delay = RB1XX_NAND_CHIP_DELAY,
+ .options = NAND_NO_AUTOINCR,
+ .chip_fixup = rb1xx_nand_fixup,
+@@ -114,10 +110,8 @@ static void __init rb1xx_mac_setup(void)
+ void __init rb1xx_add_device_flash(void)
+ {
+ /* setup data for flash0 device */
+-#ifdef CONFIG_MTD_PARTITIONS
+ adm5120_flash0_data.nr_parts = ARRAY_SIZE(rb1xx_nor_parts);
+ adm5120_flash0_data.parts = rb1xx_nor_parts;
+-#endif /* CONFIG_MTD_PARTITIONS */
+ adm5120_flash0_data.window_size = 128*1024;
+
+ adm5120_add_device_flash(0);
+--- a/arch/mips/adm5120/compex/wp54.c
++++ b/arch/mips/adm5120/compex/wp54.c
+@@ -11,7 +11,6 @@
+
+ #include "compex.h"
+
+-#ifdef CONFIG_MTD_PARTITIONS
+ static struct mtd_partition wp54g_wrt_partitions[] = {
+ {
+ .name = "cfe",
+@@ -28,7 +27,6 @@ static struct mtd_partition wp54g_wrt_pa
+ .size = 0x010000,
+ }
+ };
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ static struct adm5120_pci_irq wp54_pci_irqs[] __initdata = {
+ PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
+@@ -83,10 +81,8 @@ MIPS_MACHINE(MACH_ADM5120_WP54, "WP54",
+
+ static void __init wp54_wrt_setup(void)
+ {
+-#ifdef CONFIG_MTD_PARTITIONS
+ adm5120_flash0_data.nr_parts = ARRAY_SIZE(wp54g_wrt_partitions);
+ adm5120_flash0_data.parts = wp54g_wrt_partitions;
+-#endif
+
+ wp54_setup();
+ }
+--- a/arch/mips/adm5120/zyxel/p-33x.c
++++ b/arch/mips/adm5120/zyxel/p-33x.c
+@@ -16,7 +16,6 @@
+ #define P33X_GPIO_FLASH_A20 ADM5120_GPIO_PIN5
+ #define P33X_GPIO_DEV_MASK (1 << P33X_GPIO_FLASH_A20)
+
+-#ifdef CONFIG_MTD_PARTITIONS
+ static struct mtd_partition p33x_partitions[] = {
+ {
+ .name = "bootbase",
+@@ -46,7 +45,6 @@ static struct mtd_partition p33x_partiti
+ .size = MTDPART_SIZ_FULL,
+ }
+ };
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ static struct adm5120_pci_irq p33x_pci_irqs[] __initdata = {
+ PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
+@@ -75,10 +73,8 @@ void __init p33x_generic_setup(void)
+ gpio_request(P33X_GPIO_FLASH_A20, NULL); /* for flash A20 line */
+ gpio_direction_output(P33X_GPIO_FLASH_A20, 0);
+ adm5120_flash0_data.switch_bank = switch_bank_gpio5;
+-#ifdef CONFIG_MTD_PARTITIONS
+ adm5120_flash0_data.nr_parts = ARRAY_SIZE(p33x_partitions);
+ adm5120_flash0_data.parts = p33x_partitions;
+-#endif /* CONFIG_MTD_PARTITIONS */
+ adm5120_add_device_flash(0);
+
+ adm5120_add_device_uart(0);
+--- a/arch/mips/adm5120/generic/eb-214a.c
++++ b/arch/mips/adm5120/generic/eb-214a.c
+@@ -28,7 +28,6 @@
+ #define EB214A_GPIO_DEV_MASK 0
+ #define EB214A_CONFIG_OFFSET 0x4000
+
+-#ifdef CONFIG_MTD_PARTITIONS
+ static struct mtd_partition eb214a_partitions[] = {
+ {
+ .name = "bootloader",
+@@ -45,7 +44,6 @@ static struct mtd_partition eb214a_parti
+ .size = MTDPART_SIZ_FULL,
+ }
+ };
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ static struct adm5120_pci_irq eb214a_pci_irqs[] __initdata = {
+ PCIIRQ(4, 0, 1, ADM5120_IRQ_PCI0),
+@@ -94,10 +92,8 @@ static void __init eb214a_mac_setup(void
+
+ static void __init eb214a_setup(void)
+ {
+-#ifdef CONFIG_MTD_PARTITIONS
+ adm5120_flash0_data.nr_parts = ARRAY_SIZE(eb214a_partitions);
+ adm5120_flash0_data.parts = eb214a_partitions;
+-#endif /* CONFIG_MTD_PARTITIONS */
+ adm5120_add_device_flash(0);
+
+ adm5120_add_device_gpio(EB214A_GPIO_DEV_MASK);
+--- a/arch/mips/adm5120/motorola/pmugw.c
++++ b/arch/mips/adm5120/motorola/pmugw.c
+@@ -26,7 +26,6 @@
+ #define PMUGW_CONFIG_OFFSET 0x10000
+ #define PMUGW_CONFIG_SIZE 0x1000
+
+-#ifdef CONFIG_MTD_PARTITIONS
+ static struct mtd_partition pmugw_partitions[] = {
+ {
+ .name = "admboot",
+@@ -43,7 +42,6 @@ static struct mtd_partition pmugw_partit
+ .size = MTDPART_SIZ_FULL,
+ }
+ };
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ static u8 pmugw_vlans[6] __initdata = {
+ 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
+@@ -82,10 +80,8 @@ void __init pmugw_setup(void)
+ gpio_direction_output(ADM5120_GPIO_PIN5, 0);
+ adm5120_flash0_data.switch_bank = switch_bank_gpio5;
+
+-#ifdef CONFIG_MTD_PARTITIONS
+ adm5120_flash0_data.nr_parts = ARRAY_SIZE(pmugw_partitions);
+ adm5120_flash0_data.parts = pmugw_partitions;
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ adm5120_add_device_uart(1); /* ttyS0 */
+ adm5120_add_device_uart(0); /* ttyS1 */
+--- a/arch/mips/adm5120/osbridge/5gxi.c
++++ b/arch/mips/adm5120/osbridge/5gxi.c
+@@ -20,7 +20,6 @@
+ #include <asm/mach-adm5120/adm5120_platform.h>
+ #include <asm/mach-adm5120/adm5120_info.h>
+
+-#ifdef CONFIG_MTD_PARTITIONS
+ static struct mtd_partition osbridge_5gxi_partitions[] = {
+ {
+ .name = "bootloader",
+@@ -37,7 +36,6 @@ static struct mtd_partition osbridge_5gx
+ .size = MTDPART_SIZ_FULL,
+ }
+ };
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ static struct gpio_led osbridge_5gxi_gpio_leds[] __initdata = {
+ GPIO_LED_INV(ADM5120_GPIO_PIN6, "5gxi:green:user", NULL),
+@@ -54,10 +52,8 @@ static u8 osbridge_5gxi_vlans[6] __initd
+
+ static void __init osbridge_5gxi_setup(void)
+ {
+-#ifdef CONFIG_MTD_PARTITIONS
+ adm5120_flash0_data.nr_parts = ARRAY_SIZE(osbridge_5gxi_partitions);
+ adm5120_flash0_data.parts = osbridge_5gxi_partitions;
+-#endif /* CONFIG_MTD_PARTITIONS */
+
+ adm5120_add_device_uart(0);
+ adm5120_add_device_uart(1);
diff --git a/target/linux/adm5120/patches-3.3/a04-use-gpio-keys-polled-driver.patch b/target/linux/adm5120/patches-3.3/a04-use-gpio-keys-polled-driver.patch
new file mode 100644
index 0000000..ce9d7fa
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/a04-use-gpio-keys-polled-driver.patch
@@ -0,0 +1,263 @@
+--- a/arch/mips/adm5120/common/platform.c
++++ b/arch/mips/adm5120/common/platform.c
+@@ -245,31 +245,44 @@ void __init adm5120_add_device_uart(unsi
+ /*
+ * GPIO buttons
+ */
+-#define ADM5120_BUTTON_INTERVAL 20
+-struct gpio_buttons_platform_data adm5120_gpio_buttons_data = {
+- .poll_interval = ADM5120_BUTTON_INTERVAL,
+-};
+-
+-struct platform_device adm5120_gpio_buttons_device = {
+- .name = "gpio-buttons",
+- .id = -1,
+- .dev.platform_data = &adm5120_gpio_buttons_data,
+-};
+-
+-void __init adm5120_add_device_gpio_buttons(unsigned nbuttons,
+- struct gpio_button *buttons)
++void __init adm5120_register_gpio_buttons(int id,
++ unsigned poll_interval,
++ unsigned nbuttons,
++ struct gpio_keys_button *buttons)
+ {
+- struct gpio_button *p;
++ struct platform_device *pdev;
++ struct gpio_keys_platform_data pdata;
++ struct gpio_keys_button *p;
++ int err;
+
+- p = kmalloc(nbuttons * sizeof(*p), GFP_KERNEL);
++ p = kmemdup(buttons, nbuttons * sizeof(*p), GFP_KERNEL);
+ if (!p)
+ return;
+
+- memcpy(p, buttons, nbuttons * sizeof(*p));
+- adm5120_gpio_buttons_data.nbuttons = nbuttons;
+- adm5120_gpio_buttons_data.buttons = 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);
+
+- platform_device_register(&adm5120_gpio_buttons_device);
++err_free_buttons:
++ kfree(p);
+ }
+
+ /*
+--- a/arch/mips/include/asm/mach-adm5120/adm5120_platform.h
++++ b/arch/mips/include/asm/mach-adm5120/adm5120_platform.h
+@@ -20,7 +20,8 @@
+ #include <linux/mtd/map.h>
+ #include <linux/mtd/partitions.h>
+ #include <linux/mtd/nand.h>
+-#include <linux/gpio_buttons.h>
++#include <linux/input.h>
++#include <linux/gpio_keys.h>
+ #include <linux/amba/bus.h>
+ #include <linux/amba/serial.h>
+
+@@ -66,8 +67,10 @@ extern void adm5120_add_device_uart(unsi
+ extern void adm5120_add_device_nand(struct platform_nand_data *pdata) __init;
+ extern void adm5120_add_device_switch(unsigned num_ports, u8 *vlan_map) __init;
+ extern void adm5120_add_device_gpio(u32 disable_mask) __init;
+-extern void adm5120_add_device_gpio_buttons(unsigned nbuttons,
+- struct gpio_button *buttons) __init;
++extern void adm5120_register_gpio_buttons(int id,
++ unsigned poll_interval,
++ unsigned nbuttons,
++ struct gpio_keys_button *buttons);
+
+ #define GPIO_LED_DEF(g, n, t, a) { \
+ .name = (n), \
+--- a/arch/mips/adm5120/compex/wp54.c
++++ b/arch/mips/adm5120/compex/wp54.c
+@@ -11,6 +11,9 @@
+
+ #include "compex.h"
+
++#define WP54_KEYS_POLL_INTERVAL 20
++#define WP54_KEYS_DEBOUNCE_INTERVAL (3 * WP54_KEYS_POLL_INTERVAL)
++
+ static struct mtd_partition wp54g_wrt_partitions[] = {
+ {
+ .name = "cfe",
+@@ -32,12 +35,12 @@ static struct adm5120_pci_irq wp54_pci_i
+ PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
+ };
+
+-static struct gpio_button wp54_gpio_buttons[] __initdata = {
++static struct gpio_keys_button wp54_gpio_buttons[] __initdata = {
+ {
+ .desc = "reset_button",
+ .type = EV_KEY,
+- .code = BTN_0,
+- .threshold = 5,
++ .code = KEY_RESTART,
++ .debounce_interval = WP54_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ADM5120_GPIO_PIN4,
+ }
+ };
+@@ -69,8 +72,9 @@ static void __init wp54_setup(void)
+ adm5120_board_reset = wp54_reset;
+
+ adm5120_add_device_switch(2, wp54_vlans);
+- adm5120_add_device_gpio_buttons(ARRAY_SIZE(wp54_gpio_buttons),
+- wp54_gpio_buttons);
++ adm5120_register_gpio_buttons(-1, WP54_KEYS_POLL_INTERVAL,
++ ARRAY_SIZE(wp54_gpio_buttons),
++ wp54_gpio_buttons);
+ adm5120_add_device_gpio_leds(ARRAY_SIZE(wp54_gpio_leds),
+ wp54_gpio_leds);
+
+--- a/arch/mips/adm5120/mikrotik/rb-1xx.c
++++ b/arch/mips/adm5120/mikrotik/rb-1xx.c
+@@ -19,6 +19,9 @@
+
+ #define RB1XX_NAND_CHIP_DELAY 25
+
++#define RB1XX_KEYS_POLL_INTERVAL 20
++#define RB1XX_KEYS_DEBOUNCE_INTERVAL (3 * RB1XX_KEYS_POLL_INTERVAL)
++
+ static struct adm5120_pci_irq rb1xx_pci_irqs[] __initdata = {
+ PCIIRQ(1, 0, 1, ADM5120_IRQ_PCI0),
+ PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI1),
+@@ -85,12 +88,12 @@ struct platform_nand_data rb1xx_nand_dat
+ },
+ };
+
+-struct gpio_button rb1xx_gpio_buttons[] __initdata = {
++struct gpio_keys_button rb1xx_gpio_buttons[] __initdata = {
+ {
+ .desc = "reset_button",
+ .type = EV_KEY,
+- .code = BTN_0,
+- .threshold = 5,
++ .code = KEY_RESTART,
++ .debounce_interval = RB1XX_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ADM5120_GPIO_PIN7,
+ }
+ };
+@@ -138,8 +141,9 @@ void __init rb1xx_generic_setup(void)
+ adm5120_add_device_uart(0);
+ adm5120_add_device_uart(1);
+
+- adm5120_add_device_gpio_buttons(ARRAY_SIZE(rb1xx_gpio_buttons),
+- rb1xx_gpio_buttons);
++ adm5120_register_gpio_buttons(-1, RB1XX_KEYS_POLL_INTERVAL,
++ ARRAY_SIZE(rb1xx_gpio_buttons),
++ rb1xx_gpio_buttons);
+
+ rb1xx_add_device_flash();
+ rb1xx_mac_setup();
+--- a/arch/mips/adm5120/generic/eb-214a.c
++++ b/arch/mips/adm5120/generic/eb-214a.c
+@@ -28,6 +28,9 @@
+ #define EB214A_GPIO_DEV_MASK 0
+ #define EB214A_CONFIG_OFFSET 0x4000
+
++#define EB214A_KEYS_POLL_INTERVAL 20
++#define EB214A_KEYS_DEBOUNCE_INTERVAL (3 * EB214A_KEYS_POLL_INTERVAL)
++
+ static struct mtd_partition eb214a_partitions[] = {
+ {
+ .name = "bootloader",
+@@ -60,12 +63,12 @@ static struct gpio_led eb214a_gpio_leds[
+ GPIO_LED_INV(ADM5120_GPIO_P3L0, "usb4", NULL),
+ };
+
+-static struct gpio_button eb214a_gpio_buttons[] __initdata = {
++static struct gpio_keys_button eb214a_gpio_buttons[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+- .code = BTN_0,
+- .threshold = 5,
++ .code = KEY_RESTART,
++ .debounce_interval = EB214A_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ADM5120_GPIO_PIN1,
+ }
+ };
+@@ -105,8 +108,9 @@ static void __init eb214a_setup(void)
+
+ eb214a_mac_setup();
+
+- adm5120_add_device_gpio_buttons(ARRAY_SIZE(eb214a_gpio_buttons),
+- eb214a_gpio_buttons);
++ adm5120_register_gpio_buttons(-1, EB214A_KEYS_POLL_INTERVAL,
++ ARRAY_SIZE(eb214a_gpio_buttons),
++ eb214a_gpio_buttons);
+
+ adm5120_add_device_gpio_leds(ARRAY_SIZE(eb214a_gpio_leds),
+ eb214a_gpio_leds);
+--- a/arch/mips/adm5120/edimax/br-61xx.c
++++ b/arch/mips/adm5120/edimax/br-61xx.c
+@@ -18,6 +18,9 @@
+ #define BR61XX_CONFIG_OFFSET 0x8000
+ #define BR61XX_CONFIG_SIZE 0x1000
+
++#define BR61XX_KEYS_POLL_INTERVAL 20
++#define BR61XX_KEYS_DEBOUNCE_INTERVAL (3 * BR61XX_KEYS_POLL_INTERVAL)
++
+ static struct mtd_partition br61xx_partitions[] = {
+ {
+ .name = "admboot",
+@@ -35,12 +38,12 @@ static struct mtd_partition br61xx_parti
+ }
+ };
+
+-static struct gpio_button br61xx_gpio_buttons[] __initdata = {
++static struct gpio_keys_button br61xx_gpio_buttons[] __initdata = {
+ {
+ .desc = "reset_button",
+ .type = EV_KEY,
+- .code = BTN_0,
+- .threshold = 5,
++ .code = KEY_RESTART,
++ .debounce_interval = BR61XX_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ADM5120_GPIO_PIN2,
+ }
+ };
+@@ -76,8 +79,10 @@ void __init br61xx_generic_setup(void)
+ adm5120_add_device_uart(1);
+
+ adm5120_add_device_switch(5, br61xx_vlans);
+- adm5120_add_device_gpio_buttons(ARRAY_SIZE(br61xx_gpio_buttons),
+- br61xx_gpio_buttons);
++
++ adm5120_register_gpio_buttons(-1, BR61XX_KEYS_POLL_INTERVAL,
++ ARRAY_SIZE(br61xx_gpio_buttons),
++ br61xx_gpio_buttons);
+
+ br61xx_mac_setup();
+ }
+--- a/arch/mips/adm5120/mikrotik/rb-1xx.h
++++ b/arch/mips/adm5120/mikrotik/rb-1xx.h
+@@ -26,7 +26,7 @@
+ #include <prom/routerboot.h>
+
+ extern struct platform_nand_data rb1xx_nand_data __initdata;
+-extern struct gpio_button rb1xx_gpio_buttons[] __initdata;
++extern struct gpio_keys_button rb1xx_gpio_buttons[] __initdata;
+
+ extern void rb1xx_add_device_flash(void) __init;
+ extern void rb1xx_add_device_nand(void) __init;
diff --git a/target/linux/adm5120/patches-3.3/a10-pata-rb150-cf-3.3-fix.patch b/target/linux/adm5120/patches-3.3/a10-pata-rb150-cf-3.3-fix.patch
new file mode 100644
index 0000000..fc3257a
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/a10-pata-rb150-cf-3.3-fix.patch
@@ -0,0 +1,33 @@
+--- a/drivers/ata/pata_rb153_cf.c
++++ b/drivers/ata/pata_rb153_cf.c
+@@ -56,7 +56,7 @@ static inline void rb153_pata_finish_io(
+ ata_sff_dma_pause(ap);
+ ndelay(RB153_CF_IO_DELAY);
+
+- set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH);
++ irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH);
+ }
+
+ static void rb153_pata_exec_command(struct ata_port *ap,
+@@ -107,11 +107,11 @@ static irqreturn_t rb153_pata_irq_handle
+ struct rb153_cf_info *info = ah->private_data;
+
+ if (gpio_get_value(info->gpio_line)) {
+- set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW);
++ irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW);
+ if (!info->frozen)
+ ata_sff_interrupt(irq, dev_instance);
+ } else {
+- set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH);
++ irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH);
+ }
+
+ return IRQ_HANDLED;
+@@ -138,7 +138,6 @@ static void rb153_pata_setup_port(struct
+
+ ap->ops = &rb153_pata_port_ops;
+ ap->pio_mask = 0x1f; /* PIO4 */
+- ap->flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO;
+
+ ap->ioaddr.cmd_addr = info->iobase + RB153_CF_REG_CMD;
+ ap->ioaddr.ctl_addr = info->iobase + RB153_CF_REG_CTRL;
diff --git a/target/linux/adm5120/patches-3.3/a11-adm5120_wdt-3.3-fixes.patch b/target/linux/adm5120/patches-3.3/a11-adm5120_wdt-3.3-fixes.patch
new file mode 100644
index 0000000..261aa79
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/a11-adm5120_wdt-3.3-fixes.patch
@@ -0,0 +1,21 @@
+--- a/drivers/watchdog/adm5120_wdt.c
++++ b/drivers/watchdog/adm5120_wdt.c
+@@ -123,8 +123,7 @@ static ssize_t wdt_write(struct file *fi
+ return 0;
+ }
+
+-static int wdt_ioctl(struct inode *inode, struct file *file,
+- unsigned int cmd, unsigned long arg)
++static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+ {
+ int new_timeout;
+ static struct watchdog_info ident = {
+@@ -166,7 +165,7 @@ static const struct file_operations wdt_
+ .owner = THIS_MODULE,
+ .llseek = no_llseek,
+ .write = wdt_write,
+- .ioctl = wdt_ioctl,
++ .unlocked_ioctl = wdt_ioctl,
+ .open = wdt_open,
+ .release = wdt_release,
+ };
diff --git a/target/linux/adm5120/patches-3.3/a12-adm5120sw-3.3-fixes.patch b/target/linux/adm5120/patches-3.3/a12-adm5120sw-3.3-fixes.patch
new file mode 100644
index 0000000..aa2be2e
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/a12-adm5120sw-3.3-fixes.patch
@@ -0,0 +1,84 @@
+--- a/drivers/net/adm5120sw.c
++++ b/drivers/net/adm5120sw.c
+@@ -38,6 +38,7 @@
+ #include <asm/mach-adm5120/adm5120_switch.h>
+
+ #include "adm5120sw.h"
++#include <linux/dma-mapping.h>
+
+ #define DRV_NAME "adm5120-switch"
+ #define DRV_DESC "ADM5120 built-in ethernet switch driver"
+@@ -153,7 +154,7 @@ static unsigned int cur_txl, dirty_txl;
+
+ static unsigned int sw_used;
+
+-static spinlock_t tx_lock = SPIN_LOCK_UNLOCKED;
++static DEFINE_SPINLOCK(tx_lock);
+
+ /* ------------------------------------------------------------------------ */
+
+@@ -216,6 +217,7 @@ static inline int desc_ipcsum_fail(struc
+
+ /* ------------------------------------------------------------------------ */
+
++#ifdef CONFIG_ADM5120_SWITCH_DEBUG
+ static void sw_dump_desc(char *label, struct dma_desc *desc, int tx)
+ {
+ u32 t;
+@@ -336,6 +338,11 @@ static void sw_dump_regs(void)
+ t = sw_read_reg(SWITCH_REG_RLDA);
+ SW_DBG("rlda: %08X\n", t);
+ }
++#else
++static inline void sw_dump_desc(char *label, struct dma_desc *desc, int tx) {}
++static void sw_dump_intr_mask(char *label, u32 mask) {}
++static inline void sw_dump_regs(void) {}
++#endif /* CONFIG_ADM5120_SWITCH_DEBUG */
+
+ /* ------------------------------------------------------------------------ */
+
+@@ -502,7 +509,7 @@ static int adm5120_if_poll(struct napi_s
+ {
+ struct adm5120_if_priv *priv = container_of(napi,
+ struct adm5120_if_priv, napi);
+- struct net_device *dev = priv->dev;
++ struct net_device *dev __maybe_unused = priv->dev;
+ int done;
+ u32 status;
+
+@@ -920,7 +927,7 @@ static void adm5120_if_tx_timeout(struct
+ SW_INFO("TX timeout on %s\n", dev->name);
+ }
+
+-static void adm5120_if_set_multicast_list(struct net_device *dev)
++static void adm5120_if_set_rx_mode(struct net_device *dev)
+ {
+ struct adm5120_if_priv *priv = netdev_priv(dev);
+ u32 ports;
+@@ -937,7 +944,7 @@ static void adm5120_if_set_multicast_lis
+ t |= (ports << CPUP_CONF_DUNP_SHIFT);
+
+ if (dev->flags & IFF_PROMISC || dev->flags & IFF_ALLMULTI ||
+- dev->mc_count)
++ netdev_mc_count(dev))
+ /* enable multicast packets */
+ t &= ~(ports << CPUP_CONF_DMCP_SHIFT);
+ else
+@@ -1024,7 +1031,7 @@ static const struct net_device_ops adm51
+ .ndo_open = adm5120_if_open,
+ .ndo_stop = adm5120_if_stop,
+ .ndo_start_xmit = adm5120_if_hard_start_xmit,
+- .ndo_set_multicast_list = adm5120_if_set_multicast_list,
++ .ndo_set_rx_mode = adm5120_if_set_rx_mode,
+ .ndo_do_ioctl = adm5120_if_do_ioctl,
+ .ndo_tx_timeout = adm5120_if_tx_timeout,
+ .ndo_validate_addr = eth_validate_addr,
+@@ -1076,7 +1083,7 @@ static void adm5120_switch_cleanup(void)
+ adm5120_switch_rx_ring_free();
+ }
+
+-static int __init adm5120_switch_probe(struct platform_device *pdev)
++static int __devinit adm5120_switch_probe(struct platform_device *pdev)
+ {
+ u32 t;
+ int i, err;
diff --git a/target/linux/adm5120/patches-3.3/a13-adm5120_flash-3.3-fixes.patch b/target/linux/adm5120/patches-3.3/a13-adm5120_flash-3.3-fixes.patch
new file mode 100644
index 0000000..ea2e19f
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/a13-adm5120_flash-3.3-fixes.patch
@@ -0,0 +1,166 @@
+--- a/drivers/mtd/maps/adm5120-flash.c
++++ b/drivers/mtd/maps/adm5120-flash.c
+@@ -54,10 +54,6 @@ struct adm5120_flash_info {
+ struct resource *res;
+ struct platform_device *dev;
+ struct adm5120_map_info amap;
+-#ifdef CONFIG_MTD_PARTITIONS
+- int nr_parts;
+- struct mtd_partition *parts[MAX_PARSED_PARTS];
+-#endif
+ };
+
+ struct flash_desc {
+@@ -96,7 +92,6 @@ static const char const *probe_types[] =
+ NULL
+ };
+
+-#ifdef CONFIG_MTD_PARTITIONS
+ static const char const *parse_types[] = {
+ "cmdlinepart",
+ #ifdef CONFIG_MTD_REDBOOT_PARTS
+@@ -106,7 +101,6 @@ static const char const *parse_types[] =
+ "MyLoader",
+ #endif
+ };
+-#endif
+
+ #define BANK_SIZE (2<<20)
+ #define BANK_SIZE_MAX (4<<20)
+@@ -318,89 +312,6 @@ static void adm5120_flash_initbanks(stru
+ info->mtd->size = info->amap.window_size;
+ }
+
+-#ifdef CONFIG_MTD_PARTITIONS
+-static int adm5120_flash_initparts(struct adm5120_flash_info *info)
+-{
+- struct adm5120_flash_platform_data *pdata;
+- struct map_info *map = &info->amap.map;
+- int num_parsers;
+- const char *parser[2];
+- int err = 0;
+- int nr_parts;
+- int i;
+-
+- info->nr_parts = 0;
+-
+- pdata = info->dev->dev.platform_data;
+- if (pdata == NULL)
+- goto out;
+-
+- if (pdata->nr_parts) {
+- MAP_INFO(map, "adding static partitions\n");
+- err = add_mtd_partitions(info->mtd, pdata->parts,
+- pdata->nr_parts);
+- if (err == 0) {
+- info->nr_parts += pdata->nr_parts;
+- goto out;
+- }
+- }
+-
+- num_parsers = ARRAY_SIZE(parse_types);
+- if (num_parsers > MAX_PARSED_PARTS)
+- num_parsers = MAX_PARSED_PARTS;
+-
+- parser[1] = NULL;
+- for (i = 0; i < num_parsers; i++) {
+- parser[0] = parse_types[i];
+-
+- MAP_INFO(map, "parsing \"%s\" partitions\n",
+- parser[0]);
+- nr_parts = parse_mtd_partitions(info->mtd, parser,
+- &info->parts[i], 0);
+-
+- if (nr_parts <= 0)
+- continue;
+-
+- MAP_INFO(map, "adding \"%s\" partitions\n",
+- parser[0]);
+-
+- err = add_mtd_partitions(info->mtd, info->parts[i], nr_parts);
+- if (err)
+- break;
+-
+- info->nr_parts += nr_parts;
+- }
+-out:
+- return err;
+-}
+-#else
+-static int adm5120_flash_initparts(struct adm5120_flash_info *info)
+-{
+- return 0;
+-}
+-#endif /* CONFIG_MTD_PARTITIONS */
+-
+-#ifdef CONFIG_MTD_PARTITIONS
+-static void adm5120_flash_remove_mtd(struct adm5120_flash_info *info)
+-{
+- int i;
+-
+- if (info->nr_parts) {
+- del_mtd_partitions(info->mtd);
+- for (i = 0; i < MAX_PARSED_PARTS; i++)
+- if (info->parts[i] != NULL)
+- kfree(info->parts[i]);
+- } else {
+- del_mtd_device(info->mtd);
+- }
+-}
+-#else
+-static void adm5120_flash_remove_mtd(struct adm5120_flash_info *info)
+-{
+- del_mtd_device(info->mtd);
+-}
+-#endif
+-
+ static int adm5120_flash_remove(struct platform_device *dev)
+ {
+ struct adm5120_flash_info *info;
+@@ -412,7 +323,7 @@ static int adm5120_flash_remove(struct p
+ platform_set_drvdata(dev, NULL);
+
+ if (info->mtd != NULL) {
+- adm5120_flash_remove_mtd(info);
++ mtd_device_unregister(info->mtd);
+ map_destroy(info->mtd);
+ }
+
+@@ -429,11 +340,18 @@ static int adm5120_flash_remove(struct p
+
+ static int adm5120_flash_probe(struct platform_device *dev)
+ {
++ struct adm5120_flash_platform_data *pdata;
+ struct adm5120_flash_info *info;
+ struct map_info *map;
+ const char **probe_type;
+ int err;
+
++ pdata = dev->dev.platform_data;
++ if (!pdata) {
++ dev_err(&dev->dev, "no platform data\n");
++ return -EINVAL;
++ }
++
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
+ if (info == NULL) {
+ err = -ENOMEM;
+@@ -484,16 +402,11 @@ static int adm5120_flash_probe(struct pl
+
+ info->mtd->owner = THIS_MODULE;
+
+- err = adm5120_flash_initparts(info);
++ err = mtd_device_parse_register(info->mtd, parse_types, 0,
++ pdata->parts, pdata->nr_parts);
+ if (err)
+ goto err_out;
+
+- if (info->nr_parts == 0) {
+- MAP_INFO(map, "no partitions available, registering "
+- "whole flash\n");
+- add_mtd_device(info->mtd);
+- }
+-
+ return 0;
+
+ err_out:
diff --git a/target/linux/adm5120/patches-3.3/a14-mtd-trxsplit-fixes.patch b/target/linux/adm5120/patches-3.3/a14-mtd-trxsplit-fixes.patch
new file mode 100644
index 0000000..f9ececf
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/a14-mtd-trxsplit-fixes.patch
@@ -0,0 +1,20 @@
+--- a/drivers/mtd/trxsplit.c
++++ b/drivers/mtd/trxsplit.c
+@@ -144,7 +144,7 @@ static void trxsplit_create_partitions(s
+ part = &trx_parts[i];
+ part->name = "rootfs";
+
+- err = add_mtd_partitions(mtd, trx_parts, trx_nr_parts);
++ err = mtd_device_register(mtd, trx_parts, trx_nr_parts);
+ if (err) {
+ printk(KERN_ALERT PFX "adding TRX partitions failed\n");
+ return;
+@@ -159,7 +159,7 @@ static int trxsplit_refresh_partitions(s
+ mtd->name, MTD_BLOCK_MAJOR, mtd->index);
+
+ /* remove old partitions */
+- del_mtd_partitions(mtd);
++ mtd_device_unregister(mtd);
+
+ trxsplit_findtrx(mtd);
+ if (!trx_mtd)
diff --git a/target/linux/adm5120/patches-3.3/a15-adm5120-usb-driver-cleanup.patch b/target/linux/adm5120/patches-3.3/a15-adm5120-usb-driver-cleanup.patch
new file mode 100644
index 0000000..5994d43
--- /dev/null
+++ b/target/linux/adm5120/patches-3.3/a15-adm5120-usb-driver-cleanup.patch
@@ -0,0 +1,582 @@
+--- a/drivers/usb/host/adm5120.h
++++ b/drivers/usb/host/adm5120.h
+@@ -403,6 +403,7 @@ struct admhcd {
+ * other external transceivers should be software-transparent
+ */
+ struct otg_transceiver *transceiver;
++ void (*start_hnp)(struct admhcd *ahcd);
+ #endif
+
+ /*
+@@ -537,15 +538,7 @@ static inline struct usb_hcd *admhcd_to_
+ * Big-endian read/write functions are arch-specific.
+ * Other arches can be added if/when they're needed.
+ *
+- * REVISIT: arch/powerpc now has readl/writel_be, so the
+- * definition below can die once the STB04xxx support is
+- * finally ported over.
+ */
+-#if defined(CONFIG_PPC) && !defined(CONFIG_PPC_MERGE)
+-#define readl_be(addr) in_be32((__force unsigned *)addr)
+-#define writel_be(val, addr) out_be32((__force unsigned *)addr, val)
+-#endif
+-
+ static inline unsigned int admhc_readl(const struct admhcd *ahcd,
+ __hc32 __iomem *regs)
+ {
+--- a/drivers/usb/host/adm5120-drv.c
++++ b/drivers/usb/host/adm5120-drv.c
+@@ -9,7 +9,7 @@
+ * (C) Copyright 2002 Hewlett-Packard Company
+ *
+ * Written by Christopher Hoover <ch@hpl.hp.com>
+- * Based on fragments of previous driver by Rusell King et al.
++ * Based on fragments of previous driver by Russell King et al.
+ *
+ * Modified for LH7A404 from ahcd-sa1111.c
+ * by Durgesh Pattamatta <pattamattad@sharpsec.com>
+@@ -81,7 +81,7 @@ static int admhc_adm5120_probe(const str
+
+ admhc_hcd_init(hcd_to_admhcd(hcd));
+
+- retval = usb_add_hcd(hcd, irq, IRQF_DISABLED);
++ retval = usb_add_hcd(hcd, irq, 0);
+ if (retval)
+ goto err_io;
+
+@@ -109,10 +109,7 @@ static void admhc_adm5120_remove(struct
+ usb_put_hcd(hcd);
+ }
+
+-/*-------------------------------------------------------------------------*/
+-
+-static int __devinit
+-admhc_adm5120_start(struct usb_hcd *hcd)
++static int __devinit admhc_adm5120_start(struct usb_hcd *hcd)
+ {
+ struct admhcd *ahcd = hcd_to_admhcd(hcd);
+ int ret;
+@@ -137,8 +134,6 @@ err:
+ return ret;
+ }
+
+-/*-------------------------------------------------------------------------*/
+-
+ static const struct hc_driver adm5120_hc_driver = {
+ .description = hcd_name,
+ .product_desc = "ADM5120 built-in USB 1.1 Host Controller",
+@@ -181,8 +176,6 @@ static const struct hc_driver adm5120_hc
+ .start_port_reset = admhc_start_port_reset,
+ };
+
+-/*-------------------------------------------------------------------------*/
+-
+ static int usb_hcd_adm5120_probe(struct platform_device *pdev)
+ {
+ int ret;
+--- a/drivers/usb/host/adm5120-dbg.c
++++ b/drivers/usb/host/adm5120-dbg.c
+@@ -401,25 +401,28 @@ static const struct file_operations debu
+ .open = debug_async_open,
+ .read = debug_output,
+ .release = debug_close,
++ .llseek = default_llseek,
+ };
+ static const struct file_operations debug_periodic_fops = {
+ .owner = THIS_MODULE,
+ .open = debug_periodic_open,
+ .read = debug_output,
+ .release = debug_close,
++ .llseek = default_llseek,
+ };
+ static const struct file_operations debug_registers_fops = {
+ .owner = THIS_MODULE,
+ .open = debug_registers_open,
+ .read = debug_output,
+ .release = debug_close,
++ .llseek = default_llseek,
+ };
+
+ static struct dentry *admhc_debug_root;
+
+ struct debug_buffer {
+ ssize_t (*fill_func)(struct debug_buffer *); /* fill method */
+- struct device *dev;
++ struct admhcd *ahcd;
+ struct mutex mutex; /* protect filling of buffer */
+ size_t count; /* number of characters filled into buffer */
+ char *page;
+@@ -494,15 +497,11 @@ show_list(struct admhcd *ahcd, char *buf
+
+ static ssize_t fill_async_buffer(struct debug_buffer *buf)
+ {
+- struct usb_bus *bus;
+- struct usb_hcd *hcd;
+ struct admhcd *ahcd;
+ size_t temp;
+ unsigned long flags;
+
+- bus = dev_get_drvdata(buf->dev);
+- hcd = bus_to_hcd(bus);
+- ahcd = hcd_to_admhcd(hcd);
++ ahcd = buf->ahcd;
+
+ spin_lock_irqsave(&ahcd->lock, flags);
+ temp = show_list(ahcd, buf->page, PAGE_SIZE, ahcd->ed_head);
+@@ -516,8 +515,6 @@ static ssize_t fill_async_buffer(struct
+
+ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
+ {
+- struct usb_bus *bus;
+- struct usb_hcd *hcd;
+ struct admhcd *ahcd;
+ struct ed **seen, *ed;
+ unsigned long flags;
+@@ -530,9 +527,7 @@ static ssize_t fill_periodic_buffer(stru
+ return 0;
+ seen_count = 0;
+
+- bus = dev_get_drvdata(buf->dev);
+- hcd = bus_to_hcd(bus);
+- ahcd = hcd_to_admhcd(hcd);
++ ahcd = buf->ahcd;
+ next = buf->page;
+ size = PAGE_SIZE;
+
+@@ -615,7 +610,6 @@ static ssize_t fill_periodic_buffer(stru
+
+ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
+ {
+- struct usb_bus *bus;
+ struct usb_hcd *hcd;
+ struct admhcd *ahcd;
+ struct admhcd_regs __iomem *regs;
+@@ -624,9 +618,8 @@ static ssize_t fill_registers_buffer(str
+ char *next;
+ u32 rdata;
+
+- bus = dev_get_drvdata(buf->dev);
+- hcd = bus_to_hcd(bus);
+- ahcd = hcd_to_admhcd(hcd);
++ ahcd = buf->ahcd;
++ hcd = admhc_to_hcd(ahcd);
+ regs = ahcd->regs;
+ next = buf->page;
+ size = PAGE_SIZE;
+@@ -638,13 +631,13 @@ static ssize_t fill_registers_buffer(str
+ admhc_dbg_sw(ahcd, &next, &size,
+ "bus %s, device %s\n"
+ "%s\n"
+- "%s version " DRIVER_VERSION "\n",
++ "%s\n",
+ hcd->self.controller->bus->name,
+ dev_name(hcd->self.controller),
+ hcd->product_desc,
+ hcd_name);
+
+- if (bus->controller->power.power_state.event) {
++ if (!HCD_HW_ACCESSIBLE(hcd)) {
+ size -= scnprintf(next, size,
+ "SUSPENDED (no register access)\n");
+ goto done;
+@@ -691,7 +684,7 @@ done:
+ }
+
+
+-static struct debug_buffer *alloc_buffer(struct device *dev,
++static struct debug_buffer *alloc_buffer(struct admhcd *ahcd,
+ ssize_t (*fill_func)(struct debug_buffer *))
+ {
+ struct debug_buffer *buf;
+@@ -699,7 +692,7 @@ static struct debug_buffer *alloc_buffer
+ buf = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL);
+
+ if (buf) {
+- buf->dev = dev;
++ buf->ahcd = ahcd;
+ buf->fill_func = fill_func;
+ mutex_init(&buf->mutex);
+ }
+@@ -792,26 +785,25 @@ static int debug_registers_open(struct i
+ static inline void create_debug_files(struct admhcd *ahcd)
+ {
+ struct usb_bus *bus = &admhcd_to_hcd(ahcd)->self;
+- struct device *dev = bus->dev;
+
+ ahcd->debug_dir = debugfs_create_dir(bus->bus_name, admhc_debug_root);
+ if (!ahcd->debug_dir)
+ goto dir_error;
+
+ ahcd->debug_async = debugfs_create_file("async", S_IRUGO,
+- ahcd->debug_dir, dev,
++ ahcd->debug_dir, ahcd,
+ &debug_async_fops);
+ if (!ahcd->debug_async)
+ goto async_error;
+
+ ahcd->debug_periodic = debugfs_create_file("periodic", S_IRUGO,
+- ahcd->debug_dir, dev,
++ ahcd->debug_dir, ahcd,
+ &debug_periodic_fops);
+ if (!ahcd->debug_periodic)
+ goto periodic_error;
+
+ ahcd->debug_registers = debugfs_create_file("registers", S_IRUGO,
+- ahcd->debug_dir, dev,
++ ahcd->debug_dir, ahcd,
+ &debug_registers_fops);
+ if (!ahcd->debug_registers)
+ goto registers_error;
+--- a/drivers/usb/host/adm5120-pm.c
++++ b/drivers/usb/host/adm5120-pm.c
+@@ -257,7 +257,7 @@ static int admhc_bus_suspend(struct usb_
+
+ spin_lock_irq(&ahcd->lock);
+
+- if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)))
++ if (unlikely(!HCD_HW_ACCESSIBLE(hcd)))
+ rc = -ESHUTDOWN;
+ else
+ rc = admhc_rh_suspend(ahcd, 0);
+@@ -275,7 +275,7 @@ static int admhc_bus_resume(struct usb_h
+
+ spin_lock_irq(&ahcd->lock);
+
+- if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)))
++ if (unlikely(!HCD_HW_ACCESSIBLE(hcd)))
+ rc = -ESHUTDOWN;
+ else
+ rc = admhc_rh_resume(ahcd);
+--- a/drivers/usb/host/adm5120-hcd.c
++++ b/drivers/usb/host/adm5120-hcd.c
+@@ -32,9 +32,9 @@
+ #include <linux/list.h>
+ #include <linux/usb.h>
+ #include <linux/usb/otg.h>
++#include <linux/usb/hcd.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/dmapool.h>
+-#include <linux/reboot.h>
+ #include <linux/debugfs.h>
+ #include <linux/io.h>
+
+@@ -43,9 +43,6 @@
+ #include <asm/unaligned.h>
+ #include <asm/byteorder.h>
+
+-#include "../core/hcd.h"
+-#include "../core/hub.h"
+-
+ #define DRIVER_VERSION "0.27.0"
+ #define DRIVER_AUTHOR "Gabor Juhos <juhosg@openwrt.org>"
+ #define DRIVER_DESC "ADMtek USB 1.1 Host Controller Driver"
+@@ -117,7 +114,7 @@ static int admhc_urb_enqueue(struct usb_
+ td_cnt = 2;
+ /* FALLTHROUGH */
+ case PIPE_BULK:
+- /* one TD for every 4096 Bytes (can be upto 8K) */
++ /* one TD for every 4096 Bytes (can be up to 8K) */
+ td_cnt += urb->transfer_buffer_length / TD_DATALEN_MAX;
+ /* ... and for any remaining bytes ... */
+ if ((urb->transfer_buffer_length % TD_DATALEN_MAX) != 0)
+@@ -153,7 +150,7 @@ static int admhc_urb_enqueue(struct usb_
+
+ spin_lock_irqsave(&ahcd->lock, flags);
+ /* don't submit to a dead HC */
+- if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
++ if (!HCD_HW_ACCESSIBLE(hcd)) {
+ ret = -ENODEV;
+ goto fail;
+ }
+@@ -321,7 +318,6 @@ sanitize:
+ ep->hcpriv = NULL;
+
+ spin_unlock_irqrestore(&ahcd->lock, flags);
+- return;
+ }
+
+ static int admhc_get_frame_number(struct usb_hcd *hcd)
+@@ -488,7 +484,7 @@ err:
+ */
+ static int admhc_run(struct admhcd *ahcd)
+ {
+- u32 temp;
++ u32 val;
+ int first = ahcd->fminterval == 0;
+ struct usb_hcd *hcd = admhcd_to_hcd(ahcd);
+
+@@ -496,8 +492,8 @@ static int admhc_run(struct admhcd *ahcd
+
+ /* boot firmware should have set this up (5.1.1.3.1) */
+ if (first) {
+- temp = admhc_readl(ahcd, &ahcd->regs->fminterval);
+- ahcd->fminterval = temp & ADMHC_SFI_FI_MASK;
++ val = admhc_readl(ahcd, &ahcd->regs->fminterval);
++ ahcd->fminterval = val & ADMHC_SFI_FI_MASK;
+ if (ahcd->fminterval != FI)
+ admhc_dbg(ahcd, "fminterval delta %d\n",
+ ahcd->fminterval - FI);
+@@ -507,30 +503,30 @@ static int admhc_run(struct admhcd *ahcd
+ }
+
+ #if 0 /* TODO: not applicable */
+- /* Reset USB nearly "by the book". RemoteWakeupConnected was
+- * saved if boot firmware (BIOS/SMM/...) told us it's connected,
+- * or if bus glue did the same (e.g. for PCI add-in cards with
+- * PCI PM support).
++ /* Reset USB nearly "by the book". RemoteWakeupConnected has
++ * to be checked in case boot firmware (BIOS/SMM/...) has set up
++ * wakeup in a way the bus isn't aware of (e.g., legacy PCI PM).
++ * If the bus glue detected wakeup capability then it should
++ * already be enabled; if so we'll just enable it again.
+ */
+- if ((ahcd->hc_control & OHCI_CTRL_RWC) != 0
+- && !device_may_wakeup(hcd->self.controller))
+- device_init_wakeup(hcd->self.controller, 1);
++ if ((ahcd->hc_control & OHCI_CTRL_RWC) != 0)
++ device_set_wakeup_capable(hcd->self.controller, 1);
+ #endif
+
+ switch (ahcd->host_control & ADMHC_HC_BUSS) {
+ case ADMHC_BUSS_OPER:
+- temp = 0;
++ val = 0;
+ break;
+ case ADMHC_BUSS_SUSPEND:
+ /* FALLTHROUGH ? */
+ case ADMHC_BUSS_RESUME:
+ ahcd->host_control = ADMHC_BUSS_RESUME;
+- temp = 10 /* msec wait */;
++ val = 10 /* msec wait */;
+ break;
+ /* case ADMHC_BUSS_RESET: */
+ default:
+ ahcd->host_control = ADMHC_BUSS_RESET;
+- temp = 50 /* msec wait */;
++ val = 50 /* msec wait */;
+ break;
+ }
+ admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control);
+@@ -538,12 +534,12 @@ static int admhc_run(struct admhcd *ahcd
+ /* flush the writes */
+ admhc_writel_flush(ahcd);
+
+- msleep(temp);
+- temp = admhc_read_rhdesc(ahcd);
+- if (!(temp & ADMHC_RH_NPS)) {
++ msleep(val);
++ val = admhc_read_rhdesc(ahcd);
++ if (!(val & ADMHC_RH_NPS)) {
+ /* power down each port */
+- for (temp = 0; temp < ahcd->num_ports; temp++)
+- admhc_write_portstatus(ahcd, temp, ADMHC_PS_CPP);
++ for (val = 0; val < ahcd->num_ports; val++)
++ admhc_write_portstatus(ahcd, val, ADMHC_PS_CPP);
+ }
+ /* flush those writes */
+ admhc_writel_flush(ahcd);
+@@ -552,9 +548,9 @@ static int admhc_run(struct admhcd *ahcd
+ spin_lock_irq(&ahcd->lock);
+
+ admhc_writel(ahcd, ADMHC_CTRL_SR, &ahcd->regs->gencontrol);
+- temp = 30; /* ... allow extra time */
++ val = 30; /* ... allow extra time */
+ while ((admhc_readl(ahcd, &ahcd->regs->gencontrol) & ADMHC_CTRL_SR) != 0) {
+- if (--temp == 0) {
++ if (--val == 0) {
+ spin_unlock_irq(&ahcd->lock);
+ admhc_err(ahcd, "USB HC reset timed out!\n");
+ return -1;
+@@ -571,7 +567,7 @@ static int admhc_run(struct admhcd *ahcd
+ periodic_reinit(ahcd);
+
+ /* use rhsc irqs after khubd is fully initialized */
+- hcd->poll_rh = 1;
++ set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
+ hcd->uses_new_polling = 1;
+
+ #if 0
+@@ -594,10 +590,10 @@ static int admhc_run(struct admhcd *ahcd
+ ahcd->host_control = ADMHC_BUSS_OPER;
+ admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control);
+
+- temp = 20;
++ val = 20;
+ while ((admhc_readl(ahcd, &ahcd->regs->host_control)
+ & ADMHC_HC_BUSS) != ADMHC_BUSS_OPER) {
+- if (--temp == 0) {
++ if (--val == 0) {
+ spin_unlock_irq(&ahcd->lock);
+ admhc_err(ahcd, "unable to setup operational mode!\n");
+ return -1;
+@@ -613,10 +609,10 @@ static int admhc_run(struct admhcd *ahcd
+ /* FIXME: enabling DMA is always failed here for an unknown reason */
+ admhc_dma_enable(ahcd);
+
+- temp = 200;
++ val = 200;
+ while ((admhc_readl(ahcd, &ahcd->regs->host_control)
+ & ADMHC_HC_DMAE) != ADMHC_HC_DMAE) {
+- if (--temp == 0) {
++ if (--val == 0) {
+ spin_unlock_irq(&ahcd->lock);
+ admhc_err(ahcd, "unable to enable DMA!\n");
+ admhc_dump(ahcd, 1);
+@@ -688,7 +684,7 @@ static irqreturn_t admhc_irq(struct usb_
+ */
+ admhc_vdbg(ahcd, "Resume Detect\n");
+ admhc_intr_ack(ahcd, ADMHC_INTR_RESI);
+- hcd->poll_rh = 1;
++ set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
+ if (ahcd->autostop) {
+ spin_lock(&ahcd->lock);
+ admhc_rh_resume(ahcd);
+@@ -799,9 +795,10 @@ static int __init admhc_hcd_mod_init(voi
+ pr_info("%s: " DRIVER_INFO "\n", hcd_name);
+ pr_info("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
+ sizeof(struct ed), sizeof(struct td));
++ set_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
+
+ #ifdef DEBUG
+- admhc_debug_root = debugfs_create_dir("admhc", NULL);
++ admhc_debug_root = debugfs_create_dir("admhc", usb_debug_root);
+ if (!admhc_debug_root) {
+ ret = -ENOENT;
+ goto error_debug;
+@@ -826,6 +823,7 @@ error_platform:
+ admhc_debug_root = NULL;
+ error_debug:
+ #endif
++ clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
+ return ret;
+ }
+ module_init(admhc_hcd_mod_init);
+@@ -836,6 +834,7 @@ static void __exit admhc_hcd_mod_exit(vo
+ #ifdef DEBUG
+ debugfs_remove(admhc_debug_root);
+ #endif
++ clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
+ }
+ module_exit(admhc_hcd_mod_exit);
+
+--- a/drivers/usb/host/adm5120-hub.c
++++ b/drivers/usb/host/adm5120-hub.c
+@@ -75,7 +75,7 @@ admhc_hub_status_data(struct usb_hcd *hc
+ u32 status;
+
+ spin_lock_irqsave(&ahcd->lock, flags);
+- if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))
++ if (!HCD_HW_ACCESSIBLE(hcd))
+ goto done;
+
+ /* init status */
+@@ -106,8 +106,11 @@ admhc_hub_status_data(struct usb_hcd *hc
+ }
+ }
+
+- hcd->poll_rh = admhc_root_hub_state_changes(ahcd, changed,
+- any_connected);
++ if (admhc_root_hub_state_changes(ahcd, changed,
++ any_connected))
++ set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
++ else
++ clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
+
+ done:
+ spin_unlock_irqrestore(&ahcd->lock, flags);
+@@ -143,9 +146,9 @@ static int admhc_get_hub_descriptor(stru
+ temp |= 0x0008;
+ desc->wHubCharacteristics = (__force __u16)cpu_to_hc16(ahcd, temp);
+
+- /* two bitmaps: ports removable, and usb 1.0 legacy PortPwrCtrlMask */
+- desc->bitmap[0] = 0;
+- desc->bitmap[0] = ~0;
++ /* ports removable, and usb 1.0 legacy PortPwrCtrlMask */
++ desc->u.hs.DeviceRemovable[0] = 0;
++ desc->u.hs.DeviceRemovable[0] = ~0;
+
+ return 0;
+ }
+@@ -310,10 +313,10 @@ static int admhc_hub_control(struct usb_
+ u16 wIndex, char *buf, u16 wLength)
+ {
+ struct admhcd *ahcd = hcd_to_admhcd(hcd);
+- int ports = hcd_to_bus(hcd)->root_hub->maxchild;
++ int ports = ahcd->num_ports;
+ int ret = 0;
+
+- if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)))
++ if (unlikely(!HCD_HW_ACCESSIBLE(hcd)))
+ return -ESHUTDOWN;
+
+ switch (typeReq) {
+--- a/drivers/usb/host/adm5120-q.c
++++ b/drivers/usb/host/adm5120-q.c
+@@ -14,6 +14,7 @@
+ */
+
+ #include <linux/irq.h>
++#include <linux/slab.h>
+
+ /*-------------------------------------------------------------------------*/
+
+@@ -300,7 +301,7 @@ static struct ed *ed_get(struct admhcd *
+ u32 info;
+
+ /* FIXME: usbcore changes dev->devnum before SET_ADDRESS
+- * suceeds ... otherwise we wouldn't need "pipe".
++ * succeeds ... otherwise we wouldn't need "pipe".
+ */
+ info = usb_pipedevice(pipe);
+ info |= (ep->desc.bEndpointAddress & ~USB_DIR_IN) << ED_EN_SHIFT;
+@@ -634,8 +635,7 @@ static int td_done(struct admhcd *ahcd,
+
+ /*-------------------------------------------------------------------------*/
+
+-static inline void
+-ed_halted(struct admhcd *ahcd, struct td *td, int cc, struct td *rev)
++static void ed_halted(struct admhcd *ahcd, struct td *td, int cc)
+ {
+ struct urb *urb = td->urb;
+ struct urb_priv *urb_priv = urb->hcpriv;
+@@ -764,6 +764,7 @@ rescan_this:
+ struct urb *urb;
+ struct urb_priv *urb_priv;
+ __hc32 savebits;
++ u32 tdINFO;
+ int status;
+
+ td = list_entry(entry, struct td, td_list);
+@@ -781,6 +782,16 @@ rescan_this:
+ /* patch pointer hc uses */
+ savebits = *prev & ~cpu_to_hc32(ahcd, TD_MASK);
+ *prev = td->hwNextTD | savebits;
++ /* If this was unlinked, the TD may not have been
++ * retired ... so manually save dhe data toggle.
++ * The controller ignores the value we save for
++ * control and ISO endpoints.
++ */
++ tdINFO = hc32_to_cpup(ahcd, &td->hwINFO);
++ if ((tdINFO & TD_T) == TD_T_DATA0)
++ ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_C);
++ else if ((tdINFO & TD_T) == TD_T_DATA1)
++ ed->hwHeadP |= cpu_to_hc32(ahcd, ED_C);
+
+ /* HC may have partly processed this TD */
+ #ifdef ADMHC_VERBOSE_DEBUG
+@@ -816,13 +827,12 @@ rescan_this:
+ }
+
+ /*-------------------------------------------------------------------------*/
+-
+ /*
+ * Process normal completions (error or success) and clean the schedules.
+ *
+ * This is the main path for handing urbs back to drivers. The only other
+- * path is finish_unlinks(), which unlinks URBs using ed_rm_list, instead of
+- * scanning the (re-reversed) donelist as this does.
++ * normal path is finish_unlinks(), which unlinks URBs using ed_rm_list,
++ * instead of scanning the (re-reversed) donelist as this does.
+ */
+
+ static void ed_unhalt(struct admhcd *ahcd, struct ed *ed, struct urb *urb)
diff --git a/target/linux/adm5120/router_be/config-3.3 b/target/linux/adm5120/router_be/config-3.3
new file mode 100644
index 0000000..d5c7668
--- /dev/null
+++ b/target/linux/adm5120/router_be/config-3.3
@@ -0,0 +1,191 @@
+CONFIG_ADM5120=y
+CONFIG_ADM5120_ENET=y
+# CONFIG_ADM5120_MACH_5GXI is not set
+CONFIG_ADM5120_MACH_P_334WT=y
+CONFIG_ADM5120_MACH_P_335=y
+# CONFIG_ADM5120_OEM_CELLVISION is not set
+# CONFIG_ADM5120_OEM_COMPEX is not set
+# CONFIG_ADM5120_OEM_EDIMAX is not set
+# CONFIG_ADM5120_OEM_GENERIC is not set
+# CONFIG_ADM5120_OEM_INFINEON is not set
+# CONFIG_ADM5120_OEM_MIKROTIK is not set
+# CONFIG_ADM5120_OEM_MOTOROLA is not set
+# CONFIG_ADM5120_OEM_OSBRIDGE is not set
+CONFIG_ADM5120_OEM_ZYXEL=y
+CONFIG_ADM5120_SOC_BGA=y
+CONFIG_ADM5120_WDT=y
+CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+CONFIG_ARCH_DISCARD_MEMBLOCK=y
+# CONFIG_ARCH_DMA_ADDR_T_64BIT is not set
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM_AMBA=y
+# CONFIG_ARM_SP805_WATCHDOG is not set
+CONFIG_ATA=m
+CONFIG_BCMA_POSSIBLE=y
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_CEVT_R4K=y
+CONFIG_CEVT_R4K_LIB=y
+CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,yaffs2,jffs2"
+CONFIG_CMDLINE_BOOL=y
+# CONFIG_CMDLINE_OVERRIDE is not set
+CONFIG_CPU_BIG_ENDIAN=y
+CONFIG_CPU_HAS_PREFETCH=y
+CONFIG_CPU_HAS_SYNC=y
+# CONFIG_CPU_LITTLE_ENDIAN is not set
+CONFIG_CPU_MIPS32=y
+CONFIG_CPU_MIPS32_R1=y
+CONFIG_CPU_MIPSR1=y
+CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_CPU_SUPPORTS_HIGHMEM=y
+CONFIG_CRYPTO=m
+CONFIG_CRYPTO_AEAD2=m
+CONFIG_CRYPTO_AES=m
+CONFIG_CRYPTO_ALGAPI=m
+CONFIG_CRYPTO_ALGAPI2=m
+CONFIG_CRYPTO_ARC4=m
+CONFIG_CRYPTO_BLKCIPHER=m
+CONFIG_CRYPTO_BLKCIPHER2=m
+CONFIG_CRYPTO_ECB=m
+CONFIG_CRYPTO_HASH=m
+CONFIG_CRYPTO_HASH2=m
+CONFIG_CRYPTO_MANAGER=m
+CONFIG_CRYPTO_MANAGER2=m
+CONFIG_CRYPTO_MICHAEL_MIC=m
+CONFIG_CRYPTO_PCOMP2=m
+CONFIG_CRYPTO_RNG2=m
+CONFIG_CRYPTO_WORKQUEUE=m
+CONFIG_CSRC_R4K=y
+CONFIG_CSRC_R4K_LIB=y
+CONFIG_DECOMPRESS_LZMA=y
+CONFIG_DMA_NONCOHERENT=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_GENERIC_ATOMIC64=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+# CONFIG_GENERIC_CPU_DEVICES is not set
+CONFIG_GENERIC_GPIO=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GPIOLIB=y
+# CONFIG_GPIO_PL061 is not set
+CONFIG_GPIO_SYSFS=y
+CONFIG_HARDWARE_WATCHPOINTS=y
+CONFIG_HAS_DMA=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+CONFIG_HAVE_IDE=y
+CONFIG_HAVE_IRQ_WORK=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_HID=m
+CONFIG_HID_SUPPORT=y
+CONFIG_HOSTAP=m
+CONFIG_HOSTAP_FIRMWARE=y
+# CONFIG_HOSTAP_FIRMWARE_NVRAM is not set
+CONFIG_HOSTAP_PCI=m
+CONFIG_HW_HAS_PCI=y
+CONFIG_HW_RANDOM=y
+CONFIG_HZ=250
+# CONFIG_HZ_100 is not set
+CONFIG_HZ_250=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_IMAGE_CMDLINE_HACK=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_INPUT=m
+# CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set
+CONFIG_IRQ_CPU=y
+CONFIG_IRQ_FORCED_THREADING=y
+# CONFIG_LEDS_GPIO is not set
+# CONFIG_LEDS_TRIGGER_ADM5120_SWITCH is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+CONFIG_LIB80211=m
+CONFIG_LIB80211_CRYPT_CCMP=m
+CONFIG_LIB80211_CRYPT_TKIP=m
+CONFIG_LIB80211_CRYPT_WEP=m
+CONFIG_MII=m
+# CONFIG_MINIX_FS_NATIVE_ENDIAN is not set
+CONFIG_MIPS=y
+CONFIG_MIPS_L1_CACHE_SHIFT=5
+CONFIG_MIPS_MACHINE=y
+CONFIG_MIPS_MT_DISABLED=y
+# CONFIG_MLX4_CORE is not set
+CONFIG_MTD_ADM5120=y
+CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC=y
+# CONFIG_MTD_CFI_INTELEXT is not set
+CONFIG_MTD_CMDLINE_PARTS=y
+CONFIG_MTD_JEDECPROBE=y
+CONFIG_MTD_TRXSPLIT=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_NEED_PER_CPU_KM=y
+CONFIG_NLS=m
+CONFIG_NO_EXCEPT_FILL=y
+CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
+CONFIG_NO_HZ=y
+CONFIG_PAGEFLAGS_EXTENDED=y
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_PCI=y
+CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PERF_USE_VMALLOC=y
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_QUOTACTL is not set
+CONFIG_SCSI=m
+CONFIG_SCSI_MOD=m
+# CONFIG_SERIAL_8250 is not set
+CONFIG_SERIAL_AMBA_PL010=y
+CONFIG_SERIAL_AMBA_PL010_CONSOLE=y
+CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2
+CONFIG_SERIAL_AMBA_PL010_PORTNAME="ttyS"
+# CONFIG_SERIAL_AMBA_PL011 is not set
+CONFIG_SERIO=y
+# CONFIG_SERIO_AMBAKMI is not set
+# CONFIG_SERIO_I8042 is not set
+# CONFIG_SERIO_LIBPS2 is not set
+# CONFIG_SERIO_PCIPS2 is not set
+# CONFIG_SERIO_RAW is not set
+CONFIG_SERIO_SERPORT=y
+CONFIG_SOFT_WATCHDOG=m
+# CONFIG_SWAP is not set
+CONFIG_SWAP_IO_SPACE=y
+CONFIG_SYS_HAS_CPU_MIPS32_R1=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
+CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
+CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
+CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
+CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
+CONFIG_USB=m
+CONFIG_USB_ADM5120_HCD=m
+CONFIG_USB_ARCH_HAS_XHCI=y
+CONFIG_USB_COMMON=m
+CONFIG_USB_EHCI_HCD=m
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_HCD=m
+CONFIG_USB_SUPPORT=y
+# CONFIG_USB_UHCI_HCD is not set
+CONFIG_XZ_DEC=y
+CONFIG_ZONE_DMA_FLAG=0
diff --git a/target/linux/adm5120/router_le/config-3.3 b/target/linux/adm5120/router_le/config-3.3
new file mode 100644
index 0000000..59696e8
--- /dev/null
+++ b/target/linux/adm5120/router_le/config-3.3
@@ -0,0 +1,227 @@
+CONFIG_ADM5120=y
+CONFIG_ADM5120_ENET=y
+CONFIG_ADM5120_MACH_5GXI=y
+CONFIG_ADM5120_MACH_BR_6104K=y
+CONFIG_ADM5120_MACH_BR_6104KP=y
+CONFIG_ADM5120_MACH_BR_61X4WG=y
+CONFIG_ADM5120_MACH_CAS_771=y
+CONFIG_ADM5120_MACH_EASY5120P_ATA=y
+CONFIG_ADM5120_MACH_EASY5120_RT=y
+CONFIG_ADM5120_MACH_EASY5120_WVOIP=y
+CONFIG_ADM5120_MACH_EASY83000=y
+CONFIG_ADM5120_MACH_EB_214A=y
+CONFIG_ADM5120_MACH_NFS_101=y
+CONFIG_ADM5120_MACH_NP27G=y
+CONFIG_ADM5120_MACH_NP28G=y
+CONFIG_ADM5120_MACH_PMUGW=y
+CONFIG_ADM5120_MACH_RB_11X=y
+CONFIG_ADM5120_MACH_RB_133=y
+CONFIG_ADM5120_MACH_RB_133C=y
+CONFIG_ADM5120_MACH_RB_150=y
+CONFIG_ADM5120_MACH_RB_153=y
+CONFIG_ADM5120_MACH_RB_192=y
+CONFIG_ADM5120_MACH_WP54=y
+CONFIG_ADM5120_OEM_CELLVISION=y
+CONFIG_ADM5120_OEM_COMPEX=y
+CONFIG_ADM5120_OEM_EDIMAX=y
+CONFIG_ADM5120_OEM_GENERIC=y
+CONFIG_ADM5120_OEM_INFINEON=y
+CONFIG_ADM5120_OEM_MIKROTIK=y
+CONFIG_ADM5120_OEM_MOTOROLA=y
+CONFIG_ADM5120_OEM_OSBRIDGE=y
+# CONFIG_ADM5120_OEM_ZYXEL is not set
+CONFIG_ADM5120_SOC_BGA=y
+CONFIG_ADM5120_WDT=y
+CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+CONFIG_ARCH_DISCARD_MEMBLOCK=y
+# CONFIG_ARCH_DMA_ADDR_T_64BIT is not set
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM_AMBA=y
+# CONFIG_ARM_SP805_WATCHDOG is not set
+CONFIG_ATA=m
+CONFIG_BCMA_POSSIBLE=y
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_CEVT_R4K=y
+CONFIG_CEVT_R4K_LIB=y
+CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,yaffs2,jffs2"
+CONFIG_CMDLINE_BOOL=y
+# CONFIG_CMDLINE_OVERRIDE is not set
+# CONFIG_CPU_BIG_ENDIAN is not set
+CONFIG_CPU_HAS_PREFETCH=y
+CONFIG_CPU_HAS_SYNC=y
+CONFIG_CPU_LITTLE_ENDIAN=y
+CONFIG_CPU_MIPS32=y
+CONFIG_CPU_MIPS32_R1=y
+CONFIG_CPU_MIPSR1=y
+CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_CPU_SUPPORTS_HIGHMEM=y
+CONFIG_CRYPTO=m
+CONFIG_CRYPTO_AEAD2=m
+CONFIG_CRYPTO_AES=m
+CONFIG_CRYPTO_ALGAPI=m
+CONFIG_CRYPTO_ALGAPI2=m
+CONFIG_CRYPTO_ARC4=m
+CONFIG_CRYPTO_BLKCIPHER=m
+CONFIG_CRYPTO_BLKCIPHER2=m
+CONFIG_CRYPTO_ECB=m
+CONFIG_CRYPTO_HASH=m
+CONFIG_CRYPTO_HASH2=m
+CONFIG_CRYPTO_MANAGER=m
+CONFIG_CRYPTO_MANAGER2=m
+CONFIG_CRYPTO_MICHAEL_MIC=m
+CONFIG_CRYPTO_PCOMP2=m
+CONFIG_CRYPTO_RNG2=m
+CONFIG_CRYPTO_WORKQUEUE=m
+CONFIG_CSRC_R4K=y
+CONFIG_CSRC_R4K_LIB=y
+CONFIG_DECOMPRESS_LZMA=y
+CONFIG_DMA_NONCOHERENT=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_GENERIC_ATOMIC64=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+# CONFIG_GENERIC_CPU_DEVICES is not set
+CONFIG_GENERIC_GPIO=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GPIOLIB=y
+# CONFIG_GPIO_PL061 is not set
+CONFIG_GPIO_SYSFS=y
+CONFIG_HARDWARE_WATCHPOINTS=y
+CONFIG_HAS_DMA=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+CONFIG_HAVE_IDE=y
+CONFIG_HAVE_IRQ_WORK=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_HID=m
+CONFIG_HID_SUPPORT=y
+CONFIG_HOSTAP=m
+CONFIG_HOSTAP_FIRMWARE=y
+# CONFIG_HOSTAP_FIRMWARE_NVRAM is not set
+CONFIG_HOSTAP_PCI=m
+CONFIG_HW_HAS_PCI=y
+CONFIG_HW_RANDOM=y
+CONFIG_HZ=250
+# CONFIG_HZ_100 is not set
+CONFIG_HZ_250=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_IMAGE_CMDLINE_HACK=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_INPUT=m
+# CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set
+CONFIG_IRQ_CPU=y
+CONFIG_IRQ_FORCED_THREADING=y
+# CONFIG_LEDS_GPIO is not set
+# CONFIG_LEDS_TRIGGER_ADM5120_SWITCH is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+CONFIG_LIB80211=m
+CONFIG_LIB80211_CRYPT_CCMP=m
+CONFIG_LIB80211_CRYPT_TKIP=m
+CONFIG_LIB80211_CRYPT_WEP=m
+CONFIG_MII=m
+# CONFIG_MINIX_FS_NATIVE_ENDIAN is not set
+CONFIG_MIPS=y
+CONFIG_MIPS_L1_CACHE_SHIFT=5
+CONFIG_MIPS_MACHINE=y
+CONFIG_MIPS_MT_DISABLED=y
+# CONFIG_MLX4_CORE is not set
+CONFIG_MTD_ADM5120=y
+CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC=y
+# CONFIG_MTD_CFI_INTELEXT is not set
+CONFIG_MTD_CMDLINE_PARTS=y
+CONFIG_MTD_JEDECPROBE=y
+CONFIG_MTD_MYLOADER_PARTS=y
+CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_ECC=y
+CONFIG_MTD_NAND_PLATFORM=y
+# CONFIG_MTD_SM_COMMON is not set
+CONFIG_MTD_TRXSPLIT=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_NEED_PER_CPU_KM=y
+CONFIG_NLS=m
+CONFIG_NO_EXCEPT_FILL=y
+CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
+CONFIG_NO_HZ=y
+CONFIG_PAGEFLAGS_EXTENDED=y
+# CONFIG_PARTITION_ADVANCED is not set
+# CONFIG_PATA_RB153_CF is not set
+CONFIG_PCI=y
+CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PERF_USE_VMALLOC=y
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_QUOTACTL is not set
+CONFIG_SCSI=m
+CONFIG_SCSI_MOD=m
+# CONFIG_SERIAL_8250 is not set
+CONFIG_SERIAL_AMBA_PL010=y
+CONFIG_SERIAL_AMBA_PL010_CONSOLE=y
+CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2
+CONFIG_SERIAL_AMBA_PL010_PORTNAME="ttyS"
+# CONFIG_SERIAL_AMBA_PL011 is not set
+CONFIG_SERIO=y
+# CONFIG_SERIO_AMBAKMI is not set
+# CONFIG_SERIO_I8042 is not set
+# CONFIG_SERIO_LIBPS2 is not set
+# CONFIG_SERIO_PCIPS2 is not set
+# CONFIG_SERIO_RAW is not set
+CONFIG_SERIO_SERPORT=y
+CONFIG_SOFT_WATCHDOG=m
+# CONFIG_SWAP is not set
+CONFIG_SYS_HAS_CPU_MIPS32_R1=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
+CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
+CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
+CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
+CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
+CONFIG_USB=m
+CONFIG_USB_ADM5120_HCD=m
+CONFIG_USB_ARCH_HAS_XHCI=y
+CONFIG_USB_COMMON=m
+CONFIG_USB_EHCI_HCD=m
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_HCD=m
+CONFIG_USB_SUPPORT=y
+# CONFIG_USB_UHCI_HCD is not set
+CONFIG_XZ_DEC=y
+CONFIG_YAFFS_9BYTE_TAGS=y
+# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
+CONFIG_YAFFS_AUTO_YAFFS2=y
+# CONFIG_YAFFS_DISABLE_BACKGROUND is not set
+# CONFIG_YAFFS_DISABLE_BLOCK_REFRESHING is not set
+CONFIG_YAFFS_DISABLE_TAGS_ECC=y
+# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
+# CONFIG_YAFFS_EMPTY_LOST_AND_FOUND is not set
+CONFIG_YAFFS_FS=y
+CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
+CONFIG_YAFFS_XATTR=y
+CONFIG_YAFFS_YAFFS1=y
+CONFIG_YAFFS_YAFFS2=y
+CONFIG_ZONE_DMA_FLAG=0