From 39127ef8bfc4b94d499432a517ce7f8cdd63d3d5 Mon Sep 17 00:00:00 2001
From: Nicolas Thill <nico@openwrt.org>
Date: Fri, 27 Jul 2007 03:07:52 +0000
Subject: [PATCH] update ar7 to 2.6.22.1 (thanks to Matteo Croce for his great
 help)

SVN-Revision: 8189
---
 package/ar7-atm/patches/100-compile_fix.patch |   8 +-
 target/linux/ar7-2.6/Makefile                 |   2 +-
 target/linux/ar7-2.6/config/default           |  62 +-----
 .../ar7-2.6/files/arch/mips/ar7/memory.c      | 119 -----------
 .../ar7-2.6/files/arch/mips/ar7/platform.c    |   1 +
 .../linux/ar7-2.6/files/arch/mips/ar7/prom.c  | 185 ++++++++----------
 .../linux/ar7-2.6/files/arch/mips/ar7/setup.c |   3 +
 .../linux/ar7-2.6/files/drivers/net/cpmac.c   |   6 +-
 .../ar7-2.6/files/include/asm-mips/ar7/ar7.h  |   7 +-
 .../ar7-2.6/files/include/asm-mips/ar7/prom.h |   1 -
 .../patches-2.6.22/100-board_support.patch    |   4 +-
 .../ar7-2.6/patches/100-board_support.patch   | 106 ----------
 target/linux/ar7-2.6/patches/110-flash.patch  |  39 ----
 .../ar7-2.6/patches/120-gpio_chrdev.patch     |  30 ---
 target/linux/ar7-2.6/patches/130-leds.patch   |  27 ---
 .../linux/ar7-2.6/patches/140-watchdog.patch  |  27 ---
 .../ar7-2.6/patches/200-ethernet_driver.patch |  30 ---
 .../linux/ar7-2.6/patches/210-phy_fixed.patch |  94 ---------
 .../ar7-2.6/patches/500-serial_kludge.patch   |  52 -----
 target/linux/ar7-2.6/patches/900-git-fix.diff |  11 --
 20 files changed, 108 insertions(+), 706 deletions(-)
 delete mode 100644 target/linux/ar7-2.6/patches/100-board_support.patch
 delete mode 100644 target/linux/ar7-2.6/patches/110-flash.patch
 delete mode 100644 target/linux/ar7-2.6/patches/120-gpio_chrdev.patch
 delete mode 100644 target/linux/ar7-2.6/patches/130-leds.patch
 delete mode 100644 target/linux/ar7-2.6/patches/140-watchdog.patch
 delete mode 100644 target/linux/ar7-2.6/patches/200-ethernet_driver.patch
 delete mode 100644 target/linux/ar7-2.6/patches/210-phy_fixed.patch
 delete mode 100644 target/linux/ar7-2.6/patches/500-serial_kludge.patch
 delete mode 100644 target/linux/ar7-2.6/patches/900-git-fix.diff

diff --git a/package/ar7-atm/patches/100-compile_fix.patch b/package/ar7-atm/patches/100-compile_fix.patch
index bd081c48e7..2abd433ae2 100644
--- a/package/ar7-atm/patches/100-compile_fix.patch
+++ b/package/ar7-atm/patches/100-compile_fix.patch
@@ -344,17 +344,13 @@ diff -urN sangam_atm-07.01.00.10/tn7atm.c sangam-atm-0.3/tn7atm.c
  
    dgprintf (1, "Leave tn7atm_close\n");
  }
-@@ -1518,8 +1467,11 @@
+@@ -1518,8 +1467,7 @@
                                   * firewall is on */
  
    dgprintf (3, "pushing the skb...\n");
 -
 -  skb->stamp = vcc->timestamp = xtime;
-+  {
-+    struct timeval tv;
-+    do_gettimeofday(&tv);
-+    skb_set_timestamp(skb, &tv);
-+  }
++  __net_timestamp(skb);
  
    xdump ((unsigned char *) skb->data, skb->len, 5);
  
diff --git a/target/linux/ar7-2.6/Makefile b/target/linux/ar7-2.6/Makefile
index e6056b2f93..2dd8c82a8b 100644
--- a/target/linux/ar7-2.6/Makefile
+++ b/target/linux/ar7-2.6/Makefile
@@ -11,7 +11,7 @@ BOARD:=ar7
 BOARDNAME:=TI AR7
 FEATURES:=squashfs jffs2 atm
 
-LINUX_VERSION:=2.6.21.5
+LINUX_VERSION:=2.6.22.1
 
 define Target/Description
 	Build firmware images for TI AR7 based routers
diff --git a/target/linux/ar7-2.6/config/default b/target/linux/ar7-2.6/config/default
index f45cdeb346..ecfa805894 100644
--- a/target/linux/ar7-2.6/config/default
+++ b/target/linux/ar7-2.6/config/default
@@ -6,8 +6,9 @@ CONFIG_AR7_GPIO=y
 CONFIG_AR7_WDT=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
-CONFIG_ATM_DRIVERS=y
+# CONFIG_ARCH_SUPPORTS_MSI is not set
 # CONFIG_ATMEL is not set
+CONFIG_ATM_DRIVERS=y
 CONFIG_BASE_SMALL=0
 # CONFIG_BCM43XX is not set
 CONFIG_BITREVERSE=y
@@ -46,9 +47,11 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y
 # CONFIG_CPU_TX49XX is not set
 # CONFIG_CPU_VR41XX is not set
 # CONFIG_DDB5477 is not set
+CONFIG_DEVPORT=y
 # CONFIG_DM9000 is not set
 CONFIG_DMA_NEED_PCI_MAP_STATE=y
 CONFIG_DMA_NONCOHERENT=y
+CONFIG_EARLY_PRINTK=y
 CONFIG_FIXED_MII_100_FDX=y
 # CONFIG_FIXED_MII_10_FDX is not set
 CONFIG_FIXED_PHY=y
@@ -57,6 +60,7 @@ CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_GPIO=y
 # CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
 # CONFIG_GEN_RTC is not set
+CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 # CONFIG_HERMES is not set
@@ -80,35 +84,19 @@ CONFIG_LEDS_AR7=y
 # CONFIG_MACH_VR41XX is not set
 CONFIG_MIPS=y
 # CONFIG_MIPS_ATLAS is not set
-# CONFIG_MIPS_BOSPORUS is not set
 # CONFIG_MIPS_COBALT is not set
-# CONFIG_MIPS_DB1000 is not set
-# CONFIG_MIPS_DB1100 is not set
-# CONFIG_MIPS_DB1200 is not set
-# CONFIG_MIPS_DB1500 is not set
-# CONFIG_MIPS_DB1550 is not set
 # CONFIG_MIPS_EV64120 is not set
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 # CONFIG_MIPS_MALTA is not set
-# CONFIG_MIPS_MIRAGE is not set
-# CONFIG_MIPS_MTX1 is not set
 CONFIG_MIPS_MT_DISABLED=y
 # CONFIG_MIPS_MT_SMP is not set
 # CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_PB1000 is not set
