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