diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-ixp4xx/Kconfig | 8 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/wg302v2-pci.c | 64 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/wg302v2-setup.c | 109 |
4 files changed, 183 insertions, 0 deletions
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig index daaa190c1253..61b2dfcb89d6 100644 --- a/arch/arm/mach-ixp4xx/Kconfig +++ b/arch/arm/mach-ixp4xx/Kconfig | |||
@@ -49,6 +49,14 @@ config MACH_GATEWAY7001 | |||
49 | 7001 Access Point. For more information on this platform, | 49 | 7001 Access Point. For more information on this platform, |
50 | see http://openwrt.org | 50 | see http://openwrt.org |
51 | 51 | ||
52 | config MACH_WG302V2 | ||
53 | bool "Netgear WG302 v2 / WAG302 v2" | ||
54 | select PCI | ||
55 | help | ||
56 | Say 'Y' here if you want your kernel to support Netgear's | ||
57 | WG302 v2 or WAG302 v2 Access Points. For more information | ||
58 | on this platform, see http://openwrt.org | ||
59 | |||
52 | config ARCH_IXDP425 | 60 | config ARCH_IXDP425 |
53 | bool "IXDP425" | 61 | bool "IXDP425" |
54 | help | 62 | help |
diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile index b79ce249866a..77e00ade5585 100644 --- a/arch/arm/mach-ixp4xx/Makefile +++ b/arch/arm/mach-ixp4xx/Makefile | |||
@@ -14,6 +14,7 @@ obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-pci.o | |||
14 | obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o | 14 | obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o |
15 | obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o | 15 | obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o |
16 | obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o | 16 | obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o |
17 | obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o | ||
17 | 18 | ||
18 | obj-y += common.o | 19 | obj-y += common.o |
19 | 20 | ||
@@ -26,5 +27,6 @@ obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o | |||
26 | obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o | 27 | obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o |
27 | obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o | 28 | obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o |
28 | obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o | 29 | obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o |
30 | obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o | ||
29 | 31 | ||
30 | obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o | 32 | obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o |
diff --git a/arch/arm/mach-ixp4xx/wg302v2-pci.c b/arch/arm/mach-ixp4xx/wg302v2-pci.c new file mode 100644 index 000000000000..7c0e3aa4ef5d --- /dev/null +++ b/arch/arm/mach-ixp4xx/wg302v2-pci.c | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * arch/arch/mach-ixp4xx/wg302v2-pci.c | ||
3 | * | ||
4 | * PCI setup routines for the Netgear WG302 v2 and WAG302 v2 | ||
5 | * | ||
6 | * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org> | ||
7 | * | ||
8 | * based on coyote-pci.c: | ||
9 | * Copyright (C) 2002 Jungo Software Technologies. | ||
10 | * Copyright (C) 2003 MontaVista Software, Inc. | ||
11 | * | ||
12 | * Maintainer: Imre Kaloz <kaloz@openwrt.org> | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License version 2 as | ||
16 | * published by the Free Software Foundation. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/pci.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/irq.h> | ||
24 | |||
25 | #include <asm/mach-types.h> | ||
26 | #include <asm/hardware.h> | ||
27 | #include <asm/irq.h> | ||
28 | |||
29 | #include <asm/mach/pci.h> | ||
30 | |||
31 | void __init wg302v2_pci_preinit(void) | ||
32 | { | ||
33 | set_irq_type(IRQ_IXP4XX_GPIO8, IRQT_LOW); | ||
34 | set_irq_type(IRQ_IXP4XX_GPIO9, IRQT_LOW); | ||
35 | |||
36 | ixp4xx_pci_preinit(); | ||
37 | } | ||
38 | |||
39 | static int __init wg302v2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | ||
40 | { | ||
41 | if (slot == 1) | ||
42 | return IRQ_IXP4XX_GPIO8; | ||
43 | else if (slot == 2) | ||
44 | return IRQ_IXP4XX_GPIO9; | ||
45 | else return -1; | ||
46 | } | ||
47 | |||
48 | struct hw_pci wg302v2_pci __initdata = { | ||
49 | .nr_controllers = 1, | ||
50 | .preinit = wg302v2_pci_preinit, | ||
51 | .swizzle = pci_std_swizzle, | ||
52 | .setup = ixp4xx_setup, | ||
53 | .scan = ixp4xx_scan_bus, | ||
54 | .map_irq = wg302v2_map_irq, | ||
55 | }; | ||
56 | |||
57 | int __init wg302v2_pci_init(void) | ||
58 | { | ||
59 | if (machine_is_wg302v2()) | ||
60 | pci_common_init(&wg302v2_pci); | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | subsys_initcall(wg302v2_pci_init); | ||
diff --git a/arch/arm/mach-ixp4xx/wg302v2-setup.c b/arch/arm/mach-ixp4xx/wg302v2-setup.c new file mode 100644 index 000000000000..f7e09ad804e8 --- /dev/null +++ b/arch/arm/mach-ixp4xx/wg302v2-setup.c | |||
@@ -0,0 +1,109 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ixp4xx/wg302-setup.c | ||
3 | * | ||
4 | * Board setup for the Netgear WG302 v2 and WAG302 v2 | ||
5 | * | ||
6 | * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> | ||
7 | * | ||
8 | * based on coyote-setup.c: | ||
9 | * Copyright (C) 2003-2005 MontaVista Software, Inc. | ||
10 | * | ||
11 | * Author: Imre Kaloz <kaloz@openwrt.org> | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/serial.h> | ||
19 | #include <linux/tty.h> | ||
20 | #include <linux/serial_8250.h> | ||
21 | #include <linux/slab.h> | ||
22 | |||
23 | #include <asm/types.h> | ||
24 | #include <asm/setup.h> | ||
25 | #include <asm/memory.h> | ||
26 | #include <asm/hardware.h> | ||
27 | #include <asm/irq.h> | ||
28 | #include <asm/mach-types.h> | ||
29 | #include <asm/mach/arch.h> | ||
30 | #include <asm/mach/flash.h> | ||
31 | |||
32 | static struct flash_platform_data wg302v2_flash_data = { | ||
33 | .map_name = "cfi_probe", | ||
34 | .width = 2, | ||
35 | }; | ||
36 | |||
37 | static struct resource wg302v2_flash_resource = { | ||
38 | .flags = IORESOURCE_MEM, | ||
39 | }; | ||
40 | |||
41 | static struct platform_device wg302v2_flash = { | ||
42 | .name = "IXP4XX-Flash", | ||
43 | .id = 0, | ||
44 | .dev = { | ||
45 | .platform_data = &wg302v2_flash_data, | ||
46 | }, | ||
47 | .num_resources = 1, | ||
48 | .resource = &wg302v2_flash_resource, | ||
49 | }; | ||
50 | |||
51 | static struct resource wg302v2_uart_resource = { | ||
52 | .start = IXP4XX_UART2_BASE_PHYS, | ||
53 | .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, | ||
54 | .flags = IORESOURCE_MEM, | ||
55 | }; | ||
56 | |||
57 | static struct plat_serial8250_port wg302v2_uart_data[] = { | ||
58 | { | ||
59 | .mapbase = IXP4XX_UART2_BASE_PHYS, | ||
60 | .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, | ||
61 | .irq = IRQ_IXP4XX_UART2, | ||
62 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, | ||
63 | .iotype = UPIO_MEM, | ||
64 | .regshift = 2, | ||
65 | .uartclk = IXP4XX_UART_XTAL, | ||
66 | }, | ||
67 | { }, | ||
68 | }; | ||
69 | |||
70 | static struct platform_device wg302v2_uart = { | ||
71 | .name = "serial8250", | ||
72 | .id = PLAT8250_DEV_PLATFORM, | ||
73 | .dev = { | ||
74 | .platform_data = wg302v2_uart_data, | ||
75 | }, | ||
76 | .num_resources = 1, | ||
77 | .resource = &wg302v2_uart_resource, | ||
78 | }; | ||
79 | |||
80 | static struct platform_device *wg302v2_devices[] __initdata = { | ||
81 | &wg302v2_flash, | ||
82 | &wg302v2_uart, | ||
83 | }; | ||
84 | |||
85 | static void __init wg302v2_init(void) | ||
86 | { | ||
87 | ixp4xx_sys_init(); | ||
88 | |||
89 | wg302v2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); | ||
90 | wg302v2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; | ||
91 | |||
92 | *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; | ||
93 | *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; | ||
94 | |||
95 | platform_add_devices(wg302v2_devices, ARRAY_SIZE(wg302v2_devices)); | ||
96 | } | ||
97 | |||
98 | #ifdef CONFIG_MACH_WG302V2 | ||
99 | MACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2") | ||
100 | /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ | ||
101 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | ||
102 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, | ||
103 | .map_io = ixp4xx_map_io, | ||
104 | .init_irq = ixp4xx_init_irq, | ||
105 | .timer = &ixp4xx_timer, | ||
106 | .boot_params = 0x0100, | ||
107 | .init_machine = wg302v2_init, | ||
108 | MACHINE_END | ||
109 | #endif | ||