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