rename patch
[openwrt/openwrt.git] / target / linux / ixp4xx / patches-2.6.26 / 110-pronghorn_series_support.patch
1 --- a/arch/arm/configs/ixp4xx_defconfig
2 +++ b/arch/arm/configs/ixp4xx_defconfig
3 @@ -157,6 +157,8 @@
4 CONFIG_MACH_GATEWAY7001=y
5 CONFIG_MACH_WG302V1=y
6 CONFIG_MACH_WG302V2=y
7 +CONFIG_MACH_PRONGHORN=y
8 +CONFIG_MACH_PRONGHORNMETRO=y
9 CONFIG_ARCH_IXDP425=y
10 CONFIG_MACH_IXDPG425=y
11 CONFIG_MACH_IXDP465=y
12 --- a/arch/arm/mach-ixp4xx/Kconfig
13 +++ b/arch/arm/mach-ixp4xx/Kconfig
14 @@ -65,6 +65,24 @@
15 WG302 v2 or WAG302 v2 Access Points. For more information
16 on this platform, see http://openwrt.org
17
18 +config MACH_PRONGHORN
19 + bool "ADI Pronghorn series"
20 + select PCI
21 + help
22 + Say 'Y' here if you want your kernel to support the ADI
23 + Engineering Pronghorn series. For more
24 + information on this platform, see http://www.adiengineering.com
25 +
26 +#
27 +# There're only minimal differences kernel-wise between the Pronghorn and
28 +# Pronghorn Metro boards - they use different chip selects to drive the
29 +# CF slot connected to the expansion bus, so we just enable them together.
30 +#
31 +config MACH_PRONGHORNMETRO
32 + bool
33 + depends on MACH_PRONGHORN
34 + default y
35 +
36 config ARCH_IXDP425
37 bool "IXDP425"
38 help
39 --- a/arch/arm/mach-ixp4xx/Makefile
40 +++ b/arch/arm/mach-ixp4xx/Makefile
41 @@ -17,6 +17,7 @@
42 obj-pci-$(CONFIG_MACH_WG302V1) += wg302v1-pci.o
43 obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o
44 obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o
45 +obj-pci-$(CONFIG_MACH_PRONGHORN) += pronghorn-pci.o
46
47 obj-y += common.o
48
49 @@ -32,6 +33,7 @@
50 obj-$(CONFIG_MACH_WG302V1) += wg302v1-setup.o
51 obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o
52 obj-$(CONFIG_MACH_FSG) += fsg-setup.o
53 +obj-$(CONFIG_MACH_PRONGHORN) += pronghorn-setup.o
54
55 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
56 obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
57 --- /dev/null
58 +++ b/arch/arm/mach-ixp4xx/pronghorn-pci.c
59 @@ -0,0 +1,70 @@
60 +/*
61 + * arch/arch/mach-ixp4xx/pronghorn-pci.c
62 + *
63 + * PCI setup routines for ADI Engineering Pronghorn series
64 + *
65 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
66 + *
67 + * based on coyote-pci.c:
68 + * Copyright (C) 2002 Jungo Software Technologies.
69 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
70 + *
71 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
72 + *
73 + * This program is free software; you can redistribute it and/or modify
74 + * it under the terms of the GNU General Public License version 2 as
75 + * published by the Free Software Foundation.
76 + *
77 + */
78 +
79 +#include <linux/kernel.h>
80 +#include <linux/pci.h>
81 +#include <linux/init.h>
82 +#include <linux/irq.h>
83 +
84 +#include <asm/mach-types.h>
85 +#include <asm/hardware.h>
86 +
87 +#include <asm/mach/pci.h>
88 +
89 +void __init pronghorn_pci_preinit(void)
90 +{
91 + set_irq_type(IRQ_IXP4XX_GPIO4, IRQT_LOW);
92 + set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW);
93 + set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW);
94 + set_irq_type(IRQ_IXP4XX_GPIO1, IRQT_LOW);
95 +
96 + ixp4xx_pci_preinit();
97 +}
98 +
99 +static int __init pronghorn_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
100 +{
101 + if (slot == 13)
102 + return IRQ_IXP4XX_GPIO4;
103 + else if (slot == 14)
104 + return IRQ_IXP4XX_GPIO6;
105 + else if (slot == 15)
106 + return IRQ_IXP4XX_GPIO11;
107 + else if (slot == 16)
108 + return IRQ_IXP4XX_GPIO1;
109 + else
110 + return -1;
111 +}
112 +
113 +struct hw_pci pronghorn_pci __initdata = {
114 + .nr_controllers = 1,
115 + .preinit = pronghorn_pci_preinit,
116 + .swizzle = pci_std_swizzle,
117 + .setup = ixp4xx_setup,
118 + .scan = ixp4xx_scan_bus,
119 + .map_irq = pronghorn_map_irq,
120 +};
121 +
122 +int __init pronghorn_pci_init(void)
123 +{
124 + if (machine_is_pronghorn() || machine_is_pronghorn_metro())
125 + pci_common_init(&pronghorn_pci);
126 + return 0;
127 +}
128 +
129 +subsys_initcall(pronghorn_pci_init);
130 --- /dev/null
131 +++ b/arch/arm/mach-ixp4xx/pronghorn-setup.c
132 @@ -0,0 +1,245 @@
133 +/*
134 + * arch/arm/mach-ixp4xx/pronghorn-setup.c
135 + *
136 + * Board setup for the ADI Engineering Pronghorn series
137 + *
138 + * Copyright (C) 2008 Imre Kaloz <Kaloz@openwrt.org>
139 + *
140 + * based on coyote-setup.c:
141 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
142 + *
143 + * Author: Imre Kaloz <Kaloz@openwrt.org>
144 + */
145 +
146 +#include <linux/kernel.h>
147 +#include <linux/init.h>
148 +#include <linux/device.h>
149 +#include <linux/serial.h>
150 +#include <linux/tty.h>
151 +#include <linux/serial_8250.h>
152 +#include <linux/slab.h>
153 +#include <linux/types.h>
154 +#include <linux/memory.h>
155 +#include <linux/i2c-gpio.h>
156 +
157 +#include <asm/setup.h>
158 +#include <asm/hardware.h>
159 +#include <asm/irq.h>
160 +#include <asm/mach-types.h>
161 +#include <asm/mach/arch.h>
162 +#include <asm/mach/flash.h>
163 +
164 +static struct flash_platform_data pronghorn_flash_data = {
165 + .map_name = "cfi_probe",
166 + .width = 2,
167 +};
168 +
169 +static struct resource pronghorn_flash_resource = {
170 + .flags = IORESOURCE_MEM,
171 +};
172 +
173 +static struct platform_device pronghorn_flash = {
174 + .name = "IXP4XX-Flash",
175 + .id = 0,
176 + .dev = {
177 + .platform_data = &pronghorn_flash_data,
178 + },
179 + .num_resources = 1,
180 + .resource = &pronghorn_flash_resource,
181 +};
182 +
183 +static struct resource pronghorn_uart_resources [] = {
184 + {
185 + .start = IXP4XX_UART1_BASE_PHYS,
186 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
187 + .flags = IORESOURCE_MEM
188 + },
189 + {
190 + .start = IXP4XX_UART2_BASE_PHYS,
191 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
192 + .flags = IORESOURCE_MEM
193 + }
194 +};
195 +
196 +static struct plat_serial8250_port pronghorn_uart_data[] = {
197 + {
198 + .mapbase = IXP4XX_UART1_BASE_PHYS,
199 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
200 + .irq = IRQ_IXP4XX_UART1,
201 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
202 + .iotype = UPIO_MEM,
203 + .regshift = 2,
204 + .uartclk = IXP4XX_UART_XTAL,
205 + },
206 + {
207 + .mapbase = IXP4XX_UART2_BASE_PHYS,
208 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
209 + .irq = IRQ_IXP4XX_UART2,
210 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
211 + .iotype = UPIO_MEM,
212 + .regshift = 2,
213 + .uartclk = IXP4XX_UART_XTAL,
214 + },
215 + { },
216 +};
217 +
218 +static struct platform_device pronghorn_uart = {
219 + .name = "serial8250",
220 + .id = PLAT8250_DEV_PLATFORM,
221 + .dev = {
222 + .platform_data = pronghorn_uart_data,
223 + },
224 + .num_resources = 2,
225 + .resource = pronghorn_uart_resources,
226 +};
227 +
228 +static struct i2c_gpio_platform_data pronghorn_i2c_gpio_data = {
229 + .sda_pin = 9,
230 + .scl_pin = 10,
231 +};
232 +
233 +static struct platform_device pronghorn_i2c_gpio = {
234 + .name = "i2c-gpio",
235 + .id = 0,
236 + .dev = {
237 + .platform_data = &pronghorn_i2c_gpio_data,
238 + },
239 +};
240 +
241 +static struct gpio_led pronghorn_led_pin[] = {
242 + {
243 + .name = "pronghorn:green:status",
244 + .gpio = 7,
245 + },
246 + { },
247 +};
248 +
249 +static struct gpio_led_platform_data pronghorn_led_data = {
250 + .num_leds = ARRAY_SIZE(pronghorn_led_pin),
251 + .leds = pronghorn_led_pin,
252 +};
253 +
254 +static struct platform_device pronghorn_led = {
255 + .name = "leds-gpio",
256 + .id = -1,
257 + .dev.platform_data = &pronghorn_led_data,
258 +};
259 +
260 +static struct resource pronghorn_pata_resources[] = {
261 + {
262 + .flags = IORESOURCE_MEM
263 + },
264 + {
265 + .flags = IORESOURCE_MEM,
266 + },
267 + {
268 + .name = "intrq",
269 + .start = IRQ_IXP4XX_GPIO0,
270 + .end = IRQ_IXP4XX_GPIO0,
271 + .flags = IORESOURCE_IRQ,
272 + },
273 +};
274 +
275 +static struct ixp4xx_pata_data pronghorn_pata_data = {
276 + .cs0_bits = 0xbfff0043,
277 + .cs1_bits = 0xbfff0043,
278 +};
279 +
280 +static struct platform_device pronghorn_pata = {
281 + .name = "pata_ixp4xx_cf",
282 + .id = 0,
283 + .dev.platform_data = &pronghorn_pata_data,
284 + .num_resources = ARRAY_SIZE(pronghorn_pata_resources),
285 + .resource = pronghorn_pata_resources,
286 +};
287 +
288 +static struct eth_plat_info pronghorn_plat_eth[] = {
289 + {
290 + .phy = 0,
291 + .rxq = 3,
292 + .txreadyq = 20,
293 + }, {
294 + .phy = 1,
295 + .rxq = 4,
296 + .txreadyq = 21,
297 + }
298 +};
299 +
300 +static struct platform_device pronghorn_eth[] = {
301 + {
302 + .name = "ixp4xx_eth",
303 + .id = IXP4XX_ETH_NPEB,
304 + .dev.platform_data = pronghorn_plat_eth,
305 + }, {
306 + .name = "ixp4xx_eth",
307 + .id = IXP4XX_ETH_NPEC,
308 + .dev.platform_data = pronghorn_plat_eth + 1,
309 + }
310 +};
311 +
312 +static struct platform_device *pronghorn_devices[] __initdata = {
313 + &pronghorn_flash,
314 + &pronghorn_uart,
315 + &pronghorn_led,
316 + &pronghorn_eth[0],
317 + &pronghorn_eth[1],
318 +};
319 +
320 +static void __init pronghorn_init(void)
321 +{
322 + ixp4xx_sys_init();
323 +
324 + pronghorn_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
325 + pronghorn_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_16M - 1;
326 +
327 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
328 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
329 +
330 + platform_add_devices(pronghorn_devices, ARRAY_SIZE(pronghorn_devices));
331 +
332 + if (machine_is_pronghorn()) {
333 + pronghorn_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(3);
334 + pronghorn_pata_resources[0].end = IXP4XX_EXP_BUS_END(3);
335 +
336 + pronghorn_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(4);
337 + pronghorn_pata_resources[1].end = IXP4XX_EXP_BUS_END(4);
338 +
339 + pronghorn_pata_data.cs0_cfg = IXP4XX_EXP_CS3;
340 + pronghorn_pata_data.cs1_cfg = IXP4XX_EXP_CS4;
341 + } else {
342 + pronghorn_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(2);
343 + pronghorn_pata_resources[0].end = IXP4XX_EXP_BUS_END(2);
344 +
345 + pronghorn_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(3);
346 + pronghorn_pata_resources[1].end = IXP4XX_EXP_BUS_END(3);
347 +
348 + pronghorn_pata_data.cs0_cfg = IXP4XX_EXP_CS2;
349 + pronghorn_pata_data.cs1_cfg = IXP4XX_EXP_CS3;
350 +
351 + platform_device_register(&pronghorn_i2c_gpio);
352 + }
353 +
354 + platform_device_register(&pronghorn_pata);
355 +}
356 +
357 +MACHINE_START(PRONGHORN, "ADI Engineering Pronghorn")
358 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
359 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
360 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
361 + .map_io = ixp4xx_map_io,
362 + .init_irq = ixp4xx_init_irq,
363 + .timer = &ixp4xx_timer,
364 + .boot_params = 0x0100,
365 + .init_machine = pronghorn_init,
366 +MACHINE_END
367 +
368 +MACHINE_START(PRONGHORNMETRO, "ADI Engineering Pronghorn Metro")
369 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
370 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
371 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
372 + .map_io = ixp4xx_map_io,
373 + .init_irq = ixp4xx_init_irq,
374 + .timer = &ixp4xx_timer,
375 + .boot_params = 0x0100,
376 + .init_machine = pronghorn_init,
377 +MACHINE_END
378 --- a/include/asm-arm/arch-ixp4xx/uncompress.h
379 +++ b/include/asm-arm/arch-ixp4xx/uncompress.h
380 @@ -41,7 +41,8 @@
381 * Some boards are using UART2 as console
382 */
383 if (machine_is_adi_coyote() || machine_is_gtwx5715() ||
384 - machine_is_gateway7001() || machine_is_wg302v2())
385 + machine_is_gateway7001() || machine_is_wg302v2() ||
386 + machine_is_pronghorn() || machine_is_pronghorn_metro())
387 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
388 else
389 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;