-# CONFIG_MIPS_PB1100 is not set
-# CONFIG_MIPS_PB1200 is not set
-# CONFIG_MIPS_PB1500 is not set
-# CONFIG_MIPS_PB1550 is not set
 # CONFIG_MIPS_SEAD is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MIPS_VPE_LOADER is not set
-# CONFIG_MIPS_XXS1500 is not set
-# CONFIG_MOMENCO_JAGUAR_ATX is not set
 # CONFIG_MOMENCO_OCELOT is not set
 # CONFIG_MOMENCO_OCELOT_3 is not set
 # CONFIG_MOMENCO_OCELOT_C is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 CONFIG_MTD=y
 # CONFIG_MTD_ABSENT is not set
 CONFIG_MTD_AR7_PARTS=y
@@ -142,7 +130,6 @@ CONFIG_MTD_MAP_BANK_WIDTH_2=y
 CONFIG_MTD_MAP_BANK_WIDTH_4=y
 # CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
 # CONFIG_MTD_MTDRAM is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
 # CONFIG_MTD_ONENAND is not set
 CONFIG_MTD_PARTITIONS=y
 # CONFIG_MTD_PCI is not set
@@ -157,12 +144,10 @@ CONFIG_MTD_PHYSMAP_START=0x10000000
 # CONFIG_MTD_REDBOOT_PARTS is not set
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_SLRAM is not set
-CONFIG_NEED_MULTIPLE_NODES=y
+# CONFIG_NETDEV_1000 is not set
 # CONFIG_NET_PCI is not set
 CONFIG_NET_SCH_FIFO=y
 # CONFIG_NET_VENDOR_3COM is not set
-# CONFIG_NETDEV_1000 is not set
-CONFIG_NODES_SHIFT=6
 # CONFIG_PAGE_SIZE_16KB is not set
 CONFIG_PAGE_SIZE_4KB=y
 # CONFIG_PAGE_SIZE_64KB is not set
@@ -178,6 +163,7 @@ CONFIG_PHYLIB=y
 # CONFIG_RTC is not set
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_SCSI_WAIT_SCAN=m
 # CONFIG_SERIAL_8250_EXTENDED is not set
 CONFIG_SERIAL_8250_PCI=y
 # CONFIG_SGI_IP22 is not set
@@ -198,8 +184,10 @@ CONFIG_SERIAL_8250_PCI=y
 CONFIG_SWAP_IO_SPACE=y
 CONFIG_SYSVIPC_SYSCTL=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_KGDB=y
 CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
 # CONFIG_TOSHIBA_JMR3927 is not set
 # CONFIG_TOSHIBA_RBTX4927 is not set
@@ -207,34 +195,4 @@ CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
 CONFIG_TRAD_SIGNALS=y
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_USB is not set
-CONFIG_DEBUG_DEVRES=n
-CONFIG_DEBUG_DRIVER=n
-CONFIG_DEBUG_KERNEL=y
-CONFIG_DEBUG_KOBJECT=n
-CONFIG_DEBUG_LIST=n
-CONFIG_DEBUG_LOCKING_API_SELFTESTS=n
-CONFIG_DEBUG_LOCK_ALLOC=n
-CONFIG_DEBUG_MUTEXES=n
-CONFIG_DEBUG_RT_MUTEXES=n
-CONFIG_DEBUG_SHIRQ=n
-CONFIG_DEBUG_SLAB=n
-CONFIG_DEBUG_SPINLOCK=n
-CONFIG_DEBUG_SPINLOCK_SLEEP=n
-CONFIG_DEBUG_STACK_USAGE=n
-CONFIG_DEBUG_VM=n
-CONFIG_DETECT_SOFTLOCKUP=y
-CONFIG_EARLY_PRINTK=y
-CONFIG_FAULT_INJECTION=n
-CONFIG_FORCED_INLINING=y
-CONFIG_GDB_CONSOLE=y
-CONFIG_IP_DCCP_DEBUG=n
-CONFIG_KALLSYMS_ALL=n
-CONFIG_KGDB=y
-CONFIG_MIPS_UNCACHED=n
-CONFIG_PCI_DEBUG=n
-CONFIG_PROVE_LOCKING=n
-CONFIG_RCU_TORTURE_TEST=n
-CONFIG_RT_MUTEX_TESTER=n
-CONFIG_RUNTIME_DEBUG=n
-CONFIG_SCHEDSTATS=n
-CONFIG_TIMER_STATS=n
+# CONFIG_VGASTATE is not set
diff --git a/target/linux/ar7-2.6/files/arch/mips/ar7/memory.c b/target/linux/ar7-2.6/files/arch/mips/ar7/memory.c
index 8ff571ce27..99faf217b7 100644
--- a/target/linux/ar7-2.6/files/arch/mips/ar7/memory.c
+++ b/target/linux/ar7-2.6/files/arch/mips/ar7/memory.c
@@ -60,132 +60,13 @@ static int __init memsize(void)
 	return size;
 }
 
