From 5cb5a026ee1020543270cb7c55bc4fa20128198f Mon Sep 17 00:00:00 2001
From: Matteo Croce <rootkit85@yahoo.it>
Date: Sun, 27 Jul 2008 21:42:36 +0000
Subject: atheros: 2.6.26 patches

SVN-Revision: 11965
---
 .../linux/atheros/patches-2.6.26/100-board.patch   | 66 ++++++++++++++++++++++
 .../atheros/patches-2.6.26/110-spiflash.patch      | 20 +++++++
 .../patches-2.6.26/130-ar2313_ethernet.patch       | 25 ++++++++
 .../atheros/patches-2.6.26/135-ar2313_2.6.26.patch | 11 ++++
 .../140-redboot_partition_scan.patch               | 54 ++++++++++++++++++
 .../atheros/patches-2.6.26/150-bridge-printk.patch | 26 +++++++++
 .../200-ar2313_enable_mvswitch.patch               | 34 +++++++++++
 .../900-cevt_r4k_irq_disable_hazard.patch          | 10 ++++
 .../901-get_c0_compare_irq_function.patch          | 43 ++++++++++++++
 9 files changed, 289 insertions(+)
 create mode 100644 target/linux/atheros/patches-2.6.26/100-board.patch
 create mode 100644 target/linux/atheros/patches-2.6.26/110-spiflash.patch
 create mode 100644 target/linux/atheros/patches-2.6.26/130-ar2313_ethernet.patch
 create mode 100644 target/linux/atheros/patches-2.6.26/135-ar2313_2.6.26.patch
 create mode 100644 target/linux/atheros/patches-2.6.26/140-redboot_partition_scan.patch
 create mode 100644 target/linux/atheros/patches-2.6.26/150-bridge-printk.patch
 create mode 100644 target/linux/atheros/patches-2.6.26/200-ar2313_enable_mvswitch.patch
 create mode 100644 target/linux/atheros/patches-2.6.26/900-cevt_r4k_irq_disable_hazard.patch
 create mode 100644 target/linux/atheros/patches-2.6.26/901-get_c0_compare_irq_function.patch

(limited to 'target/linux/atheros/patches-2.6.26')

