oops, commited wrong version
[librecmc/librecmc.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 +#include <linux/leds.h>
157 +
158 +#include <asm/setup.h>
159 +#include <asm/hardware.h>
160 +#include <asm/irq.h>
161 +#include <asm/mach-types.h>
162 +#include <asm/mach/arch.h>
163 +#include <asm/mach/flash.h>
164 +
165 +static struct flash_platform_data pronghorn_flash_data = {
166 +       .map_name       = "cfi_probe",
167 +       .width          = 2,
168 +};
169 +
170 +static struct resource pronghorn_flash_resource = {
171 +       .flags          = IORESOURCE_MEM,
172 +};
173 +
174 +static struct platform_device pronghorn_flash = {
175 +       .name           = "IXP4XX-Flash",
176 +       .id             = 0,
177 +       .dev            = {
178 +               .platform_data  = &pronghorn_flash_data,
179 +       },
180 +       .num_resources  = 1,
181 +       .resource       = &pronghorn_flash_resource,
182 +};
183 +
184 +static struct resource pronghorn_uart_resources [] = {
185 +       {
186 +               .start          = IXP4XX_UART1_BASE_PHYS,
187 +               .end            = IXP4XX_UART1_BASE_PHYS + 0x0fff,
188 +               .flags          = IORESOURCE_MEM
189 +       },
190 +       {
191 +               .start          = IXP4XX_UART2_BASE_PHYS,
192 +               .end            = IXP4XX_UART2_BASE_PHYS + 0x0fff,
193 +               .flags          = IORESOURCE_MEM
194 +       }
195 +};
196 +
197 +static struct plat_serial8250_port pronghorn_uart_data[] = {
198 +       {
199 +               .mapbase        = IXP4XX_UART1_BASE_PHYS,
200 +               .membase        = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
201 +               .irq            = IRQ_IXP4XX_UART1,
202 +               .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
203 +               .iotype         = UPIO_MEM,
204 +               .regshift       = 2,
205 +               .uartclk        = IXP4XX_UART_XTAL,
206 +       },
207 +       {
208 +               .mapbase        = IXP4XX_UART2_BASE_PHYS,
209 +               .membase        = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
210 +               .irq            = IRQ_IXP4XX_UART2,
211 +               .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
212 +               .iotype         = UPIO_MEM,
213 +               .regshift       = 2,
214 +               .uartclk        = IXP4XX_UART_XTAL,
215 +       },
216 +       { },
217 +};
218 +
219 +static struct platform_device pronghorn_uart = {
220 +       .name           = "serial8250",
221 +       .id             = PLAT8250_DEV_PLATFORM,
222 +       .dev            = {
223 +               .platform_data  = pronghorn_uart_data,
224 +       },
225 +       .num_resources  = 2,
226 +       .resource       = pronghorn_uart_resources,
227 +};
228 +
229 +static struct i2c_gpio_platform_data pronghorn_i2c_gpio_data = {
230 +       .sda_pin        = 9,
231 +       .scl_pin        = 10,
232 +};
233 +
234 +static struct platform_device pronghorn_i2c_gpio = {
235 +       .name           = "i2c-gpio",
236 +       .id             = 0,
237 +       .dev            = {
238 +               .platform_data  = &pronghorn_i2c_gpio_data,
239 +       },
240 +};
241 +
242 +static struct gpio_led pronghorn_led_pin[] = {
243 +       {
244 +               .name           = "pronghorn:green:status",
245 +               .gpio           = 7,
246 +       }
247 +};
248 +
249 +static struct gpio_led_platform_data pronghorn_led_data = {
250 +       .num_leds               = 1,
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;