From e05eeb7e75550200983378ed48db3a3a1bfe3d84 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 1 Jun 2009 08:11:37 +0000 Subject: [ar7] add experimental 2.6.30 support, boot tested git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16242 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar7/patches/100-board_support.patch | 86 ++++++++++++ target/linux/ar7/patches/110-flash.patch | 26 ++++ target/linux/ar7/patches/120-gpio_chrdev.patch | 28 ++++ target/linux/ar7/patches/130-vlynq.patch | 21 +++ .../linux/ar7/patches/150-cpmac_not_broken.patch | 11 ++ .../ar7/patches/160-vlynq-bus_id_removal.patch | 148 +++++++++++++++++++++ target/linux/ar7/patches/500-serial_kludge.patch | 40 ++++++ .../linux/ar7/patches/900-cpmac_multiqueue.patch | 70 ++++++++++ 8 files changed, 430 insertions(+) create mode 100644 target/linux/ar7/patches/100-board_support.patch create mode 100644 target/linux/ar7/patches/110-flash.patch create mode 100644 target/linux/ar7/patches/120-gpio_chrdev.patch create mode 100644 target/linux/ar7/patches/130-vlynq.patch create mode 100644 target/linux/ar7/patches/150-cpmac_not_broken.patch create mode 100644 target/linux/ar7/patches/160-vlynq-bus_id_removal.patch create mode 100644 target/linux/ar7/patches/500-serial_kludge.patch create mode 100644 target/linux/ar7/patches/900-cpmac_multiqueue.patch (limited to 'target/linux/ar7/patches') diff --git a/target/linux/ar7/patches/100-board_support.patch b/target/linux/ar7/patches/100-board_support.patch new file mode 100644 index 000000000..01fe965cd --- /dev/null +++ b/target/linux/ar7/patches/100-board_support.patch @@ -0,0 +1,86 @@ +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -19,6 +19,24 @@ choice + prompt "System type" + default SGI_IP22 + ++config AR7 ++ bool "Texas Instruments AR7" ++ select BOOT_ELF32 ++ select DMA_NONCOHERENT ++ select CEVT_R4K ++ select CSRC_R4K ++ 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" + +--- a/arch/mips/kernel/traps.c ++++ b/arch/mips/kernel/traps.c +@@ -1256,9 +1256,22 @@ void *set_except_vector(int n, void *add + + exception_handlers[n] = handler; + if (n == 0 && cpu_has_divec) { +- *(u32 *)(ebase + 0x200) = 0x08000000 | +- (0x03ffffff & (handler >> 2)); +- local_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 { ++ *(u32 *)(ebase + 0x200) = ++ 0x08000000 | (0x03ffffff & (handler >> 2)); ++ flush_icache_range(ebase + 0x200, ebase + 0x204); ++ } + } + return (void *)old_handler; + } +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile +@@ -181,6 +181,13 @@ libs-$(CONFIG_SIBYTE_CFE) += arch/mips/s + # + + # ++# 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/ +--- a/arch/mips/include/asm/page.h ++++ b/arch/mips/include/asm/page.h +@@ -185,8 +185,10 @@ typedef struct { unsigned long pgprot; } + #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 + #include diff --git a/target/linux/ar7/patches/110-flash.patch b/target/linux/ar7/patches/110-flash.patch new file mode 100644 index 000000000..975eb8368 --- /dev/null +++ b/target/linux/ar7/patches/110-flash.patch @@ -0,0 +1,26 @@ +--- a/drivers/mtd/Kconfig ++++ b/drivers/mtd/Kconfig +@@ -196,6 +196,12 @@ config MTD_MYLOADER_PARTS + You will still need the parsing functions to be called by the driver + for your particular device. It won't happen automatically. + ++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 +--- a/drivers/mtd/maps/physmap.c ++++ b/drivers/mtd/maps/physmap.c +@@ -80,7 +80,7 @@ static const char *rom_probe_types[] = { + "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/120-gpio_chrdev.patch b/target/linux/ar7/patches/120-gpio_chrdev.patch new file mode 100644 index 000000000..fa61e5ccf --- /dev/null +++ b/target/linux/ar7/patches/120-gpio_chrdev.patch @@ -0,0 +1,28 @@ +--- a/drivers/char/Kconfig ++++ b/drivers/char/Kconfig +@@ -974,6 +974,15 @@ config MWAVE + 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 +--- a/drivers/char/Makefile ++++ b/drivers/char/Makefile +@@ -90,6 +90,7 @@ obj-$(CONFIG_HW_RANDOM) += hw_random/ + 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/130-vlynq.patch b/target/linux/ar7/patches/130-vlynq.patch new file mode 100644 index 000000000..12eb53846 --- /dev/null +++ b/target/linux/ar7/patches/130-vlynq.patch @@ -0,0 +1,21 @@ +--- a/drivers/Kconfig ++++ b/drivers/Kconfig +@@ -104,6 +104,8 @@ source "drivers/auxdisplay/Kconfig" + + source "drivers/uio/Kconfig" + ++source "drivers/vlynq/Kconfig" ++ + source "drivers/xen/Kconfig" + + source "drivers/staging/Kconfig" +--- a/drivers/Makefile ++++ b/drivers/Makefile +@@ -103,6 +103,7 @@ 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/ + obj-$(CONFIG_STAGING) += staging/ diff --git a/target/linux/ar7/patches/150-cpmac_not_broken.patch b/target/linux/ar7/patches/150-cpmac_not_broken.patch new file mode 100644 index 000000000..0c8a20d45 --- /dev/null +++ b/target/linux/ar7/patches/150-cpmac_not_broken.patch @@ -0,0 +1,11 @@ +--- a/drivers/net/Kconfig ++++ b/drivers/net/Kconfig +@@ -1883,7 +1883,7 @@ config SC92031 + + config CPMAC + tristate "TI AR7 CPMAC Ethernet support (EXPERIMENTAL)" +- depends on NET_ETHERNET && EXPERIMENTAL && AR7 && BROKEN ++ depends on NET_ETHERNET && EXPERIMENTAL && AR7 + select PHYLIB + help + TI AR7 CPMAC Ethernet support diff --git a/target/linux/ar7/patches/160-vlynq-bus_id_removal.patch b/target/linux/ar7/patches/160-vlynq-bus_id_removal.patch new file mode 100644 index 000000000..c40837030 --- /dev/null +++ b/target/linux/ar7/patches/160-vlynq-bus_id_removal.patch @@ -0,0 +1,148 @@ +--- a/drivers/vlynq/vlynq.c 2009-05-31 20:41:57.000000000 +0200 ++++ b/drivers/vlynq/vlynq.c 2009-05-31 22:06:36.000000000 +0200 +@@ -82,6 +82,7 @@ + static void vlynq_dump_regs(struct vlynq_device *dev) + { + int i; ++ + printk(KERN_DEBUG "VLYNQ local=%p remote=%p\n", + dev->local, dev->remote); + for (i = 0; i < 32; i++) { +@@ -95,6 +96,7 @@ + static void vlynq_dump_mem(u32 *base, int count) + { + int i; ++ + for (i = 0; i < (count + 3) / 4; i++) { + if (i % 4 == 0) printk(KERN_DEBUG "\nMEM[0x%04x]:", i * 4); + printk(KERN_DEBUG " 0x%08x", *(base + i)); +@@ -194,20 +196,24 @@ + static void vlynq_local_ack(unsigned int irq) + { + struct vlynq_device *dev = get_irq_chip_data(irq); ++ + u32 status = vlynq_reg_read(dev->local->status); ++ + if (printk_ratelimit()) + printk(KERN_DEBUG "%s: local status: 0x%08x\n", +- dev->dev.bus_id, status); ++ dev_name(&dev->dev), status); + vlynq_reg_write(dev->local->status, status); + } + + static void vlynq_remote_ack(unsigned int irq) + { + struct vlynq_device *dev = get_irq_chip_data(irq); ++ + u32 status = vlynq_reg_read(dev->remote->status); ++ + if (printk_ratelimit()) + printk(KERN_DEBUG "%s: remote status: 0x%08x\n", +- dev->dev.bus_id, status); ++ dev_name(&dev->dev), status); + vlynq_reg_write(dev->remote->status, status); + } + +@@ -262,7 +268,7 @@ + if (dev->local_irq == dev->remote_irq) { + printk(KERN_ERR + "%s: local vlynq irq should be different from remote\n", +- dev->dev.bus_id); ++ dev_name(&dev->dev)); + return -EINVAL; + } + +@@ -304,7 +310,7 @@ + } + + if (request_irq(dev->irq, vlynq_irq, IRQF_SHARED, "vlynq", dev)) { +- printk(KERN_ERR "%s: request_irq failed\n", dev->dev.bus_id); ++ printk(KERN_ERR "%s: request_irq failed\n", dev_name(&dev->dev)); + return -EAGAIN; + } + +@@ -403,7 +409,7 @@ + if (vlynq_linked(dev)) { + printk(KERN_DEBUG + "%s: using remote clock divisor %d\n", +- dev->dev.bus_id, i - vlynq_rdiv1 + 1); ++ dev_name(&dev->dev), i - vlynq_rdiv1 + 1); + dev->divisor = i; + return 0; + } else { +@@ -433,7 +439,7 @@ + if (vlynq_linked(dev)) { + printk(KERN_DEBUG + "%s: using local clock divisor %d\n", +- dev->dev.bus_id, i - vlynq_ldiv1 + 1); ++ dev_name(&dev->dev), i - vlynq_ldiv1 + 1); + dev->divisor = i; + return 0; + } else { +@@ -460,7 +466,7 @@ + + if (vlynq_linked(dev)) { + printk(KERN_DEBUG "%s: using external clock\n", +- dev->dev.bus_id); ++ dev_name(&dev->dev)); + dev->divisor = vlynq_div_external; + return 0; + } +@@ -507,7 +513,7 @@ + if (vlynq_linked(dev)) { + printk(KERN_DEBUG + "%s: using local clock divisor %d\n", +- dev->dev.bus_id, dev->divisor - vlynq_ldiv1 + 1); ++ dev_name(&dev->dev), dev->divisor - vlynq_ldiv1 + 1); + return 0; + } + break; +@@ -521,7 +527,7 @@ + if (vlynq_linked(dev)) { + printk(KERN_DEBUG + "%s: using remote clock divisor %d\n", +- dev->dev.bus_id, dev->divisor - vlynq_rdiv1 + 1); ++ dev_name(&dev->dev), dev->divisor - vlynq_rdiv1 + 1); + return 0; + } + break; +@@ -662,8 +668,7 @@ + dev->id = pdev->id; + dev->dev.bus = &vlynq_bus_type; + dev->dev.parent = &pdev->dev; +- snprintf(dev->dev.bus_id, BUS_ID_SIZE, "vlynq%d", dev->id); +- dev->dev.bus_id[BUS_ID_SIZE - 1] = 0; ++ dev_set_name(&dev->dev, "vlynq%d", dev->id); + dev->dev.platform_data = pdev->dev.platform_data; + dev->dev.release = vlynq_device_release; + +@@ -673,9 +678,9 @@ + dev->mem_end = mem_res->end; + + len = regs_res->end - regs_res->start; +- if (!request_mem_region(regs_res->start, len, dev->dev.bus_id)) { ++ if (!request_mem_region(regs_res->start, len, dev_name(&dev->dev))) { + printk(KERN_ERR "%s: Can't request vlynq registers\n", +- dev->dev.bus_id); ++ dev_name(&dev->dev)); + result = -ENXIO; + goto fail_request; + } +@@ -683,7 +688,7 @@ + dev->local = ioremap(regs_res->start, len); + if (!dev->local) { + printk(KERN_ERR "%s: Can't remap vlynq registers\n", +- dev->dev.bus_id); ++ dev_name(&dev->dev)); + result = -ENXIO; + goto fail_remap; + } +@@ -702,7 +707,7 @@ + platform_set_drvdata(pdev, dev); + + printk(KERN_INFO "%s: regs 0x%p, irq %d, mem 0x%p\n", +- dev->dev.bus_id, (void *)dev->regs_start, dev->irq, ++ dev_name(&dev->dev), (void *)dev->regs_start, dev->irq, + (void *)dev->mem_start); + + dev->dev_id = 0; diff --git a/target/linux/ar7/patches/500-serial_kludge.patch b/target/linux/ar7/patches/500-serial_kludge.patch new file mode 100644 index 000000000..cc4e424ec --- /dev/null +++ b/target/linux/ar7/patches/500-serial_kludge.patch @@ -0,0 +1,40 @@ +--- a/drivers/serial/8250.c ++++ b/drivers/serial/8250.c +@@ -286,6 +286,13 @@ static const struct serial8250_config ua + .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) +@@ -2687,7 +2694,11 @@ static void serial8250_console_putchar(s + { + 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); + } + +--- a/include/linux/serial_core.h ++++ b/include/linux/serial_core.h +@@ -41,7 +41,8 @@ + #define PORT_XSCALE 15 + #define PORT_RM9000 16 /* PMC-Sierra RM9xxx internal UART */ + #define PORT_OCTEON 17 /* Cavium OCTEON internal UART */ +-#define PORT_MAX_8250 17 /* max port ID */ ++#define PORT_AR7 18 /* TI AR7 internal UART */ ++#define PORT_MAX_8250 18 /* max port ID */ + + /* + * ARM specific type numbers. These are not currently guaranteed diff --git a/target/linux/ar7/patches/900-cpmac_multiqueue.patch b/target/linux/ar7/patches/900-cpmac_multiqueue.patch new file mode 100644 index 000000000..3df3d6832 --- /dev/null +++ b/target/linux/ar7/patches/900-cpmac_multiqueue.patch @@ -0,0 +1,70 @@ +This patch fixes the network driver cpmac.c for compilation with +configuration option CONFIG_NETDEVICES_MULTIQUEUE. + +These compiler warnings are fixed by the patch: +drivers/net/cpmac.c: In function 'cpmac_end_xmit': +drivers/net/cpmac.c:630: warning: passing argument 2 of 'netif_subqueue_stopped' makes pointer from integer without a cast +drivers/net/cpmac.c:641: warning: passing argument 2 of 'netif_subqueue_stopped' makes pointer from integer without a cast +drivers/net/cpmac.c: In function 'cpmac_probe': +drivers/net/cpmac.c:1128: warning: unused variable 'i' + +During runtime, the unpatched driver raises a fatal runtime exception. +This is fixed by calling __netif_subqueue_stopped instead +of netif_subqueue_stopped, too. + +Two additional code parts were modified for CONFIG_NETDEVICES_MULTIQUEUE +because other drivers do it in the same way. + + Signed-off-by: Stefan Weil + +--- a/drivers/net/cpmac.c ++++ b/drivers/net/cpmac.c +@@ -615,13 +615,13 @@ static void cpmac_end_xmit(struct net_de + + dev_kfree_skb_irq(desc->skb); + desc->skb = NULL; +- if (netif_subqueue_stopped(dev, queue)) ++ if (__netif_subqueue_stopped(dev, queue)) + netif_wake_subqueue(dev, queue); + } else { + if (netif_msg_tx_err(priv) && net_ratelimit()) + printk(KERN_WARNING + "%s: end_xmit: spurious interrupt\n", dev->name); +- if (netif_subqueue_stopped(dev, queue)) ++ if (__netif_subqueue_stopped(dev, queue)) + netif_wake_subqueue(dev, queue); + } + } +@@ -731,7 +731,6 @@ static void cpmac_clear_tx(struct net_de + + static void cpmac_hw_error(struct work_struct *work) + { +- int i; + struct cpmac_priv *priv = + container_of(work, struct cpmac_priv, reset_work); + +@@ -818,7 +817,6 @@ static irqreturn_t cpmac_irq(int irq, vo + + static void cpmac_tx_timeout(struct net_device *dev) + { +- int i; + struct cpmac_priv *priv = netdev_priv(dev); + + spin_lock(&priv->lock); +@@ -1097,7 +1095,7 @@ static int external_switch; + + static int __devinit cpmac_probe(struct platform_device *pdev) + { +- int rc, phy_id, i; ++ int rc, phy_id; + char *mdio_bus_id = "0"; + struct resource *mem; + struct cpmac_priv *priv; +@@ -1125,6 +1123,7 @@ static int __devinit cpmac_probe(struct + } + + dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES); ++ //~ dev = alloc_etherdev(sizeof(*priv)); + + if (!dev) { + printk(KERN_ERR "cpmac: Unable to allocate net_device\n"); -- cgit v1.2.3