From abd74f86b459f4ac684de4a0f1bf6552d14b105a Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 13 May 2012 15:10:40 +0000
Subject: [PATCH] amazon: update amazon target to kernel 3.3

This is just compile tested, my device is currently not working.

SVN-Revision: 31706
---
 target/linux/amazon/Makefile                  |  2 +-
 .../amazon/{config-2.6.37 => config-3.3}      | 32 ++++++++--------
 .../amazon/files/arch/mips/amazon/interrupt.c | 37 ++++++++-----------
 .../amazon/files/drivers/mtd/maps/amazon.c    |  4 +-
 .../files/drivers/net/{ => ethernet}/admmod.c |  1 -
 .../drivers/net/{ => ethernet}/amazon_sw.c    |  2 +-
 .../drivers/{ => tty}/serial/amazon_asc.c     |  0
 .../files/drivers/watchdog/amazon_wdt.c       |  2 +-
 .../patches-2.6.37/140-net_drivers.patch      |  9 -----
 .../patches-2.6.37/150-serial_driver.patch    | 10 -----
 .../000-mips-bad-intctl.patch                 |  4 +-
 .../010-mips_clocksource_init_war.patch       |  0
 .../017-wdt-driver.patch                      |  4 +-
 .../100-board.patch                           | 10 ++---
 .../130-mtd_drivers.patch                     |  6 +--
 .../amazon/patches-3.3/140-net_drivers.patch  |  9 +++++
 .../patches-3.3/150-serial_driver.patch       |  7 ++++
 .../160-cfi-swap.patch                        | 10 ++---
 18 files changed, 71 insertions(+), 78 deletions(-)
 rename target/linux/amazon/{config-2.6.37 => config-3.3} (84%)
 rename target/linux/amazon/files/drivers/net/{ => ethernet}/admmod.c (99%)
 rename target/linux/amazon/files/drivers/net/{ => ethernet}/amazon_sw.c (99%)
 rename target/linux/amazon/files/drivers/{ => tty}/serial/amazon_asc.c (100%)
 delete mode 100644 target/linux/amazon/patches-2.6.37/140-net_drivers.patch
 delete mode 100644 target/linux/amazon/patches-2.6.37/150-serial_driver.patch
 rename target/linux/amazon/{patches-2.6.37 => patches-3.3}/000-mips-bad-intctl.patch (88%)
 rename target/linux/amazon/{patches-2.6.37 => patches-3.3}/010-mips_clocksource_init_war.patch (100%)
 rename target/linux/amazon/{patches-2.6.37 => patches-3.3}/017-wdt-driver.patch (69%)
 rename target/linux/amazon/{patches-2.6.37 => patches-3.3}/100-board.patch (85%)
 rename target/linux/amazon/{patches-2.6.37 => patches-3.3}/130-mtd_drivers.patch (50%)
 create mode 100644 target/linux/amazon/patches-3.3/140-net_drivers.patch
 create mode 100644 target/linux/amazon/patches-3.3/150-serial_driver.patch
 rename target/linux/amazon/{patches-2.6.37 => patches-3.3}/160-cfi-swap.patch (77%)

diff --git a/target/linux/amazon/Makefile b/target/linux/amazon/Makefile
index e90fc4c8bd..bfab52e506 100644
--- a/target/linux/amazon/Makefile
+++ b/target/linux/amazon/Makefile
@@ -10,7 +10,7 @@ ARCH:=mips
 BOARD:=amazon
 BOARDNAME:=Infineon Amazon
 FEATURES:=squashfs jffs2 broken
-LINUX_VERSION:=2.6.37.6
+LINUX_VERSION:=3.3.5
 
 include $(INCLUDE_DIR)/target.mk
 
diff --git a/target/linux/amazon/config-2.6.37 b/target/linux/amazon/config-3.3
similarity index 84%
rename from target/linux/amazon/config-2.6.37
rename to target/linux/amazon/config-3.3
index ca76524273..e34f87bdd5 100644
--- a/target/linux/amazon/config-2.6.37
+++ b/target/linux/amazon/config-3.3
@@ -5,15 +5,16 @@ CONFIG_AMAZON_MTD=y
 CONFIG_AMAZON_NET_SW=y
 CONFIG_AMAZON_PCI=y
 CONFIG_AMAZON_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_POPULATES_NODE_MAP=y
 # CONFIG_ARCH_SUPPORTS_MSI is not set
