update config, make 2.6.26-rc8 the default for ixp4xx
[openwrt.git] / target / linux / ixp4xx / patches-2.6.24 / 110-pronghorn_metro_support.patch
1 Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig
2 ===================================================================
3 --- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Kconfig
4 +++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig
5 @@ -57,6 +57,14 @@ config MACH_WG302V2
6           WG302 v2 or WAG302 v2 Access Points. For more information
7           on this platform, see http://openwrt.org
8  
9 +config MACH_PRONGHORNMETRO
10 +       bool "Pronghorn Metro"
11 +       select PCI
12 +       help
13 +         Say 'Y' here if you want your kernel to support the ADI 
14 +         Engineering Pronghorn Metro Platform. For more
15 +         information on this platform, see <file:Documentation/arm/IXP4xx>.
16 +
17  config ARCH_IXDP425
18         bool "IXDP425"
19         help
20 Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile
21 ===================================================================
22 --- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Makefile
23 +++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile
24 @@ -16,6 +16,7 @@ obj-pci-$(CONFIG_MACH_DSMG600)                += dsmg6
25  obj-pci-$(CONFIG_MACH_GATEWAY7001)     += gateway7001-pci.o
26  obj-pci-$(CONFIG_MACH_WG302V2)         += wg302v2-pci.o
27  obj-pci-$(CONFIG_MACH_FSG)             += fsg-pci.o
28 +obj-pci-$(CONFIG_MACH_PRONGHORNMETRO)  += pronghornmetro-pci.o
29  
30  obj-y  += common.o
31  
32 @@ -30,5 +31,6 @@ obj-$(CONFIG_MACH_DSMG600)      += dsmg6
33  obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
34  obj-$(CONFIG_MACH_WG302V2)     += wg302v2-setup.o
35  obj-$(CONFIG_MACH_FSG)         += fsg-setup.o
36 +obj-$(CONFIG_MACH_PRONGHORNMETRO)      += pronghornmetro-setup.o
37  
38  obj-$(CONFIG_PCI)              += $(obj-pci-$(CONFIG_PCI)) common-pci.o
39 Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/pronghornmetro-pci.c
40 ===================================================================
41 --- /dev/null
42 +++ linux-2.6.24.7/arch/arm/mach-ixp4xx/pronghornmetro-pci.c
43 @@ -0,0 +1,74 @@
44 +/*
45 + * arch/arch/mach-ixp4xx/pronghornmetro-pci.c
46 + *
47 + * PCI setup routines for ADI Engineering Pronghorn Metro
48 + *
49 + * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org>
50 + *
51 + * based on coyote-pci.c:
52 + *     Copyright (C) 2002 Jungo Software Technologies.
53 + *     Copyright (C) 2003 MontaVista Softwrae, Inc.
54 + *
55 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
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 + */
62 +
63 +#include <linux/kernel.h>
64 +#include <linux/pci.h>
65 +#include <linux/init.h>
66 +#include <linux/irq.h>
67 +
68 +#include <asm/mach-types.h>
69 +#include <asm/hardware.h>
70 +#include <asm/irq.h>
71 +
72 +#include <asm/mach/pci.h>
73 +
74 +extern void ixp4xx_pci_preinit(void);
75 +extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
76 +extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
77 +
78 +void __init pronghornmetro_pci_preinit(void)
79 +{
80 +       set_irq_type(IRQ_IXP4XX_GPIO4, IRQT_LOW);
81 +       set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW);
82 +       set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW);
83 +       set_irq_type(IRQ_IXP4XX_GPIO1, IRQT_LOW);
84 +
85 +       ixp4xx_pci_preinit();
86 +}
87 +
88 +static int __init pronghornmetro_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
89 +{
90 +       if (slot == 13)
91 +               return IRQ_IXP4XX_GPIO4;
92 +       else if (slot == 14)
93 +               return IRQ_IXP4XX_GPIO6;
94 +       else if (slot == 15)
95 +               return IRQ_IXP4XX_GPIO11;
96 +       else if (slot == 16)
97 +               return IRQ_IXP4XX_GPIO1;
98 +       else return -1;
99 +}
100 +
101 +struct hw_pci pronghornmetro_pci __initdata = {
102 +       .nr_controllers = 1,
103 +       .preinit =        pronghornmetro_pci_preinit,
104 +       .swizzle =        pci_std_swizzle,
105 +       .setup =          ixp4xx_setup,
106 +       .scan =           ixp4xx_scan_bus,
107 +       .map_irq =        pronghornmetro_map_irq,
108 +};
109 +
110 +int __init pronghornmetro_pci_init(void)
111 +{
112 +       if (machine_is_pronghorn_metro())
113 +               pci_common_init(&pronghornmetro_pci);
114 +       return 0;
115 +}
116 +
117 +subsys_initcall(pronghornmetro_pci_init);
118 Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/pronghornmetro-setup.c
119 ===================================================================
120 --- /dev/null
121 +++ linux-2.6.24.7/arch/arm/mach-ixp4xx/pronghornmetro-setup.c
122 @@ -0,0 +1,147 @@
123 +/*
124 + * arch/arm/mach-ixp4xx/pronghornmetro-setup.c
125 + *
126 + * Board setup for the ADI Engineering Pronghorn Metro
127 + *
128 + * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org>
129 + *
130 + * based on coyote-setup.c:
131 + *      Copyright (C) 2003-2005 MontaVista Software, Inc.
132 + *
133 + * Author: Imre Kaloz <Kaloz@openwrt.org>
134 + */
135 +
136 +#include <linux/kernel.h>
137 +#include <linux/init.h>
138 +#include <linux/device.h>
139 +#include <linux/serial.h>
140 +#include <linux/tty.h>
141 +#include <linux/serial_8250.h>
142 +#include <linux/slab.h>
143 +
144 +#include <asm/types.h>
145 +#include <asm/setup.h>
146 +#include <asm/memory.h>
147 +#include <asm/hardware.h>
148 +#include <asm/irq.h>
149 +#include <asm/mach-types.h>
150 +#include <asm/mach/arch.h>
151 +#include <asm/mach/flash.h>
152 +
153 +static struct flash_platform_data pronghornmetro_flash_data = {
154 +       .map_name       = "cfi_probe",
155 +       .width          = 2,
156 +};
157 +
158 +static struct resource pronghornmetro_flash_resource = {
159 +       .flags          = IORESOURCE_MEM,
160 +};
161 +
162 +static struct platform_device pronghornmetro_flash = {
163 +       .name           = "IXP4XX-Flash",
164 +       .id             = 0,
165 +       .dev            = {
166 +               .platform_data = &pronghornmetro_flash_data,
167 +       },
168 +       .num_resources  = 1,
169 +       .resource       = &pronghornmetro_flash_resource,
170 +};
171 +
172 +static struct resource pronghornmetro_uart_resource = {
173 +       .start  = IXP4XX_UART2_BASE_PHYS,
174 +       .end    = IXP4XX_UART2_BASE_PHYS + 0x0fff,
175 +       .flags  = IORESOURCE_MEM,
176 +};
177 +
178 +static struct plat_serial8250_port pronghornmetro_uart_data[] = {
179 +       {
180 +               .mapbase        = IXP4XX_UART2_BASE_PHYS,
181 +               .membase        = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
182 +               .irq            = IRQ_IXP4XX_UART2,
183 +               .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
184 +               .iotype         = UPIO_MEM,
185 +               .regshift       = 2,
186 +               .uartclk        = IXP4XX_UART_XTAL,
187 +       },
188 +       { },
189 +};
190 +
191 +static struct platform_device pronghornmetro_uart = {
192 +       .name           = "serial8250",
193 +       .id             = PLAT8250_DEV_PLATFORM,
194 +       .dev                    = {
195 +               .platform_data  = pronghornmetro_uart_data,
196 +       },
197 +       .num_resources  = 1,
198 +       .resource       = &pronghornmetro_uart_resource,
199 +};
200 +
201 +static struct resource pronghornmetro_pata_resources[] = {
202 +       {
203 +               .flags  = IORESOURCE_MEM
204 +       },
205 +       {
206 +               .flags  = IORESOURCE_MEM,
207 +       },
208 +       {
209 +               .name   = "intrq",
210 +               .start  = IRQ_IXP4XX_GPIO0,
211 +               .end    = IRQ_IXP4XX_GPIO0,
212 +               .flags  = IORESOURCE_IRQ,
213 +       },
214 +};
215 +
216 +static struct ixp4xx_pata_data pronghornmetro_pata_data = {
217 +       .cs0_bits       = 0xbfff0043,
218 +       .cs1_bits       = 0xbfff0043,
219 +};
220 +
221 +static struct platform_device pronghornmetro_pata = {
222 +       .name                   = "pata_ixp4xx_cf",
223 +       .id                     = 0,
224 +       .dev.platform_data      = &pronghornmetro_pata_data,
225 +       .num_resources          = ARRAY_SIZE(pronghornmetro_pata_resources),
226 +       .resource               = pronghornmetro_pata_resources,
227 +};
228 +
229 +static struct platform_device *pronghornmetro_devices[] __initdata = {
230 +       &pronghornmetro_flash,
231 +       &pronghornmetro_uart,
232 +};
233 +
234 +static void __init pronghornmetro_init(void)
235 +{
236 +       ixp4xx_sys_init();
237 +
238 +       pronghornmetro_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
239 +       pronghornmetro_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_16M - 1;
240 +
241 +       *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
242 +       *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
243 +
244 +       platform_add_devices(pronghornmetro_devices, ARRAY_SIZE(pronghornmetro_devices));
245 +
246 +       pronghornmetro_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
247 +       pronghornmetro_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
248 +
249 +       pronghornmetro_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
250 +       pronghornmetro_pata_resources[1].end = IXP4XX_EXP_BUS_END(2);
251 +
252 +       pronghornmetro_pata_data.cs0_cfg = IXP4XX_EXP_CS1;
253 +       pronghornmetro_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
254 +
255 +       platform_device_register(&pronghornmetro_pata);
256 +}
257 +
258 +#ifdef CONFIG_MACH_PRONGHORNMETRO
259 +MACHINE_START(PRONGHORNMETRO, "ADI Engineering Pronghorn Metro")
260 +       /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
261 +       .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
262 +       .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
263 +       .map_io         = ixp4xx_map_io,
264 +       .init_irq       = ixp4xx_init_irq,
265 +       .timer          = &ixp4xx_timer,
266 +       .boot_params    = 0x0100,
267 +       .init_machine   = pronghornmetro_init,
268 +MACHINE_END
269 +#endif
270 Index: linux-2.6.24.7/Documentation/arm/IXP4xx
271 ===================================================================
272 --- linux-2.6.24.7.orig/Documentation/arm/IXP4xx
273 +++ linux-2.6.24.7/Documentation/arm/IXP4xx
274 @@ -111,6 +111,9 @@ http://www.adiengineering.com/productsCo
275     the platform has two mini-PCI slots used for 802.11[bga] cards.
276     Finally, there is an IDE port hanging off the expansion bus.
277  
278 +ADI Engineering Pronghorn Metro Platform
279 +http://www.adiengineering.com/php-bin/ecomm4/productDisplay.php?category_id=30&product_id=85
280 +
281  Gateworks Avila Network Platform
282  http://www.gateworks.com/avila_sbc.htm
283  
284 Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/uncompress.h
285 ===================================================================
286 --- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/uncompress.h
287 +++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/uncompress.h
288 @@ -41,7 +41,8 @@ static __inline__ void __arch_decomp_set
289          * Some boards are using UART2 as console
290          */
291         if (machine_is_adi_coyote() || machine_is_gtwx5715() ||
292 -                        machine_is_gateway7001() || machine_is_wg302v2())
293 +                        machine_is_gateway7001() || machine_is_wg302v2() ||
294 +                        machine_is_pronghorn_metro())
295                 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
296         else
297                 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;