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