Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / arm / mach-ixp4xx / vulcan-setup.c
blob2c03d2f6b6479b2b1423e347b1b69998e65810a9
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * arch/arm/mach-ixp4xx/vulcan-setup.c
5 * Arcom/Eurotech Vulcan board-setup
7 * Copyright (C) 2010 Marc Zyngier <maz@misterjones.org>
9 * based on fsg-setup.c:
10 * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au>
13 #include <linux/if_ether.h>
14 #include <linux/irq.h>
15 #include <linux/serial.h>
16 #include <linux/serial_8250.h>
17 #include <linux/io.h>
18 #include <linux/w1-gpio.h>
19 #include <linux/gpio/machine.h>
20 #include <linux/mtd/plat-ram.h>
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/flash.h>
25 static struct flash_platform_data vulcan_flash_data = {
26 .map_name = "cfi_probe",
27 .width = 2,
30 static struct resource vulcan_flash_resource = {
31 .flags = IORESOURCE_MEM,
34 static struct platform_device vulcan_flash = {
35 .name = "IXP4XX-Flash",
36 .id = 0,
37 .dev = {
38 .platform_data = &vulcan_flash_data,
40 .resource = &vulcan_flash_resource,
41 .num_resources = 1,
44 static struct platdata_mtd_ram vulcan_sram_data = {
45 .mapname = "Vulcan SRAM",
46 .bankwidth = 1,
49 static struct resource vulcan_sram_resource = {
50 .flags = IORESOURCE_MEM,
53 static struct platform_device vulcan_sram = {
54 .name = "mtd-ram",
55 .id = 0,
56 .dev = {
57 .platform_data = &vulcan_sram_data,
59 .resource = &vulcan_sram_resource,
60 .num_resources = 1,
63 static struct resource vulcan_uart_resources[] = {
64 [0] = {
65 .start = IXP4XX_UART1_BASE_PHYS,
66 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
67 .flags = IORESOURCE_MEM,
69 [1] = {
70 .start = IXP4XX_UART2_BASE_PHYS,
71 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
72 .flags = IORESOURCE_MEM,
74 [2] = {
75 .flags = IORESOURCE_MEM,
79 static struct plat_serial8250_port vulcan_uart_data[] = {
80 [0] = {
81 .mapbase = IXP4XX_UART1_BASE_PHYS,
82 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
83 .irq = IRQ_IXP4XX_UART1,
84 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
85 .iotype = UPIO_MEM,
86 .regshift = 2,
87 .uartclk = IXP4XX_UART_XTAL,
89 [1] = {
90 .mapbase = IXP4XX_UART2_BASE_PHYS,
91 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
92 .irq = IRQ_IXP4XX_UART2,
93 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
94 .iotype = UPIO_MEM,
95 .regshift = 2,
96 .uartclk = IXP4XX_UART_XTAL,
98 [2] = {
99 .irq = IXP4XX_GPIO_IRQ(4),
100 .irqflags = IRQF_TRIGGER_LOW,
101 .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
102 .iotype = UPIO_MEM,
103 .uartclk = 1843200,
105 [3] = {
106 .irq = IXP4XX_GPIO_IRQ(4),
107 .irqflags = IRQF_TRIGGER_LOW,
108 .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
109 .iotype = UPIO_MEM,
110 .uartclk = 1843200,
115 static struct platform_device vulcan_uart = {
116 .name = "serial8250",
117 .id = PLAT8250_DEV_PLATFORM,
118 .dev = {
119 .platform_data = vulcan_uart_data,
121 .resource = vulcan_uart_resources,
122 .num_resources = ARRAY_SIZE(vulcan_uart_resources),
125 static struct eth_plat_info vulcan_plat_eth[] = {
126 [0] = {
127 .phy = 0,
128 .rxq = 3,
129 .txreadyq = 20,
131 [1] = {
132 .phy = 1,
133 .rxq = 4,
134 .txreadyq = 21,
138 static struct platform_device vulcan_eth[] = {
139 [0] = {
140 .name = "ixp4xx_eth",
141 .id = IXP4XX_ETH_NPEB,
142 .dev = {
143 .platform_data = &vulcan_plat_eth[0],
146 [1] = {
147 .name = "ixp4xx_eth",
148 .id = IXP4XX_ETH_NPEC,
149 .dev = {
150 .platform_data = &vulcan_plat_eth[1],
155 static struct resource vulcan_max6369_resource = {
156 .flags = IORESOURCE_MEM,
159 static struct platform_device vulcan_max6369 = {
160 .name = "max6369_wdt",
161 .id = -1,
162 .resource = &vulcan_max6369_resource,
163 .num_resources = 1,
166 static struct gpiod_lookup_table vulcan_w1_gpiod_table = {
167 .dev_id = "w1-gpio",
168 .table = {
169 GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", 14, NULL, 0,
170 GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
174 static struct w1_gpio_platform_data vulcan_w1_gpio_pdata = {
175 /* Intentionally left blank */
178 static struct platform_device vulcan_w1_gpio = {
179 .name = "w1-gpio",
180 .id = 0,
181 .dev = {
182 .platform_data = &vulcan_w1_gpio_pdata,
186 static struct platform_device *vulcan_devices[] __initdata = {
187 &vulcan_uart,
188 &vulcan_flash,
189 &vulcan_sram,
190 &vulcan_max6369,
191 &vulcan_eth[0],
192 &vulcan_eth[1],
193 &vulcan_w1_gpio,
196 static void __init vulcan_init(void)
198 ixp4xx_sys_init();
200 /* Flash is spread over both CS0 and CS1 */
201 vulcan_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
202 vulcan_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
203 *IXP4XX_EXP_CS0 = IXP4XX_EXP_BUS_CS_EN |
204 IXP4XX_EXP_BUS_STROBE_T(3) |
205 IXP4XX_EXP_BUS_SIZE(0xF) |
206 IXP4XX_EXP_BUS_BYTE_RD16 |
207 IXP4XX_EXP_BUS_WR_EN;
208 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
210 /* SRAM on CS2, (256kB, 8bit, writable) */
211 vulcan_sram_resource.start = IXP4XX_EXP_BUS_BASE(2);
212 vulcan_sram_resource.end = IXP4XX_EXP_BUS_BASE(2) + SZ_256K - 1;
213 *IXP4XX_EXP_CS2 = IXP4XX_EXP_BUS_CS_EN |
214 IXP4XX_EXP_BUS_STROBE_T(1) |
215 IXP4XX_EXP_BUS_HOLD_T(2) |
216 IXP4XX_EXP_BUS_SIZE(9) |
217 IXP4XX_EXP_BUS_SPLT_EN |
218 IXP4XX_EXP_BUS_WR_EN |
219 IXP4XX_EXP_BUS_BYTE_EN;
221 /* XR16L2551 on CS3 (Moto style, 512 bytes, 8bits, writable) */
222 vulcan_uart_resources[2].start = IXP4XX_EXP_BUS_BASE(3);
223 vulcan_uart_resources[2].end = IXP4XX_EXP_BUS_BASE(3) + 16 - 1;
224 vulcan_uart_data[2].mapbase = vulcan_uart_resources[2].start;
225 vulcan_uart_data[3].mapbase = vulcan_uart_data[2].mapbase + 8;
226 *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN |
227 IXP4XX_EXP_BUS_STROBE_T(3) |
228 IXP4XX_EXP_BUS_CYCLES(IXP4XX_EXP_BUS_CYCLES_MOTOROLA)|
229 IXP4XX_EXP_BUS_WR_EN |
230 IXP4XX_EXP_BUS_BYTE_EN;
232 /* GPIOS on CS4 (512 bytes, 8bits, writable) */
233 *IXP4XX_EXP_CS4 = IXP4XX_EXP_BUS_CS_EN |
234 IXP4XX_EXP_BUS_WR_EN |
235 IXP4XX_EXP_BUS_BYTE_EN;
237 /* max6369 on CS5 (512 bytes, 8bits, writable) */
238 vulcan_max6369_resource.start = IXP4XX_EXP_BUS_BASE(5);
239 vulcan_max6369_resource.end = IXP4XX_EXP_BUS_BASE(5);
240 *IXP4XX_EXP_CS5 = IXP4XX_EXP_BUS_CS_EN |
241 IXP4XX_EXP_BUS_WR_EN |
242 IXP4XX_EXP_BUS_BYTE_EN;
244 gpiod_add_lookup_table(&vulcan_w1_gpiod_table);
245 platform_add_devices(vulcan_devices, ARRAY_SIZE(vulcan_devices));
248 MACHINE_START(ARCOM_VULCAN, "Arcom/Eurotech Vulcan")
249 /* Maintainer: Marc Zyngier <maz@misterjones.org> */
250 .map_io = ixp4xx_map_io,
251 .init_early = ixp4xx_init_early,
252 .init_irq = ixp4xx_init_irq,
253 .init_time = ixp4xx_timer_init,
254 .atag_offset = 0x100,
255 .init_machine = vulcan_init,
256 #if defined(CONFIG_PCI)
257 .dma_zone_size = SZ_64M,
258 #endif
259 .restart = ixp4xx_restart,
260 MACHINE_END