d0175044db480475e37c8d5e8a80be4c1eb7ec78
[openwrt.git] / target / linux / ixp4xx / patches-2.6.28 / 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 @@ -25,6 +25,7 @@ obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt
21 obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o
22 obj-pci-$(CONFIG_MACH_TW5334) += tw5334-pci.o
23 obj-pci-$(CONFIG_MACH_MI424WR) += mi424wr-pci.o
24 +obj-pci-$(CONFIG_MACH_USR8200) += usr8200-pci.o
25
26 obj-y += common.o
27
28 @@ -48,6 +49,7 @@ obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv
29 obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o
30 obj-$(CONFIG_MACH_TW5334) += tw5334-setup.o
31 obj-$(CONFIG_MACH_MI424WR) += mi424wr-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,78 @@
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/mach-types.h>
66 +#include <mach/hardware.h>
67 +
68 +#include <asm/mach/pci.h>
69 +
70 +void __init usr8200_pci_preinit(void)
71 +{
72 + set_irq_type(IRQ_IXP4XX_GPIO7, IRQ_TYPE_LEVEL_LOW);
73 + set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW);
74 + set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW);
75 + set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW);
76 + set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW);
77 +
78 + ixp4xx_pci_preinit();
79 +}
80 +
81 +static int __init usr8200_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
82 +{
83 + if (slot == 14)
84 + return IRQ_IXP4XX_GPIO7;
85 + else if (slot == 15)
86 + return IRQ_IXP4XX_GPIO8;
87 + else if (slot == 16) {
88 + if (pin == 1)
89 + return IRQ_IXP4XX_GPIO11;
90 + else if (pin == 2)
91 + return IRQ_IXP4XX_GPIO10;
92 + else if (pin == 3)
93 + return IRQ_IXP4XX_GPIO9;
94 + else
95 + return -1;
96 + } else
97 + return -1;
98 +}
99 +
100 +struct hw_pci usr8200_pci __initdata = {
101 + .nr_controllers = 1,
102 + .preinit = usr8200_pci_preinit,
103 + .swizzle = pci_std_swizzle,
104 + .setup = ixp4xx_setup,
105 + .scan = ixp4xx_scan_bus,
106 + .map_irq = usr8200_map_irq,
107 +};
108 +
109 +int __init usr8200_pci_init(void)
110 +{
111 + if (machine_is_usr8200())
112 + pci_common_init(&usr8200_pci);
113 + return 0;
114 +}
115 +
116 +subsys_initcall(usr8200_pci_init);
117 --- /dev/null
118 +++ b/arch/arm/mach-ixp4xx/usr8200-setup.c
119 @@ -0,0 +1,212 @@
120 +/*
121 + * arch/arm/mach-ixp4xx/usr8200-setup.c
122 + *
123 + * Board setup for the USRobotics USR8200
124 + *
125 + * Copyright (C) 2008 Peter Denison <openwrt@marshadder.org>
126 + *
127 + * based on pronghorn-setup.c:
128 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
129 + * based on coyote-setup.c:
130 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
131 + *
132 + * Author: Peter Denison <openwrt@marshadder.org>
133 + */
134 +
135 +#include <linux/kernel.h>
136 +#include <linux/init.h>
137 +#include <linux/device.h>
138 +#include <linux/serial.h>
139 +#include <linux/tty.h>
140 +#include <linux/serial_8250.h>
141 +#include <linux/slab.h>
142 +#include <linux/types.h>
143 +#include <linux/memory.h>
144 +#include <linux/i2c-gpio.h>
145 +#include <linux/leds.h>
146 +
147 +#include <asm/setup.h>
148 +#include <mach/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 usr8200_flash_data = {
155 + .map_name = "cfi_probe",
156 + .width = 2,
157 +};
158 +
159 +static struct resource usr8200_flash_resource = {
160 + .flags = IORESOURCE_MEM,
161 +};
162 +
163 +static struct platform_device usr8200_flash = {
164 + .name = "IXP4XX-Flash",
165 + .id = 0,
166 + .dev = {
167 + .platform_data = &usr8200_flash_data,
168 + },
169 + .num_resources = 1,
170 + .resource = &usr8200_flash_resource,
171 +};
172 +
173 +static struct resource usr8200_uart_resources [] = {
174 + {
175 + .start = IXP4XX_UART2_BASE_PHYS,
176 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
177 + .flags = IORESOURCE_MEM
178 + },
179 + {
180 + .start = IXP4XX_UART1_BASE_PHYS,
181 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
182 + .flags = IORESOURCE_MEM
183 + }
184 +};
185 +
186 +static struct plat_serial8250_port usr8200_uart_data[] = {
187 + {
188 + .mapbase = IXP4XX_UART2_BASE_PHYS,
189 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
190 + .irq = IRQ_IXP4XX_UART2,
191 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
192 + .iotype = UPIO_MEM,
193 + .regshift = 2,
194 + .uartclk = IXP4XX_UART_XTAL,
195 + },
196 + {
197 + .mapbase = IXP4XX_UART1_BASE_PHYS,
198 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
199 + .irq = IRQ_IXP4XX_UART1,
200 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
201 + .iotype = UPIO_MEM,
202 + .regshift = 2,
203 + .uartclk = IXP4XX_UART_XTAL,
204 + },
205 + { },
206 +};
207 +
208 +static struct platform_device usr8200_uart = {
209 + .name = "serial8250",
210 + .id = PLAT8250_DEV_PLATFORM,
211 + .dev = {
212 + .platform_data = usr8200_uart_data,
213 + },
214 + .num_resources = 2,
215 + .resource = usr8200_uart_resources,
216 +};
217 +
218 +static struct gpio_led usr8200_led_pin[] = {
219 + {
220 + .name = "usr8200:usb1",
221 + .gpio = 0,
222 + .active_low = 1,
223 + },
224 + {
225 + .name = "usr8200:usb2",
226 + .gpio = 1,
227 + .active_low = 1,
228 + },
229 + {
230 + .name = "usr8200:ieee1394",
231 + .gpio = 2,
232 + .active_low = 1,
233 + },
234 + {
235 + .name = "usr8200:internal",
236 + .gpio = 3,
237 + .active_low = 1,
238 + },
239 + {
240 + .name = "usr8200:power",
241 + .gpio = 14,
242 + }
243 +};
244 +
245 +static struct gpio_led_platform_data usr8200_led_data = {
246 + .num_leds = ARRAY_SIZE(usr8200_led_pin),
247 + .leds = usr8200_led_pin,
248 +};
249 +
250 +static struct platform_device usr8200_led = {
251 + .name = "leds-gpio",
252 + .id = -1,
253 + .dev.platform_data = &usr8200_led_data,
254 +};
255 +
256 +static struct eth_plat_info usr8200_plat_eth[] = {
257 + { /* NPEC - LAN with Marvell 88E6060 switch */
258 + .phy = IXP4XX_ETH_PHY_MAX_ADDR,
259 + .phy_mask = 0x0F0000,
260 + .rxq = 4,
261 + .txreadyq = 21,
262 + }, { /* NPEB - WAN */
263 + .phy = 9,
264 + .rxq = 3,
265 + .txreadyq = 20,
266 + }
267 +};
268 +
269 +static struct platform_device usr8200_eth[] = {
270 + {
271 + .name = "ixp4xx_eth",
272 + .id = IXP4XX_ETH_NPEC,
273 + .dev.platform_data = usr8200_plat_eth,
274 + }, {
275 + .name = "ixp4xx_eth",
276 + .id = IXP4XX_ETH_NPEB,
277 + .dev.platform_data = usr8200_plat_eth + 1,
278 + }
279 +};
280 +
281 +static struct resource usr8200_rtc_resources = {
282 + .flags = IORESOURCE_MEM
283 +};
284 +
285 +static struct platform_device usr8200_rtc = {
286 + .name = "rtc7301",
287 + .id = 0,
288 + .num_resources = 1,
289 + .resource = &usr8200_rtc_resources,
290 +};
291 +
292 +static struct platform_device *usr8200_devices[] __initdata = {
293 + &usr8200_flash,
294 + &usr8200_uart,
295 + &usr8200_led,
296 + &usr8200_eth[0],
297 + &usr8200_eth[1],
298 + &usr8200_rtc,
299 +};
300 +
301 +static void __init usr8200_init(void)
302 +{
303 + ixp4xx_sys_init();
304 +
305 + usr8200_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
306 + usr8200_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_16M - 1;
307 +
308 + usr8200_rtc_resources.start = IXP4XX_EXP_BUS_BASE(2);
309 + usr8200_rtc_resources.end = IXP4XX_EXP_BUS_BASE(2) + 0x01ff;
310 +
311 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
312 + *IXP4XX_EXP_CS2 = 0x3fff000 | IXP4XX_EXP_BUS_SIZE(0) | IXP4XX_EXP_BUS_WR_EN |
313 + IXP4XX_EXP_BUS_CS_EN | IXP4XX_EXP_BUS_BYTE_EN;
314 + *IXP4XX_GPIO_GPCLKR = 0x01100000;
315 +
316 + /* configure button as input */
317 + gpio_line_config(12, IXP4XX_GPIO_IN);
318 +
319 + platform_add_devices(usr8200_devices, ARRAY_SIZE(usr8200_devices));
320 +}
321 +
322 +MACHINE_START(USR8200, "USRobotics USR8200")
323 + /* Maintainer: Peter Denison <openwrt@marshadder.org> */
324 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
325 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
326 + .map_io = ixp4xx_map_io,
327 + .init_irq = ixp4xx_init_irq,
328 + .timer = &ixp4xx_timer,
329 + .boot_params = 0x0100,
330 + .init_machine = usr8200_init,
331 +MACHINE_END
332 --- a/arch/arm/mach-ixp4xx/include/mach/uncompress.h
333 +++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h
334 @@ -43,7 +43,7 @@ static __inline__ void __arch_decomp_set
335 if (machine_is_adi_coyote() || machine_is_gtwx5715() ||
336 machine_is_gateway7001() || machine_is_wg302v2() ||
337 machine_is_pronghorn() || machine_is_pronghorn_metro() || machine_is_wrt300nv2() ||
338 - machine_is_tw5334())
339 + machine_is_tw5334() || machine_is_usr8200())
340 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
341 else
342 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;
This page took 0.057866 seconds and 3 git commands to generate.