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