[kernel] workaround a gcc-4.1 bug which cannot see that word will be initialized
[openwrt.git] / target / linux / ixp4xx / patches-2.6.26 / 500-usr8200_support.patch
1 --- a/arch/arm/mach-ixp4xx/Kconfig
2 +++ b/arch/arm/mach-ixp4xx/Kconfig
3 @@ -97,6 +97,14 @@ config MACH_SIDEWINDER
4 Engineering Sidewinder board. For more information on this
5 platform, see http://www.adiengineering.com
6
7 +config MACH_USR8200
8 + bool "USRobotics USR8200"
9 + select PCI
10 + help
11 + Say 'Y' here if you want your kernel to support the USRobotics
12 + USR8200 router board. For more information on this platform, see
13 + http://openwrt.org
14 +
15 config MACH_COMPEX
16 bool "Compex WP18 / NP18A"
17 select PCI
18 --- a/arch/arm/mach-ixp4xx/Makefile
19 +++ b/arch/arm/mach-ixp4xx/Makefile
20 @@ -24,6 +24,7 @@ obj-pci-$(CONFIG_MACH_COMPEX) += ixdp42
21 obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o
22 obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o
23 obj-pci-$(CONFIG_MACH_TW5334) += tw5334-pci.o
24 +obj-pci-$(CONFIG_MACH_USR8200) += usr8200-pci.o
25
26 obj-y += common.o
27
28 @@ -46,6 +47,7 @@ obj-$(CONFIG_MACH_COMPEX) += compex-setu
29 obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o
30 obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o
31 obj-$(CONFIG_MACH_TW5334) += tw5334-setup.o
32 +obj-$(CONFIG_MACH_USR8200) += usr8200-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/usr8200-pci.c
38 @@ -0,0 +1,79 @@
39 +/*
40 + * arch/arch/mach-ixp4xx/usr8200-pci.c
41 + *
42 + * PCI setup routines for USRobotics USR8200
43 + *
44 + * Copyright (C) 2008 Peter Denison <openwrt@marshadder.org>
45 + *
46 + * based on pronghorn-pci.c
47 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
48 + * based on coyote-pci.c:
49 + * Copyright (C) 2002 Jungo Software Technologies.
50 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
51 + *
52 + * Maintainer: Peter Denison <openwrt@marshadder.org>
53 + *
54 + * This program is free software; you can redistribute it and/or modify
55 + * it under the terms of the GNU General Public License version 2 as
56 + * published by the Free Software Foundation.
57 + *
58 + */
59 +
60 +#include <linux/kernel.h>
61 +#include <linux/pci.h>
62 +#include <linux/init.h>
63 +#include <linux/irq.h>
64 +
65 +#include <asm/irq.h>
66 +#include <asm/mach-types.h>
67 +#include <asm/hardware.h>
68 +
69 +#include <asm/mach/pci.h>
70 +
71 +void __init usr8200_pci_preinit(void)
72 +{
73 + set_irq_type(IRQ_IXP4XX_GPIO7, IRQ_TYPE_LEVEL_LOW);
74 + set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW);
75 + set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW);
76 + set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW);
77 + set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW);
78 +
79 + ixp4xx_pci_preinit();
80 +}
81 +
82 +static int __init usr8200_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
83 +{
84 + if (slot == 14)
85 + return IRQ_IXP4XX_GPIO7;
86 + else if (slot == 15)
87 + return IRQ_IXP4XX_GPIO8;
88 + else if (slot == 16) {
89 + if (pin == 1)
90 + return IRQ_IXP4XX_GPIO11;
91 + else if (pin == 2)
92 + return IRQ_IXP4XX_GPIO10;
93 + else if (pin == 3)
94 + return IRQ_IXP4XX_GPIO9;
95 + else
96 + return -1;
97 + } else
98 + return -1;
99 +}
100 +
101 +struct hw_pci usr8200_pci __initdata = {
102 + .nr_controllers = 1,
103 + .preinit = usr8200_pci_preinit,
104 + .swizzle = pci_std_swizzle,
105 + .setup = ixp4xx_setup,
106 + .scan = ixp4xx_scan_bus,
107 + .map_irq = usr8200_map_irq,
108 +};
109 +
110 +int __init usr8200_pci_init(void)
111 +{
112 + if (machine_is_usr8200())
113 + pci_common_init(&usr8200_pci);
114 + return 0;
115 +}
116 +
117 +subsys_initcall(usr8200_pci_init);
118 --- /dev/null
119 +++ b/arch/arm/mach-ixp4xx/usr8200-setup.c
120 @@ -0,0 +1,212 @@
121 +/*
122 + * arch/arm/mach-ixp4xx/usr8200-setup.c
123 + *
124 + * Board setup for the USRobotics USR8200
125 + *
126 + * Copyright (C) 2008 Peter Denison <openwrt@marshadder.org>
127 + *
128 + * based on pronghorn-setup.c:
129 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
130 + * based on coyote-setup.c:
131 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
132 + *
133 + * Author: Peter Denison <openwrt@marshadder.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 +#include <linux/types.h>
144 +#include <linux/memory.h>
145 +#include <linux/i2c-gpio.h>
146 +#include <linux/leds.h>
147 +
148 +#include <asm/setup.h>
149 +#include <asm/hardware.h>
150 +#include <asm/irq.h>
151 +#include <asm/mach-types.h>
152 +#include <asm/mach/arch.h>
153 +#include <asm/mach/flash.h>
154 +
155 +static struct flash_platform_data usr8200_flash_data = {
156 + .map_name = "cfi_probe",
157 + .width = 2,
158 +};
159 +
160 +static struct resource usr8200_flash_resource = {
161 + .flags = IORESOURCE_MEM,
162 +};
163 +
164 +static struct platform_device usr8200_flash = {
165 + .name = "IXP4XX-Flash",
166 + .id = 0,
167 + .dev = {
168 + .platform_data = &usr8200_flash_data,
169 + },
170 + .num_resources = 1,
171 + .resource = &usr8200_flash_resource,
172 +};
173 +
174 +static struct resource usr8200_uart_resources [] = {
175 + {
176 + .start = IXP4XX_UART2_BASE_PHYS,
177 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
178 + .flags = IORESOURCE_MEM
179 + },
180 + {
181 + .start = IXP4XX_UART1_BASE_PHYS,
182 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
183 + .flags = IORESOURCE_MEM
184 + }
185 +};
186 +
187 +static struct plat_serial8250_port usr8200_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 + .mapbase = IXP4XX_UART1_BASE_PHYS,
199 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
200 + .irq = IRQ_IXP4XX_UART1,
201 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
202 + .iotype = UPIO_MEM,
203 + .regshift = 2,
204 + .uartclk = IXP4XX_UART_XTAL,
205 + },
206 + { },
207 +};
208 +
209 +static struct platform_device usr8200_uart = {
210 + .name = "serial8250",
211 + .id = PLAT8250_DEV_PLATFORM,
212 + .dev = {
213 + .platform_data = usr8200_uart_data,
214 + },
215 + .num_resources = 2,
216 + .resource = usr8200_uart_resources,
217 +};
218 +
219 +static struct gpio_led usr8200_led_pin[] = {
220 + {
221 + .name = "usr8200:usb1",
222 + .gpio = 0,
223 + .active_low = 1,
224 + },
225 + {
226 + .name = "usr8200:usb2",
227 + .gpio = 1,
228 + .active_low = 1,
229 + },
230 + {
231 + .name = "usr8200:ieee1394",
232 + .gpio = 2,
233 + .active_low = 1,
234 + },
235 + {
236 + .name = "usr8200:internal",
237 + .gpio = 3,
238 + .active_low = 1,
239 + },
240 + {
241 + .name = "usr8200:power",
242 + .gpio = 14,
243 + }
244 +};
245 +
246 +static struct gpio_led_platform_data usr8200_led_data = {
247 + .num_leds = ARRAY_SIZE(usr8200_led_pin),
248 + .leds = usr8200_led_pin,
249 +};
250 +
251 +static struct platform_device usr8200_led = {
252 + .name = "leds-gpio",
253 + .id = -1,
254 + .dev.platform_data = &usr8200_led_data,
255 +};
256 +
257 +static struct eth_plat_info usr8200_plat_eth[] = {
258 + { /* NPEC - LAN with Marvell 88E6060 switch */
259 + .phy = IXP4XX_ETH_PHY_MAX_ADDR,
260 + .phy_mask = 0x0F0000,
261 + .rxq = 4,
262 + .txreadyq = 21,
263 + }, { /* NPEB - WAN */
264 + .phy = 9,
265 + .rxq = 3,
266 + .txreadyq = 20,
267 + }
268 +};
269 +
270 +static struct platform_device usr8200_eth[] = {
271 + {
272 + .name = "ixp4xx_eth",
273 + .id = IXP4XX_ETH_NPEC,
274 + .dev.platform_data = usr8200_plat_eth,
275 + }, {
276 + .name = "ixp4xx_eth",
277 + .id = IXP4XX_ETH_NPEB,
278 + .dev.platform_data = usr8200_plat_eth + 1,
279 + }
280 +};
281 +
282 +static struct resource usr8200_rtc_resources = {
283 + .flags = IORESOURCE_MEM
284 +};
285 +
286 +static struct platform_device usr8200_rtc = {
287 + .name = "rtc7301",
288 + .id = 0,
289 + .num_resources = 1,
290 + .resource = &usr8200_rtc_resources,
291 +};
292 +
293 +static struct platform_device *usr8200_devices[] __initdata = {
294 + &usr8200_flash,
295 + &usr8200_uart,
296 + &usr8200_led,
297 + &usr8200_eth[0],
298 + &usr8200_eth[1],
299 + &usr8200_rtc,
300 +};
301 +
302 +static void __init usr8200_init(void)
303 +{
304 + ixp4xx_sys_init();
305 +
306 + usr8200_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
307 + usr8200_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_16M - 1;
308 +
309 + usr8200_rtc_resources.start = IXP4XX_EXP_BUS_BASE(2);
310 + usr8200_rtc_resources.end = IXP4XX_EXP_BUS_BASE(2) + 0x01ff;
311 +
312 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
313 + *IXP4XX_EXP_CS2 = IXP4XX_EXP_BUS_SIZE(0) | IXP4XX_EXP_BUS_WR_EN |
314 + IXP4XX_EXP_BUS_CS_EN | IXP4XX_EXP_BUS_BYTE_EN;
315 + *IXP4XX_GPIO_GPCLKR = 0x01100000;
316 +
317 + /* configure button as input */
318 + gpio_line_config(12, IXP4XX_GPIO_IN);
319 +
320 + platform_add_devices(usr8200_devices, ARRAY_SIZE(usr8200_devices));
321 +}
322 +
323 +MACHINE_START(USR8200, "USRobotics USR8200")
324 + /* Maintainer: Peter Denison <openwrt@marshadder.org> */
325 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
326 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
327 + .map_io = ixp4xx_map_io,
328 + .init_irq = ixp4xx_init_irq,
329 + .timer = &ixp4xx_timer,
330 + .boot_params = 0x0100,
331 + .init_machine = usr8200_init,
332 +MACHINE_END
333 --- a/include/asm-arm/arch-ixp4xx/uncompress.h
334 +++ b/include/asm-arm/arch-ixp4xx/uncompress.h
335 @@ -43,7 +43,7 @@ static __inline__ void __arch_decomp_set
336 if (machine_is_adi_coyote() || machine_is_gtwx5715() ||
337 machine_is_gateway7001() || machine_is_wg302v2() ||
338 machine_is_pronghorn() || machine_is_pronghorn_metro() || machine_is_wrt300nv2() ||
339 - machine_is_tw5334())
340 + machine_is_tw5334() || machine_is_usr8200())
341 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
342 else
343 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;
This page took 0.06581 seconds and 5 git commands to generate.