-CONFIG_ARCH_SUPPORTS_OPROFILE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
-# CONFIG_AUTO_IRQ_AFFINITY is not set
+CONFIG_BCMA_POSSIBLE=y
 CONFIG_CEVT_R4K=y
 CONFIG_CEVT_R4K_LIB=y
 CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 init=/bin/sh"
@@ -33,21 +34,18 @@ CONFIG_CSRC_R4K_LIB=y
 CONFIG_DECOMPRESS_LZMA=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_EARLY_PRINTK=y
-# CONFIG_FSNOTIFY is not set
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 CONFIG_GENERIC_CMOS_UPDATE=y
-CONFIG_GENERIC_FIND_LAST_BIT=y
-CONFIG_GENERIC_FIND_NEXT_BIT=y
-# CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED is not set
-CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
-# CONFIG_GENERIC_PENDING_IRQ is not set
-# CONFIG_HARDIRQS_SW_RESEND is not set
+# CONFIG_GENERIC_CPU_DEVICES is not set
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_PCI_IOMAP=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
@@ -60,22 +58,24 @@ 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_HAVE_SPARSE_IRQ is not set
 CONFIG_HAVE_STD_PC_SERIAL_PORT=y
 CONFIG_HW_HAS_PCI=y
 CONFIG_HW_RANDOM=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IRQ_CPU=y
-# CONFIG_IRQ_PER_CPU is not set
+CONFIG_IRQ_FORCED_THREADING=y
 CONFIG_KALLSYMS=y
-CONFIG_LOONGSON_UART_BASE=y
-CONFIG_MACH_NO_WESTBRIDGE=y
+# CONFIG_MINIX_FS_NATIVE_ENDIAN is not set
 CONFIG_MIPS=y
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 # CONFIG_MIPS_MACHINE is not set
 CONFIG_MIPS_MT_DISABLED=y
+# CONFIG_MLX4_CORE is not set
 CONFIG_MTD_AMAZON_BUS_WIDTH_16=y
 # CONFIG_MTD_AMAZON_BUS_WIDTH_32 is not set
 # CONFIG_MTD_AMAZON_BUS_WIDTH_8 is not set
@@ -91,7 +91,7 @@ CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-3
 CONFIG_MTD_REDBOOT_PARTS=y
 CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEED_PER_CPU_KM=y
-# CONFIG_NET_PCI is not set
+CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_PCI=y
 CONFIG_PCI_DOMAINS=y
@@ -107,5 +107,7 @@ 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_USB_ARCH_HAS_XHCI=y
 CONFIG_USB_SUPPORT=y
+CONFIG_XZ_DEC=y
 CONFIG_ZONE_DMA_FLAG=0
diff --git a/target/linux/amazon/files/arch/mips/amazon/interrupt.c b/target/linux/amazon/files/arch/mips/amazon/interrupt.c
index e264ca7592..05ff1ee75a 100644
--- a/target/linux/amazon/files/arch/mips/amazon/interrupt.c
+++ b/target/linux/amazon/files/arch/mips/amazon/interrupt.c
@@ -34,10 +34,11 @@
 #include <asm/irq.h>
 #include <asm/time.h>
 
-static void amazon_disable_irq(unsigned int irq_nr)
+static void amazon_disable_irq(struct irq_data *d)
 {
 	int i;
 	u32 amazon_ier = AMAZON_ICU_IM0_IER;
+	unsigned int irq_nr = d->irq;
 
 	if (irq_nr <= INT_NUM_IM0_IRL11 && irq_nr >= INT_NUM_IM0_IRL0)
 		amazon_writel(amazon_readl(amazon_ier) & (~(AMAZON_DMA_H_MASK)), amazon_ier);
@@ -53,11 +54,12 @@ static void amazon_disable_irq(unsigned int irq_nr)
 	}	
 }
 
