From a16ea0db8f0c77fe385de98621c697948045657d Mon Sep 17 00:00:00 2001
From: matteo <matteo@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Sun, 30 Dec 2007 15:17:10 +0000
Subject: AR7 2.6.24 patches

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10052 3c298f89-4303-0410-b956-a3cf2f4a3e73
---
 .../ar7/patches-2.6.24/100-board_support.patch     | 92 ++++++++++++++++++++++
 target/linux/ar7/patches-2.6.24/110-flash.patch    | 43 ++++++++++
 .../linux/ar7/patches-2.6.24/120-gpio_chrdev.patch | 32 ++++++++
 target/linux/ar7/patches-2.6.24/130-vlynq.patch    | 23 ++++++
 target/linux/ar7/patches-2.6.24/140-watchdog.patch | 29 +++++++
 .../ar7/patches-2.6.24/200-ethernet_driver.patch   | 32 ++++++++
 .../ar7/patches-2.6.24/500-serial_kludge.patch     | 57 ++++++++++++++
 7 files changed, 308 insertions(+)
 create mode 100644 target/linux/ar7/patches-2.6.24/100-board_support.patch
 create mode 100644 target/linux/ar7/patches-2.6.24/110-flash.patch
 create mode 100644 target/linux/ar7/patches-2.6.24/120-gpio_chrdev.patch
 create mode 100644 target/linux/ar7/patches-2.6.24/130-vlynq.patch
 create mode 100644 target/linux/ar7/patches-2.6.24/140-watchdog.patch
 create mode 100644 target/linux/ar7/patches-2.6.24/200-ethernet_driver.patch
 create mode 100644 target/linux/ar7/patches-2.6.24/500-serial_kludge.patch

(limited to 'target/linux')

