1 --- a/arch/arm/configs/ixp4xx_defconfig
2 +++ b/arch/arm/configs/ixp4xx_defconfig
3 @@ -155,6 +155,7 @@ CONFIG_MACH_AVILA=y
5 CONFIG_ARCH_ADI_COYOTE=y
6 CONFIG_MACH_GATEWAY7001=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
18 + bool "Netgear WG302 v1 / WAG302 v1"
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
26 bool "Netgear WG302 v2 / WAG302 v2"
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
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
47 +++ b/arch/arm/mach-ixp4xx/wg302v1-pci.c
50 + * arch/arch/mach-ixp4xx/wg302v1-pci.c
52 + * PCI setup routines for the Netgear WG302 v1 and WAG302 v1
54 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
56 + * based on coyote-pci.c:
57 + * Copyright (C) 2002 Jungo Software Technologies.
58 + * Copyright (C) 2003 MontaVista Software, Inc.
60 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
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.
68 +#include <linux/kernel.h>
69 +#include <linux/pci.h>
70 +#include <linux/init.h>
71 +#include <linux/irq.h>
73 +#include <asm/mach-types.h>
74 +#include <mach/hardware.h>
76 +#include <asm/mach/pci.h>
78 +void __init wg302v1_pci_preinit(void)
80 + set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW);
81 + set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW);
83 + ixp4xx_pci_preinit();
86 +static int __init wg302v1_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
89 + return IRQ_IXP4XX_GPIO8;
91 + return IRQ_IXP4XX_GPIO10;
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,
105 +int __init wg302v1_pci_init(void)
107 + if (machine_is_wg302v1())
108 + pci_common_init(&wg302v1_pci);
112 +subsys_initcall(wg302v1_pci_init);
114 +++ b/arch/arm/mach-ixp4xx/wg302v1-setup.c
117 + * arch/arm/mach-ixp4xx/wg302v1-setup.c
119 + * Board setup for the Netgear WG302 v1 and WAG302 v1
121 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
123 + * based on coyote-setup.c:
124 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
126 + * Author: Imre Kaloz <kaloz@openwrt.org>
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>
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>
147 +static struct flash_platform_data wg302v1_flash_data = {
148 + .map_name = "cfi_probe",
152 +static struct resource wg302v1_flash_resource = {
153 + .flags = IORESOURCE_MEM,
156 +static struct platform_device wg302v1_flash = {
157 + .name = "IXP4XX-Flash",
160 + .platform_data = &wg302v1_flash_data,
162 + .num_resources = 1,
163 + .resource = &wg302v1_flash_resource,
166 +static struct resource wg302v1_uart_resources[] = {
168 + .start = IXP4XX_UART1_BASE_PHYS,
169 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
170 + .flags = IORESOURCE_MEM,
173 + .start = IXP4XX_UART2_BASE_PHYS,
174 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
175 + .flags = IORESOURCE_MEM,
179 +static struct plat_serial8250_port wg302v1_uart_data[] = {
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,
187 + .uartclk = IXP4XX_UART_XTAL,
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,
196 + .uartclk = IXP4XX_UART_XTAL,
201 +static struct platform_device wg302v1_uart = {
202 + .name = "serial8250",
203 + .id = PLAT8250_DEV_PLATFORM,
205 + .platform_data = wg302v1_uart_data,
207 + .num_resources = 2,
208 + .resource = wg302v1_uart_resources,
211 +static struct eth_plat_info wg302v1_plat_eth[] = {
219 +static struct platform_device wg302v1_eth[] = {
221 + .name = "ixp4xx_eth",
222 + .id = IXP4XX_ETH_NPEB,
223 + .dev.platform_data = wg302v1_plat_eth,
227 +static struct platform_device *wg302v1_devices[] __initdata = {
233 +static void __init wg302v1_init(void)
237 + wg302v1_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
238 + wg302v1_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
240 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
241 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
243 + platform_add_devices(wg302v1_devices, ARRAY_SIZE(wg302v1_devices));
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,