[rb532] refresh patches
[openwrt.git] / target / linux / ixp4xx / patches-2.6.27 / 105-wg302v1_support.patch
1 --- a/arch/arm/configs/ixp4xx_defconfig
2 +++ b/arch/arm/configs/ixp4xx_defconfig
3 @@ -155,6 +155,7 @@ CONFIG_MACH_AVILA=y
4 CONFIG_MACH_LOFT=y
5 CONFIG_ARCH_ADI_COYOTE=y
6 CONFIG_MACH_GATEWAY7001=y
7 +CONFIG_MACH_WG302V1=y
8 CONFIG_MACH_WG302V2=y
9 CONFIG_ARCH_IXDP425=y
10 CONFIG_MACH_IXDPG425=y
11 --- a/arch/arm/mach-ixp4xx/Kconfig
12 +++ b/arch/arm/mach-ixp4xx/Kconfig
13 @@ -49,6 +49,14 @@ config MACH_GATEWAY7001
14 7001 Access Point. For more information on this platform,
15 see http://openwrt.org
16
17 +config MACH_WG302V1
18 + bool "Netgear WG302 v1 / WAG302 v1"
19 + select PCI
20 + help
21 + Say 'Y' here if you want your kernel to support Netgear's
22 + WG302 v1 or WAG302 v1 Access Points. For more information
23 + on this platform, see http://openwrt.org
24 +
25 config MACH_WG302V2
26 bool "Netgear WG302 v2 / WAG302 v2"
27 select PCI
28 --- a/arch/arm/mach-ixp4xx/Makefile
29 +++ b/arch/arm/mach-ixp4xx/Makefile
30 @@ -14,6 +14,7 @@ obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-p
31 obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o
32 obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o
33 obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o
34 +obj-pci-$(CONFIG_MACH_WG302V1) += wg302v1-pci.o
35 obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o
36 obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o
37
38 @@ -28,6 +29,7 @@ obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.
39 obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o
40 obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o
41 obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
42 +obj-$(CONFIG_MACH_WG302V1) += wg302v1-setup.o
43 obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o
44 obj-$(CONFIG_MACH_FSG) += fsg-setup.o
45
46 --- /dev/null
47 +++ b/arch/arm/mach-ixp4xx/wg302v1-pci.c
48 @@ -0,0 +1,64 @@
49 +/*
50 + * arch/arch/mach-ixp4xx/wg302v1-pci.c
51 + *
52 + * PCI setup routines for the Netgear WG302 v1 and WAG302 v1
53 + *
54 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
55 + *
56 + * based on coyote-pci.c:
57 + * Copyright (C) 2002 Jungo Software Technologies.
58 + * Copyright (C) 2003 MontaVista Software, Inc.
59 + *
60 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
61 + *
62 + * This program is free software; you can redistribute it and/or modify
63 + * it under the terms of the GNU General Public License version 2 as
64 + * published by the Free Software Foundation.
65 + *
66 + */
67 +
68 +#include <linux/kernel.h>
69 +#include <linux/pci.h>
70 +#include <linux/init.h>
71 +#include <linux/irq.h>
72 +
73 +#include <asm/mach-types.h>
74 +#include <mach/hardware.h>
75 +
76 +#include <asm/mach/pci.h>
77 +
78 +void __init wg302v1_pci_preinit(void)
79 +{
80 + set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW);
81 + set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW);
82 +
83 + ixp4xx_pci_preinit();
84 +}
85 +
86 +static int __init wg302v1_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
87 +{
88 + if (slot == 1)
89 + return IRQ_IXP4XX_GPIO8;
90 + else if (slot == 2)
91 + return IRQ_IXP4XX_GPIO10;
92 + else
93 + return -1;
94 +}
95 +
96 +struct hw_pci wg302v1_pci __initdata = {
97 + .nr_controllers = 1,
98 + .preinit = wg302v1_pci_preinit,
99 + .swizzle = pci_std_swizzle,
100 + .setup = ixp4xx_setup,
101 + .scan = ixp4xx_scan_bus,
102 + .map_irq = wg302v1_map_irq,
103 +};
104 +
105 +int __init wg302v1_pci_init(void)
106 +{
107 + if (machine_is_wg302v1())
108 + pci_common_init(&wg302v1_pci);
109 + return 0;
110 +}
111 +
112 +subsys_initcall(wg302v1_pci_init);
113 --- /dev/null
114 +++ b/arch/arm/mach-ixp4xx/wg302v1-setup.c
115 @@ -0,0 +1,142 @@
116 +/*
117 + * arch/arm/mach-ixp4xx/wg302v1-setup.c
118 + *
119 + * Board setup for the Netgear WG302 v1 and WAG302 v1
120 + *
121 + * Copyright (C) 2008 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 +
130 +#include <linux/kernel.h>
131 +#include <linux/init.h>
132 +#include <linux/device.h>
133 +#include <linux/serial.h>
134 +#include <linux/tty.h>
135 +#include <linux/serial_8250.h>
136 +#include <linux/slab.h>
137 +#include <linux/types.h>
138 +#include <linux/memory.h>
139 +
140 +#include <asm/setup.h>
141 +#include <mach/hardware.h>
142 +#include <asm/irq.h>
143 +#include <asm/mach-types.h>
144 +#include <asm/mach/arch.h>
145 +#include <asm/mach/flash.h>
146 +
147 +static struct flash_platform_data wg302v1_flash_data = {
148 + .map_name = "cfi_probe",
149 + .width = 2,
150 +};
151 +
152 +static struct resource wg302v1_flash_resource = {
153 + .flags = IORESOURCE_MEM,
154 +};
155 +
156 +static struct platform_device wg302v1_flash = {
157 + .name = "IXP4XX-Flash",
158 + .id = 0,
159 + .dev = {
160 + .platform_data = &wg302v1_flash_data,
161 + },
162 + .num_resources = 1,
163 + .resource = &wg302v1_flash_resource,
164 +};
165 +
166 +static struct resource wg302v1_uart_resources[] = {
167 + {
168 + .start = IXP4XX_UART1_BASE_PHYS,
169 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
170 + .flags = IORESOURCE_MEM,
171 + },
172 + {
173 + .start = IXP4XX_UART2_BASE_PHYS,
174 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
175 + .flags = IORESOURCE_MEM,
176 + }
177 +};
178 +
179 +static struct plat_serial8250_port wg302v1_uart_data[] = {
180 + {
181 + .mapbase = IXP4XX_UART1_BASE_PHYS,
182 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
183 + .irq = IRQ_IXP4XX_UART1,
184 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
185 + .iotype = UPIO_MEM,
186 + .regshift = 2,
187 + .uartclk = IXP4XX_UART_XTAL,
188 + },
189 + {
190 + .mapbase = IXP4XX_UART2_BASE_PHYS,
191 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
192 + .irq = IRQ_IXP4XX_UART2,
193 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
194 + .iotype = UPIO_MEM,
195 + .regshift = 2,
196 + .uartclk = IXP4XX_UART_XTAL,
197 + },
198 + { },
199 +};
200 +
201 +static struct platform_device wg302v1_uart = {
202 + .name = "serial8250",
203 + .id = PLAT8250_DEV_PLATFORM,
204 + .dev = {
205 + .platform_data = wg302v1_uart_data,
206 + },
207 + .num_resources = 2,
208 + .resource = wg302v1_uart_resources,
209 +};
210 +
211 +static struct eth_plat_info wg302v1_plat_eth[] = {
212 + {
213 + .phy = 30,
214 + .rxq = 3,
215 + .txreadyq = 20,
216 + }
217 +};
218 +
219 +static struct platform_device wg302v1_eth[] = {
220 + {
221 + .name = "ixp4xx_eth",
222 + .id = IXP4XX_ETH_NPEB,
223 + .dev.platform_data = wg302v1_plat_eth,
224 + }
225 +};
226 +
227 +static struct platform_device *wg302v1_devices[] __initdata = {
228 + &wg302v1_flash,
229 + &wg302v1_uart,
230 + &wg302v1_eth[0],
231 +};
232 +
233 +static void __init wg302v1_init(void)
234 +{
235 + ixp4xx_sys_init();
236 +
237 + wg302v1_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
238 + wg302v1_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
239 +
240 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
241 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
242 +
243 + platform_add_devices(wg302v1_devices, ARRAY_SIZE(wg302v1_devices));
244 +}
245 +
246 +#ifdef CONFIG_MACH_WG302V1
247 +MACHINE_START(WG302V1, "Netgear WG302 v1 / WAG302 v1")
248 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
249 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
250 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
251 + .map_io = ixp4xx_map_io,
252 + .init_irq = ixp4xx_init_irq,
253 + .timer = &ixp4xx_timer,
254 + .boot_params = 0x0100,
255 + .init_machine = wg302v1_init,
256 +MACHINE_END
257 +#endif
This page took 0.04806 seconds and 5 git commands to generate.