| 1 | --- a/arch/arm/mach-ixp4xx/Kconfig |
| 2 | +++ b/arch/arm/mach-ixp4xx/Kconfig |
| 3 | @@ -164,6 +164,14 @@ config ARCH_PRPMC1100 |
| 4 | PrPCM1100 Processor Mezanine Module. For more information on |
| 5 | this platform, see <file:Documentation/arm/IXP4xx>. |
| 6 | |
| 7 | +config MACH_TW5334 |
| 8 | + bool "Titan Wireless TW-533-4" |
| 9 | + select PCI |
| 10 | + help |
| 11 | + Say 'Y' here if you want your kernel to support the Titan |
| 12 | + Wireless TW533-4. For more information on this platform, |
| 13 | + see http://openwrt.org |
| 14 | + |
| 15 | config MACH_NAS100D |
| 16 | bool |
| 17 | prompt "NAS100D" |
| 18 | --- a/arch/arm/mach-ixp4xx/Makefile |
| 19 | +++ b/arch/arm/mach-ixp4xx/Makefile |
| 20 | @@ -23,6 +23,7 @@ obj-pci-$(CONFIG_MACH_SIDEWINDER) += sid |
| 21 | obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o |
| 22 | obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o |
| 23 | obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o |
| 24 | +obj-pci-$(CONFIG_MACH_TW5334) += tw5334-pci.o |
| 25 | |
| 26 | obj-y += common.o |
| 27 | |
| 28 | @@ -45,6 +46,7 @@ obj-$(CONFIG_MACH_SIDEWINDER) += sidewin |
| 29 | obj-$(CONFIG_MACH_COMPEX) += compex-setup.o |
| 30 | obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o |
| 31 | obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o |
| 32 | +obj-$(CONFIG_MACH_TW5334) += tw5334-setup.o |
| 33 | |
| 34 | obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o |
| 35 | obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o |
| 36 | --- /dev/null |
| 37 | +++ b/arch/arm/mach-ixp4xx/tw5334-setup.c |
| 38 | @@ -0,0 +1,161 @@ |
| 39 | +/* |
| 40 | + * arch/arm/mach-ixp4xx/tw5334-setup.c |
| 41 | + * |
| 42 | + * Board setup for the Titan Wireless TW-533-4 |
| 43 | + * |
| 44 | + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> |
| 45 | + * |
| 46 | + * based on coyote-setup.c: |
| 47 | + * Copyright (C) 2003-2005 MontaVista Software, Inc. |
| 48 | + * |
| 49 | + * Author: Imre Kaloz <Kaloz@openwrt.org> |
| 50 | + */ |
| 51 | + |
| 52 | +#include <linux/if_ether.h> |
| 53 | +#include <linux/kernel.h> |
| 54 | +#include <linux/init.h> |
| 55 | +#include <linux/device.h> |
| 56 | +#include <linux/serial.h> |
| 57 | +#include <linux/tty.h> |
| 58 | +#include <linux/serial_8250.h> |
| 59 | +#include <linux/slab.h> |
| 60 | + |
| 61 | +#include <asm/types.h> |
| 62 | +#include <asm/setup.h> |
| 63 | +#include <asm/memory.h> |
| 64 | +#include <mach/hardware.h> |
| 65 | +#include <asm/irq.h> |
| 66 | +#include <asm/mach-types.h> |
| 67 | +#include <asm/mach/arch.h> |
| 68 | +#include <asm/mach/flash.h> |
| 69 | + |
| 70 | +static struct flash_platform_data tw5334_flash_data = { |
| 71 | + .map_name = "cfi_probe", |
| 72 | + .width = 2, |
| 73 | +}; |
| 74 | + |
| 75 | +static struct resource tw5334_flash_resource = { |
| 76 | + .flags = IORESOURCE_MEM, |
| 77 | +}; |
| 78 | + |
| 79 | +static struct platform_device tw5334_flash = { |
| 80 | + .name = "IXP4XX-Flash", |
| 81 | + .id = 0, |
| 82 | + .dev = { |
| 83 | + .platform_data = &tw5334_flash_data, |
| 84 | + }, |
| 85 | + .num_resources = 1, |
| 86 | + .resource = &tw5334_flash_resource, |
| 87 | +}; |
| 88 | + |
| 89 | +static struct resource tw5334_uart_resource = { |
| 90 | + .start = IXP4XX_UART2_BASE_PHYS, |
| 91 | + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, |
| 92 | + .flags = IORESOURCE_MEM, |
| 93 | +}; |
| 94 | + |
| 95 | +static struct plat_serial8250_port tw5334_uart_data[] = { |
| 96 | + { |
| 97 | + .mapbase = IXP4XX_UART2_BASE_PHYS, |
| 98 | + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, |
| 99 | + .irq = IRQ_IXP4XX_UART2, |
| 100 | + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, |
| 101 | + .iotype = UPIO_MEM, |
| 102 | + .regshift = 2, |
| 103 | + .uartclk = IXP4XX_UART_XTAL, |
| 104 | + }, |
| 105 | + { }, |
| 106 | +}; |
| 107 | + |
| 108 | +static struct platform_device tw5334_uart = { |
| 109 | + .name = "serial8250", |
| 110 | + .id = PLAT8250_DEV_PLATFORM, |
| 111 | + .dev = { |
| 112 | + .platform_data = tw5334_uart_data, |
| 113 | + }, |
| 114 | + .num_resources = 1, |
| 115 | + .resource = &tw5334_uart_resource, |
| 116 | +}; |
| 117 | + |
| 118 | +/* Built-in 10/100 Ethernet MAC interfaces */ |
| 119 | +static struct eth_plat_info tw5334_plat_eth[] = { |
| 120 | + { |
| 121 | + .phy = 0, |
| 122 | + .rxq = 3, |
| 123 | + .txreadyq = 20, |
| 124 | + }, { |
| 125 | + .phy = 1, |
| 126 | + .rxq = 4, |
| 127 | + .txreadyq = 21, |
| 128 | + } |
| 129 | +}; |
| 130 | + |
| 131 | +static struct platform_device tw5334_eth[] = { |
| 132 | + { |
| 133 | + .name = "ixp4xx_eth", |
| 134 | + .id = IXP4XX_ETH_NPEB, |
| 135 | + .dev.platform_data = tw5334_plat_eth, |
| 136 | + }, { |
| 137 | + .name = "ixp4xx_eth", |
| 138 | + .id = IXP4XX_ETH_NPEC, |
| 139 | + .dev.platform_data = tw5334_plat_eth + 1, |
| 140 | + } |
| 141 | +}; |
| 142 | + |
| 143 | +static struct platform_device *tw5334_devices[] __initdata = { |
| 144 | + &tw5334_flash, |
| 145 | + &tw5334_uart, |
| 146 | + &tw5334_eth[0], |
| 147 | + &tw5334_eth[1], |
| 148 | +}; |
| 149 | + |
| 150 | +static void __init tw5334_init(void) |
| 151 | +{ |
| 152 | + uint8_t __iomem *f; |
| 153 | + int i; |
| 154 | + |
| 155 | + ixp4xx_sys_init(); |
| 156 | + |
| 157 | + tw5334_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); |
| 158 | + tw5334_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; |
| 159 | + |
| 160 | + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; |
| 161 | + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; |
| 162 | + |
| 163 | + platform_add_devices(tw5334_devices, ARRAY_SIZE(tw5334_devices)); |
| 164 | + |
| 165 | + /* |
| 166 | + * Map in a portion of the flash and read the MAC addresses. |
| 167 | + * Since it is stored in BE in the flash itself, we need to |
| 168 | + * byteswap it if we're in LE mode. |
| 169 | + */ |
| 170 | + f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x1000000); |
| 171 | + if (f) { |
| 172 | + for (i = 0; i < 6; i++) { |
| 173 | +#ifdef __ARMEB__ |
| 174 | + tw5334_plat_eth[0].hwaddr[i] = readb(f + 0xFC0422 + i); |
| 175 | + tw5334_plat_eth[1].hwaddr[i] = readb(f + 0xFC043B + i); |
| 176 | +#else |
| 177 | + tw5334_plat_eth[0].hwaddr[i] = readb(f + 0xFC0422 + (i^3)); |
| 178 | + tw5334_plat_eth[1].hwaddr[i] = readb(f + 0xFC043B + (i^3)); |
| 179 | +#endif |
| 180 | + } |
| 181 | + iounmap(f); |
| 182 | + } |
| 183 | + |
| 184 | + printk(KERN_INFO "TW-533-4: Using MAC address %pM for port 0\n", |
| 185 | + tw5334_plat_eth[0].hwaddr); |
| 186 | + printk(KERN_INFO "TW-533-4: Using MAC address %pM for port 1\n", |
| 187 | + tw5334_plat_eth[1].hwaddr); |
| 188 | +} |
| 189 | + |
| 190 | +#ifdef CONFIG_MACH_TW5334 |
| 191 | +MACHINE_START(TW5334, "Titan Wireless TW-533-4") |
| 192 | + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ |
| 193 | + .map_io = ixp4xx_map_io, |
| 194 | + .init_irq = ixp4xx_init_irq, |
| 195 | + .timer = &ixp4xx_timer, |
| 196 | + .boot_params = 0x0100, |
| 197 | + .init_machine = tw5334_init, |
| 198 | +MACHINE_END |
| 199 | +#endif |
| 200 | --- /dev/null |
| 201 | +++ b/arch/arm/mach-ixp4xx/tw5334-pci.c |
| 202 | @@ -0,0 +1,69 @@ |
| 203 | +/* |
| 204 | + * arch/arch/mach-ixp4xx/tw5334-pci.c |
| 205 | + * |
| 206 | + * PCI setup routines for the Titan Wireless TW-533-4 |
| 207 | + * |
| 208 | + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> |
| 209 | + * |
| 210 | + * based on coyote-pci.c: |
| 211 | + * Copyright (C) 2002 Jungo Software Technologies. |
| 212 | + * Copyright (C) 2003 MontaVista Softwrae, Inc. |
| 213 | + * |
| 214 | + * Maintainer: Imre Kaloz <kaloz@openwrt.org> |
| 215 | + * |
| 216 | + * This program is free software; you can redistribute it and/or modify |
| 217 | + * it under the terms of the GNU General Public License version 2 as |
| 218 | + * published by the Free Software Foundation. |
| 219 | + * |
| 220 | + */ |
| 221 | + |
| 222 | +#include <linux/kernel.h> |
| 223 | +#include <linux/pci.h> |
| 224 | +#include <linux/init.h> |
| 225 | +#include <linux/irq.h> |
| 226 | + |
| 227 | +#include <asm/mach-types.h> |
| 228 | +#include <mach/hardware.h> |
| 229 | + |
| 230 | +#include <asm/mach/pci.h> |
| 231 | + |
| 232 | +void __init tw5334_pci_preinit(void) |
| 233 | +{ |
| 234 | + set_irq_type(IRQ_IXP4XX_GPIO6, IRQ_TYPE_LEVEL_LOW); |
| 235 | + set_irq_type(IRQ_IXP4XX_GPIO2, IRQ_TYPE_LEVEL_LOW); |
| 236 | + set_irq_type(IRQ_IXP4XX_GPIO1, IRQ_TYPE_LEVEL_LOW); |
| 237 | + set_irq_type(IRQ_IXP4XX_GPIO0, IRQ_TYPE_LEVEL_LOW); |
| 238 | + |
| 239 | + ixp4xx_pci_preinit(); |
| 240 | +} |
| 241 | + |
| 242 | +static int __init tw5334_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |
| 243 | +{ |
| 244 | + if (slot == 12) |
| 245 | + return IRQ_IXP4XX_GPIO6; |
| 246 | + else if (slot == 13) |
| 247 | + return IRQ_IXP4XX_GPIO2; |
| 248 | + else if (slot == 14) |
| 249 | + return IRQ_IXP4XX_GPIO1; |
| 250 | + else if (slot == 15) |
| 251 | + return IRQ_IXP4XX_GPIO0; |
| 252 | + else return -1; |
| 253 | +} |
| 254 | + |
| 255 | +struct hw_pci tw5334_pci __initdata = { |
| 256 | + .nr_controllers = 1, |
| 257 | + .preinit = tw5334_pci_preinit, |
| 258 | + .swizzle = pci_std_swizzle, |
| 259 | + .setup = ixp4xx_setup, |
| 260 | + .scan = ixp4xx_scan_bus, |
| 261 | + .map_irq = tw5334_map_irq, |
| 262 | +}; |
| 263 | + |
| 264 | +int __init tw5334_pci_init(void) |
| 265 | +{ |
| 266 | + if (machine_is_tw5334()) |
| 267 | + pci_common_init(&tw5334_pci); |
| 268 | + return 0; |
| 269 | +} |
| 270 | + |
| 271 | +subsys_initcall(tw5334_pci_init); |
| 272 | --- a/arch/arm/mach-ixp4xx/include/mach/uncompress.h |
| 273 | +++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h |
| 274 | @@ -42,7 +42,8 @@ static __inline__ void __arch_decomp_set |
| 275 | */ |
| 276 | if (machine_is_adi_coyote() || machine_is_gtwx5715() || |
| 277 | machine_is_gateway7001() || machine_is_wg302v2() || |
| 278 | - machine_is_pronghorn() || machine_is_pronghorn_metro() || machine_is_wrt300nv2()) |
| 279 | + machine_is_pronghorn() || machine_is_pronghorn_metro() || machine_is_wrt300nv2() || |
| 280 | + machine_is_tw5334()) |
| 281 | uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; |
| 282 | else |
| 283 | uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; |
| 284 | |