From 84ee0935744035d586676b5eb0f34ca338bedb8a Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Tue, 15 Jul 2008 17:18:28 +0000 Subject: Add basic 2.6.24 support for rb532, korina napi code has to be adapted to work git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11844 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../rb532/patches-2.6.24/100-rb5xx_support.patch | 101 +++++++++++++++++++++ .../rb532/patches-2.6.24/110-korina_ethernet.patch | 31 +++++++ target/linux/rb532/patches-2.6.24/120-cf.patch | 31 +++++++ .../rb532/patches-2.6.24/140-cmdline_hack.patch | 15 +++ .../patches-2.6.24/200-bridge_resource_hack.patch | 15 +++ .../rb532/patches-2.6.24/220-serial_fix.patch | 18 ++++ .../patches-2.6.24/240-via_rhine_performance.patch | 100 ++++++++++++++++++++ .../linux/rb532/patches-2.6.24/510-rb500_led.patch | 27 ++++++ .../rb532/patches-2.6.24/520-rc32434_wdt.patch | 33 +++++++ .../patches-2.6.24/530-no_panic_pci_iomap.patch | 12 +++ 10 files changed, 383 insertions(+) create mode 100644 target/linux/rb532/patches-2.6.24/100-rb5xx_support.patch create mode 100644 target/linux/rb532/patches-2.6.24/110-korina_ethernet.patch create mode 100644 target/linux/rb532/patches-2.6.24/120-cf.patch create mode 100644 target/linux/rb532/patches-2.6.24/140-cmdline_hack.patch create mode 100644 target/linux/rb532/patches-2.6.24/200-bridge_resource_hack.patch create mode 100644 target/linux/rb532/patches-2.6.24/220-serial_fix.patch create mode 100644 target/linux/rb532/patches-2.6.24/240-via_rhine_performance.patch create mode 100644 target/linux/rb532/patches-2.6.24/510-rb500_led.patch create mode 100644 target/linux/rb532/patches-2.6.24/520-rc32434_wdt.patch create mode 100644 target/linux/rb532/patches-2.6.24/530-no_panic_pci_iomap.patch (limited to 'target/linux/rb532/patches-2.6.24') diff --git a/target/linux/rb532/patches-2.6.24/100-rb5xx_support.patch b/target/linux/rb532/patches-2.6.24/100-rb5xx_support.patch new file mode 100644 index 0000000000..081eced2b4 --- /dev/null +++ b/target/linux/rb532/patches-2.6.24/100-rb5xx_support.patch @@ -0,0 +1,101 @@ +diff -urN linux-2.6.24.7/arch/mips/Kconfig linux-2.6.24.7.new/arch/mips/Kconfig +--- linux-2.6.24.7/arch/mips/Kconfig 2008-05-07 01:22:34.000000000 +0200 ++++ linux-2.6.24.7.new/arch/mips/Kconfig 2008-07-15 15:29:51.000000000 +0200 +@@ -687,6 +687,23 @@ + This enables support for the Wind River MIPS32 4KC PPMC evaluation + board, which is based on GT64120 bridge chip. + ++config MIKROTIK_RB500 ++ bool "Support for RB5xx boards" ++ select HW_HAS_PCI ++ select CEVT_R4K ++ select CSRC_R4K ++ select IRQ_CPU ++ select SYS_HAS_CPU_MIPS32_R1 ++ select SYS_SUPPORTS_LITTLE_ENDIAN ++ select SYS_SUPPORTS_32BIT_KERNEL ++ select SWAP_IO_SPACE ++ select DMA_NONCOHERENT ++ select GENERIC_GPIO ++ help ++ Support the Mikrotik(tm) Routerboard 500 series, ++ such as the RB532. ++ ++ + endchoice + + source "arch/mips/au1000/Kconfig" +@@ -967,6 +982,7 @@ + default "4" if MACH_DECSTATION + default "7" if SGI_IP27 || SNI_RM + default "4" if PMC_MSP4200_EVAL ++ default "4" if MIKROTIK_RB500 + default "5" + + config HAVE_STD_PC_SERIAL_PORT +diff -urN linux-2.6.24.7/arch/mips/Makefile linux-2.6.24.7.new/arch/mips/Makefile +--- linux-2.6.24.7/arch/mips/Makefile 2008-07-15 15:27:55.000000000 +0200 ++++ linux-2.6.24.7.new/arch/mips/Makefile 2008-07-15 15:30:21.000000000 +0200 +@@ -297,6 +297,13 @@ + cflags-$(CONFIG_LEMOTE_FULONG) += -Iinclude/asm-mips/mach-lemote + + # ++# Routerboard 532 board ++# ++core-$(CONFIG_MIKROTIK_RB500) += arch/mips/rb500/ ++cflags-$(CONFIG_MIKROTIK_RB500) += -Iinclude/asm-mips/rc32434 ++load-$(CONFIG_MIKROTIK_RB500) += 0xffffffff80101000 ++ ++# + # For all MIPS, Inc. eval boards + # + core-$(CONFIG_MIPS_BOARDS_GEN) += arch/mips/mips-boards/generic/ +diff -urN linux-2.6.24.7/arch/mips/pci/Makefile linux-2.6.24.7.new/arch/mips/pci/Makefile +--- linux-2.6.24.7/arch/mips/pci/Makefile 2008-05-07 01:22:34.000000000 +0200 ++++ linux-2.6.24.7.new/arch/mips/pci/Makefile 2008-07-15 15:30:46.000000000 +0200 +@@ -48,3 +48,4 @@ + obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o + obj-$(CONFIG_ZAO_CAPCELLA) += fixup-capcella.o + obj-$(CONFIG_WR_PPMC) += fixup-wrppmc.o ++obj-$(CONFIG_MIKROTIK_RB500) += pci-rc32434.o ops-rc32434.o fixup-rb500.o +diff -urN linux-2.6.24.7/drivers/pci/Makefile linux-2.6.24.7.new/drivers/pci/Makefile +--- linux-2.6.24.7/drivers/pci/Makefile 2008-05-07 01:22:34.000000000 +0200 ++++ linux-2.6.24.7.new/drivers/pci/Makefile 2008-07-15 15:31:20.000000000 +0200 +@@ -35,6 +35,7 @@ + obj-$(CONFIG_PPC64) += setup-bus.o + obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o + obj-$(CONFIG_X86_VISWS) += setup-irq.o ++obj-$(CONFIG_MIKROTIK_RB500) += setup-irq.o + + # + # ACPI Related PCI FW Functions +diff -urN linux-2.6.24.7/include/asm-mips/bootinfo.h linux-2.6.24.7.new/include/asm-mips/bootinfo.h +--- linux-2.6.24.7/include/asm-mips/bootinfo.h 2008-05-07 01:22:34.000000000 +0200 ++++ linux-2.6.24.7.new/include/asm-mips/bootinfo.h 2008-07-15 15:32:06.000000000 +0200 +@@ -198,6 +198,14 @@ + #define MACH_GROUP_BRCM 23 /* Broadcom */ + #define MACH_BCM47XX 1 /* Broadcom BCM47XX */ + ++ ++/* ++ * Valid machtype for group Mikrotik ++ */ ++#define MACH_GROUP_MIKROTIK 29 /* Mikrotik Boards */ ++#define MACH_MIKROTIK_RB532 0 /* Mikrotik RouterBoard 532 */ ++#define MACH_MIKROTIK_RB532A 1 /* Mikrotik RouterBoard 532A */ ++ + #define CL_SIZE COMMAND_LINE_SIZE + + const char *get_system_type(void); +diff -urN linux-2.6.24.7/include/asm-mips/cpu.h linux-2.6.24.7.new/include/asm-mips/cpu.h +--- linux-2.6.24.7/include/asm-mips/cpu.h 2008-05-07 01:22:34.000000000 +0200 ++++ linux-2.6.24.7.new/include/asm-mips/cpu.h 2008-07-15 15:32:22.000000000 +0200 +@@ -196,7 +196,7 @@ + */ + CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_74K, CPU_AU1000, + CPU_AU1100, CPU_AU1200, CPU_AU1500, CPU_AU1550, CPU_PR4450, +- CPU_BCM3302, CPU_BCM4710, ++ CPU_BCM3302, CPU_BCM4710, CPU_RC32300, + + /* + * MIPS64 class processors diff --git a/target/linux/rb532/patches-2.6.24/110-korina_ethernet.patch b/target/linux/rb532/patches-2.6.24/110-korina_ethernet.patch new file mode 100644 index 0000000000..acfba6c00a --- /dev/null +++ b/target/linux/rb532/patches-2.6.24/110-korina_ethernet.patch @@ -0,0 +1,31 @@ +Index: linux-2.6.23.17/drivers/net/Kconfig +=================================================================== +--- linux-2.6.23.17.orig/drivers/net/Kconfig ++++ linux-2.6.23.17/drivers/net/Kconfig +@@ -348,6 +348,13 @@ config AX88796 + AX88796 driver, using platform bus to provide + chip detection and resources + ++config KORINA ++ tristate "Korina Local Ethernet support" ++ depends on NET_ETHERNET && ( IDT_EB434 || MIKROTIK_RB500) ++ help ++ IDT RC32434 has one local ethernet port. Say Y here to enable it. ++ To compile this driver as a module, choose M here. ++ + config MACE + tristate "MACE (Power Mac ethernet) support" + depends on PPC_PMAC && PPC32 +Index: linux-2.6.23.17/drivers/net/Makefile +=================================================================== +--- linux-2.6.23.17.orig/drivers/net/Makefile ++++ linux-2.6.23.17/drivers/net/Makefile +@@ -25,6 +25,8 @@ ucc_geth_driver-objs := ucc_geth.o ucc_g + # + obj-$(CONFIG_PLIP) += plip.o + ++obj-$(CONFIG_KORINA) += korina.o ++ + obj-$(CONFIG_ROADRUNNER) += rrunner.o + + obj-$(CONFIG_HAPPYMEAL) += sunhme.o diff --git a/target/linux/rb532/patches-2.6.24/120-cf.patch b/target/linux/rb532/patches-2.6.24/120-cf.patch new file mode 100644 index 0000000000..522195e451 --- /dev/null +++ b/target/linux/rb532/patches-2.6.24/120-cf.patch @@ -0,0 +1,31 @@ +Index: linux-2.6.23.17/drivers/block/Kconfig +=================================================================== +--- linux-2.6.23.17.orig/drivers/block/Kconfig ++++ linux-2.6.23.17/drivers/block/Kconfig +@@ -426,6 +426,14 @@ config SUNVDC + Support for virtual disk devices as a client under Sun + Logical Domains. + ++config BLK_DEV_CF_MIPS ++ bool "CF slot of RB532 board" ++ depends on MIKROTIK_RB500 ++ default y ++ help ++ The Routerboard 532 has a CF slot on it. Enable the special block ++ device driver for it. ++ + source "drivers/s390/block/Kconfig" + + config XILINX_SYSACE +Index: linux-2.6.23.17/drivers/block/Makefile +=================================================================== +--- linux-2.6.23.17.orig/drivers/block/Makefile ++++ linux-2.6.23.17/drivers/block/Makefile +@@ -21,6 +21,7 @@ obj-$(CONFIG_BLK_DEV_DAC960) += DAC960.o + obj-$(CONFIG_XILINX_SYSACE) += xsysace.o + obj-$(CONFIG_CDROM_PKTCDVD) += pktcdvd.o + obj-$(CONFIG_SUNVDC) += sunvdc.o ++obj-$(CONFIG_BLK_DEV_CF_MIPS) += rb500/ + + obj-$(CONFIG_BLK_DEV_UMEM) += umem.o + obj-$(CONFIG_BLK_DEV_NBD) += nbd.o diff --git a/target/linux/rb532/patches-2.6.24/140-cmdline_hack.patch b/target/linux/rb532/patches-2.6.24/140-cmdline_hack.patch new file mode 100644 index 0000000000..1e01e953e5 --- /dev/null +++ b/target/linux/rb532/patches-2.6.24/140-cmdline_hack.patch @@ -0,0 +1,15 @@ +Index: linux-2.6.23.17/arch/mips/kernel/head.S +=================================================================== +--- linux-2.6.23.17.orig/arch/mips/kernel/head.S ++++ linux-2.6.23.17/arch/mips/kernel/head.S +@@ -132,6 +132,10 @@ + + j kernel_entry + nop ++ ++EXPORT(_image_cmdline) ++ .ascii "CMDLINE:" ++ + #ifndef CONFIG_NO_EXCEPT_FILL + /* + * Reserved space for exception handlers. diff --git a/target/linux/rb532/patches-2.6.24/200-bridge_resource_hack.patch b/target/linux/rb532/patches-2.6.24/200-bridge_resource_hack.patch new file mode 100644 index 0000000000..707935539b --- /dev/null +++ b/target/linux/rb532/patches-2.6.24/200-bridge_resource_hack.patch @@ -0,0 +1,15 @@ +Index: linux-2.6.23.17/arch/mips/pci/pci.c +=================================================================== +--- linux-2.6.23.17.orig/arch/mips/pci/pci.c ++++ linux-2.6.23.17/arch/mips/pci/pci.c +@@ -64,8 +64,10 @@ pcibios_align_resource(void *data, struc + /* + * Put everything into 0x00-0xff region modulo 0x400 + */ ++#ifndef CONFIG_MIKROTIK_RB500 + if (start & 0x300) + start = (start + 0x3ff) & ~0x3ff; ++#endif + } else if (res->flags & IORESOURCE_MEM) { + /* Make sure we start at our min on all hoses */ + if (start < PCIBIOS_MIN_MEM + hose->mem_resource->start) diff --git a/target/linux/rb532/patches-2.6.24/220-serial_fix.patch b/target/linux/rb532/patches-2.6.24/220-serial_fix.patch new file mode 100644 index 0000000000..4af6620fb5 --- /dev/null +++ b/target/linux/rb532/patches-2.6.24/220-serial_fix.patch @@ -0,0 +1,18 @@ +Index: linux-2.6.23.17/drivers/serial/8250.c +=================================================================== +--- linux-2.6.23.17.orig/drivers/serial/8250.c ++++ linux-2.6.23.17/drivers/serial/8250.c +@@ -433,6 +433,13 @@ serial_out(struct uart_8250_port *up, in + default: + outb(value, up->port.iobase + offset); + } ++ ++#if defined(CONFIG_IDT_EB434) || defined(CONFIG_MIKROTIK_RB500) ++ __SLOW_DOWN_IO; ++ __SLOW_DOWN_IO; ++ __SLOW_DOWN_IO; ++ __SLOW_DOWN_IO; ++#endif + } + + static void diff --git a/target/linux/rb532/patches-2.6.24/240-via_rhine_performance.patch b/target/linux/rb532/patches-2.6.24/240-via_rhine_performance.patch new file mode 100644 index 0000000000..d82b6f7055 --- /dev/null +++ b/target/linux/rb532/patches-2.6.24/240-via_rhine_performance.patch @@ -0,0 +1,100 @@ +Index: linux-2.6.23.17/drivers/net/via-rhine.c +=================================================================== +--- linux-2.6.23.17.orig/drivers/net/via-rhine.c ++++ linux-2.6.23.17/drivers/net/via-rhine.c +@@ -33,6 +33,8 @@ + #define DRV_VERSION "1.4.3" + #define DRV_RELDATE "2007-03-06" + ++#define PKT_ALIGN 1 ++ + + /* A few user-configurable values. + These may be modified when a driver module is loaded. */ +@@ -40,6 +42,7 @@ + static int debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */ + static int max_interrupt_work = 20; + ++#ifndef PKT_ALIGN + /* Set the copy breakpoint for the copy-only-tiny-frames scheme. + Setting to > 1518 effectively disables this feature. */ + #if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \ +@@ -49,6 +52,7 @@ static int rx_copybreak = 1518; + #else + static int rx_copybreak; + #endif ++#endif /* PKT_ALIGN */ + + /* Work-around for broken BIOSes: they are unable to get the chip back out of + power state D3 so PXE booting fails. bootparam(7): via-rhine.avoid_D3=1 */ +@@ -111,6 +115,7 @@ static const int multicast_filter_limit + #include + #include + #include ++#include + #include + + /* These identify the driver base version and may not be removed. */ +@@ -130,12 +135,14 @@ MODULE_LICENSE("GPL"); + + module_param(max_interrupt_work, int, 0); + module_param(debug, int, 0); +-module_param(rx_copybreak, int, 0); + module_param(avoid_D3, bool, 0); + MODULE_PARM_DESC(max_interrupt_work, "VIA Rhine maximum events handled per interrupt"); + MODULE_PARM_DESC(debug, "VIA Rhine debug level (0-7)"); +-MODULE_PARM_DESC(rx_copybreak, "VIA Rhine copy breakpoint for copy-only-tiny-frames"); + MODULE_PARM_DESC(avoid_D3, "Avoid power state D3 (work-around for broken BIOSes)"); ++#ifndef PKT_ALIGN ++module_param(rx_copybreak, int, 0); ++MODULE_PARM_DESC(rx_copybreak, "VIA Rhine copy breakpoint for copy-only-tiny-frames"); ++#endif + + /* + Theory of Operation +@@ -927,7 +934,7 @@ static void alloc_rbufs(struct net_devic + + /* Fill in the Rx buffers. Handle allocation failure gracefully. */ + for (i = 0; i < RX_RING_SIZE; i++) { +- struct sk_buff *skb = dev_alloc_skb(rp->rx_buf_sz); ++ struct sk_buff *skb = dev_alloc_skb(rp->rx_buf_sz + 4); + rp->rx_skbuff[i] = skb; + if (skb == NULL) + break; +@@ -1484,7 +1491,9 @@ static int rhine_rx(struct net_device *d + struct sk_buff *skb; + /* Length should omit the CRC */ + int pkt_len = data_size - 4; +- ++#ifdef PKT_ALIGN ++ int i; ++#else + /* Check if the packet is long enough to accept without + copying to a minimally-sized skbuff. */ + if (pkt_len < rx_copybreak && +@@ -1503,7 +1512,9 @@ static int rhine_rx(struct net_device *d + rp->rx_skbuff_dma[entry], + rp->rx_buf_sz, + PCI_DMA_FROMDEVICE); +- } else { ++ } else ++#endif ++ { + skb = rp->rx_skbuff[entry]; + if (skb == NULL) { + printk(KERN_ERR "%s: Inconsistent Rx " +@@ -1517,6 +1528,14 @@ static int rhine_rx(struct net_device *d + rp->rx_skbuff_dma[entry], + rp->rx_buf_sz, + PCI_DMA_FROMDEVICE); ++#ifdef PKT_ALIGN ++ /* align the data to the ip header - should be faster than copying the entire packet */ ++ for (i = pkt_len - (pkt_len % 4); i >= 0; i -= 4) { ++ put_unaligned(*((u32 *) (skb->data + i)), (u32 *) (skb->data + i + 2)); ++ } ++ skb->data += 2; ++ skb->tail += 2; ++#endif + } + skb->protocol = eth_type_trans(skb, dev); + #ifdef CONFIG_VIA_RHINE_NAPI diff --git a/target/linux/rb532/patches-2.6.24/510-rb500_led.patch b/target/linux/rb532/patches-2.6.24/510-rb500_led.patch new file mode 100644 index 0000000000..6cd7b1a1c5 --- /dev/null +++ b/target/linux/rb532/patches-2.6.24/510-rb500_led.patch @@ -0,0 +1,27 @@ +diff -urN linux-2.6.24.7/drivers/leds/Kconfig linux-2.6.24.7.new/drivers/leds/Kconfig +--- linux-2.6.24.7/drivers/leds/Kconfig 2008-07-15 15:27:55.000000000 +0200 ++++ linux-2.6.24.7.new/drivers/leds/Kconfig 2008-07-15 15:35:24.000000000 +0200 +@@ -120,6 +120,12 @@ + help + This option enables support for the CM-X270 LEDs. + ++config LEDS_RB500 ++ tristate "LED Support for RB5xx boards" ++ depends on LEDS_CLASS && MIKROTIK_RB500 ++ help ++ This option enables support for the yellow user LED on RB5xx boards. ++ + comment "LED Triggers" + + config LEDS_TRIGGERS +diff -urN linux-2.6.24.7/drivers/leds/Makefile linux-2.6.24.7.new/drivers/leds/Makefile +--- linux-2.6.24.7/drivers/leds/Makefile 2008-07-15 15:27:55.000000000 +0200 ++++ linux-2.6.24.7.new/drivers/leds/Makefile 2008-07-15 15:35:38.000000000 +0200 +@@ -20,6 +20,7 @@ + obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o + obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o + obj-$(CONFIG_LEDS_CM_X270) += leds-cm-x270.o ++obj-$(CONFIG_LEDS_RB500) += leds-rb500.o + + # LED Triggers + obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o diff --git a/target/linux/rb532/patches-2.6.24/520-rc32434_wdt.patch b/target/linux/rb532/patches-2.6.24/520-rc32434_wdt.patch new file mode 100644 index 0000000000..6e26237042 --- /dev/null +++ b/target/linux/rb532/patches-2.6.24/520-rc32434_wdt.patch @@ -0,0 +1,33 @@ +diff -urN linux-2.6.24.7/arch/mips/kernel/time.c linux-2.6.24.7.new/arch/mips/kernel/time.c +--- linux-2.6.24.7/arch/mips/kernel/time.c 2008-05-07 01:22:34.000000000 +0200 ++++ linux-2.6.24.7.new/arch/mips/kernel/time.c 2008-07-15 15:38:33.000000000 +0200 +@@ -75,6 +75,7 @@ + */ + + unsigned int mips_hpt_frequency; ++EXPORT_SYMBOL(mips_hpt_frequency); + + void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock) + { +diff -urN linux-2.6.24.7/drivers/watchdog/Kconfig linux-2.6.24.7.new/drivers/watchdog/Kconfig +--- linux-2.6.24.7/drivers/watchdog/Kconfig 2008-05-07 01:22:34.000000000 +0200 ++++ linux-2.6.24.7.new/drivers/watchdog/Kconfig 2008-07-15 15:39:24.000000000 +0200 +@@ -639,6 +639,18 @@ + help + Hardware driver for the TI AR7 Watchdog Timer. + ++config RC32434_WDT ++ tristate "IDT Interprise 79RC32434 SoC hardware watchdog" ++ depends on WATCHDOG && MIKROTIK_RB500 ++ help ++ This is a driver for hardware watchdog integrated in IDT Interprise ++ 79RC32434 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 rc32434_wdt. ++ + # PARISC Architecture + + # POWERPC Architecture diff --git a/target/linux/rb532/patches-2.6.24/530-no_panic_pci_iomap.patch b/target/linux/rb532/patches-2.6.24/530-no_panic_pci_iomap.patch new file mode 100644 index 0000000000..a37b190dfe --- /dev/null +++ b/target/linux/rb532/patches-2.6.24/530-no_panic_pci_iomap.patch @@ -0,0 +1,12 @@ +diff -urN linux-2.6.24.7/arch/mips/lib/iomap-pci.c linux-2.6.24.7.new/arch/mips/lib/iomap-pci.c +--- linux-2.6.24.7/arch/mips/lib/iomap-pci.c 2008-05-07 01:22:34.000000000 +0200 ++++ linux-2.6.24.7.new/arch/mips/lib/iomap-pci.c 2008-07-15 16:24:22.000000000 +0200 +@@ -32,7 +32,7 @@ + "report it to linux-mips@linux-mips.org or your " + "vendor.\n", name); + #ifdef CONFIG_PCI_DOMAINS +- panic("To avoid data corruption io_map_base MUST be set with " ++ printk(KERN_WARNING "To avoid data corruption io_map_base MUST be set with " + "multiple PCI domains."); + #endif + } -- cgit v1.2.3