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