-#ifdef CONFIG_NEED_MULTIPLE_NODES
-static bootmem_data_t node_bootmem_data;
-pg_data_t __node_data[1] = {
-	{ 
-		.bdata = &node_bootmem_data 
-	},
-};
-EXPORT_SYMBOL(__node_data);
-
-unsigned long max_mapnr;
-struct page *mem_map;
-EXPORT_SYMBOL(max_mapnr);
-EXPORT_SYMBOL(mem_map);
-
-static unsigned long setup_zero_pages(void)
-{
-	unsigned int order = 3;
-	unsigned long size;
-	struct page *page;
-
-	empty_zero_page = __get_free_pages(GFP_KERNEL | __GFP_ZERO, order);
-	if (!empty_zero_page)
-		panic("Oh boy, that early out of memory?");
-
-	page = virt_to_page(empty_zero_page);
-	split_page(page, order);
-	while (page < virt_to_page(empty_zero_page + (PAGE_SIZE << order))) {
-		SetPageReserved(page);
-		page++;
-	}
-
-	size = PAGE_SIZE << order;
-	zero_page_mask = (size - 1) & PAGE_MASK;
-
-	return 1UL << order;
-}
-
-extern void pagetable_init(void);
-
-void __init paging_init(void)
-{
-	unsigned long zones_size[MAX_NR_ZONES] = { 0, };
-
-	pagetable_init();
-
-	zones_size[ZONE_DMA] = max_low_pfn - min_low_pfn;
-
-	free_area_init_node(0, NODE_DATA(0), zones_size, ARCH_PFN_OFFSET, NULL);
-}
-
-static struct kcore_list kcore_mem, kcore_vmalloc;
-
-void __init mem_init(void)
-{
-	unsigned long codesize, reservedpages, datasize, initsize;
-	unsigned long tmp, ram;
-	unsigned long kernel_start, kernel_end;
-
-	kernel_start = PFN_DOWN(CPHYSADDR((unsigned long)&_text));
-	kernel_end = PFN_UP(CPHYSADDR((unsigned long)&_end));
-	for (tmp = min_low_pfn + 1; tmp < kernel_start; tmp++) {
-		ClearPageReserved(pfn_to_page(tmp));
-		init_page_count(pfn_to_page(tmp));
-		free_page((unsigned long)__va(tmp << PAGE_SHIFT));
-	}
-
-	totalram_pages += free_all_bootmem();
-	totalram_pages -= setup_zero_pages();	/* Setup zeroed pages.  */
-
-	reservedpages = ram = 0;
-	for (tmp = min_low_pfn; tmp <= max_low_pfn; tmp++) {
-		ram++;
-		if (PageReserved(pfn_to_page(tmp)))
-			if ((tmp < kernel_start) || (tmp > kernel_end)) 
-				reservedpages++;
-	}
-	num_physpages = ram;
-
-	codesize =  (unsigned long) &_etext - (unsigned long) &_text;
-	datasize =  (unsigned long) &_edata - (unsigned long) &_etext;
-	initsize =  (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
-	kclist_add(&kcore_mem, __va(min_low_pfn), 
-		   (max_low_pfn - min_low_pfn) << PAGE_SHIFT);
-	kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
-		   VMALLOC_END - VMALLOC_START);
-
-	printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
-	       "%ldk reserved, %ldk data, %ldk init)\n",
-	       (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
-	       ram << (PAGE_SHIFT-10),
-	       codesize >> 10,
-	       reservedpages << (PAGE_SHIFT-10),
-	       datasize >> 10,
-	       initsize >> 10);
-}
-#endif
-
 void __init prom_meminit(void)
 {
 	unsigned long pages;
-#ifdef CONFIG_NEED_MULTIPLE_NODES
-	unsigned long kernel_start, kernel_end;
-	unsigned long free_pages;
-	unsigned long bootmap_size;
-#endif
 
 	pages = memsize() >> PAGE_SHIFT;
 	add_memory_region(ARCH_PFN_OFFSET << PAGE_SHIFT, pages <<
 			  PAGE_SHIFT, BOOT_MEM_RAM);
-
-#ifdef CONFIG_NEED_MULTIPLE_NODES
-	kernel_start = PFN_DOWN(CPHYSADDR((unsigned long)&_text));
-	kernel_end = PFN_UP(CPHYSADDR((unsigned long)&_end));
-	min_low_pfn = ARCH_PFN_OFFSET;
-	max_low_pfn = ARCH_PFN_OFFSET + pages;
-	max_mapnr = max_low_pfn;
-	free_pages = pages - (kernel_end - min_low_pfn);
-	bootmap_size = init_bootmem_node(NODE_DATA(0), kernel_end,
-					 ARCH_PFN_OFFSET, max_low_pfn);
-
-	free_bootmem(PFN_PHYS(kernel_end), free_pages << PAGE_SHIFT);
-	memory_present(0, min_low_pfn, max_low_pfn);
-	reserve_bootmem(PFN_PHYS(kernel_end), bootmap_size);
-	mem_map = NODE_DATA(0)->node_mem_map;
-#endif
 }
 
 void __init prom_free_prom_memory(void)
diff --git a/target/linux/ar7-2.6/files/arch/mips/ar7/platform.c b/target/linux/ar7-2.6/files/arch/mips/ar7/platform.c
index c61e20a6c1..b9f7d0e9f9 100644
--- a/target/linux/ar7-2.6/files/arch/mips/ar7/platform.c
+++ b/target/linux/ar7-2.6/files/arch/mips/ar7/platform.c
@@ -32,6 +32,7 @@
 #include <asm/io.h>
 #include <asm/ar7/ar7.h>
 #include <asm/ar7/gpio.h>
