* upgrade ixp4xx to 2.6.23.12
[openwrt.git] / target / linux / ixp4xx / patches-2.6.23 / 110-pronghorn_metro_support.patch
1 diff -Nur linux-2.6.23/arch/arm/mach-ixp4xx/Kconfig linux-2.6.23-owrt/arch/arm/mach-ixp4xx/Kconfig
2 --- linux-2.6.23/arch/arm/mach-ixp4xx/Kconfig   2007-10-22 14:47:50.000000000 +0200
3 +++ linux-2.6.23-owrt/arch/arm/mach-ixp4xx/Kconfig      2007-10-22 15:16:43.000000000 +0200
4 @@ -57,6 +57,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.23/arch/arm/mach-ixp4xx/Makefile linux-2.6.23-owrt/arch/arm/mach-ixp4xx/Makefile
20 --- linux-2.6.23/arch/arm/mach-ixp4xx/Makefile  2007-10-22 14:47:50.000000000 +0200
21 +++ linux-2.6.23-owrt/arch/arm/mach-ixp4xx/Makefile     2007-10-22 15:26:15.000000000 +0200
22 @@ -16,6 +16,7 @@
23  obj-pci-$(CONFIG_MACH_GATEWAY7001)     += gateway7001-pci.o
24  obj-pci-$(CONFIG_MACH_WG302V2)         += wg302v2-pci.o
25  obj-pci-$(CONFIG_MACH_FSG)             += fsg-pci.o
26 +obj-pci-$(CONFIG_MACH_PRONGHORNMETRO)  += pronghornmetro-pci.o
27  
28  obj-y  += common.o
29  
30 @@ -30,6 +31,7 @@
31  obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
32  obj-$(CONFIG_MACH_WG302V2)     += wg302v2-setup.o
33  obj-$(CONFIG_MACH_FSG)         += fsg-setup.o
34 +obj-$(CONFIG_MACH_PRONGHORNMETRO)      += pronghornmetro-setup.o
35  
36  obj-$(CONFIG_PCI)              += $(obj-pci-$(CONFIG_PCI)) common-pci.o
37  obj-$(CONFIG_IXP4XX_QMGR)      += ixp4xx_qmgr.o
38 diff -Nur linux-2.6.23/arch/arm/mach-ixp4xx/pronghornmetro-pci.c linux-2.6.23-owrt/arch/arm/mach-ixp4xx/pronghornmetro-pci.c
39 --- linux-2.6.23/arch/arm/mach-ixp4xx/pronghornmetro-pci.c      1970-01-01 01:00:00.000000000 +0100
40 +++ linux-2.6.23-owrt/arch/arm/mach-ixp4xx/pronghornmetro-pci.c 2007-10-22 15:16:43.000000000 +0200
41 @@ -0,0 +1,74 @@
42 +/*
43 + * arch/arch/mach-ixp4xx/pronghornmetro-pci.c
44 + *
45 + * PCI setup routines for ADI Engineering Pronghorn Metro
46 + *
47 + * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org>
48 + *
49 + * based on coyote-pci.c:
50 + *     Copyright (C) 2002 Jungo Software Technologies.
51 + *     Copyright (C) 2003 MontaVista Softwrae, Inc.
52 + *
53 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
54 + *
55 + * This program is free software; you can redistribute it and/or modify
56 + * it under the terms of the GNU General Public License version 2 as
57 + * published by the Free Software Foundation.
58 + *
59 + */
60 +
61 +#include <linux/kernel.h>
62 +#include <linux/pci.h>
63 +#include <linux/init.h>
64 +#include <linux/irq.h>
65 +
66 +#include <asm/mach-types.h>
67 +#include <asm/hardware.h>
68 +#include <asm/irq.h>
69 +
70 +#include <asm/mach/pci.h>
71 +
72 +extern void ixp4xx_pci_preinit(void);
73 +extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
74 +extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
75 +
76 +void __init pronghornmetro_pci_preinit(void)
77 +{
78 +       set_irq_type(IRQ_IXP4XX_GPIO4, IRQT_LOW);
79 +       set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW);
80 +       set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW);
81 +       set_irq_type(IRQ_IXP4XX_GPIO1, IRQT_LOW);
82 +
83 +       ixp4xx_pci_preinit();
84 +}
85 +
86 +static int __init pronghornmetro_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
87 +{
88 +       if (slot == 13)
89 +               return IRQ_IXP4XX_GPIO4;
90 +       else if (slot == 14)
91 +               return IRQ_IXP4XX_GPIO6;
92 +       else if (slot == 15)
93 +               return IRQ_IXP4XX_GPIO11;
94 +       else if (slot == 16)
95 +               return IRQ_IXP4XX_GPIO1;
96 +       else return -1;
97 +}
98 +
99 +struct hw_pci pronghornmetro_pci __initdata = {
100 +       .nr_controllers = 1,
101 +       .preinit =        pronghornmetro_pci_preinit,
102 +       .swizzle =        pci_std_swizzle,
103 +       .setup =          ixp4xx_setup,
104 +       .scan =           ixp4xx_scan_bus,
105 +       .map_irq =        pronghornmetro_map_irq,
106 +};
107 +
108 +int __init pronghornmetro_pci_init(void)
109 +{
110 +       if (machine_is_pronghorn_metro())
111 +               pci_common_init(&pronghornmetro_pci);
112 +       return 0;
113 +}
114 +
115 +subsys_initcall(pronghornmetro_pci_init);
116 diff -Nur linux-2.6.23/arch/arm/mach-ixp4xx/pronghornmetro-setup.c linux-2.6.23-owrt/arch/arm/mach-ixp4xx/pronghornmetro-setup.c
117 --- linux-2.6.23/arch/arm/mach-ixp4xx/pronghornmetro-setup.c    1970-01-01 01:00:00.000000000 +0100
118 +++ linux-2.6.23-owrt/arch/arm/mach-ixp4xx/pronghornmetro-setup.c       2007-10-22 15:36:35.000000000 +0200
119 @@ -0,0 +1,147 @@
120 +/*
121 + * arch/arm/mach-ixp4xx/pronghornmetro-setup.c
122 + *
123 + * Board setup for the ADI Engineering Pronghorn Metro
124 + *
125 + * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org>
126 + *
127 + * based on coyote-setup.c:
128 + *      Copyright (C) 2003-2005 MontaVista Software, Inc.
129 + *
130 + * Author: Imre Kaloz <Kaloz@openwrt.org>
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 plat_serial8250_port pronghornmetro_uart_data[] = {
176 +       {
177 +               .mapbase        = IXP4XX_UART2_BASE_PHYS,
178 +               .membase        = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
179 +               .irq            = IRQ_IXP4XX_UART2,
180 +               .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
181 +               .iotype         = UPIO_MEM,
182 +               .regshift       = 2,
183 +               .uartclk        = IXP4XX_UART_XTAL,
184 +       },
185 +       { },
186 +};
187 +
188 +static struct platform_device pronghornmetro_uart = {
189 +       .name           = "serial8250",
190 +       .id             = PLAT8250_DEV_PLATFORM,
191 +       .dev                    = {
192 +               .platform_data  = pronghornmetro_uart_data,
193 +       },
194 +       .num_resources  = 1,
195 +       .resource       = &pronghornmetro_uart_resource,
196 +};
197 +
198 +static struct resource pronghornmetro_pata_resources[] = {
199 +       {
200 +               .flags  = IORESOURCE_MEM
201 +       },
202 +       {
203 +               .flags  = IORESOURCE_MEM,
204 +       },
205 +       {
206 +               .name   = "intrq",
207 +               .start  = IRQ_IXP4XX_GPIO0,
208 +               .end    = IRQ_IXP4XX_GPIO0,
209 +               .flags  = IORESOURCE_IRQ,
210 +       },
211 +};
212 +
213 +static struct ixp4xx_pata_data pronghornmetro_pata_data = {
214 +       .cs0_bits       = 0xbfff0043,
215 +       .cs1_bits       = 0xbfff0043,
216 +};
217 +
218 +static struct platform_device pronghornmetro_pata = {
219 +       .name                   = "pata_ixp4xx_cf",
220 +       .id                     = 0,
221 +       .dev.platform_data      = &pronghornmetro_pata_data,
222 +       .num_resources          = ARRAY_SIZE(pronghornmetro_pata_resources),
223 +       .resource               = pronghornmetro_pata_resources,
224 +};
225 +
226 +static struct platform_device *pronghornmetro_devices[] __initdata = {
227 +       &pronghornmetro_flash,
228 +       &pronghornmetro_uart,
229 +};
230 +
231 +static void __init pronghornmetro_init(void)
232 +{
233 +       ixp4xx_sys_init();
234 +
235 +       pronghornmetro_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
236 +       pronghornmetro_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_16M - 1;
237 +
238 +       *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
239 +       *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
240 +
241 +       platform_add_devices(pronghornmetro_devices, ARRAY_SIZE(pronghornmetro_devices));
242 +
243 +       pronghornmetro_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
244 +       pronghornmetro_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
245 +
246 +       pronghornmetro_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
247 +       pronghornmetro_pata_resources[1].end = IXP4XX_EXP_BUS_END(2);
248 +
249 +       pronghornmetro_pata_data.cs0_cfg = IXP4XX_EXP_CS1;
250 +       pronghornmetro_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
251 +
252 +       platform_device_register(&pronghornmetro_pata);
253 +}
254 +
255 +#ifdef CONFIG_MACH_PRONGHORNMETRO
256 +MACHINE_START(PRONGHORNMETRO, "ADI Engineering Pronghorn Metro")
257 +       /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
258 +       .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
259 +       .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
260 +       .map_io         = ixp4xx_map_io,
261 +       .init_irq       = ixp4xx_init_irq,
262 +       .timer          = &ixp4xx_timer,
263 +       .boot_params    = 0x0100,
264 +       .init_machine   = pronghornmetro_init,
265 +MACHINE_END
266 +#endif
267 diff -Nur linux-2.6.23/Documentation/arm/IXP4xx linux-2.6.23-owrt/Documentation/arm/IXP4xx
268 --- linux-2.6.23/Documentation/arm/IXP4xx       2007-10-09 22:31:38.000000000 +0200
269 +++ linux-2.6.23-owrt/Documentation/arm/IXP4xx  2007-10-22 15:16:43.000000000 +0200
270 @@ -111,6 +111,9 @@
271     the platform has two mini-PCI slots used for 802.11[bga] cards.
272     Finally, there is an IDE port hanging off the expansion bus.
273  
274 +ADI Engineering Pronghorn Metro Platform
275 +http://www.adiengineering.com/php-bin/ecomm4/productDisplay.php?category_id=30&product_id=85
276 +
277  Gateworks Avila Network Platform
278  http://www.gateworks.com/avila_sbc.htm
279  
280 diff -Nur linux-2.6.23/include/asm-arm/arch-ixp4xx/uncompress.h linux-2.6.23-owrt/include/asm-arm/arch-ixp4xx/uncompress.h
281 --- linux-2.6.23/include/asm-arm/arch-ixp4xx/uncompress.h       2007-10-22 14:47:50.000000000 +0200
282 +++ linux-2.6.23-owrt/include/asm-arm/arch-ixp4xx/uncompress.h  2007-10-22 15:18:47.000000000 +0200
283 @@ -41,7 +41,8 @@
284          * Some boards are using UART2 as console
285          */
286         if (machine_is_adi_coyote() || machine_is_gtwx5715() ||
287 -                        machine_is_gateway7001() || machine_is_wg302v2())
288 +                        machine_is_gateway7001() || machine_is_wg302v2() ||
289 +                        machine_is_pronghorn_metro())
290                 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
291         else
292                 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;