1 --- a/arch/arm/mach-ixp4xx/Kconfig
2 +++ b/arch/arm/mach-ixp4xx/Kconfig
3 @@ -180,6 +180,15 @@ config ARCH_PRPMC1100
4 PrPCM1100 Processor Mezanine Module. For more information on
5 this platform, see <file:Documentation/arm/IXP4xx>.
8 + bool "Titan Wireless TW-266-2"
11 + Say 'Y' here if you want your kernel to support the Titan
12 + Wireless TW266-2. For more information on this platform,
13 + see http://openwrt.org
17 bool "Titan Wireless TW-533-4"
19 --- a/arch/arm/mach-ixp4xx/Makefile
20 +++ b/arch/arm/mach-ixp4xx/Makefile
21 @@ -24,6 +24,7 @@ obj-pci-$(CONFIG_MACH_SIDEWINDER) += sid
22 obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o
23 obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o
24 obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o
25 +obj-pci-$(CONFIG_MACH_TW2662) += tw2662-pci.o
26 obj-pci-$(CONFIG_MACH_TW5334) += tw5334-pci.o
27 obj-pci-$(CONFIG_MACH_MI424WR) += mi424wr-pci.o
28 obj-pci-$(CONFIG_MACH_USR8200) += usr8200-pci.o
29 @@ -50,6 +51,7 @@ obj-$(CONFIG_MACH_SIDEWINDER) += sidewin
30 obj-$(CONFIG_MACH_COMPEX) += compex-setup.o
31 obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o
32 obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o
33 +obj-$(CONFIG_MACH_TW2662) += tw2662-setup.o
34 obj-$(CONFIG_MACH_TW5334) += tw5334-setup.o
35 obj-$(CONFIG_MACH_MI424WR) += mi424wr-setup.o
36 obj-$(CONFIG_MACH_USR8200) += usr8200-setup.o
37 --- a/arch/arm/mach-ixp4xx/include/mach/uncompress.h
38 +++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h
39 @@ -43,7 +43,7 @@ static __inline__ void __arch_decomp_set
40 if (machine_is_adi_coyote() || machine_is_gtwx5715() ||
41 machine_is_gateway7001() || machine_is_wg302v2() ||
42 machine_is_pronghorn() || machine_is_pronghorn_metro() || machine_is_wrt300nv2() ||
43 - machine_is_tw5334() || machine_is_usr8200())
44 + machine_is_tw5334() || machine_is_usr8200() || machine_is_tw2662())
45 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
47 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;
49 +++ b/arch/arm/mach-ixp4xx/tw2662-pci.c
52 + * arch/arm/mach-ixp4xx/tw2662-pci.c
54 + * PCI setup routines for Tiran Wireless TW-266-2 platform
56 + * Copyright (C) 2002 Jungo Software Technologies.
57 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
58 + * Copyright (C) 2010 Alexandros C. Couloumbis <alex@ozo.com>
59 + * Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
61 + * Maintainer: Deepak Saxena <dsaxena@mvista.com>
62 + * Maintainer: Alexandros C. Couloumbis <alex@ozo.com>
64 + * This program is free software; you can redistribute it and/or modify
65 + * it under the terms of the GNU General Public License version 2 as
66 + * published by the Free Software Foundation.
70 +#include <linux/kernel.h>
71 +#include <linux/pci.h>
72 +#include <linux/init.h>
73 +#include <linux/irq.h>
74 +#include <asm/mach-types.h>
75 +#include <mach/hardware.h>
77 +#include <asm/mach/pci.h>
79 +#define SLOT0_DEVID 1
80 +#define SLOT1_DEVID 3
82 +/* PCI controller GPIO to IRQ pin mappings */
83 +#define SLOT0_INTA 11
86 +void __init tw2662_pci_preinit(void)
88 + irq_set_irq_type(IXP4XX_GPIO_IRQ(SLOT0_INTA), IRQ_TYPE_LEVEL_LOW);
89 + irq_set_irq_type(IXP4XX_GPIO_IRQ(SLOT1_INTA), IRQ_TYPE_LEVEL_LOW);
90 + ixp4xx_pci_preinit();
93 +static int __init tw2662_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
95 + if (slot == SLOT0_DEVID)
96 + return IXP4XX_GPIO_IRQ(SLOT0_INTA);
97 + else if (slot == SLOT1_DEVID)
98 + return IXP4XX_GPIO_IRQ(SLOT1_INTA);
102 +struct hw_pci tw2662_pci __initdata = {
103 + .nr_controllers = 1,
104 + .preinit = tw2662_pci_preinit,
105 + .swizzle = pci_std_swizzle,
106 + .setup = ixp4xx_setup,
107 + .scan = ixp4xx_scan_bus,
108 + .map_irq = tw2662_map_irq,
111 +int __init tw2662_pci_init(void)
113 + if (machine_is_tw2662())
114 + pci_common_init(&tw2662_pci);
118 +subsys_initcall(tw2662_pci_init);
120 +++ b/arch/arm/mach-ixp4xx/tw2662-setup.c
123 + * arch/arm/mach-ixp4xx/tw2662-setup.c
125 + * Titan Wireless TW-266-2
127 + * Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
128 + * Copyright (C) 2010 Alexandros C. Couloumbis <alex@ozo.com>
130 + * based on ap1000-setup.c:
131 + * Author: Imre Kaloz <Kaloz@openwrt.org>
134 +#include <linux/if_ether.h>
135 +#include <linux/kernel.h>
136 +#include <linux/init.h>
137 +#include <linux/device.h>
138 +#include <linux/serial.h>
139 +#include <linux/tty.h>
140 +#include <linux/serial_8250.h>
141 +#include <linux/slab.h>
142 +#include <linux/netdevice.h>
143 +#include <linux/etherdevice.h>
144 +#include <linux/platform_device.h>
147 +#include <asm/types.h>
148 +#include <asm/setup.h>
149 +#include <asm/memory.h>
150 +#include <mach/hardware.h>
151 +#include <asm/mach-types.h>
152 +#include <asm/irq.h>
153 +#include <asm/mach/arch.h>
154 +#include <asm/mach/flash.h>
156 +/* gpio mask used by platform device */
157 +#define TW2662_GPIO_MASK (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7)
159 +static struct flash_platform_data tw2662_flash_data = {
160 + .map_name = "cfi_probe",
164 +static struct resource tw2662_flash_resource = {
165 + .flags = IORESOURCE_MEM,
168 +static struct platform_device tw2662_flash = {
169 + .name = "IXP4XX-Flash",
172 + .platform_data = &tw2662_flash_data,
174 + .num_resources = 1,
175 + .resource = &tw2662_flash_resource,
178 +static struct resource tw2662_gpio_resources[] = {
181 + /* FIXME: gpio mask should be model specific */
182 + .start = TW2662_GPIO_MASK,
183 + .end = TW2662_GPIO_MASK,
188 +static struct platform_device tw2662_gpio = {
191 + .num_resources = ARRAY_SIZE(tw2662_gpio_resources),
192 + .resource = tw2662_gpio_resources,
195 +static struct resource tw2662_uart_resources[] = {
197 + .start = IXP4XX_UART1_BASE_PHYS,
198 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
199 + .flags = IORESOURCE_MEM
202 + .start = IXP4XX_UART2_BASE_PHYS,
203 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
204 + .flags = IORESOURCE_MEM
208 +static struct plat_serial8250_port tw2662_uart_data[] = {
210 + .mapbase = IXP4XX_UART1_BASE_PHYS,
211 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
212 + .irq = IRQ_IXP4XX_UART1,
213 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
214 + .iotype = UPIO_MEM,
216 + .uartclk = IXP4XX_UART_XTAL,
219 + .mapbase = IXP4XX_UART2_BASE_PHYS,
220 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
221 + .irq = IRQ_IXP4XX_UART2,
222 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
223 + .iotype = UPIO_MEM,
225 + .uartclk = IXP4XX_UART_XTAL,
230 +static struct platform_device tw2662_uart = {
231 + .name = "serial8250",
232 + .id = PLAT8250_DEV_PLATFORM,
233 + .dev.platform_data = tw2662_uart_data,
234 + .num_resources = 2,
235 + .resource = tw2662_uart_resources
238 +/* Built-in 10/100 Ethernet MAC interfaces */
239 +static struct eth_plat_info tw2662_plat_eth[] = {
251 +static struct platform_device tw2662_eth[] = {
253 + .name = "ixp4xx_eth",
254 + .id = IXP4XX_ETH_NPEB,
255 + .dev.platform_data = tw2662_plat_eth,
257 + .name = "ixp4xx_eth",
258 + .id = IXP4XX_ETH_NPEC,
259 + .dev.platform_data = tw2662_plat_eth + 1,
264 +static struct platform_device *tw2662_devices[] __initdata = {
272 +static char tw2662_mem_fixup[] __initdata = "mem=64M ";
274 +static void __init tw2662_fixup(struct machine_desc *desc,
275 + struct tag *tags, char **cmdline, struct meminfo *mi)
278 + struct tag *t = tags;
279 + char *p = *cmdline;
281 + /* Find the end of the tags table, taking note of any cmdline tag. */
282 + for (; t->hdr.size; t = tag_next(t)) {
283 + if (t->hdr.tag == ATAG_CMDLINE) {
284 + p = t->u.cmdline.cmdline;
288 + /* Overwrite the end of the table with a new cmdline tag. */
289 + t->hdr.tag = ATAG_CMDLINE;
290 + t->hdr.size = (sizeof (struct tag_header) +
291 + strlen(tw2662_mem_fixup) + strlen(p) + 1 + 4) >> 2;
292 + strlcpy(t->u.cmdline.cmdline, tw2662_mem_fixup, COMMAND_LINE_SIZE);
293 + strlcpy(t->u.cmdline.cmdline + strlen(tw2662_mem_fixup), p,
294 + COMMAND_LINE_SIZE - strlen(tw2662_mem_fixup));
296 + /* Terminate the table. */
298 + t->hdr.tag = ATAG_NONE;
302 +static void __init tw2662_init(void)
306 + tw2662_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
307 + tw2662_flash_resource.end =
308 + IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
310 + platform_add_devices(tw2662_devices, ARRAY_SIZE(tw2662_devices));
312 + if (!(is_valid_ether_addr(tw2662_plat_eth[0].hwaddr)))
313 + random_ether_addr(tw2662_plat_eth[0].hwaddr);
314 + if (!(is_valid_ether_addr(tw2662_plat_eth[1].hwaddr))) {
315 + memcpy(tw2662_plat_eth[1].hwaddr, tw2662_plat_eth[0].hwaddr, ETH_ALEN);
316 + tw2662_plat_eth[1].hwaddr[5] = (tw2662_plat_eth[0].hwaddr[5] + 1);
321 +#ifdef CONFIG_MACH_TW2662
322 +MACHINE_START(TW2662, "Titan Wireless TW-266-2")
323 + /* Maintainer: Alexandros C. Couloumbis <alex@ozo.com> */
324 + .fixup = tw2662_fixup,
325 + .map_io = ixp4xx_map_io,
326 + .init_irq = ixp4xx_init_irq,
327 + .timer = &ixp4xx_timer,
328 + .boot_params = 0x0100,
329 + .init_machine = tw2662_init,