+#include <asm/ar7/prom.h>
 #include <asm/ar7/vlynq.h>
 
 struct plat_vlynq_data {
diff --git a/target/linux/ar7-2.6/files/arch/mips/ar7/prom.c b/target/linux/ar7-2.6/files/arch/mips/ar7/prom.c
index 08904dee71..28397427d0 100644
--- a/target/linux/ar7-2.6/files/arch/mips/ar7/prom.c
+++ b/target/linux/ar7-2.6/files/arch/mips/ar7/prom.c
@@ -33,6 +33,7 @@
 #include <asm/gdb-stub.h>
 
 #include <asm/ar7/ar7.h>
+#include <asm/ar7/prom.h>
 
 #define MAX_ENTRY 80
 
@@ -41,72 +42,6 @@ struct env_var {
 	char *value;
 };
 
-struct psp_chip_map {
-	u16 chip;
-	char *names[50];
-};
-
-/* I hate this. No. *I* *HATE* *THIS* */
-static __initdata struct psp_chip_map psp_chip_map[] = {
-	{
-		.chip = AR7_CHIP_7100,
-		.names = {
-			"dummy", "cpufrequency", "memsize",
-			"flashsize", "modetty0", "modetty1", "prompt",
-			"bootcfg", "maca", "macb", "usb_rndis_mac",
-			"macap", "my_ipaddress", "server_ipaddress",
-			"bline_maca", "bline_macb", "bline_rndis",
-			"bline_atm", "usb_pid", "usb_vid",
-			"usb_eppolli", "gateway_ipaddress",
-			"subnet_mask", "usb_serial", "usb_board_mac",
-			"remote_user", "remote_pass", "remote_dir",
-			"sysfrequency", "link_timeout", "mac_port",
-			"path", "hostname", "tftpcfg", "buildops",
-			"tftp_fo_fname", "tftp_fo_ports",
-			"console_state", "mipsfrequency", 
-		},
-	},
-	{
-		.chip = AR7_CHIP_7200,
-		.names = {
-			"dummy", "cpufrequency", "memsize",
-			"flashsize", "modetty0", "modetty1", "prompt",
-			"bootcfg", "maca", "macb", "usb_rndis_mac",
-			"macap", "my_ipaddress", "server_ipaddress",
-			"bline_maca", "bline_macb", "bline_rndis",
-			"bline_atm", "usb_pid", "usb_vid",
-			"usb_eppolli", "gateway_ipaddress",
-			"subnet_mask", "usb_serial", "usb_board_mac",
-			"remote_user", "remote_pass", "remote_dir",
-			"sysfrequency", "link_timeout", "mac_port",
-			"path", "hostname", "tftpcfg", "buildops",
-			"tftp_fo_fname", "tftp_fo_ports",
-			"console_state", "mipsfrequency", 
-		},
-	},
-	{
-		.chip = AR7_CHIP_7300,
-		.names = {
-			"dummy", "cpufrequency", "memsize",
-			"flashsize", "modetty0", "modetty1", "prompt",
-			"bootcfg", "maca", "macb", "usb_rndis_mac",
-			"macap", "my_ipaddress", "server_ipaddress",
-			"bline_maca", "bline_macb", "bline_rndis",
-			"bline_atm", "usb_pid", "usb_vid",
-			"usb_eppolli", "gateway_ipaddress",
-			"subnet_mask", "usb_serial", "usb_board_mac",
-			"remote_user", "remote_pass", "remote_dir",
-			"sysfrequency", "link_timeout", "mac_port",
-			"path", "hostname", "tftpcfg", "buildops",
-			"tftp_fo_fname", "tftp_fo_ports",
-			"console_state", "mipsfrequency", 
-		},
-	},
-	{
-		.chip = 0x0,
-	},
-};
-
 static struct env_var adam2_env[MAX_ENTRY] = { { 0, }, };
 
 char * prom_getenv(char *name)
@@ -155,15 +90,71 @@ struct psbl_rec {
 
 static __initdata char psp_env_version[] = "TIENV0.8";
 
-struct psp_env_var {
-	unsigned char num;
-	unsigned char ctrl;
-	unsigned short csum;
-	unsigned char len;
-	unsigned char data[11];
+struct psp_env_chunk {
+	u8 num;
+	u8 ctrl;
+	u16 csum;
+	u8 len;
+	char data[11];
+} __attribute__ ((packed));
+
+struct psp_var_map_entry {
+	u8 num;
+	char *value;
+};
+
+static struct psp_var_map_entry psp_var_map[] = {
+	{ 1, "cpufrequency" },
+	{ 2, "memsize" },
+	{ 3, "flashsize" },
+	{ 4, "modetty0" },
+	{ 5, "modetty1" },
+	{ 8, "maca" },
+	{ 9, "macb" },
+	{ 28, "sysfrequency" },
+	{ 38, "mipsfrequency" },
 };
 
-static char psp_env_data[2048] = { 0, };
+/*
+
+Well-known variable (num is looked up in table above for matching variable name)
+Example: cpufrequency=211968000
++----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
+| 01 |CTRL|CHECKSUM | 01 | _2 | _1 | _1 | _9 | _6 | _8 | _0 | _0 | _0 | \0 | FF |
++----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
+
+Name=Value pair in a single chunk
+Example: NAME=VALUE
++----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
+| 00 |CTRL|CHECKSUM | 01 | _N | _A | _M | _E | _0 | _V | _A | _L | _U | _E | \0 |
++----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
+
+Name=Value pair in 2 chunks (len is the number of chunks)
+Example: bootloaderVersion=1.3.7.15
++----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
+| 00 |CTRL|CHECKSUM | 02 | _b | _o | _o | _t | _l | _o | _a | _d | _e | _r | _V |
++----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
+| _e | _r | _s | _i | _o | _n | \0 | _1 | _. | _3 | _. | _7 | _. | _1 | _5 | \0 |
++----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ 
+
+Data is padded with 0xFF
+
+*/
+
+#define PSP_ENV_SIZE  4096
+
+static char psp_env_data[PSP_ENV_SIZE] = { 0, };
+
+static char * __init lookup_psp_var_map(u8 num)
+{
+	int i;
+
+	for (i = 0; i < sizeof(psp_var_map); i++)
+		if (psp_var_map[i].num == num)
+			return psp_var_map[i].value;
+	
+	return NULL;
+}
 
 static void __init add_adam2_var(char *name, char *value)
 {
@@ -180,41 +171,29 @@ static void __init add_adam2_var(char *name, char *value)
 	}
 }
 
-static int __init parse_psp_env(void *start)
+static int __init parse_psp_env(void *psp_env_base)
 {
-	int i, j;
-	u16 chip;
-	struct psp_chip_map *map;
-	char *src, *dest, *name, *value;
-	struct psp_env_var *vars = start;
-
-	chip = ar7_chip_id();
-	for (map = psp_chip_map; map->chip; map++)
-		if (map->chip == chip)
-			break;
+	int i, n;
+	char *name, *value;
+	struct psp_env_chunk *chunks = (struct psp_env_chunk *)psp_env_data;
 
-	if (!map->chip)
-		return -EINVAL;
+	memcpy_fromio(chunks, psp_env_base, PSP_ENV_SIZE);
 
 	i = 1;
-	j = 0;
-	dest = psp_env_data;
-	while (vars[i].num < 0xff) {
-		src = vars[i].data;
-		if (vars[i].num) {
-			strcpy(dest, map->names[vars[i].num]);
-			name = dest;
+	n = PSP_ENV_SIZE / sizeof(struct psp_env_chunk);
+	while (i < n) {
+		if ((chunks[i].num == 0xff) || ((i + chunks[i].len) > n))
+			break;
+		value = chunks[i].data;
+		if (chunks[i].num) {
+			name = lookup_psp_var_map(chunks[i].num);
 		} else {
-			strcpy(dest, src);
-			name = dest;
-			src += strlen(src) + 1;
-		}			
-		dest += strlen(dest) + 1;
-		strcpy(dest, src);
-		value = dest;
-		dest += strlen(dest) + 1;
-		add_adam2_var(name, value);
-		i += vars[i].len;
+			name = value;
+			value += strlen(name) + 1;
+		}
+		if (name)
+			add_adam2_var(name, value);
+		i += chunks[i].len;
 	}
 	return 0;
 }
diff --git a/target/linux/ar7-2.6/files/arch/mips/ar7/setup.c b/target/linux/ar7-2.6/files/arch/mips/ar7/setup.c
index 6c9c1bf7bd..4abc39f1df 100644
--- a/target/linux/ar7-2.6/files/arch/mips/ar7/setup.c
+++ b/target/linux/ar7-2.6/files/arch/mips/ar7/setup.c
@@ -116,6 +116,9 @@ void __init plat_mem_setup(void)
 	ioport_resource.end   = ~0;
 	iomem_resource.start  = 0;
 	iomem_resource.end    = ~0;
+
+	printk("%s, ID: 0x%04x, Revision: 0x%02x\n", get_system_type(), 
+		ar7_chip_id(), ar7_chip_rev());
 }
 
 console_initcall(ar7_init_console);
diff --git a/target/linux/ar7-2.6/files/drivers/net/cpmac.c b/target/linux/ar7-2.6/files/drivers/net/cpmac.c
index 1be7cb8ddd..7d46677080 100644
--- a/target/linux/ar7-2.6/files/drivers/net/cpmac.c
+++ b/target/linux/ar7-2.6/files/drivers/net/cpmac.c
@@ -1173,9 +1173,9 @@ int __devinit cpmac_init(void)
 #warning FIXME: unhardcode gpio&reset bits
 	ar7_gpio_disable(26);
 	ar7_gpio_disable(27);
-	ar7_device_reset(17);
-	ar7_device_reset(21);
-	ar7_device_reset(26);
+	ar7_device_reset(AR7_RESET_BIT_CPMAC_LO);
+	ar7_device_reset(AR7_RESET_BIT_CPMAC_HI);
+	ar7_device_reset(AR7_RESET_BIT_EPHY);
 
 	cpmac_mii.reset(&cpmac_mii);
 
diff --git a/target/linux/ar7-2.6/files/include/asm-mips/ar7/ar7.h b/target/linux/ar7-2.6/files/include/asm-mips/ar7/ar7.h
index 3e6a50c324..e8e32a0b83 100644
--- a/target/linux/ar7-2.6/files/include/asm-mips/ar7/ar7.h
+++ b/target/linux/ar7-2.6/files/include/asm-mips/ar7/ar7.h
@@ -53,7 +53,10 @@
 #define  AR7_RESET_SOFTWARE    0x4
 #define  AR7_RESET_STATUS      0x8
 
-#define AR7_RESET_BIT_MDIO   22
+#define AR7_RESET_BIT_CPMAC_LO 17
+#define AR7_RESET_BIT_CPMAC_HI 21
+#define AR7_RESET_BIT_MDIO     22
+#define AR7_RESET_BIT_EPHY     26
 
 /* GPIO control registers */
 #define  AR7_GPIO_INPUT  0x0
@@ -83,8 +86,6 @@ struct plat_dsl_data {
 	int reset_bit_sar;
 };
 
-extern char *prom_getenv(char *envname);
-
 extern int ar7_cpu_clock, ar7_bus_clock, ar7_dsp_clock;
 
 static inline u16 ar7_chip_id(void)
diff --git a/target/linux/ar7-2.6/files/include/asm-mips/ar7/prom.h b/target/linux/ar7-2.6/files/include/asm-mips/ar7/prom.h
index bb0b0c4d5b..10d6235102 100644
--- a/target/linux/ar7-2.6/files/include/asm-mips/ar7/prom.h
+++ b/target/linux/ar7-2.6/files/include/asm-mips/ar7/prom.h
@@ -21,7 +21,6 @@
 #ifndef __PROM_H__
 #define __PROM_H__
 
-extern void prom_init(void);
 extern char *prom_getenv(char *name);
 extern void prom_printf(char *fmt, ...);
 
diff --git a/target/linux/ar7-2.6/patches-2.6.22/100-board_support.patch b/target/linux/ar7-2.6/patches-2.6.22/100-board_support.patch
index 7d99e9be3f..0ab93b6caa 100644
--- a/target/linux/ar7-2.6/patches-2.6.22/100-board_support.patch
+++ b/target/linux/ar7-2.6/patches-2.6.22/100-board_support.patch
@@ -15,8 +15,8 @@ diff -urN linux-2.6.22/arch/mips/Kconfig linux-2.6.22.new/arch/mips/Kconfig
 +	select SYS_HAS_CPU_MIPS32_R1
 +	select SYS_HAS_EARLY_PRINTK
 +	select SYS_SUPPORTS_32BIT_KERNEL
++	select SYS_SUPPORTS_KGDB
 +	select SYS_SUPPORTS_LITTLE_ENDIAN
-+	select NEED_MULTIPLE_NODES
 +	select GENERIC_GPIO
 +	select ZONE_DMA
 +
@@ -24,7 +24,7 @@ diff -urN linux-2.6.22/arch/mips/Kconfig linux-2.6.22.new/arch/mips/Kconfig
  	bool "Alchemy processor based machines"
  
 diff -urN linux-2.6.22/arch/mips/kernel/setup.c linux-2.6.22.new/arch/mips/kernel/setup.c
---- linux-2.6.22/arch/mips/kernel/setup.c	2007-07-09 01:32:17.000000000 +0200
+-- linux-2.6.22/arch/mips/kernel/setup.c	2007-07-09 01:32:17.000000000 +0200
 +++ linux-2.6.22.new/arch/mips/kernel/setup.c	2007-07-11 02:32:39.000000000 +0200
 @@ -258,7 +258,7 @@
   * Initialize the bootmem allocator. It also setup initrd related data
diff --git a/target/linux/ar7-2.6/patches/100-board_support.patch b/target/linux/ar7-2.6/patches/100-board_support.patch
deleted file mode 100644
index 9702efa8ec..0000000000
--- a/target/linux/ar7-2.6/patches/100-board_support.patch
+++ /dev/null
@@ -1,106 +0,0 @@
-diff -Nru linux-2.6.19.2/arch/mips/Kconfig linux-ar7/arch/mips/Kconfig
---- linux-2.6.19.2/arch/mips/Kconfig	2006-12-12 02:32:53.000000000 +0700
-+++ linux-ar7/arch/mips/Kconfig	2007-01-29 21:52:21.000000000 +0700
-@@ -16,6 +16,21 @@
- 	prompt "System type"
- 	default SGI_IP22
- 
-+config AR7
-+	bool "Texas Instruments AR7"
-+	select BOOT_ELF32
-+	select DMA_NONCOHERENT
-+	select HW_HAS_PCI
-+	select IRQ_CPU
-+	select SWAP_IO_SPACE
-+	select SYS_HAS_CPU_MIPS32_R1
-+	select SYS_HAS_EARLY_PRINTK
-+	select SYS_SUPPORTS_32BIT_KERNEL
-+	select SYS_SUPPORTS_LITTLE_ENDIAN
-+	select SYS_SUPPORTS_KGDB
-+	select NEED_MULTIPLE_NODES
-+	select GENERIC_GPIO
-+
- config MIPS_MTX1
- 	bool "4G Systems MTX-1 board"
- 	select DMA_NONCOHERENT
-diff -Nru linux-2.6.19.2/arch/mips/Makefile linux-ar7/arch/mips/Makefile
---- linux-2.6.19.2/arch/mips/Makefile	2006-12-12 02:32:53.000000000 +0700
-+++ linux-ar7/arch/mips/Makefile	2007-01-29 21:52:21.000000000 +0700
-@@ -158,6 +158,13 @@
- #
- 
- #
-+# Texas Instruments AR7
-+#
-+core-$(CONFIG_AR7)		+= arch/mips/ar7/
-+cflags-$(CONFIG_AR7)		+= -Iinclude/asm-mips/ar7
-+load-$(CONFIG_AR7)		+= 0xffffffff94100000
-+
-+#
- # Acer PICA 61, Mips Magnum 4000 and Olivetti M700.
- #
- core-$(CONFIG_MACH_JAZZ)	+= arch/mips/jazz/
-diff -Nru linux-2.6.19.2/arch/mips/kernel/setup.c linux-ar7/arch/mips/kernel/setup.c
---- linux-2.6.19.2orig/arch/mips/kernel/setup.c	2006-12-12 02:32:53.000000000 +0700
-+++ linux-ar7/arch/mips/kernel/setup.c	2007-03-04 22:32:13.000000000 +0700
-@@ -236,7 +236,7 @@
-  * Initialize the bootmem allocator. It also setup initrd related data
-  * if needed.
-  */
--#ifdef CONFIG_SGI_IP27
-+#ifdef CONFIG_NEED_MULTIPLE_NODES
- 
- static void __init bootmem_init(void)
- {
-@@ -244,7 +244,7 @@
- 	finalize_initrd();
- }
- 
--#else  /* !CONFIG_SGI_IP27 */
-+#else  /* !CONFIG_NEED_MULTIPLE_NODES */
- 
- static void __init bootmem_init(void)
- {
-@@ -349,7 +349,7 @@
- 	finalize_initrd();
- }
- 
--#endif	/* CONFIG_SGI_IP27 */
-+#endif	/* CONFIG_NEED_MULTIPLE_NODES */
- 
- /*
-  * arch_mem_init - initialize memory managment subsystem
-diff -Nru linux-2.6.19.2/arch/mips/kernel/traps.c linux-ar7/arch/mips/kernel/traps.c
---- linux-2.6.19.2/arch/mips/kernel/traps.c	2007-01-11 02:10:37.000000000 +0700
-+++ linux-ar7/arch/mips/kernel/traps.c	2007-03-15 13:19:19.000000000 +0700
-@@ -1072,11 +1072,6 @@
- unsigned long exception_handlers[32];
- unsigned long vi_handlers[64];
- 
--/*
-- * As a side effect of the way this is implemented we're limited
-- * to interrupt handlers in the address range from
-- * KSEG0 <= x < KSEG0 + 256mb on the Nevada.  Oh well ...
-- */
- void *set_except_vector(int n, void *addr)
- {
- 	unsigned long handler = (unsigned long) addr;
-@@ -1084,9 +1079,15 @@
- 
- 	exception_handlers[n] = handler;
- 	if (n == 0 && cpu_has_divec) {
--		*(volatile u32 *)(ebase + 0x200) = 0x08000000 |
--		                                 (0x03ffffff & (handler >> 2));
--		flush_icache_range(ebase + 0x200, ebase + 0x204);
-+		/* lui k0, 0x0000 */
-+		*(volatile u32 *)(CAC_BASE+0x200) = 0x3c1a0000 | (handler >> 16);
-+		/* ori k0, 0x0000 */
-+		*(volatile u32 *)(CAC_BASE+0x204) = 0x375a0000 | (handler & 0xffff);
-+		/* jr k0 */
-+		*(volatile u32 *)(CAC_BASE+0x208) = 0x03400008;
-+		/* nop */
-+		*(volatile u32 *)(CAC_BASE+0x20C) = 0x00000000;
-+		flush_icache_range(CAC_BASE+0x200, CAC_BASE+0x210);
- 	}
- 	return (void *)old_handler;
- }
diff --git a/target/linux/ar7-2.6/patches/110-flash.patch b/target/linux/ar7-2.6/patches/110-flash.patch
deleted file mode 100644
index b104067540..0000000000
--- a/target/linux/ar7-2.6/patches/110-flash.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-diff -Nru linux-2.6.19.2/drivers/mtd/Kconfig linux-ar7/drivers/mtd/Kconfig
---- linux-2.6.19.2/drivers/mtd/Kconfig	2006-12-12 02:32:53.000000000 +0700
-+++ linux-ar7/drivers/mtd/Kconfig	2007-02-03 22:47:10.000000000 +0700
-@@ -152,6 +152,12 @@
- 	  for your particular device. It won't happen automatically. The
- 	  'armflash' map driver (CONFIG_MTD_ARMFLASH) does this, for example.
- 
-+config MTD_AR7_PARTS
-+	tristate "TI AR7 partitioning support"
-+	depends on MTD_PARTITIONS
-+	---help---
-+	  TI AR7 partitioning support
-+
- comment "User Modules And Translation Layers"
- 	depends on MTD
- 
-diff -Nru linux-2.6.19.2/drivers/mtd/Makefile linux-ar7/drivers/mtd/Makefile
---- linux-2.6.19.2/drivers/mtd/Makefile	2006-12-12 02:32:53.000000000 +0700
-+++ linux-ar7/drivers/mtd/Makefile	2007-02-03 22:02:27.000000000 +0700
-@@ -12,6 +12,7 @@
- obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
- obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
- obj-$(CONFIG_MTD_AFS_PARTS)	+= afs.o
-+obj-$(CONFIG_MTD_AR7_PARTS)	+= ar7part.o
- 
- # 'Users' - code which presents functionality to userspace.
- obj-$(CONFIG_MTD_CHAR)		+= mtdchar.o
-diff -Nru linux-2.6.19.2/drivers/mtd/maps/physmap.c linux-ar7/drivers/mtd/maps/physmap.c
---- linux-2.6.19.2/drivers/mtd/maps/physmap.c	2006-12-12 02:32:53.000000000 +0700
-+++ linux-ar7/drivers/mtd/maps/physmap.c	2007-02-03 21:57:11.000000000 +0700
-@@ -74,7 +74,7 @@
- 
- static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", "map_rom", NULL };
- #ifdef CONFIG_MTD_PARTITIONS
--static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL };
-+static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", "ar7part", NULL };
- #endif
- 
- static int physmap_flash_probe(struct platform_device *dev)
diff --git a/target/linux/ar7-2.6/patches/120-gpio_chrdev.patch b/target/linux/ar7-2.6/patches/120-gpio_chrdev.patch
deleted file mode 100644
index 41a8b8e02f..0000000000
--- a/target/linux/ar7-2.6/patches/120-gpio_chrdev.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-diff -ruN linux-2.6.19.2-orig/drivers/char/Kconfig linux-2.6.19.2-ar7/drivers/char/Kconfig
---- linux-2.6.19.2-orig/drivers/char/Kconfig	2007-01-10 20:10:37.000000000 +0100
-+++ linux-2.6.19.2-ar7/drivers/char/Kconfig	2007-02-19 01:22:23.000000000 +0100
-@@ -920,6 +920,15 @@
- 	  To compile this driver as a module, choose M here: the
- 	  module will be called mwave.
- 
-+config AR7_GPIO
-+	tristate "TI AR7 GPIO Support"
-+	depends on AR7
-+	help
-+	  Give userspace access to the GPIO pins on the Texas Instruments AR7 
-+	  processors.
-+
-+	  If compiled as a module, it will be called ar7_gpio.
-+
- config SCx200_GPIO
- 	tristate "NatSemi SCx200 GPIO Support"
- 	depends on SCx200
-diff -ruN linux-2.6.19.2-orig/drivers/char/Makefile linux-2.6.19.2-ar7/drivers/char/Makefile
---- linux-2.6.19.2-orig/drivers/char/Makefile	2007-01-10 20:10:37.000000000 +0100
-+++ linux-2.6.19.2-ar7/drivers/char/Makefile	2007-02-19 01:22:23.000000000 +0100
-@@ -83,6 +83,7 @@
- obj-$(CONFIG_PPDEV)		+= ppdev.o
- obj-$(CONFIG_NWBUTTON)		+= nwbutton.o
- obj-$(CONFIG_NWFLASH)		+= nwflash.o
-+obj-$(CONFIG_AR7_GPIO)		+= ar7_gpio.o
- obj-$(CONFIG_SCx200_GPIO)	+= scx200_gpio.o
- obj-$(CONFIG_PC8736x_GPIO)	+= pc8736x_gpio.o
- obj-$(CONFIG_NSC_GPIO)		+= nsc_gpio.o
diff --git a/target/linux/ar7-2.6/patches/130-leds.patch b/target/linux/ar7-2.6/patches/130-leds.patch
deleted file mode 100644
index 261b712196..0000000000
--- a/target/linux/ar7-2.6/patches/130-leds.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-diff -ruN linux-2.6.19.2-orig/drivers/leds/Kconfig linux-2.6.19.2-ar7/drivers/leds/Kconfig
---- linux-2.6.19.2-orig/drivers/leds/Kconfig	2007-01-10 20:10:37.000000000 +0100
-+++ linux-2.6.19.2-ar7/drivers/leds/Kconfig	2007-02-24 02:30:48.000000000 +0100
-@@ -19,6 +19,12 @@
- 
- comment "LED drivers"
- 
-+config LEDS_AR7
-+	tristate "LED Support for the TI AR7"
-+	depends LEDS_CLASS && AR7
-+	help
-+	  This option enables support for the LEDs on TI AR7.
-+
- config LEDS_CORGI
- 	tristate "LED Support for the Sharp SL-C7x0 series"
- 	depends LEDS_CLASS && PXA_SHARP_C7xx
-diff -ruN linux-2.6.19.2-orig/drivers/leds/Makefile linux-2.6.19.2-ar7/drivers/leds/Makefile
---- linux-2.6.19.2-orig/drivers/leds/Makefile	2007-01-10 20:10:37.000000000 +0100
-+++ linux-2.6.19.2-ar7/drivers/leds/Makefile	2007-02-24 02:29:44.000000000 +0100
-@@ -5,6 +5,7 @@
- obj-$(CONFIG_LEDS_TRIGGERS)		+= led-triggers.o
- 
- # LED Platform Drivers
-+obj-$(CONFIG_LEDS_AR7)			+= leds-ar7.o
- obj-$(CONFIG_LEDS_CORGI)		+= leds-corgi.o
- obj-$(CONFIG_LEDS_LOCOMO)		+= leds-locomo.o
- obj-$(CONFIG_LEDS_SPITZ)		+= leds-spitz.o
diff --git a/target/linux/ar7-2.6/patches/140-watchdog.patch b/target/linux/ar7-2.6/patches/140-watchdog.patch
deleted file mode 100644
index 163df40ba6..0000000000
--- a/target/linux/ar7-2.6/patches/140-watchdog.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-diff -ruN linux-2.6.19.2-orig/drivers/char/watchdog/Kconfig linux-2.6.19.2-ar7/drivers/char/watchdog/Kconfig
---- linux-2.6.19.2-orig/drivers/char/watchdog/Kconfig	2007-01-10 20:10:37.000000000 +0100
-+++ linux-2.6.19.2-ar7/drivers/char/watchdog/Kconfig	2007-02-26 12:49:29.000000000 +0100
-@@ -544,6 +544,12 @@
- 
- # MIPS Architecture
- 
-+config AR7_WDT
-+	tristate "TI AR7 Watchdog Timer"
-+	depends on WATCHDOG && AR7
-+	help
-+	  Hardware driver for the TI AR7 Watchdog Timer.
-+
- config INDYDOG
- 	tristate "Indy/I2 Hardware Watchdog"
- 	depends on WATCHDOG && SGI_IP22
-diff -ruN linux-2.6.19.2-orig/drivers/char/watchdog/Makefile linux-2.6.19.2-ar7/drivers/char/watchdog/Makefile
---- linux-2.6.19.2-orig/drivers/char/watchdog/Makefile	2007-01-10 20:10:37.000000000 +0100
-+++ linux-2.6.19.2-ar7/drivers/char/watchdog/Makefile	2007-02-26 12:46:36.000000000 +0100
-@@ -71,6 +71,7 @@
- obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o
- 
- # MIPS Architecture
-+obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
- obj-$(CONFIG_INDYDOG) += indydog.o
- 
- # S390 Architecture
diff --git a/target/linux/ar7-2.6/patches/200-ethernet_driver.patch b/target/linux/ar7-2.6/patches/200-ethernet_driver.patch
deleted file mode 100644
index ca603ad610..0000000000
--- a/target/linux/ar7-2.6/patches/200-ethernet_driver.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-diff -Nru linux-2.6.19.2/drivers/net/Kconfig linux-ar7/drivers/net/Kconfig
---- linux-2.6.19.2/drivers/net/Kconfig	2006-12-12 02:32:53.000000000 +0700
-+++ linux-ar7/drivers/net/Kconfig	2007-01-29 21:52:22.000000000 +0700
-@@ -1777,6 +1777,15 @@
- 	  workstations.
- 	  See <http://www.semiconductors.philips.com/pip/SAA9730_flyer_1>.
- 
-+config CPMAC
-+	tristate "TI AR7 CPMAC Ethernet support (EXPERIMENTAL)"
-+	depends on NET_ETHERNET && EXPERIMENTAL && AR7
-+	select PHYLIB
-+	select FIXED_PHY
-+	select FIXED_MII_100_FDX
-+	help
-+	  TI AR7 CPMAC Ethernet support
-+
- config NET_POCKET
- 	bool "Pocket and portable adapters"
- 	depends on NET_ETHERNET && PARPORT
-diff -Nru linux-2.6.19.2/drivers/net/Makefile linux-ar7/drivers/net/Makefile
---- linux-2.6.19.2/drivers/net/Makefile	2006-12-12 02:32:53.000000000 +0700
-+++ linux-ar7/drivers/net/Makefile	2007-01-29 21:52:22.000000000 +0700
-@@ -148,6 +148,7 @@
- obj-$(CONFIG_8139TOO) += 8139too.o
- obj-$(CONFIG_ZNET) += znet.o
- obj-$(CONFIG_LAN_SAA9730) += saa9730.o
-+obj-$(CONFIG_CPMAC) += cpmac.o
- obj-$(CONFIG_DEPCA) += depca.o
- obj-$(CONFIG_EWRK3) += ewrk3.o
- obj-$(CONFIG_ATP) += atp.o
diff --git a/target/linux/ar7-2.6/patches/210-phy_fixed.patch b/target/linux/ar7-2.6/patches/210-phy_fixed.patch
deleted file mode 100644
index 0ae2282c71..0000000000
--- a/target/linux/ar7-2.6/patches/210-phy_fixed.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-Index: linux-2.6.21.4/drivers/net/phy/fixed.c
-===================================================================
---- linux-2.6.21.4.orig/drivers/net/phy/fixed.c	2007-06-11 16:30:06.418483448 +0200
-+++ linux-2.6.21.4/drivers/net/phy/fixed.c	2007-06-11 16:30:11.156763120 +0200
-@@ -187,6 +187,19 @@
- 	.driver 	= { .owner = THIS_MODULE,},
- };
- 
-+static void fixed_mdio_release (struct device * dev)
-+{
-+	struct phy_device *phydev = container_of(dev, struct phy_device, dev);
-+	struct mii_bus *bus = phydev->bus;
-+	struct fixed_info *fixed = bus->priv;
-+
-+	kfree(phydev);
-+	kfree(bus->dev);
-+	kfree(bus);
-+	kfree(fixed->regs);
-+	kfree(fixed);
-+}
-+
- /*-----------------------------------------------------------------------------
-  *  This func is used to create all the necessary stuff, bind
-  * the fixed phy driver and register all it on the mdio_bus_type.
-@@ -221,6 +234,12 @@
- 	}
- 
- 	fixed->regs = kzalloc(MII_REGS_NUM*sizeof(int), GFP_KERNEL);
-+	if (NULL == fixed->regs) {
-+		kfree(dev);
-+		kfree(new_bus);
-+		kfree(fixed);
-+		return -ENOMEM;
-+	}
- 	fixed->regs_num = MII_REGS_NUM;
- 	fixed->phy_status.speed = speed;
- 	fixed->phy_status.duplex = duplex;
-@@ -249,8 +268,11 @@
- 	fixed->phydev = phydev;
- 
- 	if(NULL == phydev) {
--		err = -ENOMEM;
--		goto device_create_fail;
-+		kfree(dev);
-+		kfree(new_bus);
-+		kfree(fixed->regs);
-+		kfree(fixed);
-+		return -ENOMEM;
- 	}
- 
- 	phydev->irq = PHY_IGNORE_INTERRUPT;
-@@ -262,8 +284,34 @@
- 	else
- 		snprintf(phydev->dev.bus_id, BUS_ID_SIZE,
- 				"fixed@%d:%d", speed, duplex);
-+
- 	phydev->bus = new_bus;
- 
-+#if 1
-+	phydev->dev.driver = &fixed_mdio_driver.driver;
-+	phydev->dev.release = fixed_mdio_release;
-+
-+	err = phydev->dev.driver->probe(&phydev->dev);
-+	if(err < 0) {
-+		printk(KERN_ERR "Phy %s: problems with fixed driver\n",
-+			phydev->dev.bus_id);
-+		kfree(phydev);
-+		kfree(dev);
-+		kfree(new_bus);
-+		kfree(fixed->regs);
-+		kfree(fixed);
-+		return err;
-+	}
-+
-+	down_write(&phydev->dev.bus->subsys.rwsem);
-+	err = device_register(&phydev->dev);
-+	if(err) {
-+		printk(KERN_ERR "Phy %s failed to register\n",
-+				phydev->dev.bus_id);
-+	}
-+
-+	return 0;
-+#else
- 	err = device_register(&phydev->dev);
- 	if(err) {
- 		printk(KERN_ERR "Phy %s failed to register\n",
-@@ -306,6 +354,7 @@
- 	kfree(fixed);
- 
- 	return err;
-+#endif
- }
- 
- 
diff --git a/target/linux/ar7-2.6/patches/500-serial_kludge.patch b/target/linux/ar7-2.6/patches/500-serial_kludge.patch
deleted file mode 100644
index 959c5cfe4c..0000000000
--- a/target/linux/ar7-2.6/patches/500-serial_kludge.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-diff -Nru linux-2.6.19.2/include/linux/serialP.h linux-ar7/include/linux/serialP.h
---- linux-2.6.19.2/include/linux/serialP.h	2007-01-17 01:24:01.000000000 +0700
-+++ linux-ar7/include/linux/serialP.h	2007-03-22 22:36:48.000000000 +0700
-@@ -135,6 +135,9 @@
-  * the interrupt line _up_ instead of down, so if we register the IRQ
-  * while the UART is in that state, we die in an IRQ storm. */
- #define ALPHA_KLUDGE_MCR (UART_MCR_OUT2)
-+#elif defined(CONFIG_AR7)
-+/* This is how it is set up by bootloader... */
-+#define ALPHA_KLUDGE_MCR  (UART_MCR_OUT2 | UART_MCR_OUT1 | UART_MCR_RTS | UART_MCR_DTR)
- #else
- #define ALPHA_KLUDGE_MCR 0
- #endif
-diff -Nru linux-2.6.19.2/include/linux/serial_core.h linux-ar7/include/linux/serial_core.h
---- linux-2.6.19.2/include/linux/serial_core.h	2007-01-11 02:10:37.000000000 +0700
-+++ linux-ar7/include/linux/serial_core.h	2007-03-22 22:50:13.000000000 +0700
-@@ -39,7 +39,8 @@
- #define PORT_RSA	13
- #define PORT_NS16550A	14
- #define PORT_XSCALE	15
--#define PORT_MAX_8250	15	/* max port ID */
-+#define PORT_AR7	16
-+#define PORT_MAX_8250	16	/* max port ID */
- 
- /*
-  * ARM specific type numbers.  These are not currently guaranteed
-diff -Nru linux-2.6.19.2/drivers/serial/8250.c linux-ar7/drivers/serial/8250.c
---- linux-2.6.19.2/drivers/serial/8250.c	2007-01-11 02:10:37.000000000 +0700
-+++ linux-ar7/drivers/serial/8250.c	2007-03-22 22:45:17.000000000 +0700
-@@ -251,6 +251,13 @@
- 		.fcr		= UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
- 		.flags		= UART_CAP_FIFO | UART_CAP_UUE,
- 	},
-+	[PORT_AR7] = {
-+		.name		= "TI-AR7",
-+		.fifo_size	= 16,
-+		.tx_loadsz	= 16,
-+		.fcr		= UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00,
-+		.flags		= UART_CAP_FIFO | UART_CAP_AFE,
-+	},
- };
- 
- #ifdef CONFIG_SERIAL_8250_AU1X00
-@@ -2243,7 +2250,7 @@
- {
- 	struct uart_8250_port *up = (struct uart_8250_port *)port;
- 
--	wait_for_xmitr(up, UART_LSR_THRE);
-+	wait_for_xmitr(up, BOTH_EMPTY);
- 	serial_out(up, UART_TX, ch);
- }
- 
diff --git a/target/linux/ar7-2.6/patches/900-git-fix.diff b/target/linux/ar7-2.6/patches/900-git-fix.diff
deleted file mode 100644
index 2c5323a9d5..0000000000
--- a/target/linux/ar7-2.6/patches/900-git-fix.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- linux-2.6.19.orig/scripts/setlocalversion	2006-11-30 04:57:37.000000000 +0700
-+++ linux-2.6.19/scripts/setlocalversion	2006-12-25 12:50:53.000000000 +0700
-@@ -1,6 +1,8 @@
- #!/bin/sh
- # Print additional version information for non-release trees.
- 
-+exit 0
-+
- usage() {
- 	echo "Usage: $0 [srctree]" >&2
- 	exit 1
-- 
2.30.2