-static void amazon_mask_and_ack_irq(unsigned int irq_nr)
+static void amazon_mask_and_ack_irq(struct irq_data *d)
 {
 	int i;
 	u32 amazon_ier = AMAZON_ICU_IM0_IER;
 	u32 amazon_isr = AMAZON_ICU_IM0_ISR;
+	unsigned int irq_nr = d->irq;
 
 	if (irq_nr <= INT_NUM_IM0_IRL11 && irq_nr >= INT_NUM_IM0_IRL0){
 		amazon_writel(amazon_readl(amazon_ier) & (~(AMAZON_DMA_H_MASK)), amazon_ier);
@@ -77,10 +79,11 @@ static void amazon_mask_and_ack_irq(unsigned int irq_nr)
 	}
 }
 
-static void amazon_enable_irq(unsigned int irq_nr)
+static void amazon_enable_irq(struct irq_data *d)
 {
 	int i;
 	u32 amazon_ier = AMAZON_ICU_IM0_IER;
+	unsigned int irq_nr = d->irq;
 
 	if (irq_nr <= INT_NUM_IM0_IRL11 && irq_nr >= INT_NUM_IM0_IRL0)
 		amazon_writel(amazon_readl(amazon_ier) | AMAZON_DMA_H_MASK, amazon_ier);
@@ -96,29 +99,21 @@ static void amazon_enable_irq(unsigned int irq_nr)
 	}
 }
 
-static unsigned int amazon_startup_irq(unsigned int irq)
+static unsigned int amazon_startup_irq(struct irq_data *d)
 {
-	amazon_enable_irq(irq);
+	amazon_enable_irq(d);
 	return 0;
 }
 
-static void amazon_end_irq(unsigned int irq)
-{
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) {
-		amazon_enable_irq(irq);
-	}
-}
-
 static struct irq_chip amazon_irq_type = {
 	.name = "AMAZON",
-	.startup = amazon_startup_irq,
-	.enable = amazon_enable_irq,
-	.disable = amazon_disable_irq,
-	.unmask = amazon_enable_irq,
-	.ack = amazon_mask_and_ack_irq,
-	.mask = amazon_disable_irq,
-	.mask_ack = amazon_mask_and_ack_irq,
-	.end = amazon_end_irq
+	.irq_startup = amazon_startup_irq,
+	.irq_enable = amazon_enable_irq,
+	.irq_disable = amazon_disable_irq,
+	.irq_unmask = amazon_enable_irq,
+	.irq_ack = amazon_mask_and_ack_irq,
+	.irq_mask = amazon_disable_irq,
+	.irq_mask_ack = amazon_mask_and_ack_irq,
 };
 
 /* Cascaded interrupts from IM0-4 */
@@ -178,7 +173,7 @@ void __init arch_init_irq(void)
 	}
 
 	for (i = INT_NUM_IRQ0; i <= INT_NUM_IM4_IRL31; i++)
-		set_irq_chip_and_handler(i, &amazon_irq_type,
+		irq_set_chip_and_handler(i, &amazon_irq_type,
 			handle_level_irq);
 
 	set_c0_status(IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5);
diff --git a/target/linux/amazon/files/drivers/mtd/maps/amazon.c b/target/linux/amazon/files/drivers/mtd/maps/amazon.c
index 55bfe32372..568f7d828d 100644
--- a/target/linux/amazon/files/drivers/mtd/maps/amazon.c
+++ b/target/linux/amazon/files/drivers/mtd/maps/amazon.c
@@ -118,7 +118,7 @@ int find_uImage_size(unsigned long start_offset)
 	return temp + 0x40;
 }
 
-static int __init amazon_mtd_probe(struct platform_device *dev)
+static int amazon_mtd_probe(struct platform_device *dev)
 {
 	unsigned long uimage_size;
 	struct mtd_info *mymtd = NULL;
@@ -167,7 +167,7 @@ static int __init amazon_mtd_probe(struct platform_device *dev)
 		amazon_partitions[2].size = mymtd->size - amazon_partitions[2].offset - (2 * mymtd->erasesize);
 	}
 
