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