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