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