diff options
Diffstat (limited to 'arch/arm/mach-ixp4xx')
-rw-r--r-- | arch/arm/mach-ixp4xx/Kconfig | 16 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/Makefile | 4 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/gateway7001-pci.c | 63 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/gateway7001-setup.c | 108 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/gtwx5715-pci.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/ixdp425-setup.c | 96 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/wg302v2-pci.c | 63 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/wg302v2-setup.c | 109 |
8 files changed, 461 insertions, 6 deletions
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig index 060909870b50..61b2dfcb89d6 100644 --- a/arch/arm/mach-ixp4xx/Kconfig +++ b/arch/arm/mach-ixp4xx/Kconfig | |||
@@ -41,6 +41,22 @@ config ARCH_ADI_COYOTE | |||
41 | Engineering Coyote Gateway Reference Platform. For more | 41 | Engineering Coyote Gateway Reference Platform. For more |
42 | information on this platform, see <file:Documentation/arm/IXP4xx>. | 42 | information on this platform, see <file:Documentation/arm/IXP4xx>. |
43 | 43 | ||
44 | config MACH_GATEWAY7001 | ||
45 | bool "Gateway 7001" | ||
46 | select PCI | ||
47 | help | ||
48 | Say 'Y' here if you want your kernel to support Gateway's | ||
49 | 7001 Access Point. For more information on this platform, | ||
50 | see http://openwrt.org | ||
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 | |||
44 | config ARCH_IXDP425 | 60 | config ARCH_IXDP425 |
45 | bool "IXDP425" | 61 | bool "IXDP425" |
46 | help | 62 | help |
diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile index 3b87c47e06cf..77e00ade5585 100644 --- a/arch/arm/mach-ixp4xx/Makefile +++ b/arch/arm/mach-ixp4xx/Makefile | |||
@@ -13,6 +13,8 @@ obj-pci-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o | |||
13 | obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-pci.o | 13 | 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 | ||
17 | obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o | ||
16 | 18 | ||
17 | obj-y += common.o | 19 | obj-y += common.o |
18 | 20 | ||
@@ -24,5 +26,7 @@ obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o | |||
24 | obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o | 26 | obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o |
25 | obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o | 27 | obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o |
26 | obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o | 28 | obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o |
29 | obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o | ||
30 | obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o | ||
27 | 31 | ||
28 | 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/gateway7001-pci.c b/arch/arm/mach-ixp4xx/gateway7001-pci.c new file mode 100644 index 000000000000..6abf568322d3 --- /dev/null +++ b/arch/arm/mach-ixp4xx/gateway7001-pci.c | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * arch/arch/mach-ixp4xx/gateway7001-pci.c | ||
3 | * | ||
4 | * PCI setup routines for Gateway 7001 | ||
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 Softwrae, 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 | |||
28 | #include <asm/mach/pci.h> | ||
29 | |||
30 | void __init gateway7001_pci_preinit(void) | ||
31 | { | ||
32 | set_irq_type(IRQ_IXP4XX_GPIO10, IRQT_LOW); | ||
33 | set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW); | ||
34 | |||
35 | ixp4xx_pci_preinit(); | ||
36 | } | ||
37 | |||
38 | static int __init gateway7001_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | ||
39 | { | ||
40 | if (slot == 1) | ||
41 | return IRQ_IXP4XX_GPIO11; | ||
42 | else if (slot == 2) | ||
43 | return IRQ_IXP4XX_GPIO10; | ||
44 | else return -1; | ||
45 | } | ||
46 | |||
47 | struct hw_pci gateway7001_pci __initdata = { | ||
48 | .nr_controllers = 1, | ||
49 | .preinit = gateway7001_pci_preinit, | ||
50 | .swizzle = pci_std_swizzle, | ||
51 | .setup = ixp4xx_setup, | ||
52 | .scan = ixp4xx_scan_bus, | ||
53 | .map_irq = gateway7001_map_irq, | ||
54 | }; | ||
55 | |||
56 | int __init gateway7001_pci_init(void) | ||
57 | { | ||
58 | if (machine_is_gateway7001()) | ||
59 | pci_common_init(&gateway7001_pci); | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | subsys_initcall(gateway7001_pci_init); | ||
diff --git a/arch/arm/mach-ixp4xx/gateway7001-setup.c b/arch/arm/mach-ixp4xx/gateway7001-setup.c new file mode 100644 index 000000000000..37876832e141 --- /dev/null +++ b/arch/arm/mach-ixp4xx/gateway7001-setup.c | |||
@@ -0,0 +1,108 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ixp4xx/gateway7001-setup.c | ||
3 | * | ||
4 | * Board setup for the Gateway 7001 board | ||
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 | #include <linux/kernel.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/device.h> | ||
17 | #include <linux/serial.h> | ||
18 | #include <linux/tty.h> | ||
19 | #include <linux/serial_8250.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | #include <asm/types.h> | ||
23 | #include <asm/setup.h> | ||
24 | #include <asm/memory.h> | ||
25 | #include <asm/hardware.h> | ||
26 | #include <asm/irq.h> | ||
27 | #include <asm/mach-types.h> | ||
28 | #include <asm/mach/arch.h> | ||
29 | #include <asm/mach/flash.h> | ||
30 | |||
31 | static struct flash_platform_data gateway7001_flash_data = { | ||
32 | .map_name = "cfi_probe", | ||
33 | .width = 2, | ||
34 | }; | ||
35 | |||
36 | static struct resource gateway7001_flash_resource = { | ||
37 | .flags = IORESOURCE_MEM, | ||
38 | }; | ||
39 | |||
40 | static struct platform_device gateway7001_flash = { | ||
41 | .name = "IXP4XX-Flash", | ||
42 | .id = 0, | ||
43 | .dev = { | ||
44 | .platform_data = &gateway7001_flash_data, | ||
45 | }, | ||
46 | .num_resources = 1, | ||
47 | .resource = &gateway7001_flash_resource, | ||
48 | }; | ||
49 | |||
50 | static struct resource gateway7001_uart_resource = { | ||
51 | .start = IXP4XX_UART2_BASE_PHYS, | ||
52 | .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, | ||
53 | .flags = IORESOURCE_MEM, | ||
54 | }; | ||
55 | |||
56 | static struct plat_serial8250_port gateway7001_uart_data[] = { | ||
57 | { | ||
58 | .mapbase = IXP4XX_UART2_BASE_PHYS, | ||
59 | .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, | ||
60 | .irq = IRQ_IXP4XX_UART2, | ||
61 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, | ||
62 | .iotype = UPIO_MEM, | ||
63 | .regshift = 2, | ||
64 | .uartclk = IXP4XX_UART_XTAL, | ||
65 | }, | ||
66 | { }, | ||
67 | }; | ||
68 | |||
69 | static struct platform_device gateway7001_uart = { | ||
70 | .name = "serial8250", | ||
71 | .id = PLAT8250_DEV_PLATFORM, | ||
72 | .dev = { | ||
73 | .platform_data = gateway7001_uart_data, | ||
74 | }, | ||
75 | .num_resources = 1, | ||
76 | .resource = &gateway7001_uart_resource, | ||
77 | }; | ||
78 | |||
79 | static struct platform_device *gateway7001_devices[] __initdata = { | ||
80 | &gateway7001_flash, | ||
81 | &gateway7001_uart | ||
82 | }; | ||
83 | |||
84 | static void __init gateway7001_init(void) | ||
85 | { | ||
86 | ixp4xx_sys_init(); | ||
87 | |||
88 | gateway7001_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); | ||
89 | gateway7001_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; | ||
90 | |||
91 | *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; | ||
92 | *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; | ||
93 | |||
94 | platform_add_devices(gateway7001_devices, ARRAY_SIZE(gateway7001_devices)); | ||
95 | } | ||
96 | |||
97 | #ifdef CONFIG_MACH_GATEWAY7001 | ||
98 | MACHINE_START(GATEWAY7001, "Gateway 7001 AP") | ||
99 | /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ | ||
100 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | ||
101 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, | ||
102 | .map_io = ixp4xx_map_io, | ||
103 | .init_irq = ixp4xx_init_irq, | ||
104 | .timer = &ixp4xx_timer, | ||
105 | .boot_params = 0x0100, | ||
106 | .init_machine = gateway7001_init, | ||
107 | MACHINE_END | ||
108 | #endif | ||
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-pci.c b/arch/arm/mach-ixp4xx/gtwx5715-pci.c index a66484b63d36..0d5a42455820 100644 --- a/arch/arm/mach-ixp4xx/gtwx5715-pci.c +++ b/arch/arm/mach-ixp4xx/gtwx5715-pci.c | |||
@@ -25,17 +25,13 @@ | |||
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/irq.h> | ||
29 | |||
28 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
29 | #include <asm/hardware.h> | 31 | #include <asm/hardware.h> |
30 | #include <asm/irq.h> | ||
31 | #include <asm/arch/gtwx5715.h> | 32 | #include <asm/arch/gtwx5715.h> |
32 | #include <asm/mach/pci.h> | 33 | #include <asm/mach/pci.h> |
33 | 34 | ||
34 | extern void ixp4xx_pci_preinit(void); | ||
35 | extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); | ||
36 | extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); | ||
37 | |||
38 | |||
39 | /* | 35 | /* |
40 | * The exact GPIO pins and IRQs are defined in arch-ixp4xx/gtwx5715.h | 36 | * The exact GPIO pins and IRQs are defined in arch-ixp4xx/gtwx5715.h |
41 | * Slot 0 isn't actually populated with a card connector but | 37 | * Slot 0 isn't actually populated with a card connector but |
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c index ec4f07950ec6..d5008d8fc9a5 100644 --- a/arch/arm/mach-ixp4xx/ixdp425-setup.c +++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c | |||
@@ -15,6 +15,10 @@ | |||
15 | #include <linux/tty.h> | 15 | #include <linux/tty.h> |
16 | #include <linux/serial_8250.h> | 16 | #include <linux/serial_8250.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/io.h> | ||
19 | #include <linux/mtd/mtd.h> | ||
20 | #include <linux/mtd/nand.h> | ||
21 | #include <linux/mtd/partitions.h> | ||
18 | 22 | ||
19 | #include <asm/types.h> | 23 | #include <asm/types.h> |
20 | #include <asm/setup.h> | 24 | #include <asm/setup.h> |
@@ -24,6 +28,7 @@ | |||
24 | #include <asm/irq.h> | 28 | #include <asm/irq.h> |
25 | #include <asm/mach/arch.h> | 29 | #include <asm/mach/arch.h> |
26 | #include <asm/mach/flash.h> | 30 | #include <asm/mach/flash.h> |
31 | #include <asm/delay.h> | ||
27 | 32 | ||
28 | static struct flash_platform_data ixdp425_flash_data = { | 33 | static struct flash_platform_data ixdp425_flash_data = { |
29 | .map_name = "cfi_probe", | 34 | .map_name = "cfi_probe", |
@@ -44,6 +49,77 @@ static struct platform_device ixdp425_flash = { | |||
44 | .resource = &ixdp425_flash_resource, | 49 | .resource = &ixdp425_flash_resource, |
45 | }; | 50 | }; |
46 | 51 | ||
52 | #if defined(CONFIG_MTD_NAND_PLATFORM) || \ | ||
53 | defined(CONFIG_MTD_NAND_PLATFORM_MODULE) | ||
54 | |||
55 | #ifdef CONFIG_MTD_PARTITIONS | ||
56 | const char *part_probes[] = { "cmdlinepart", NULL }; | ||
57 | |||
58 | static struct mtd_partition ixdp425_partitions[] = { | ||
59 | { | ||
60 | .name = "ixp400 NAND FS 0", | ||
61 | .offset = 0, | ||
62 | .size = SZ_8M | ||
63 | }, { | ||
64 | .name = "ixp400 NAND FS 1", | ||
65 | .offset = MTDPART_OFS_APPEND, | ||
66 | .size = MTDPART_SIZ_FULL | ||
67 | }, | ||
68 | }; | ||
69 | #endif | ||
70 | |||
71 | static void | ||
72 | ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) | ||
73 | { | ||
74 | struct nand_chip *this = mtd->priv; | ||
75 | int offset = (int)this->priv; | ||
76 | |||
77 | if (ctrl & NAND_CTRL_CHANGE) { | ||
78 | if (ctrl & NAND_NCE) { | ||
79 | gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_LOW); | ||
80 | udelay(5); | ||
81 | } else | ||
82 | gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_HIGH); | ||
83 | |||
84 | offset = (ctrl & NAND_CLE) ? IXDP425_NAND_CMD_BYTE : 0; | ||
85 | offset |= (ctrl & NAND_ALE) ? IXDP425_NAND_ADDR_BYTE : 0; | ||
86 | this->priv = (void *)offset; | ||
87 | } | ||
88 | |||
89 | if (cmd != NAND_CMD_NONE) | ||
90 | writeb(cmd, this->IO_ADDR_W + offset); | ||
91 | } | ||
92 | |||
93 | static struct platform_nand_data ixdp425_flash_nand_data = { | ||
94 | .chip = { | ||
95 | .chip_delay = 30, | ||
96 | .options = NAND_NO_AUTOINCR, | ||
97 | #ifdef CONFIG_MTD_PARTITIONS | ||
98 | .part_probe_types = part_probes, | ||
99 | .partitions = ixdp425_partitions, | ||
100 | .nr_partitions = ARRAY_SIZE(ixdp425_partitions), | ||
101 | #endif | ||
102 | }, | ||
103 | .ctrl = { | ||
104 | .cmd_ctrl = ixdp425_flash_nand_cmd_ctrl | ||
105 | } | ||
106 | }; | ||
107 | |||
108 | static struct resource ixdp425_flash_nand_resource = { | ||
109 | .flags = IORESOURCE_MEM, | ||
110 | }; | ||
111 | |||
112 | static struct platform_device ixdp425_flash_nand = { | ||
113 | .name = "gen_nand", | ||
114 | .id = -1, | ||
115 | .dev = { | ||
116 | .platform_data = &ixdp425_flash_nand_data, | ||
117 | }, | ||
118 | .num_resources = 1, | ||
119 | .resource = &ixdp425_flash_nand_resource, | ||
120 | }; | ||
121 | #endif /* CONFIG_MTD_NAND_PLATFORM */ | ||
122 | |||
47 | static struct ixp4xx_i2c_pins ixdp425_i2c_gpio_pins = { | 123 | static struct ixp4xx_i2c_pins ixdp425_i2c_gpio_pins = { |
48 | .sda_pin = IXDP425_SDA_PIN, | 124 | .sda_pin = IXDP425_SDA_PIN, |
49 | .scl_pin = IXDP425_SCL_PIN, | 125 | .scl_pin = IXDP425_SCL_PIN, |
@@ -104,6 +180,10 @@ static struct platform_device ixdp425_uart = { | |||
104 | static struct platform_device *ixdp425_devices[] __initdata = { | 180 | static struct platform_device *ixdp425_devices[] __initdata = { |
105 | &ixdp425_i2c_controller, | 181 | &ixdp425_i2c_controller, |
106 | &ixdp425_flash, | 182 | &ixdp425_flash, |
183 | #if defined(CONFIG_MTD_NAND_PLATFORM) || \ | ||
184 | defined(CONFIG_MTD_NAND_PLATFORM_MODULE) | ||
185 | &ixdp425_flash_nand, | ||
186 | #endif | ||
107 | &ixdp425_uart | 187 | &ixdp425_uart |
108 | }; | 188 | }; |
109 | 189 | ||
@@ -115,6 +195,22 @@ static void __init ixdp425_init(void) | |||
115 | ixdp425_flash_resource.end = | 195 | ixdp425_flash_resource.end = |
116 | IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; | 196 | IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; |
117 | 197 | ||
198 | #if defined(CONFIG_MTD_NAND_PLATFORM) || \ | ||
199 | defined(CONFIG_MTD_NAND_PLATFORM_MODULE) | ||
200 | ixdp425_flash_nand_resource.start = IXP4XX_EXP_BUS_BASE(3), | ||
201 | ixdp425_flash_nand_resource.end = IXP4XX_EXP_BUS_BASE(3) + 0x10 - 1; | ||
202 | |||
203 | gpio_line_config(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_OUT); | ||
204 | |||
205 | /* Configure expansion bus for NAND Flash */ | ||
206 | *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN | | ||
207 | IXP4XX_EXP_BUS_STROBE_T(1) | /* extend by 1 clock */ | ||
208 | IXP4XX_EXP_BUS_CYCLES(0) | /* Intel cycles */ | ||
209 | IXP4XX_EXP_BUS_SIZE(0) | /* 512bytes addr space*/ | ||
210 | IXP4XX_EXP_BUS_WR_EN | | ||
211 | IXP4XX_EXP_BUS_BYTE_EN; /* 8 bit data bus */ | ||
212 | #endif | ||
213 | |||
118 | if (cpu_is_ixp43x()) { | 214 | if (cpu_is_ixp43x()) { |
119 | ixdp425_uart.num_resources = 1; | 215 | ixdp425_uart.num_resources = 1; |
120 | ixdp425_uart_data[1].flags = 0; | 216 | ixdp425_uart_data[1].flags = 0; |
diff --git a/arch/arm/mach-ixp4xx/wg302v2-pci.c b/arch/arm/mach-ixp4xx/wg302v2-pci.c new file mode 100644 index 000000000000..6588f2c758e2 --- /dev/null +++ b/arch/arm/mach-ixp4xx/wg302v2-pci.c | |||
@@ -0,0 +1,63 @@ | |||
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 | |||
28 | #include <asm/mach/pci.h> | ||
29 | |||
30 | void __init wg302v2_pci_preinit(void) | ||
31 | { | ||
32 | set_irq_type(IRQ_IXP4XX_GPIO8, IRQT_LOW); | ||
33 | set_irq_type(IRQ_IXP4XX_GPIO9, IRQT_LOW); | ||
34 | |||
35 | ixp4xx_pci_preinit(); | ||
36 | } | ||
37 | |||
38 | static int __init wg302v2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | ||
39 | { | ||
40 | if (slot == 1) | ||
41 | return IRQ_IXP4XX_GPIO8; | ||
42 | else if (slot == 2) | ||
43 | return IRQ_IXP4XX_GPIO9; | ||
44 | else return -1; | ||
45 | } | ||
46 | |||
47 | struct hw_pci wg302v2_pci __initdata = { | ||
48 | .nr_controllers = 1, | ||
49 | .preinit = wg302v2_pci_preinit, | ||
50 | .swizzle = pci_std_swizzle, | ||
51 | .setup = ixp4xx_setup, | ||
52 | .scan = ixp4xx_scan_bus, | ||
53 | .map_irq = wg302v2_map_irq, | ||
54 | }; | ||
55 | |||
56 | int __init wg302v2_pci_init(void) | ||
57 | { | ||
58 | if (machine_is_wg302v2()) | ||
59 | pci_common_init(&wg302v2_pci); | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | 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 | ||