fixup avila networking, add support for the loft
[openwrt/openwrt.git] / target / linux / ixp4xx-2.6 / patches / 710-avila_loft_setup.patch
1 This patch adds support for the Gateworks Avila Network Platform in
2 a separate set of setup files to the IXDP425. This is necessary now
3 that a driver for the Avila CF card slot is available. It also adds
4 support for a minor variant on the Avila board known as the Loft,
5 which has a different number of maximum PCI devices.
6
7 Signed-off-by: Michael-Luke Jones <mlj28 <at> cam.ac.uk>
8
9 Index: linux-2.6.19/arch/arm/mach-ixp4xx/Kconfig
10 ===================================================================
11 --- linux-2.6.19.orig/arch/arm/mach-ixp4xx/Kconfig
12 +++ linux-2.6.19/arch/arm/mach-ixp4xx/Kconfig
13 @@ -17,7 +17,7 @@ config MACH_NSLU2
14 NSLU2 NAS device. For more information on this platform,
15 see http://www.nslu2-linux.org
16
17 -config ARCH_AVILA
18 +config MACH_AVILA
19 bool "Avila"
20 select PCI
21 help
22 @@ -25,6 +25,14 @@ config ARCH_AVILA
23 Avila Network Platform. For more information on this platform,
24 see <file:Documentation/arm/IXP4xx>.
25
26 +config MACH_LOFT
27 + bool "Loft"
28 + depends on MACH_AVILA
29 + help
30 + Say 'Y' here if you want your kernel to support the Giant
31 + Shoulder Inc Loft board (a minor variation on the standard
32 + Gateworks Avila Network Platform).
33 +
34 config ARCH_ADI_COYOTE
35 bool "Coyote"
36 select PCI
37 @@ -86,7 +94,7 @@ config MACH_NAS100D
38 #
39 config ARCH_IXDP4XX
40 bool
41 - depends on ARCH_IXDP425 || ARCH_AVILA || MACH_IXDP465
42 + depends on ARCH_IXDP425 || MACH_IXDP465
43 default y
44
45 #
46 Index: linux-2.6.19/arch/arm/mach-ixp4xx/Makefile
47 ===================================================================
48 --- linux-2.6.19.orig/arch/arm/mach-ixp4xx/Makefile
49 +++ linux-2.6.19/arch/arm/mach-ixp4xx/Makefile
50 @@ -6,6 +6,7 @@ obj-pci-y :=
51 obj-pci-n :=
52
53 obj-pci-$(CONFIG_ARCH_IXDP4XX) += ixdp425-pci.o
54 +obj-pci-$(CONFIG_MACH_AVILA) += avila-pci.o
55 obj-pci-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o
56 obj-pci-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o
57 obj-pci-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o
58 @@ -15,6 +16,7 @@ obj-pci-$(CONFIG_MACH_NAS100D) += nas10
59 obj-y += common.o
60
61 obj-$(CONFIG_ARCH_IXDP4XX) += ixdp425-setup.o
62 +obj-$(CONFIG_MACH_AVILA) += avila-setup.o
63 obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o
64 obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o
65 obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o
66 Index: linux-2.6.19/arch/arm/mach-ixp4xx/avila-pci.c
67 ===================================================================
68 --- /dev/null
69 +++ linux-2.6.19/arch/arm/mach-ixp4xx/avila-pci.c
70 @@ -0,0 +1,78 @@
71 +/*
72 + * arch/arm/mach-ixp4xx/avila-pci.c
73 + *
74 + * Gateworks Avila board-level PCI initialization
75 + *
76 + * Author: Michael-Luke Jones <mlj28@cam.ac.uk>
77 + *
78 + * Based on ixdp-pci.c
79 + * Copyright (C) 2002 Intel Corporation.
80 + * Copyright (C) 2003-2004 MontaVista Software, Inc.
81 + *
82 + * Maintainer: Deepak Saxena <dsaxena@plexity.net>
83 + *
84 + * This program is free software; you can redistribute it and/or modify
85 + * it under the terms of the GNU General Public License version 2 as
86 + * published by the Free Software Foundation.
87 + *
88 + */
89 +
90 +#include <linux/kernel.h>
91 +#include <linux/pci.h>
92 +#include <linux/init.h>
93 +#include <linux/irq.h>
94 +#include <linux/delay.h>
95 +
96 +#include <asm/mach/pci.h>
97 +#include <asm/irq.h>
98 +#include <asm/hardware.h>
99 +#include <asm/mach-types.h>
100 +
101 +void __init avila_pci_preinit(void)
102 +{
103 + set_irq_type(IRQ_AVILA_PCI_INTA, IRQT_LOW);
104 + set_irq_type(IRQ_AVILA_PCI_INTB, IRQT_LOW);
105 + set_irq_type(IRQ_AVILA_PCI_INTC, IRQT_LOW);
106 + set_irq_type(IRQ_AVILA_PCI_INTD, IRQT_LOW);
107 +
108 + ixp4xx_pci_preinit();
109 +}
110 +
111 +static int __init avila_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
112 +{
113 + static int pci_irq_table[AVILA_PCI_IRQ_LINES] = {
114 + IRQ_AVILA_PCI_INTA,
115 + IRQ_AVILA_PCI_INTB,
116 + IRQ_AVILA_PCI_INTC,
117 + IRQ_AVILA_PCI_INTD
118 + };
119 +
120 + int irq = -1;
121 +
122 + if (slot >= 1 &&
123 + slot <= (machine_is_loft() ? LOFT_PCI_MAX_DEV : AVILA_PCI_MAX_DEV) &&
124 + pin >= 1 && pin <= AVILA_PCI_IRQ_LINES) {
125 + irq = pci_irq_table[(slot + pin - 2) % 4];
126 + }
127 +
128 + return irq;
129 +}
130 +
131 +struct hw_pci avila_pci __initdata = {
132 + .nr_controllers = 1,
133 + .preinit = avila_pci_preinit,
134 + .swizzle = pci_std_swizzle,
135 + .setup = ixp4xx_setup,
136 + .scan = ixp4xx_scan_bus,
137 + .map_irq = avila_map_irq,
138 +};
139 +
140 +int __init avila_pci_init(void)
141 +{
142 + if (machine_is_avila() || machine_is_loft())
143 + pci_common_init(&avila_pci);
144 + return 0;
145 +}
146 +
147 +subsys_initcall(avila_pci_init);
148 +
149 Index: linux-2.6.19/arch/arm/mach-ixp4xx/avila-setup.c
150 ===================================================================
151 --- /dev/null
152 +++ linux-2.6.19/arch/arm/mach-ixp4xx/avila-setup.c
153 @@ -0,0 +1,152 @@
154 +/*
155 + * arch/arm/mach-ixp4xx/avila-setup.c
156 + *
157 + * Gateworks Avila board-setup
158 + *
159 + * Author: Michael-Luke Jones <mlj28@cam.ac.uk>
160 + *
161 + * Based on ixdp-setup.c
162 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
163 + *
164 + * Author: Deepak Saxena <dsaxena@plexity.net>
165 + */
166 +
167 +#include <linux/kernel.h>
168 +#include <linux/init.h>
169 +#include <linux/device.h>
170 +#include <linux/serial.h>
171 +#include <linux/tty.h>
172 +#include <linux/serial_8250.h>
173 +#include <linux/slab.h>
174 +
175 +#include <asm/types.h>
176 +#include <asm/setup.h>
177 +#include <asm/memory.h>
178 +#include <asm/hardware.h>
179 +#include <asm/mach-types.h>
180 +#include <asm/irq.h>
181 +#include <asm/mach/arch.h>
182 +#include <asm/mach/flash.h>
183 +
184 +static struct flash_platform_data avila_flash_data = {
185 + .map_name = "cfi_probe",
186 + .width = 2,
187 +};
188 +
189 +static struct resource avila_flash_resource = {
190 + .flags = IORESOURCE_MEM,
191 +};
192 +
193 +static struct platform_device avila_flash = {
194 + .name = "IXP4XX-Flash",
195 + .id = 0,
196 + .dev = {
197 + .platform_data = &avila_flash_data,
198 + },
199 + .num_resources = 1,
200 + .resource = &avila_flash_resource,
201 +};
202 +
203 +static struct ixp4xx_i2c_pins avila_i2c_gpio_pins = {
204 + .sda_pin = AVILA_SDA_PIN,
205 + .scl_pin = AVILA_SCL_PIN,
206 +};
207 +
208 +static struct platform_device avila_i2c_controller = {
209 + .name = "IXP4XX-I2C",
210 + .id = 0,
211 + .dev = {
212 + .platform_data = &avila_i2c_gpio_pins,
213 + },
214 + .num_resources = 0
215 +};
216 +
217 +static struct resource avila_uart_resources[] = {
218 + {
219 + .start = IXP4XX_UART1_BASE_PHYS,
220 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
221 + .flags = IORESOURCE_MEM
222 + },
223 + {
224 + .start = IXP4XX_UART2_BASE_PHYS,
225 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
226 + .flags = IORESOURCE_MEM
227 + }
228 +};
229 +
230 +static struct plat_serial8250_port avila_uart_data[] = {
231 + {
232 + .mapbase = IXP4XX_UART1_BASE_PHYS,
233 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
234 + .irq = IRQ_IXP4XX_UART1,
235 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
236 + .iotype = UPIO_MEM,
237 + .regshift = 2,
238 + .uartclk = IXP4XX_UART_XTAL,
239 + },
240 + {
241 + .mapbase = IXP4XX_UART2_BASE_PHYS,
242 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
243 + .irq = IRQ_IXP4XX_UART2,
244 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
245 + .iotype = UPIO_MEM,
246 + .regshift = 2,
247 + .uartclk = IXP4XX_UART_XTAL,
248 + },
249 + { },
250 +};
251 +
252 +static struct platform_device avila_uart = {
253 + .name = "serial8250",
254 + .id = PLAT8250_DEV_PLATFORM,
255 + .dev.platform_data = avila_uart_data,
256 + .num_resources = 2,
257 + .resource = avila_uart_resources
258 +};
259 +
260 +static struct platform_device *avila_devices[] __initdata = {
261 + &avila_i2c_controller,
262 + &avila_flash,
263 + &avila_uart
264 +};
265 +
266 +static void __init avila_init(void)
267 +{
268 + ixp4xx_sys_init();
269 +
270 + avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
271 + avila_flash_resource.end =
272 + IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
273 +
274 + platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices));
275 +}
276 +
277 +MACHINE_START(AVILA, "Gateworks Avila Network Platform")
278 + /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
279 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
280 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
281 + .map_io = ixp4xx_map_io,
282 + .init_irq = ixp4xx_init_irq,
283 + .timer = &ixp4xx_timer,
284 + .boot_params = 0x0100,
285 + .init_machine = avila_init,
286 +MACHINE_END
287 +
288 + /*
289 + * Loft is functionally equivalent to Avila except that it has a
290 + * different number for the maximum PCI devices. The MACHINE
291 + * structure below is identical to Avila except for the comment.
292 + */
293 +#ifdef CONFIG_MACH_LOFT
294 +MACHINE_START(LOFT, "Giant Shoulder Inc Loft board")
295 + /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */
296 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
297 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
298 + .map_io = ixp4xx_map_io,
299 + .init_irq = ixp4xx_init_irq,
300 + .timer = &ixp4xx_timer,
301 + .boot_params = 0x0100,
302 + .init_machine = avila_init,
303 +MACHINE_END
304 +#endif
305 +
306 Index: linux-2.6.19/include/asm-arm/arch-ixp4xx/avila.h
307 ===================================================================
308 --- /dev/null
309 +++ linux-2.6.19/include/asm-arm/arch-ixp4xx/avila.h
310 @@ -0,0 +1,39 @@
311 +/*
312 + * include/asm-arm/arch-ixp4xx/avila.h
313 + *
314 + * Gateworks Avila platform specific definitions
315 + *
316 + * Author: Michael-Luke Jones <mlj28@cam.ac.uk>
317 + *
318 + * Based on ixdp425.h
319 + * Author: Deepak Saxena <dsaxena@plexity.net>
320 + *
321 + * Copyright 2004 (c) MontaVista, Software, Inc.
322 + *
323 + * This file is licensed under the terms of the GNU General Public
324 + * License version 2. This program is licensed "as is" without any
325 + * warranty of any kind, whether express or implied.
326 + */
327 +
328 +#ifndef __ASM_ARCH_HARDWARE_H__
329 +#error "Do not include this directly, instead #include <asm/hardware.h>"
330 +#endif
331 +
332 +#define AVILA_SDA_PIN 7
333 +#define AVILA_SCL_PIN 6
334 +
335 +/*
336 + * AVILA PCI IRQs
337 + */
338 +#define AVILA_PCI_MAX_DEV 4
339 +#define LOFT_PCI_MAX_DEV 6
340 +#define AVILA_PCI_IRQ_LINES 4
341 +
342 +
343 +/* PCI controller GPIO to IRQ pin mappings */
344 +#define AVILA_PCI_INTA_PIN 11
345 +#define AVILA_PCI_INTB_PIN 10
346 +#define AVILA_PCI_INTC_PIN 9
347 +#define AVILA_PCI_INTD_PIN 8
348 +
349 +
350 Index: linux-2.6.19/include/asm-arm/arch-ixp4xx/hardware.h
351 ===================================================================
352 --- linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/hardware.h
353 +++ linux-2.6.19/include/asm-arm/arch-ixp4xx/hardware.h
354 @@ -42,6 +42,7 @@ extern unsigned int processor_id;
355
356 /* Platform specific details */
357 #include "ixdp425.h"
358 +#include "avila.h"
359 #include "coyote.h"
360 #include "prpmc1100.h"
361 #include "nslu2.h"
362 Index: linux-2.6.19/include/asm-arm/arch-ixp4xx/irqs.h
363 ===================================================================
364 --- linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/irqs.h
365 +++ linux-2.6.19/include/asm-arm/arch-ixp4xx/irqs.h
366 @@ -79,6 +79,15 @@
367 #define IRQ_IXDP425_PCI_INTD IRQ_IXP4XX_GPIO8
368
369 /*
370 + * Gateworks Avila board IRQs
371 + */
372 +#define IRQ_AVILA_PCI_INTA IRQ_IXP4XX_GPIO11
373 +#define IRQ_AVILA_PCI_INTB IRQ_IXP4XX_GPIO10
374 +#define IRQ_AVILA_PCI_INTC IRQ_IXP4XX_GPIO9
375 +#define IRQ_AVILA_PCI_INTD IRQ_IXP4XX_GPIO8
376 +
377 +
378 +/*
379 * PrPMC1100 Board IRQs
380 */
381 #define IRQ_PRPMC1100_PCI_INTA IRQ_IXP4XX_GPIO11