add basic support for the ADI Engineering Pronghorn Metro
[openwrt/openwrt.git] / target / linux / ixp4xx-2.6 / patches / 400-pronghorn_metro.patch
1 diff -Nur linux-2.6.19.2/arch/arm/mach-ixp4xx/Kconfig linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/Kconfig
2 --- linux-2.6.19.2/arch/arm/mach-ixp4xx/Kconfig 2007-04-02 16:10:51.000000000 +0200
3 +++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/Kconfig 2007-04-02 16:11:12.000000000 +0200
4 @@ -49,6 +49,22 @@
5 WG302 v2 or WAG302 v2 Access Points. For more information
6 on this platform, see http://openwrt.org
7
8 +config MACH_PRONGHORN
9 + bool "Pronghorn"
10 + select PCI
11 + help
12 + Say 'Y' here if you want your kernel to support the ADI
13 + Engineering Pronghorn Platform. For more
14 + information on this platform, see <file:Documentation/arm/IXP4xx>.
15 +
16 +config MACH_PRONGHORNMETRO
17 + bool "Pronghorn Metro"
18 + select PCI
19 + help
20 + Say 'Y' here if you want your kernel to support the ADI
21 + Engineering Pronghorn Metro Platform. For more
22 + information on this platform, see <file:Documentation/arm/IXP4xx>.
23 +
24 config ARCH_IXDP425
25 bool "IXDP425"
26 help
27 diff -Nur linux-2.6.19.2/arch/arm/mach-ixp4xx/Makefile linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/Makefile
28 --- linux-2.6.19.2/arch/arm/mach-ixp4xx/Makefile 2007-04-02 16:10:51.000000000 +0200
29 +++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/Makefile 2007-04-02 16:15:51.000000000 +0200
30 @@ -13,6 +13,7 @@
31 obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o
32 obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o
33 obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o
34 +obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o
35
36 obj-y += common.o
37
38 @@ -24,5 +25,6 @@
39 obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o
40 obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
41 obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o
42 +obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o
43
44 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
45 diff -Nur linux-2.6.19.2/arch/arm/mach-ixp4xx/pronghornmetro-pci.c linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/pronghornmetro-pci.c
46 --- linux-2.6.19.2/arch/arm/mach-ixp4xx/pronghornmetro-pci.c 1970-01-01 01:00:00.000000000 +0100
47 +++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/pronghornmetro-pci.c 2007-04-02 16:17:35.000000000 +0200
48 @@ -0,0 +1,70 @@
49 +/*
50 + * arch/arch/mach-ixp4xx/pronghornmetro-pci.c
51 + *
52 + * PCI setup routines for ADI Engineering Pronghorn Metro platform
53 + *
54 + * Copyright (C) 2002 Jungo Software Technologies.
55 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
56 + *
57 + * This program is free software; you can redistribute it and/or modify
58 + * it under the terms of the GNU General Public License version 2 as
59 + * published by the Free Software Foundation.
60 + *
61 + * Author: Copied from coyote-pci.c
62 + */
63 +
64 +#include <linux/kernel.h>
65 +#include <linux/pci.h>
66 +#include <linux/init.h>
67 +#include <linux/irq.h>
68 +
69 +#include <asm/mach-types.h>
70 +#include <asm/hardware.h>
71 +#include <asm/irq.h>
72 +
73 +#include <asm/mach/pci.h>
74 +
75 +extern void ixp4xx_pci_preinit(void);
76 +extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
77 +extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
78 +
79 +void __init pronghornmetro_pci_preinit(void)
80 +{
81 + set_irq_type(IRQ_PCI_SLOT0, IRQT_LOW);
82 + set_irq_type(IRQ_PCI_SLOT1, IRQT_LOW);
83 + set_irq_type(IRQ_PCI_SLOT2, IRQT_LOW);
84 + set_irq_type(IRQ_PCI_SLOT3, IRQT_LOW);
85 +
86 + ixp4xx_pci_preinit();
87 +}
88 +
89 +static int __init pronghornmetro_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
90 +{
91 + if (slot == PCI_SLOT0_DEVID)
92 + return IRQ_PCI_SLOT0;
93 + else if (slot == PCI_SLOT1_DEVID)
94 + return IRQ_PCI_SLOT1;
95 + else if (slot == PCI_SLOT2_DEVID)
96 + return IRQ_PCI_SLOT2;
97 + else if (slot == PCI_SLOT3_DEVID)
98 + return IRQ_PCI_SLOT3;
99 + else return -1;
100 +}
101 +
102 +struct hw_pci pronghornmetro_pci __initdata = {
103 + .nr_controllers = 1,
104 + .preinit = pronghornmetro_pci_preinit,
105 + .swizzle = pci_std_swizzle,
106 + .setup = ixp4xx_setup,
107 + .scan = ixp4xx_scan_bus,
108 + .map_irq = pronghornmetro_map_irq,
109 +};
110 +
111 +int __init pronghornmetro_pci_init(void)
112 +{
113 + if (machine_is_pronghorn_metro())
114 + pci_common_init(&pronghornmetro_pci);
115 + return 0;
116 +}
117 +
118 +subsys_initcall(pronghornmetro_pci_init);
119 diff -Nur linux-2.6.19.2/arch/arm/mach-ixp4xx/pronghornmetro-setup.c linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/pronghornmetro-setup.c
120 --- linux-2.6.19.2/arch/arm/mach-ixp4xx/pronghornmetro-setup.c 1970-01-01 01:00:00.000000000 +0100
121 +++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/pronghornmetro-setup.c 2007-04-02 16:18:13.000000000 +0200
122 @@ -0,0 +1,119 @@
123 +/*
124 + * arch/arm/mach-ixp4xx/pronghornmetro-setup.c
125 + *
126 + * Board setup for ADI Engineering Pronghorn Metro
127 + *
128 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
129 + *
130 + * Author: Copied from coyote-setup.c
131 + */
132 +
133 +#include <linux/kernel.h>
134 +#include <linux/init.h>
135 +#include <linux/device.h>
136 +#include <linux/serial.h>
137 +#include <linux/tty.h>
138 +#include <linux/serial_8250.h>
139 +#include <linux/slab.h>
140 +
141 +#include <asm/types.h>
142 +#include <asm/setup.h>
143 +#include <asm/memory.h>
144 +#include <asm/hardware.h>
145 +#include <asm/irq.h>
146 +#include <asm/mach-types.h>
147 +#include <asm/mach/arch.h>
148 +#include <asm/mach/flash.h>
149 +
150 +static struct flash_platform_data pronghornmetro_flash_data = {
151 + .map_name = "cfi_probe",
152 + .width = 2,
153 +};
154 +
155 +static struct resource pronghornmetro_flash_resource = {
156 + .flags = IORESOURCE_MEM,
157 +};
158 +
159 +static struct platform_device pronghornmetro_flash = {
160 + .name = "IXP4XX-Flash",
161 + .id = 0,
162 + .dev = {
163 + .platform_data = &pronghornmetro_flash_data,
164 + },
165 + .num_resources = 1,
166 + .resource = &pronghornmetro_flash_resource,
167 +};
168 +
169 +static struct resource pronghornmetro_uart_resource = {
170 + .start = IXP4XX_UART2_BASE_PHYS,
171 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
172 + .flags = IORESOURCE_MEM,
173 +};
174 +
175 +static struct ixp4xx_i2c_pins pronghornmetro_i2c_gpio_pins = {
176 + .sda_pin = PRONGHORNMETRO_SDA_PIN,
177 + .scl_pin = PRONGHORNMETRO_SCL_PIN,
178 +};
179 +
180 +static struct platform_device pronghornmetro_i2c_controller = {
181 + .name = "IXP4XX-I2C",
182 + .id = 0,
183 + .dev = {
184 + .platform_data = &pronghornmetro_i2c_gpio_pins,
185 + },
186 + .num_resources = 0
187 +};
188 +
189 +static struct plat_serial8250_port pronghornmetro_uart_data[] = {
190 + {
191 + .mapbase = IXP4XX_UART2_BASE_PHYS,
192 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
193 + .irq = IRQ_IXP4XX_UART2,
194 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
195 + .iotype = UPIO_MEM,
196 + .regshift = 2,
197 + .uartclk = IXP4XX_UART_XTAL,
198 + },
199 + { },
200 +};
201 +
202 +static struct platform_device pronghornmetro_uart = {
203 + .name = "serial8250",
204 + .id = PLAT8250_DEV_PLATFORM,
205 + .dev = {
206 + .platform_data = pronghornmetro_uart_data,
207 + },
208 + .num_resources = 1,
209 + .resource = &pronghornmetro_uart_resource,
210 +};
211 +
212 +static struct platform_device *pronghornmetro_devices[] __initdata = {
213 + &pronghornmetro_i2c_controller,
214 + &pronghornmetro_flash,
215 + &pronghornmetro_uart
216 +};
217 +
218 +static void __init pronghornmetro_init(void)
219 +{
220 + ixp4xx_sys_init();
221 +
222 + pronghornmetro_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
223 + pronghornmetro_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
224 +
225 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
226 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
227 +
228 + platform_add_devices(pronghornmetro_devices, ARRAY_SIZE(pronghornmetro_devices));
229 +}
230 +
231 +#ifdef CONFIG_MACH_PRONGHORNMETRO
232 +MACHINE_START(PRONGHORNMETRO, "ADI Engineering Pronghorn Metro")
233 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
234 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
235 + .map_io = ixp4xx_map_io,
236 + .init_irq = ixp4xx_init_irq,
237 + .timer = &ixp4xx_timer,
238 + .boot_params = 0x0100,
239 + .init_machine = pronghornmetro_init,
240 +MACHINE_END
241 +#endif
242 diff -Nur linux-2.6.19.2/Documentation/arm/IXP4xx linux-2.6.19.2-owrt/Documentation/arm/IXP4xx
243 --- linux-2.6.19.2/Documentation/arm/IXP4xx 2007-01-10 20:10:37.000000000 +0100
244 +++ linux-2.6.19.2-owrt/Documentation/arm/IXP4xx 2007-04-02 16:11:12.000000000 +0200
245 @@ -111,6 +111,9 @@
246 the platform has two mini-PCI slots used for 802.11[bga] cards.
247 Finally, there is an IDE port hanging off the expansion bus.
248
249 +ADI Engineering Pronghorn Metro Platform
250 +http://www.adiengineering.com/productsPronghornMetro.html
251 +
252 Gateworks Avila Network Platform
253 http://www.gateworks.com/avila_sbc.htm
254
255 diff -Nur linux-2.6.19.2/include/asm-arm/arch-ixp4xx/hardware.h linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/hardware.h
256 --- linux-2.6.19.2/include/asm-arm/arch-ixp4xx/hardware.h 2007-01-10 20:10:37.000000000 +0100
257 +++ linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/hardware.h 2007-04-02 16:11:12.000000000 +0200
258 @@ -43,6 +43,7 @@
259 /* Platform specific details */
260 #include "ixdp425.h"
261 #include "coyote.h"
262 +#include "pronghornmetro.h"
263 #include "prpmc1100.h"
264 #include "nslu2.h"
265 #include "nas100d.h"
266 diff -Nur linux-2.6.19.2/include/asm-arm/arch-ixp4xx/irqs.h linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/irqs.h
267 --- linux-2.6.19.2/include/asm-arm/arch-ixp4xx/irqs.h 2007-01-10 20:10:37.000000000 +0100
268 +++ linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/irqs.h 2007-04-02 16:11:12.000000000 +0200
269 @@ -94,6 +94,21 @@
270 #define IRQ_COYOTE_IDE IRQ_IXP4XX_GPIO5
271
272 /*
273 + * ADI Pronghorn Metro Board IRQs
274 + */
275 +#if defined(CONFIG_MACH_PRONGHORNMETRO)
276 +#define IRQ_PCI_SLOT0 IRQ_IXP4XX_GPIO4
277 +#define IRQ_PCI_SLOT1 IRQ_IXP4XX_GPIO6
278 +#define IRQ_PCI_SLOT2 IRQ_IXP4XX_GPIO11
279 +#define IRQ_PCI_SLOT3 IRQ_IXP4XX_GPIO1
280 +#define IRQ_IDE IRQ_IXP4XX_GPIO0
281 +#elif defined (CONFIG_MACH_PRONGHORN)
282 +#define IRQ_PCI_SLOT0 IRQ_IXP4XX_GPIO11
283 +#define IRQ_PCI_SLOT1 IRQ_IXP4XX_GPIO6
284 +#define IRQ_IDE IRQ_IXP4XX_GPIO0
285 +#endif
286 +
287 +/*
288 * NSLU2 board IRQs
289 */
290 #define IRQ_NSLU2_PCI_INTA IRQ_IXP4XX_GPIO11
291 diff -Nur linux-2.6.19.2/include/asm-arm/arch-ixp4xx/pronghornmetro.h linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/pronghornmetro.h
292 --- linux-2.6.19.2/include/asm-arm/arch-ixp4xx/pronghornmetro.h 1970-01-01 01:00:00.000000000 +0100
293 +++ linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/pronghornmetro.h 2007-04-02 16:11:12.000000000 +0200
294 @@ -0,0 +1,47 @@
295 +/*
296 + * include/asm-arm/arch-ixp4xx/pronghornmetro.h
297 + *
298 + * ADI Engineering platform specific definitions
299 + *
300 + * Copyright 2004 (c) MontaVista, Software, Inc.
301 + *
302 + * This file is licensed under the terms of the GNU General Public
303 + * License version 2. This program is licensed "as is" without any
304 + * warranty of any kind, whether express or implied.
305 + */
306 +
307 +#ifndef __ASM_ARCH_HARDWARE_H__
308 +#error "Do not include this directly, instead #include <asm/hardware.h>"
309 +#endif
310 +
311 +#if defined(CONFIG_MACH_PRONGHORNMETRO)
312 +#define PRONGHORNMETRO_SDA_PIN 9
313 +#define PRONGHORNMETRO_SCL_PIN 10
314 +
315 +/* PCI controller GPIO to IRQ pin mappings */
316 +#define PCI_SLOT0_PIN 1
317 +#define PCI_SLOT1_PIN 11
318 +#define PCI_SLOT2_PIN 6
319 +#define PCI_SLOT3_PIN 4
320 +
321 +#define PCI_SLOT0_DEVID 13
322 +#define PCI_SLOT1_DEVID 14
323 +#define PCI_SLOT2_DEVID 15
324 +#define PCI_SLOT3_DEVID 16
325 +
326 +#define TASKFILE_CS 3
327 +#define TASKFILE_CS_REG IXP4XX_EXP_CS3
328 +#define ALTSTAT_CS 4
329 +
330 +#elif defined(CONFIG_MACH_PRONGHORN)
331 +/* PCI controller GPIO to IRQ pin mappings */
332 +#define PCI_SLOT0_PIN 11
333 +#define PCI_SLOT1_PIN 6
334 +
335 +#define PCI_SLOT0_DEVID 15
336 +#define PCI_SLOT1_DEVID 14
337 +
338 +#define TASKFILE_CS 2
339 +#define TASKFILE_CS_REG IXP4XX_EXP_CS2
340 +#define ALTSTAT_CS 3
341 +#endif
342 diff -Nur linux-2.6.19.2/include/asm-arm/arch-ixp4xx/uncompress.h linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/uncompress.h
343 --- linux-2.6.19.2/include/asm-arm/arch-ixp4xx/uncompress.h 2007-04-02 16:10:51.000000000 +0200
344 +++ linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/uncompress.h 2007-04-02 16:12:24.000000000 +0200
345 @@ -40,7 +40,7 @@
346 /*
347 * Some boards are using UART2 as console
348 */
349 - if (machine_is_adi_coyote() || machine_is_gtwx5715() || machine_is_gateway7001() || machine_is_wg302v2())
350 + if (machine_is_adi_coyote() || machine_is_gtwx5715() || machine_is_gateway7001() || machine_is_wg302v2() || machine_is_pronghorn() || machine_is_pronghorn_metro())
351 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
352 else
353 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;