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