-	add_mtd_partitions(mymtd, parts, 3);
+	mtd_device_register(mymtd, parts, 3);
 
 	printk(KERN_INFO "amazon_mtd: added %s flash with %dMB\n",
 		amazon_map.name, ((int)mymtd->size) >> 20);
diff --git a/target/linux/amazon/files/drivers/net/admmod.c b/target/linux/amazon/files/drivers/net/ethernet/admmod.c
similarity index 99%
rename from target/linux/amazon/files/drivers/net/admmod.c
rename to target/linux/amazon/files/drivers/net/ethernet/admmod.c
index 473a1f6387..a11ee1d393 100644
--- a/target/linux/amazon/files/drivers/net/admmod.c
+++ b/target/linux/amazon/files/drivers/net/ethernet/admmod.c
@@ -1245,7 +1245,6 @@ int adm_process_protocol_filter_request (unsigned int cmd, PPROTOCOLFILTER uPROT
 
 int adm_process_mac_table_request (unsigned int cmd, PMACENTRY mMACENTRY)
 {
-    unsigned int rtval;
     unsigned int val;		//6996i
     unsigned int control[6] ;	//6996i
     unsigned int status[6] ;	//6996i
diff --git a/target/linux/amazon/files/drivers/net/amazon_sw.c b/target/linux/amazon/files/drivers/net/ethernet/amazon_sw.c
similarity index 99%
rename from target/linux/amazon/files/drivers/net/amazon_sw.c
rename to target/linux/amazon/files/drivers/net/ethernet/amazon_sw.c
index 54a70622e4..d18b439cea 100644
--- a/target/linux/amazon/files/drivers/net/amazon_sw.c
+++ b/target/linux/amazon/files/drivers/net/ethernet/amazon_sw.c
@@ -98,7 +98,7 @@
 #define ETHERNET_PACKET_DMA_BUFFER_SIZE 1536
 
 /***************************************** Module Parameters *************************************/
-char mode[] = "bridge";
+static char mode[] = "bridge";
 module_param_array(mode, charp, NULL, 0);
 
 static int timeout = 1 * HZ;
diff --git a/target/linux/amazon/files/drivers/serial/amazon_asc.c b/target/linux/amazon/files/drivers/tty/serial/amazon_asc.c
similarity index 100%
rename from target/linux/amazon/files/drivers/serial/amazon_asc.c
rename to target/linux/amazon/files/drivers/tty/serial/amazon_asc.c
diff --git a/target/linux/amazon/files/drivers/watchdog/amazon_wdt.c b/target/linux/amazon/files/drivers/watchdog/amazon_wdt.c
index 89f1e2281c..b18296b794 100644
--- a/target/linux/amazon/files/drivers/watchdog/amazon_wdt.c
+++ b/target/linux/amazon/files/drivers/watchdog/amazon_wdt.c
@@ -215,7 +215,7 @@ static struct file_operations wdt_fops = {
 	release:	wdt_release,	
 };
 
-static int __init amazon_wdt_probe(struct platform_device *dev)
+static int amazon_wdt_probe(struct platform_device *dev)
 {
 	int result = result = register_chrdev(0, "watchdog", &wdt_fops);
    	
diff --git a/target/linux/amazon/patches-2.6.37/140-net_drivers.patch b/target/linux/amazon/patches-2.6.37/140-net_drivers.patch
deleted file mode 100644
index 49dc3c8138..0000000000
--- a/target/linux/amazon/patches-2.6.37/140-net_drivers.patch
+++ /dev/null
@@ -1,9 +0,0 @@
---- a/drivers/net/Makefile
-+++ b/drivers/net/Makefile
-@@ -302,3 +302,6 @@ obj-$(CONFIG_CAIF) += caif/
- obj-$(CONFIG_OCTEON_MGMT_ETHERNET) += octeon/
- obj-$(CONFIG_PCH_GBE) += pch_gbe/
- obj-$(CONFIG_TILE_NET) += tile/
-+
-+obj-$(CONFIG_AMAZON_NET_SW) += amazon_sw.o
-+obj-$(CONFIG_ADM6996_SUPPORT) += admmod.o
diff --git a/target/linux/amazon/patches-2.6.37/150-serial_driver.patch b/target/linux/amazon/patches-2.6.37/150-serial_driver.patch
deleted file mode 100644
index 8b7741c93b..0000000000
--- a/target/linux/amazon/patches-2.6.37/150-serial_driver.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/drivers/serial/Makefile
-+++ b/drivers/serial/Makefile
-@@ -3,6 +3,7 @@
- #
- 
- obj-$(CONFIG_SERIAL_CORE) += serial_core.o
-+obj-$(CONFIG_AMAZON_ASC_UART) += amazon_asc.o
- obj-$(CONFIG_SERIAL_21285) += 21285.o
- 
- # These Sparc drivers have to appear before others such as 8250
diff --git a/target/linux/amazon/patches-2.6.37/000-mips-bad-intctl.patch b/target/linux/amazon/patches-3.3/000-mips-bad-intctl.patch
similarity index 88%
rename from target/linux/amazon/patches-2.6.37/000-mips-bad-intctl.patch
rename to target/linux/amazon/patches-3.3/000-mips-bad-intctl.patch
index f89e078e70..0aa37780a8 100644
--- a/target/linux/amazon/patches-2.6.37/000-mips-bad-intctl.patch
+++ b/target/linux/amazon/patches-3.3/000-mips-bad-intctl.patch
@@ -1,6 +1,6 @@
 --- a/arch/mips/kernel/traps.c
 +++ b/arch/mips/kernel/traps.c
-@@ -1578,7 +1578,16 @@ void __cpuinit per_cpu_trap_init(void)
+@@ -1593,7 +1593,16 @@ void __cpuinit per_cpu_trap_init(void)
  	if (cpu_has_mips_r2) {
  		cp0_compare_irq_shift = CAUSEB_TI - CAUSEB_IP;
  		cp0_compare_irq = (read_c0_intctl() >> INTCTLB_IPTI) & 7;
@@ -19,7 +19,7 @@
  	} else {
 --- a/arch/mips/include/asm/irq.h
 +++ b/arch/mips/include/asm/irq.h
-@@ -138,9 +138,11 @@ extern void free_irqno(unsigned int irq)
+@@ -139,9 +139,11 @@ extern void free_irqno(unsigned int irq)
   * IE7.  Since R2 their number has to be read from the c0_intctl register.
   */
  #define CP0_LEGACY_COMPARE_IRQ 7
diff --git a/target/linux/amazon/patches-2.6.37/010-mips_clocksource_init_war.patch b/target/linux/amazon/patches-3.3/010-mips_clocksource_init_war.patch
similarity index 100%
rename from target/linux/amazon/patches-2.6.37/010-mips_clocksource_init_war.patch
rename to target/linux/amazon/patches-3.3/010-mips_clocksource_init_war.patch
diff --git a/target/linux/amazon/patches-2.6.37/017-wdt-driver.patch b/target/linux/amazon/patches-3.3/017-wdt-driver.patch
similarity index 69%
rename from target/linux/amazon/patches-2.6.37/017-wdt-driver.patch
rename to target/linux/amazon/patches-3.3/017-wdt-driver.patch
index 63da655f6e..005ee710ac 100644
--- a/target/linux/amazon/patches-2.6.37/017-wdt-driver.patch
+++ b/target/linux/amazon/patches-3.3/017-wdt-driver.patch
@@ -1,9 +1,9 @@
 --- a/drivers/watchdog/Makefile
 +++ b/drivers/watchdog/Makefile
-@@ -119,6 +119,7 @@ obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
- obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
+@@ -132,6 +132,7 @@ obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
  obj-$(CONFIG_OCTEON_WDT) += octeon-wdt.o
  octeon-wdt-y := octeon-wdt-main.o octeon-wdt-nmi.o
+ obj-$(CONFIG_LANTIQ_WDT) += lantiq_wdt.o
 +obj-$(CONFIG_AMAZON_WDT) += amazon_wdt.o
  
  # PARISC Architecture
diff --git a/target/linux/amazon/patches-2.6.37/100-board.patch b/target/linux/amazon/patches-3.3/100-board.patch
similarity index 85%
rename from target/linux/amazon/patches-2.6.37/100-board.patch
rename to target/linux/amazon/patches-3.3/100-board.patch
index 15f367feb6..b743052731 100644
--- a/target/linux/amazon/patches-2.6.37/100-board.patch
+++ b/target/linux/amazon/patches-3.3/100-board.patch
@@ -1,6 +1,6 @@
 --- a/arch/mips/Kconfig
 +++ b/arch/mips/Kconfig
-@@ -102,6 +102,22 @@ config BCM63XX
+@@ -120,6 +120,22 @@ config BCM63XX
  	help
  	 Support for BCM63XX based boards
  
@@ -23,17 +23,17 @@
  config MIPS_COBALT
  	bool "Cobalt Server"
  	select CEVT_R4K
-@@ -716,6 +732,7 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
+@@ -813,6 +829,7 @@ config NLM_XLP_BOARD
  
  endchoice
  
 +source "arch/mips/amazon/Kconfig"
  source "arch/mips/alchemy/Kconfig"
- source "arch/mips/bcm63xx/Kconfig"
- source "arch/mips/jazz/Kconfig"
+ source "arch/mips/ath79/Kconfig"
+ source "arch/mips/bcm47xx/Kconfig"
 --- a/arch/mips/Kbuild.platforms
 +++ b/arch/mips/Kbuild.platforms
-@@ -5,6 +5,7 @@ platforms += ar7
+@@ -6,6 +6,7 @@ platforms += ath79
  platforms += bcm47xx
  platforms += bcm63xx
  platforms += cavium-octeon
diff --git a/target/linux/amazon/patches-2.6.37/130-mtd_drivers.patch b/target/linux/amazon/patches-3.3/130-mtd_drivers.patch
similarity index 50%
rename from target/linux/amazon/patches-2.6.37/130-mtd_drivers.patch
rename to target/linux/amazon/patches-3.3/130-mtd_drivers.patch
index b13a8374ff..6ce28e3fdd 100644
--- a/target/linux/amazon/patches-2.6.37/130-mtd_drivers.patch
+++ b/target/linux/amazon/patches-3.3/130-mtd_drivers.patch
@@ -1,7 +1,7 @@
 --- a/drivers/mtd/maps/Makefile
 +++ b/drivers/mtd/maps/Makefile
-@@ -59,3 +59,4 @@ obj-$(CONFIG_MTD_RBTX4939)	+= rbtx4939-f
- obj-$(CONFIG_MTD_VMU)		+= vmu-flash.o
+@@ -57,3 +57,4 @@ obj-$(CONFIG_MTD_VMU)		+= vmu-flash.o
  obj-$(CONFIG_MTD_GPIO_ADDR)	+= gpio-addr-flash.o
- obj-$(CONFIG_MTD_BCM963XX)	+= bcm963xx-flash.o
+ obj-$(CONFIG_MTD_LATCH_ADDR)	+= latch-addr-flash.o
+ obj-$(CONFIG_MTD_LANTIQ)	+= lantiq-flash.o
 +obj-$(CONFIG_AMAZON_MTD)	+= amazon.o
diff --git a/target/linux/amazon/patches-3.3/140-net_drivers.patch b/target/linux/amazon/patches-3.3/140-net_drivers.patch
new file mode 100644
index 0000000000..9c840e67f9
--- /dev/null
+++ b/target/linux/amazon/patches-3.3/140-net_drivers.patch
@@ -0,0 +1,9 @@
+--- a/drivers/net/ethernet/Makefile
++++ b/drivers/net/ethernet/Makefile
+@@ -74,3 +74,6 @@ obj-$(CONFIG_NET_VENDOR_TUNDRA) += tundr
+ obj-$(CONFIG_NET_VENDOR_VIA) += via/
+ obj-$(CONFIG_NET_VENDOR_XILINX) += xilinx/
+ obj-$(CONFIG_NET_VENDOR_XIRCOM) += xircom/
++
++obj-$(CONFIG_AMAZON_NET_SW) += amazon_sw.o
++obj-$(CONFIG_ADM6996_SUPPORT) += admmod.o
diff --git a/target/linux/amazon/patches-3.3/150-serial_driver.patch b/target/linux/amazon/patches-3.3/150-serial_driver.patch
new file mode 100644
index 0000000000..c6e7f39bd4
--- /dev/null
+++ b/target/linux/amazon/patches-3.3/150-serial_driver.patch
@@ -0,0 +1,7 @@
+--- a/drivers/tty/serial/Makefile
++++ b/drivers/tty/serial/Makefile
+@@ -78,3 +78,4 @@ obj-$(CONFIG_SERIAL_LANTIQ)	+= lantiq.o
+ obj-$(CONFIG_SERIAL_XILINX_PS_UART) += xilinx_uartps.o
+ obj-$(CONFIG_SERIAL_SIRFSOC) += sirfsoc_uart.o
+ obj-$(CONFIG_SERIAL_AR933X)   += ar933x_uart.o
++obj-$(CONFIG_AMAZON_ASC_UART) += amazon_asc.o
diff --git a/target/linux/amazon/patches-2.6.37/160-cfi-swap.patch b/target/linux/amazon/patches-3.3/160-cfi-swap.patch
similarity index 77%
rename from target/linux/amazon/patches-2.6.37/160-cfi-swap.patch
rename to target/linux/amazon/patches-3.3/160-cfi-swap.patch
index 65ce6616d3..4a0009e432 100644
--- a/target/linux/amazon/patches-2.6.37/160-cfi-swap.patch
+++ b/target/linux/amazon/patches-3.3/160-cfi-swap.patch
@@ -1,6 +1,6 @@
 --- a/drivers/mtd/chips/cfi_cmdset_0002.c
 +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
-@@ -1166,6 +1166,9 @@ static int __xipram do_write_oneword(str
+@@ -1152,6 +1152,9 @@ static int __xipram do_write_oneword(str
  	int retry_cnt = 0;
  
  	adr += chip->start;
@@ -10,7 +10,7 @@
  
  	mutex_lock(&chip->mutex);
  	ret = get_chip(map, chip, adr, FL_WRITING);
-@@ -1433,7 +1436,11 @@ static int __xipram do_write_buffer(stru
+@@ -1420,7 +1423,11 @@ static int __xipram do_write_buffer(stru
  	z = 0;
  	while(z < words * map_bankwidth(map)) {
  		datum = map_word_load(map, buf);
@@ -22,7 +22,7 @@
  
  		z += map_bankwidth(map);
  		buf += map_bankwidth(map);
-@@ -1678,6 +1685,9 @@ static int __xipram do_erase_oneblock(st
+@@ -1665,6 +1672,9 @@ static int __xipram do_erase_oneblock(st
  	int ret = 0;
  
  	adr += chip->start;
@@ -32,7 +32,7 @@
  
  	mutex_lock(&chip->mutex);
  	ret = get_chip(map, chip, adr, FL_ERASING);
-@@ -1806,6 +1816,10 @@ static int do_atmel_lock(struct map_info
+@@ -1793,6 +1803,10 @@ static int do_atmel_lock(struct map_info
  	struct cfi_private *cfi = map->fldrv_priv;
  	int ret;
  
@@ -43,7 +43,7 @@
  	mutex_lock(&chip->mutex);
  	ret = get_chip(map, chip, adr + chip->start, FL_LOCKING);
  	if (ret)
-@@ -1842,6 +1856,10 @@ static int do_atmel_unlock(struct map_in
+@@ -1828,6 +1842,10 @@ static int do_atmel_unlock(struct map_in
  	struct cfi_private *cfi = map->fldrv_priv;
  	int ret;
  
-- 
2.30.2