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