diff --git a/target/linux/ar7/patches-2.6.24/100-board_support.patch b/target/linux/ar7/patches-2.6.24/100-board_support.patch
new file mode 100644
index 000000000..d23aecf4f
--- /dev/null
+++ b/target/linux/ar7/patches-2.6.24/100-board_support.patch
@@ -0,0 +1,92 @@
+Index: linux-2.6.23-rc6/arch/mips/Kconfig
+===================================================================
+--- linux-2.6.23-rc6.orig/arch/mips/Kconfig	2007-09-21 16:23:51.000000000 +0800
++++ linux-2.6.23-rc6/arch/mips/Kconfig	2007-09-21 16:24:11.000000000 +0800
+@@ -15,6 +15,22 @@
+ 	prompt "System type"
+ 	default SGI_IP22
+ 
++config AR7
++	bool "Texas Instruments AR7"
++	select BOOT_ELF32
++	select DMA_NONCOHERENT
++	select IRQ_CPU
++	select NO_EXCEPT_FILL
++	select SWAP_IO_SPACE
++	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 SYS_SUPPORTS_BIG_ENDIAN
++	select GENERIC_GPIO
++	select GENERIC_HARDIRQS_NO__DO_IRQ
++
+ config MACH_ALCHEMY
+ 	bool "Alchemy processor based machines"
+ 
+Index: linux-2.6.23-rc6/arch/mips/kernel/traps.c
+===================================================================
+--- linux-2.6.23-rc6.orig/arch/mips/kernel/traps.c	2007-09-21 16:23:51.000000000 +0800
++++ linux-2.6.23-rc6/arch/mips/kernel/traps.c	2007-09-21 16:24:11.000000000 +0800
+@@ -1093,9 +1093,22 @@ void *set_except_vector(int n, void *addr)
+ 
+ 	exception_handlers[n] = handler;
+ 	if (n == 0 && cpu_has_divec) {
+-		*(u32 *)(ebase + 0x200) = 0x08000000 |
+-					  (0x03ffffff & (handler >> 2));
+-		flush_icache_range(ebase + 0x200, ebase + 0x204);
++		if ((handler ^ (ebase + 4)) & 0xfc000000) {
++			/* lui k0, 0x0000 */
++			*(u32 *)(ebase + 0x200) = 0x3c1a0000 | (handler >> 16);
++			/* ori k0, 0x0000 */
++			*(u32 *)(ebase + 0x204) =
++					0x375a0000 | (handler & 0xffff);
++			/* jr k0 */
++			*(u32 *)(ebase + 0x208) = 0x03400008;
++			/* nop */
++			*(u32 *)(ebase + 0x20C) = 0x00000000;
++			flush_icache_range(ebase + 0x200, ebase + 0x210);
++		} else {
++			*(volatile u32 *)(ebase + 0x200) =
++				0x08000000 | (0x03ffffff & (handler >> 2));
++			flush_icache_range(ebase + 0x200, ebase + 0x204);
++		}
+ 	}
+ 	return (void *)old_handler;
+ }
+Index: linux-2.6.23-rc6/arch/mips/Makefile
+===================================================================
+--- linux-2.6.23-rc6.orig/arch/mips/Makefile	2007-09-21 16:24:05.000000000 +0800
++++ linux-2.6.23-rc6/arch/mips/Makefile	2007-09-21 16:24:11.000000000 +0800
+@@ -161,6 +161,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/
+Index: linux-2.6.23-rc6/include/asm-mips/page.h
+===================================================================
+--- linux-2.6.23-rc6.orig/include/asm-mips/page.h	2007-09-21 16:23:51.000000000 +0800
++++ linux-2.6.23-rc6/include/asm-mips/page.h	2007-09-21 16:24:11.000000000 +0800
+@@ -184,8 +184,10 @@
+ #define VM_DATA_DEFAULT_FLAGS	(VM_READ | VM_WRITE | VM_EXEC | \
+ 				 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
+ 
+-#define UNCAC_ADDR(addr)	((addr) - PAGE_OFFSET + UNCAC_BASE)
+-#define CAC_ADDR(addr)		((addr) - UNCAC_BASE + PAGE_OFFSET)
++#define UNCAC_ADDR(addr)	((addr) - PAGE_OFFSET + UNCAC_BASE +	\
++				 PHYS_OFFSET)
++#define CAC_ADDR(addr)		((addr) - UNCAC_BASE + PAGE_OFFSET -	\
++				 PHYS_OFFSET)
+ 
+ #include <asm-generic/memory_model.h>
+ #include <asm-generic/page.h>
diff --git a/target/linux/ar7/patches-2.6.24/110-flash.patch b/target/linux/ar7/patches-2.6.24/110-flash.patch
new file mode 100644
index 000000000..4f6a3c287
--- /dev/null
+++ b/target/linux/ar7/patches-2.6.24/110-flash.patch
@@ -0,0 +1,43 @@
+Index: linux-2.6.23-rc6/drivers/mtd/Kconfig
+===================================================================
+--- linux-2.6.23-rc6.orig/drivers/mtd/Kconfig	2007-09-21 16:23:59.000000000 +0800
++++ linux-2.6.23-rc6/drivers/mtd/Kconfig	2007-09-21 16:24:11.000000000 +0800
+@@ -160,6 +160,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"
+ 
+ config MTD_CHAR
+Index: linux-2.6.23-rc6/drivers/mtd/Makefile
+===================================================================
+--- linux-2.6.23-rc6.orig/drivers/mtd/Makefile	2007-09-21 16:23:51.000000000 +0800
++++ linux-2.6.23-rc6/drivers/mtd/Makefile	2007-09-21 16:24:11.000000000 +0800
+@@ -11,6 +11,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
+Index: linux-2.6.23-rc6/drivers/mtd/maps/physmap.c
+===================================================================
+--- linux-2.6.23-rc6.orig/drivers/mtd/maps/physmap.c	2007-09-21 16:23:51.000000000 +0800
++++ linux-2.6.23-rc6/drivers/mtd/maps/physmap.c	2007-09-21 16:24:11.000000000 +0800
+@@ -74,7 +74,8 @@
+ 
+ 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/patches-2.6.24/120-gpio_chrdev.patch b/target/linux/ar7/patches-2.6.24/120-gpio_chrdev.patch
new file mode 100644
index 000000000..53fd7796a
--- /dev/null
+++ b/target/linux/ar7/patches-2.6.24/120-gpio_chrdev.patch
@@ -0,0 +1,32 @@
+Index: linux-2.6.23-rc6/drivers/char/Kconfig
+===================================================================
+--- linux-2.6.23-rc6.orig/drivers/char/Kconfig	2007-09-21 16:23:51.000000000 +0800
++++ linux-2.6.23-rc6/drivers/char/Kconfig	2007-09-21 16:24:12.000000000 +0800
+@@ -928,6 +928,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
+Index: linux-2.6.23-rc6/drivers/char/Makefile
+===================================================================
+--- linux-2.6.23-rc6.orig/drivers/char/Makefile	2007-09-21 16:23:51.000000000 +0800
++++ linux-2.6.23-rc6/drivers/char/Makefile	2007-09-21 16:24:12.000000000 +0800
+@@ -89,6 +89,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/patches-2.6.24/130-vlynq.patch b/target/linux/ar7/patches-2.6.24/130-vlynq.patch
new file mode 100644
index 000000000..df460fc13
--- /dev/null
+++ b/target/linux/ar7/patches-2.6.24/130-vlynq.patch
@@ -0,0 +1,23 @@
+Index: linux-2.6.23-rc9/drivers/Kconfig
+===================================================================
+--- linux-2.6.23-rc9.orig/drivers/Kconfig	2007-10-05 20:47:14.000000000 +0800
++++ linux-2.6.23-rc9/drivers/Kconfig	2007-10-05 20:47:42.000000000 +0800
+@@ -94,5 +94,7 @@ source "drivers/kvm/Kconfig"
+ 
+ source "drivers/uio/Kconfig"
+ 
++source "drivers/vlynq/Kconfig"
++
+ source "drivers/virtio/Kconfig"
+ endmenu
+Index: linux-2.6.23-rc9/drivers/Makefile
+===================================================================
+--- linux-2.6.23-rc9.orig/drivers/Makefile	2007-10-05 20:47:09.000000000 +0800
++++ linux-2.6.23-rc9/drivers/Makefile	2007-10-05 20:47:30.000000000 +0800
+@@ -89,5 +89,6 @@ obj-$(CONFIG_DCA)		+= dca/
+ obj-$(CONFIG_HID)		+= hid/
+ obj-$(CONFIG_PPC_PS3)		+= ps3/
+ obj-$(CONFIG_OF)		+= of/
++obj-$(CONFIG_VLYNQ)		+= vlynq/
+ obj-$(CONFIG_SSB)		+= ssb/
+ obj-$(CONFIG_VIRTIO)		+= virtio/
diff --git a/target/linux/ar7/patches-2.6.24/140-watchdog.patch b/target/linux/ar7/patches-2.6.24/140-watchdog.patch
new file mode 100644
index 000000000..6bd9e458d
--- /dev/null
+++ b/target/linux/ar7/patches-2.6.24/140-watchdog.patch
@@ -0,0 +1,29 @@
+Index: linux-2.6.23-rc6/drivers/char/watchdog/Kconfig
+===================================================================
+--- linux-2.6.23-rc6.orig/drivers/char/watchdog/Kconfig	2007-09-21 16:23:51.000000000 +0800
++++ linux-2.6.23-rc6/drivers/char/watchdog/Kconfig	2007-09-21 16:24:12.000000000 +0800
+@@ -583,6 +583,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 SGI_IP22
+Index: linux-2.6.23-rc6/drivers/char/watchdog/Makefile
+===================================================================
+--- linux-2.6.23-rc6.orig/drivers/char/watchdog/Makefile	2007-09-21 16:23:51.000000000 +0800
++++ linux-2.6.23-rc6/drivers/char/watchdog/Makefile	2007-09-21 16:24:12.000000000 +0800
+@@ -87,6 +87,7 @@
+ # M68KNOMMU Architecture
+ 
+ # MIPS Architecture
++obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
+ obj-$(CONFIG_INDYDOG) += indydog.o
+ obj-$(CONFIG_WDT_MTX1)	+= mtx-1_wdt.o
+ obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o
diff --git a/target/linux/ar7/patches-2.6.24/200-ethernet_driver.patch b/target/linux/ar7/patches-2.6.24/200-ethernet_driver.patch
new file mode 100644
index 000000000..08f26576b
--- /dev/null
+++ b/target/linux/ar7/patches-2.6.24/200-ethernet_driver.patch
@@ -0,0 +1,32 @@
+Index: linux-2.6.23/drivers/net/Kconfig
+===================================================================
+--- linux-2.6.23.orig/drivers/net/Kconfig	2007-10-10 13:52:54.000000000 +0800
++++ linux-2.6.23/drivers/net/Kconfig	2007-10-10 13:53:54.000000000 +0800
+@@ -1965,6 +1965,15 @@
+ 	  To compile this driver as a module, choose M here: the module
+ 	  will be called sc92031.  This is recommended.
+ 
++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 PARPORT
+Index: linux-2.6.23/drivers/net/Makefile
+===================================================================
+--- linux-2.6.23.orig/drivers/net/Makefile	2007-10-10 13:52:54.000000000 +0800
++++ linux-2.6.23/drivers/net/Makefile	2007-10-10 13:53:54.000000000 +0800
+@@ -156,6 +156,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/patches-2.6.24/500-serial_kludge.patch b/target/linux/ar7/patches-2.6.24/500-serial_kludge.patch
new file mode 100644
index 000000000..446b2b555
--- /dev/null
+++ b/target/linux/ar7/patches-2.6.24/500-serial_kludge.patch
@@ -0,0 +1,57 @@
+Index: linux-2.6.23-rc6/drivers/serial/8250.c
+===================================================================
+--- linux-2.6.23-rc6.orig/drivers/serial/8250.c	2007-09-21 16:23:51.000000000 +0800
++++ linux-2.6.23-rc6/drivers/serial/8250.c	2007-09-21 16:24:14.000000000 +0800
+@@ -267,6 +267,13 @@
+ 		.fcr		= UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
+ 		.flags		= UART_CAP_FIFO,
+ 	},
++	[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,
++	},
+ };
+ 
+ #if defined (CONFIG_SERIAL_8250_AU1X00)
+@@ -2453,7 +2460,11 @@
+ {
+ 	struct uart_8250_port *up = (struct uart_8250_port *)port;
+ 
++#ifdef CONFIG_AR7
++	wait_for_xmitr(up, BOTH_EMPTY);
++#else
+ 	wait_for_xmitr(up, UART_LSR_THRE);
++#endif
+ 	serial_out(up, UART_TX, ch);
+ }
+ 
+Index: linux-2.6.23-rc6/include/linux/serial_core.h
+===================================================================
+--- linux-2.6.23-rc6.orig/include/linux/serial_core.h	2007-09-21 16:23:51.000000000 +0800
++++ linux-2.6.23-rc6/include/linux/serial_core.h	2007-09-21 16:24:14.000000000 +0800
+@@ -40,6 +40,7 @@
+ #define PORT_NS16550A	14
+ #define PORT_XSCALE	15
+ #define PORT_RM9000	16	/* PMC-Sierra RM9xxx internal UART */
++#define PORT_AR7	16
+ #define PORT_MAX_8250	16	/* max port ID */
+ 
+ /*
+Index: linux-2.6.23-rc6/include/linux/serialP.h
+===================================================================
+--- linux-2.6.23-rc6.orig/include/linux/serialP.h	2007-09-21 16:23:51.000000000 +0800
++++ linux-2.6.23-rc6/include/linux/serialP.h	2007-09-21 16:24:14.000000000 +0800
+@@ -135,6 +135,10 @@
+  * 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
-- 
cgit v1.2.3