[ixp4xx] move the latch-led driver into a separated patch
[openwrt.git] / target / linux / ixp4xx / patches-2.6.25 / 110-pronghorn_metro_support.patch
1 Index: linux-2.6.25.4/arch/arm/mach-ixp4xx/Kconfig
2 ===================================================================
3 --- linux-2.6.25.4.orig/arch/arm/mach-ixp4xx/Kconfig
4 +++ linux-2.6.25.4/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.25.4/arch/arm/mach-ixp4xx/Makefile
21 ===================================================================
22 --- linux-2.6.25.4.orig/arch/arm/mach-ixp4xx/Makefile
23 +++ linux-2.6.25.4/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,6 +31,7 @@ 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  obj-$(CONFIG_IXP4XX_QMGR)      += ixp4xx_qmgr.o
40 Index: linux-2.6.25.4/arch/arm/mach-ixp4xx/pronghornmetro-pci.c
41 ===================================================================
42 --- /dev/null
43 +++ linux-2.6.25.4/arch/arm/mach-ixp4xx/pronghornmetro-pci.c
44 @@ -0,0 +1,74 @@
45 +/*
46 + * arch/arch/mach-ixp4xx/pronghornmetro-pci.c
47 + *
48 + * PCI setup routines for ADI Engineering Pronghorn Metro
49 + *
50 + * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org>
51 + *
52 + * based on coyote-pci.c:
53 + *     Copyright (C) 2002 Jungo Software Technologies.
54 + *     Copyright (C) 2003 MontaVista Softwrae, Inc.
55 + *
56 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
57 + *
58 + * This program is free software; you can redistribute it and/or modify
59 + * it under the terms of the GNU General Public License version 2 as
60 + * published by the Free Software Foundation.
61 + *
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_IXP4XX_GPIO4, IRQT_LOW);
82 +       set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW);
83 +       set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW);
84 +       set_irq_type(IRQ_IXP4XX_GPIO1, 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 == 13)
92 +               return IRQ_IXP4XX_GPIO4;
93 +       else if (slot == 14)
94 +               return IRQ_IXP4XX_GPIO6;
95 +       else if (slot == 15)
96 +               return IRQ_IXP4XX_GPIO11;
97 +       else if (slot == 16)
98 +               return IRQ_IXP4XX_GPIO1;
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 Index: linux-2.6.25.4/arch/arm/mach-ixp4xx/pronghornmetro-setup.c
120 ===================================================================
121 --- /dev/null
122 +++ linux-2.6.25.4/arch/arm/mach-ixp4xx/pronghornmetro-setup.c
123 @@ -0,0 +1,147 @@
124 +/*
125 + * arch/arm/mach-ixp4xx/pronghornmetro-setup.c
126 + *
127 + * Board setup for the ADI Engineering Pronghorn Metro
128 + *
129 + * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org>
130 + *
131 + * based on coyote-setup.c:
132 + *      Copyright (C) 2003-2005 MontaVista Software, Inc.
133 + *
134 + * Author: Imre Kaloz <Kaloz@openwrt.org>
135 + */
136 +
137 +#include <linux/kernel.h>
138 +#include <linux/init.h>
139 +#include <linux/device.h>
140 +#include <linux/serial.h>
141 +#include <linux/tty.h>
142 +#include <linux/serial_8250.h>
143 +#include <linux/slab.h>
144 +
145 +#include <asm/types.h>
146 +#include <asm/setup.h>
147 +#include <asm/memory.h>
148 +#include <asm/hardware.h>
149 +#include <asm/irq.h>
150 +#include <asm/mach-types.h>
151 +#include <asm/mach/arch.h>
152 +#include <asm/mach/flash.h>
153 +
154 +static struct flash_platform_data pronghornmetro_flash_data = {
155 +       .map_name       = "cfi_probe",
156 +       .width          = 2,
157 +};
158 +
159 +static struct resource pronghornmetro_flash_resource = {
160 +       .flags          = IORESOURCE_MEM,
161 +};
162 +
163 +static struct platform_device pronghornmetro_flash = {
164 +       .name           = "IXP4XX-Flash",
165 +       .id             = 0,
166 +       .dev            = {
167 +               .platform_data = &pronghornmetro_flash_data,
168 +       },
169 +       .num_resources  = 1,
170 +       .resource       = &pronghornmetro_flash_resource,
171 +};
172 +
173 +static struct resource pronghornmetro_uart_resource = {
174 +       .start  = IXP4XX_UART2_BASE_PHYS,
175 +       .end    = IXP4XX_UART2_BASE_PHYS + 0x0fff,
176 +       .flags  = IORESOURCE_MEM,
177 +};
178 +
179 +static struct plat_serial8250_port pronghornmetro_uart_data[] = {
180 +       {
181 +               .mapbase        = IXP4XX_UART2_BASE_PHYS,
182 +               .membase        = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
183 +               .irq            = IRQ_IXP4XX_UART2,
184 +               .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
185 +               .iotype         = UPIO_MEM,
186 +               .regshift       = 2,
187 +               .uartclk        = IXP4XX_UART_XTAL,
188 +       },
189 +       { },
190 +};
191 +
192 +static struct platform_device pronghornmetro_uart = {
193 +       .name           = "serial8250",
194 +       .id             = PLAT8250_DEV_PLATFORM,
195 +       .dev                    = {
196 +               .platform_data  = pronghornmetro_uart_data,
197 +       },
198 +       .num_resources  = 1,
199 +       .resource       = &pronghornmetro_uart_resource,
200 +};
201 +
202 +static struct resource pronghornmetro_pata_resources[] = {
203 +       {
204 +               .flags  = IORESOURCE_MEM
205 +       },
206 +       {
207 +               .flags  = IORESOURCE_MEM,
208 +       },
209 +       {
210 +               .name   = "intrq",
211 +               .start  = IRQ_IXP4XX_GPIO0,
212 +               .end    = IRQ_IXP4XX_GPIO0,
213 +               .flags  = IORESOURCE_IRQ,
214 +       },
215 +};
216 +
217 +static struct ixp4xx_pata_data pronghornmetro_pata_data = {
218 +       .cs0_bits       = 0xbfff0043,
219 +       .cs1_bits       = 0xbfff0043,
220 +};
221 +
222 +static struct platform_device pronghornmetro_pata = {
223 +       .name                   = "pata_ixp4xx_cf",
224 +       .id                     = 0,
225 +       .dev.platform_data      = &pronghornmetro_pata_data,
226 +       .num_resources          = ARRAY_SIZE(pronghornmetro_pata_resources),
227 +       .resource               = pronghornmetro_pata_resources,
228 +};
229 +
230 +static struct platform_device *pronghornmetro_devices[] __initdata = {
231 +       &pronghornmetro_flash,
232 +       &pronghornmetro_uart,
233 +};
234 +
235 +static void __init pronghornmetro_init(void)
236 +{
237 +       ixp4xx_sys_init();
238 +
239 +       pronghornmetro_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
240 +       pronghornmetro_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_16M - 1;
241 +
242 +       *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
243 +       *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
244 +
245 +       platform_add_devices(pronghornmetro_devices, ARRAY_SIZE(pronghornmetro_devices));
246 +
247 +       pronghornmetro_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
248 +       pronghornmetro_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
249 +
250 +       pronghornmetro_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
251 +       pronghornmetro_pata_resources[1].end = IXP4XX_EXP_BUS_END(2);
252 +
253 +       pronghornmetro_pata_data.cs0_cfg = IXP4XX_EXP_CS1;
254 +       pronghornmetro_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
255 +
256 +       platform_device_register(&pronghornmetro_pata);
257 +}
258 +
259 +#ifdef CONFIG_MACH_PRONGHORNMETRO
260 +MACHINE_START(PRONGHORNMETRO, "ADI Engineering Pronghorn Metro")
261 +       /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
262 +       .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
263 +       .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
264 +       .map_io         = ixp4xx_map_io,
265 +       .init_irq       = ixp4xx_init_irq,
266 +       .timer          = &ixp4xx_timer,
267 +       .boot_params    = 0x0100,
268 +       .init_machine   = pronghornmetro_init,
269 +MACHINE_END
270 +#endif
271 Index: linux-2.6.25.4/Documentation/arm/IXP4xx
272 ===================================================================
273 --- linux-2.6.25.4.orig/Documentation/arm/IXP4xx
274 +++ linux-2.6.25.4/Documentation/arm/IXP4xx
275 @@ -111,6 +111,9 @@ http://www.adiengineering.com/productsCo
276     the platform has two mini-PCI slots used for 802.11[bga] cards.
277     Finally, there is an IDE port hanging off the expansion bus.
278  
279 +ADI Engineering Pronghorn Metro Platform
280 +http://www.adiengineering.com/php-bin/ecomm4/productDisplay.php?category_id=30&product_id=85
281 +
282  Gateworks Avila Network Platform
283  http://www.gateworks.com/avila_sbc.htm
284  
285 Index: linux-2.6.25.4/include/asm-arm/arch-ixp4xx/uncompress.h
286 ===================================================================
287 --- linux-2.6.25.4.orig/include/asm-arm/arch-ixp4xx/uncompress.h
288 +++ linux-2.6.25.4/include/asm-arm/arch-ixp4xx/uncompress.h
289 @@ -41,7 +41,8 @@ static __inline__ void __arch_decomp_set
290          * Some boards are using UART2 as console
291          */
292         if (machine_is_adi_coyote() || machine_is_gtwx5715() ||
293 -                        machine_is_gateway7001() || machine_is_wg302v2())
294 +                        machine_is_gateway7001() || machine_is_wg302v2() ||
295 +                        machine_is_pronghorn_metro())
296                 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
297         else
298                 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;