1 // SPDX-License-Identifier: GPL-2.0
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>
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>
27 static struct flash_platform_data vulcan_flash_data
= {
28 .map_name
= "cfi_probe",
32 static struct resource vulcan_flash_resource
= {
33 .flags
= IORESOURCE_MEM
,
36 static struct platform_device vulcan_flash
= {
37 .name
= "IXP4XX-Flash",
40 .platform_data
= &vulcan_flash_data
,
42 .resource
= &vulcan_flash_resource
,
46 static struct platdata_mtd_ram vulcan_sram_data
= {
47 .mapname
= "Vulcan SRAM",
51 static struct resource vulcan_sram_resource
= {
52 .flags
= IORESOURCE_MEM
,
55 static struct platform_device vulcan_sram
= {
59 .platform_data
= &vulcan_sram_data
,
61 .resource
= &vulcan_sram_resource
,
65 static struct resource vulcan_uart_resources
[] = {
67 .start
= IXP4XX_UART1_BASE_PHYS
,
68 .end
= IXP4XX_UART1_BASE_PHYS
+ 0x0fff,
69 .flags
= IORESOURCE_MEM
,
72 .start
= IXP4XX_UART2_BASE_PHYS
,
73 .end
= IXP4XX_UART2_BASE_PHYS
+ 0x0fff,
74 .flags
= IORESOURCE_MEM
,
77 .flags
= IORESOURCE_MEM
,
81 static struct plat_serial8250_port vulcan_uart_data
[] = {
83 .mapbase
= IXP4XX_UART1_BASE_PHYS
,
84 .membase
= (char *)IXP4XX_UART1_BASE_VIRT
+ REG_OFFSET
,
85 .irq
= IRQ_IXP4XX_UART1
,
86 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
,
89 .uartclk
= IXP4XX_UART_XTAL
,
92 .mapbase
= IXP4XX_UART2_BASE_PHYS
,
93 .membase
= (char *)IXP4XX_UART2_BASE_VIRT
+ REG_OFFSET
,
94 .irq
= IRQ_IXP4XX_UART2
,
95 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
,
98 .uartclk
= IXP4XX_UART_XTAL
,
101 .irq
= IXP4XX_GPIO_IRQ(4),
102 .irqflags
= IRQF_TRIGGER_LOW
,
103 .flags
= UPF_IOREMAP
| UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
,
108 .irq
= IXP4XX_GPIO_IRQ(4),
109 .irqflags
= IRQF_TRIGGER_LOW
,
110 .flags
= UPF_IOREMAP
| UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
,
117 static struct platform_device vulcan_uart
= {
118 .name
= "serial8250",
119 .id
= PLAT8250_DEV_PLATFORM
,
121 .platform_data
= vulcan_uart_data
,
123 .resource
= vulcan_uart_resources
,
124 .num_resources
= ARRAY_SIZE(vulcan_uart_resources
),
127 static struct resource vulcan_npeb_resources
[] = {
129 .start
= IXP4XX_EthB_BASE_PHYS
,
130 .end
= IXP4XX_EthB_BASE_PHYS
+ 0x0fff,
131 .flags
= IORESOURCE_MEM
,
135 static struct resource vulcan_npec_resources
[] = {
137 .start
= IXP4XX_EthC_BASE_PHYS
,
138 .end
= IXP4XX_EthC_BASE_PHYS
+ 0x0fff,
139 .flags
= IORESOURCE_MEM
,
143 static struct eth_plat_info vulcan_plat_eth
[] = {
156 static struct platform_device vulcan_eth
[] = {
158 .name
= "ixp4xx_eth",
159 .id
= IXP4XX_ETH_NPEB
,
161 .platform_data
= &vulcan_plat_eth
[0],
163 .num_resources
= ARRAY_SIZE(vulcan_npeb_resources
),
164 .resource
= vulcan_npeb_resources
,
167 .name
= "ixp4xx_eth",
168 .id
= IXP4XX_ETH_NPEC
,
170 .platform_data
= &vulcan_plat_eth
[1],
172 .num_resources
= ARRAY_SIZE(vulcan_npec_resources
),
173 .resource
= vulcan_npec_resources
,
177 static struct resource vulcan_max6369_resource
= {
178 .flags
= IORESOURCE_MEM
,
181 static struct platform_device vulcan_max6369
= {
182 .name
= "max6369_wdt",
184 .resource
= &vulcan_max6369_resource
,
188 static struct gpiod_lookup_table vulcan_w1_gpiod_table
= {
191 GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", 14, NULL
, 0,
192 GPIO_ACTIVE_HIGH
| GPIO_OPEN_DRAIN
),
196 static struct w1_gpio_platform_data vulcan_w1_gpio_pdata
= {
197 /* Intentionally left blank */
200 static struct platform_device vulcan_w1_gpio
= {
204 .platform_data
= &vulcan_w1_gpio_pdata
,
208 static struct platform_device
*vulcan_devices
[] __initdata
= {
218 static void __init
vulcan_init(void)
222 /* Flash is spread over both CS0 and CS1 */
223 vulcan_flash_resource
.start
= IXP4XX_EXP_BUS_BASE(0);
224 vulcan_flash_resource
.end
= IXP4XX_EXP_BUS_BASE(0) + SZ_32M
- 1;
225 *IXP4XX_EXP_CS0
= IXP4XX_EXP_BUS_CS_EN
|
226 IXP4XX_EXP_BUS_STROBE_T(3) |
227 IXP4XX_EXP_BUS_SIZE(0xF) |
228 IXP4XX_EXP_BUS_BYTE_RD16
|
229 IXP4XX_EXP_BUS_WR_EN
;
230 *IXP4XX_EXP_CS1
= *IXP4XX_EXP_CS0
;
232 /* SRAM on CS2, (256kB, 8bit, writable) */
233 vulcan_sram_resource
.start
= IXP4XX_EXP_BUS_BASE(2);
234 vulcan_sram_resource
.end
= IXP4XX_EXP_BUS_BASE(2) + SZ_256K
- 1;
235 *IXP4XX_EXP_CS2
= IXP4XX_EXP_BUS_CS_EN
|
236 IXP4XX_EXP_BUS_STROBE_T(1) |
237 IXP4XX_EXP_BUS_HOLD_T(2) |
238 IXP4XX_EXP_BUS_SIZE(9) |
239 IXP4XX_EXP_BUS_SPLT_EN
|
240 IXP4XX_EXP_BUS_WR_EN
|
241 IXP4XX_EXP_BUS_BYTE_EN
;
243 /* XR16L2551 on CS3 (Moto style, 512 bytes, 8bits, writable) */
244 vulcan_uart_resources
[2].start
= IXP4XX_EXP_BUS_BASE(3);
245 vulcan_uart_resources
[2].end
= IXP4XX_EXP_BUS_BASE(3) + 16 - 1;
246 vulcan_uart_data
[2].mapbase
= vulcan_uart_resources
[2].start
;
247 vulcan_uart_data
[3].mapbase
= vulcan_uart_data
[2].mapbase
+ 8;
248 *IXP4XX_EXP_CS3
= IXP4XX_EXP_BUS_CS_EN
|
249 IXP4XX_EXP_BUS_STROBE_T(3) |
250 IXP4XX_EXP_BUS_CYCLES(IXP4XX_EXP_BUS_CYCLES_MOTOROLA
)|
251 IXP4XX_EXP_BUS_WR_EN
|
252 IXP4XX_EXP_BUS_BYTE_EN
;
254 /* GPIOS on CS4 (512 bytes, 8bits, writable) */
255 *IXP4XX_EXP_CS4
= IXP4XX_EXP_BUS_CS_EN
|
256 IXP4XX_EXP_BUS_WR_EN
|
257 IXP4XX_EXP_BUS_BYTE_EN
;
259 /* max6369 on CS5 (512 bytes, 8bits, writable) */
260 vulcan_max6369_resource
.start
= IXP4XX_EXP_BUS_BASE(5);
261 vulcan_max6369_resource
.end
= IXP4XX_EXP_BUS_BASE(5);
262 *IXP4XX_EXP_CS5
= IXP4XX_EXP_BUS_CS_EN
|
263 IXP4XX_EXP_BUS_WR_EN
|
264 IXP4XX_EXP_BUS_BYTE_EN
;
266 gpiod_add_lookup_table(&vulcan_w1_gpiod_table
);
267 platform_add_devices(vulcan_devices
, ARRAY_SIZE(vulcan_devices
));
270 MACHINE_START(ARCOM_VULCAN
, "Arcom/Eurotech Vulcan")
271 /* Maintainer: Marc Zyngier <maz@misterjones.org> */
272 .map_io
= ixp4xx_map_io
,
273 .init_early
= ixp4xx_init_early
,
274 .init_irq
= ixp4xx_init_irq
,
275 .init_time
= ixp4xx_timer_init
,
276 .atag_offset
= 0x100,
277 .init_machine
= vulcan_init
,
278 #if defined(CONFIG_PCI)
279 .dma_zone_size
= SZ_64M
,
281 .restart
= ixp4xx_restart
,