]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | // SPDX-License-Identifier: GPL-2.0 |
dcdeeb21 IK |
2 | /* |
3 | * arch/arm/mach-ixp4xx/wg302-setup.c | |
4 | * | |
5 | * Board setup for the Netgear WG302 v2 and WAG302 v2 | |
6 | * | |
7 | * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> | |
8 | * | |
9 | * based on coyote-setup.c: | |
10 | * Copyright (C) 2003-2005 MontaVista Software, Inc. | |
11 | * | |
12 | * Author: Imre Kaloz <kaloz@openwrt.org> | |
13 | * | |
14 | */ | |
15 | ||
16 | #include <linux/kernel.h> | |
17 | #include <linux/init.h> | |
18 | #include <linux/device.h> | |
19 | #include <linux/serial.h> | |
20 | #include <linux/tty.h> | |
21 | #include <linux/serial_8250.h> | |
dcdeeb21 IK |
22 | |
23 | #include <asm/types.h> | |
24 | #include <asm/setup.h> | |
25 | #include <asm/memory.h> | |
a09e64fb | 26 | #include <mach/hardware.h> |
dcdeeb21 IK |
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> */ | |
dcdeeb21 | 101 | .map_io = ixp4xx_map_io, |
f449588c | 102 | .init_early = ixp4xx_init_early, |
dcdeeb21 | 103 | .init_irq = ixp4xx_init_irq, |
6bb27d73 | 104 | .init_time = ixp4xx_timer_init, |
e022c729 | 105 | .atag_offset = 0x100, |
dcdeeb21 | 106 | .init_machine = wg302v2_init, |
7553ee77 NP |
107 | #if defined(CONFIG_PCI) |
108 | .dma_zone_size = SZ_64M, | |
109 | #endif | |
d1b860fb | 110 | .restart = ixp4xx_restart, |
dcdeeb21 IK |
111 | MACHINE_END |
112 | #endif |