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