diff --git a/target/linux/atheros/patches-2.6.26/100-board.patch b/target/linux/atheros/patches-2.6.26/100-board.patch
new file mode 100644
index 0000000000..9e68eddd4e
--- /dev/null
+++ b/target/linux/atheros/patches-2.6.26/100-board.patch
@@ -0,0 +1,66 @@
+--- a/arch/mips/Kconfig
++++ b/arch/mips/Kconfig
+@@ -59,6 +59,18 @@
+ 	help
+ 	 Support for BCM47XX based boards
+ 
++config ATHEROS
++	bool "Atheros SoC support (EXPERIMENTAL)"
++	depends on EXPERIMENTAL
++	select DMA_NONCOHERENT
++	select CEVT_R4K
++	select CSRC_R4K
++	select IRQ_CPU
++	select SYS_HAS_CPU_MIPS32_R1
++	select SYS_SUPPORTS_BIG_ENDIAN
++	select SYS_SUPPORTS_32BIT_KERNEL
++	select GENERIC_GPIO
++
+ config MIPS_COBALT
+ 	bool "Cobalt Server"
+ 	select CEVT_R4K
+@@ -687,6 +699,7 @@
+ 
+ endchoice
+ 
++source "arch/mips/atheros/Kconfig"
+ source "arch/mips/au1000/Kconfig"
+ source "arch/mips/basler/excite/Kconfig"
+ source "arch/mips/jazz/Kconfig"
+--- a/arch/mips/Makefile
++++ b/arch/mips/Makefile
+@@ -276,6 +276,13 @@
+ load-$(CONFIG_MIPS_XXS1500)	+= 0xffffffff80100000
+ 
+ #
++# Atheros AR5312/AR2312 WiSoC
++#
++core-$(CONFIG_ATHEROS)		+= arch/mips/atheros/
++cflags-$(CONFIG_ATHEROS)	+= -Iinclude/asm-mips/mach-atheros
++load-$(CONFIG_ATHEROS)		+= 0xffffffff80041000
++
++#
+ # Cobalt Server
+ #
+ core-$(CONFIG_MIPS_COBALT)	+= arch/mips/cobalt/
+--- a/include/asm-mips/bootinfo.h
++++ b/include/asm-mips/bootinfo.h
+@@ -94,6 +94,18 @@
+ #define MACH_MSP7120_FPGA       5	/* PMC-Sierra MSP7120 Emulation */
+ #define MACH_MSP_OTHER        255	/* PMC-Sierra unknown board type */
+ 
++/*
++ * Valid machtype for group ATHEROS
++ */
++#define MACH_GROUP_ATHEROS	26
++#define MACH_ATHEROS_AR5312	0
++#define MACH_ATHEROS_AR2312	1
++#define MACH_ATHEROS_AR2313	2
++#define MACH_ATHEROS_AR2315	3
++#define MACH_ATHEROS_AR2316	4
++#define MACH_ATHEROS_AR2317	5
++#define MACH_ATHEROS_AR2318	6
++
+ #define CL_SIZE			COMMAND_LINE_SIZE
+ 
+ extern char *system_type;
diff --git a/target/linux/atheros/patches-2.6.26/110-spiflash.patch b/target/linux/atheros/patches-2.6.26/110-spiflash.patch
new file mode 100644
index 0000000000..527198c210
--- /dev/null
+++ b/target/linux/atheros/patches-2.6.26/110-spiflash.patch
@@ -0,0 +1,20 @@
+--- a/drivers/mtd/devices/Kconfig
++++ b/drivers/mtd/devices/Kconfig
+@@ -84,6 +84,10 @@
+ 	help
+ 	  This option enables FAST_READ access supported by ST M25Pxx.
+ 
++config MTD_SPIFLASH
++	tristate "Atheros AR2315/6/7 SPI Flash support"
++	depends on ATHEROS_AR5315
++
+ config MTD_SLRAM
+ 	tristate "Uncached system RAM"
+ 	help
+--- a/drivers/mtd/devices/Makefile
++++ b/drivers/mtd/devices/Makefile
+@@ -17,3 +17,4 @@
+ obj-$(CONFIG_MTD_BLOCK2MTD)	+= block2mtd.o
+ obj-$(CONFIG_MTD_DATAFLASH)	+= mtd_dataflash.o
+ obj-$(CONFIG_MTD_M25P80)	+= m25p80.o
++obj-$(CONFIG_MTD_SPIFLASH)	+= spiflash.o
diff --git a/target/linux/atheros/patches-2.6.26/130-ar2313_ethernet.patch b/target/linux/atheros/patches-2.6.26/130-ar2313_ethernet.patch
new file mode 100644
index 0000000000..13580d1801
--- /dev/null
+++ b/target/linux/atheros/patches-2.6.26/130-ar2313_ethernet.patch
@@ -0,0 +1,25 @@
+--- a/drivers/net/Kconfig
++++ b/drivers/net/Kconfig
+@@ -367,6 +367,12 @@
+ 	help
+ 	  Select this if your platform comes with an external 93CX6 eeprom.
+ 
++config AR2313
++	tristate "AR2313 Ethernet support"
++	depends on NET_ETHERNET && ATHEROS
++	help
++	  Support for the AR231x/531x ethernet controller
++
+ config MACE
+ 	tristate "MACE (Power Mac ethernet) support"
+ 	depends on PPC_PMAC && PPC32
+--- a/drivers/net/Makefile
++++ b/drivers/net/Makefile
+@@ -194,6 +194,7 @@
+ obj-$(CONFIG_KORINA) += korina.o
+ obj-$(CONFIG_MIPS_JAZZ_SONIC) += jazzsonic.o
+ obj-$(CONFIG_MIPS_AU1X00_ENET) += au1000_eth.o
++obj-$(CONFIG_AR2313) += ar2313/
+ obj-$(CONFIG_MIPS_SIM_NET) += mipsnet.o
+ obj-$(CONFIG_SGI_IOC3_ETH) += ioc3-eth.o
+ obj-$(CONFIG_DECLANCE) += declance.o
diff --git a/target/linux/atheros/patches-2.6.26/135-ar2313_2.6.26.patch b/target/linux/atheros/patches-2.6.26/135-ar2313_2.6.26.patch
new file mode 100644
index 0000000000..e3a30d8872
--- /dev/null
+++ b/target/linux/atheros/patches-2.6.26/135-ar2313_2.6.26.patch
@@ -0,0 +1,11 @@
+--- a/drivers/net/ar2313/ar2313.c	(revisione 11911)
++++ a/drivers/net/ar2313/ar2313.c	(copia locale)
+@@ -291,7 +291,7 @@
+ 	sp->mii_bus.write = mdiobus_write;
+ 	sp->mii_bus.reset = mdiobus_reset;
+ 	sp->mii_bus.name = "ar2313_eth_mii";
+-	sp->mii_bus.id = 0;
++	snprintf(sp->mii_bus.id, MII_BUS_ID_SIZE, "0");
+ 	sp->mii_bus.irq = kmalloc(sizeof(int), GFP_KERNEL);
+ 	*sp->mii_bus.irq = PHY_POLL;
+ 
diff --git a/target/linux/atheros/patches-2.6.26/140-redboot_partition_scan.patch b/target/linux/atheros/patches-2.6.26/140-redboot_partition_scan.patch
new file mode 100644
index 0000000000..baf8026a39
--- /dev/null
+++ b/target/linux/atheros/patches-2.6.26/140-redboot_partition_scan.patch
@@ -0,0 +1,54 @@
+--- a/drivers/mtd/redboot.c
++++ b/drivers/mtd/redboot.c
+@@ -59,31 +59,32 @@
+ 	static char nullstring[] = "unallocated";
+ #endif
+ 
++	buf = vmalloc(master->erasesize);
++	if (!buf)
++		return -ENOMEM;
++
++ restart:
+ 	if ( directory < 0 ) {
+ 		offset = master->size + directory * master->erasesize;
+-		while (master->block_isbad && 
++		while (master->block_isbad &&
+ 		       master->block_isbad(master, offset)) {
+ 			if (!offset) {
+ 			nogood:
+ 				printk(KERN_NOTICE "Failed to find a non-bad block to check for RedBoot partition table\n");
++				vfree(buf);
+ 				return -EIO;
+ 			}
+ 			offset -= master->erasesize;
+ 		}
+ 	} else {
+ 		offset = directory * master->erasesize;
+-		while (master->block_isbad && 
++		while (master->block_isbad &&
+ 		       master->block_isbad(master, offset)) {
+ 			offset += master->erasesize;
+ 			if (offset == master->size)
+ 				goto nogood;
+ 		}
+ 	}
+-	buf = vmalloc(master->erasesize);
+-
+-	if (!buf)
+-		return -ENOMEM;
+-
+ 	printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n",
+ 	       master->name, offset);
+ 
+@@ -155,6 +156,11 @@
+ 	}
+ 	if (i == numslots) {
+ 		/* Didn't find it */
++		if (offset + master->erasesize < master->size) {
++			/* not at the end of the flash yet, maybe next block :) */
++			directory++;
++			goto restart;
++		}
+ 		printk(KERN_NOTICE "No RedBoot partition table detected in %s\n",
+ 		       master->name);
+ 		ret = 0;
diff --git a/target/linux/atheros/patches-2.6.26/150-bridge-printk.patch b/target/linux/atheros/patches-2.6.26/150-bridge-printk.patch
new file mode 100644
index 0000000000..a2b949db9f
--- /dev/null
+++ b/target/linux/atheros/patches-2.6.26/150-bridge-printk.patch
@@ -0,0 +1,26 @@
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -3786,8 +3786,8 @@
+ 	/* Fix illegal SG+CSUM combinations. */
+ 	if ((dev->features & NETIF_F_SG) &&
+ 	    !(dev->features & NETIF_F_ALL_CSUM)) {
+-		printk(KERN_NOTICE "%s: Dropping NETIF_F_SG since no checksum feature.\n",
+-		       dev->name);
++		//printk(KERN_NOTICE "%s: Dropping NETIF_F_SG since no checksum feature.\n",
++		//       dev->name);
+ 		dev->features &= ~NETIF_F_SG;
+ 	}
+ 
+@@ -3800,9 +3800,9 @@
+ 	}
+ 	if (dev->features & NETIF_F_UFO) {
+ 		if (!(dev->features & NETIF_F_HW_CSUM)) {
+-			printk(KERN_ERR "%s: Dropping NETIF_F_UFO since no "
+-					"NETIF_F_HW_CSUM feature.\n",
+-							dev->name);
++			//printk(KERN_ERR "%s: Dropping NETIF_F_UFO since no "
++			//		"NETIF_F_HW_CSUM feature.\n",
++			//				dev->name);
+ 			dev->features &= ~NETIF_F_UFO;
+ 		}
+ 		if (!(dev->features & NETIF_F_SG)) {
diff --git a/target/linux/atheros/patches-2.6.26/200-ar2313_enable_mvswitch.patch b/target/linux/atheros/patches-2.6.26/200-ar2313_enable_mvswitch.patch
new file mode 100644
index 0000000000..752b07f89c
--- /dev/null
+++ b/target/linux/atheros/patches-2.6.26/200-ar2313_enable_mvswitch.patch
@@ -0,0 +1,34 @@
+--- a/drivers/net/ar2313/ar2313.c
++++ b/drivers/net/ar2313/ar2313.c
+@@ -953,9 +953,9 @@
+ 						((status >> DMA_RX_LEN_SHIFT) & 0x3fff) - CRC_LEN);
+ 
+ 				dev->stats.rx_bytes += skb->len;
+-				skb->protocol = eth_type_trans(skb, dev);
++
+ 				/* pass the packet to upper layers */
+-				netif_rx(skb);
++				sp->rx(skb);
+ 
+ 				skb_new->dev = dev;
+ 				/* 16 bit align */
+@@ -1370,6 +1370,8 @@
+ 		return PTR_ERR(phydev);
+ 	}
+ 
++	sp->rx = phydev->netif_rx;
++
+ 	/* mask with MAC supported features */
+ 	phydev->supported &= (SUPPORTED_10baseT_Half
+ 		| SUPPORTED_10baseT_Full
+--- a/drivers/net/ar2313/ar2313.h
++++ b/drivers/net/ar2313/ar2313.h
+@@ -107,6 +107,8 @@
+  */
+ struct ar2313_private {
+ 	struct net_device *dev;
++	int (*rx)(struct sk_buff *skb);
++
+ 	int version;
+ 	u32 mb[2];
+ 
diff --git a/target/linux/atheros/patches-2.6.26/900-cevt_r4k_irq_disable_hazard.patch b/target/linux/atheros/patches-2.6.26/900-cevt_r4k_irq_disable_hazard.patch
new file mode 100644
index 0000000000..f60325ee2f
--- /dev/null
+++ b/target/linux/atheros/patches-2.6.26/900-cevt_r4k_irq_disable_hazard.patch
@@ -0,0 +1,10 @@
+--- a/arch/mips/kernel/cevt-r4k.c
++++ b/arch/mips/kernel/cevt-r4k.c
+@@ -205,6 +205,7 @@
+ 	while ((int)(read_c0_count() - cnt) <= 0)
+ 		;	/* Wait for expiry  */
+ 
++	irq_disable_hazard();
+ 	if (!c0_compare_int_pending())
+ 		return 0;
+ 
diff --git a/target/linux/atheros/patches-2.6.26/901-get_c0_compare_irq_function.patch b/target/linux/atheros/patches-2.6.26/901-get_c0_compare_irq_function.patch
new file mode 100644
index 0000000000..4d25b1f2a5
--- /dev/null
+++ b/target/linux/atheros/patches-2.6.26/901-get_c0_compare_irq_function.patch
@@ -0,0 +1,43 @@
+--- a/arch/mips/kernel/traps.c
++++ b/arch/mips/kernel/traps.c
+@@ -43,6 +43,7 @@
+ #include <asm/mmu_context.h>
+ #include <asm/types.h>
+ #include <asm/stacktrace.h>
++#include <asm/time.h>
+ 
+ extern asmlinkage void handle_int(void);
+ extern asmlinkage void handle_tlbm(void);
+@@ -1464,6 +1465,8 @@
+ 	 */
+ 	if (cpu_has_mips_r2) {
+ 		cp0_compare_irq = (read_c0_intctl() >> 29) & 7;
++		if (get_c0_compare_irq)
++			cp0_compare_irq = get_c0_compare_irq();
+ 		cp0_perfcount_irq = (read_c0_intctl() >> 26) & 7;
+ 		if (cp0_perfcount_irq == cp0_compare_irq)
+ 			cp0_perfcount_irq = -1;
+--- a/include/asm-mips/time.h
++++ b/include/asm-mips/time.h
+@@ -53,6 +53,7 @@
+ #ifdef CONFIG_CEVT_R4K
+ extern int mips_clockevent_init(void);
+ extern unsigned int __weak get_c0_compare_int(void);
++extern unsigned int __weak get_c0_compare_irq(void);
+ #else
+ static inline int mips_clockevent_init(void)
+ {
+--- a/arch/mips/atheros/board.c
++++ b/arch/mips/atheros/board.c
+@@ -205,6 +205,11 @@
+ void __init plat_time_init(void) {
+     board_time_init();
+ }
++
++unsigned int __init get_c0_compare_irq(void)
++{
++	return CP0_LEGACY_COMPARE_IRQ;
++}
+ #endif
+ 
+ void __init arch_init_irq(void)
-- 
cgit v1.2.3