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>
25 static struct flash_platform_data vulcan_flash_data
= {
26 .map_name
= "cfi_probe",
30 static struct resource vulcan_flash_resource
= {
31 .flags
= IORESOURCE_MEM
,
34 static struct platform_device vulcan_flash
= {
35 .name
= "IXP4XX-Flash",
38 .platform_data
= &vulcan_flash_data
,
40 .resource
= &vulcan_flash_resource
,
44 static struct platdata_mtd_ram vulcan_sram_data
= {
45 .mapname
= "Vulcan SRAM",
49 static struct resource vulcan_sram_resource
= {
50 .flags
= IORESOURCE_MEM
,
53 static struct platform_device vulcan_sram
= {
57 .platform_data
= &vulcan_sram_data
,
59 .resource
= &vulcan_sram_resource
,
63 static struct resource vulcan_uart_resources
[] = {
65 .start
= IXP4XX_UART1_BASE_PHYS
,
66 .end
= IXP4XX_UART1_BASE_PHYS
+ 0x0fff,
67 .flags
= IORESOURCE_MEM
,
70 .start
= IXP4XX_UART2_BASE_PHYS
,
71 .end
= IXP4XX_UART2_BASE_PHYS
+ 0x0fff,
72 .flags
= IORESOURCE_MEM
,
75 .flags
= IORESOURCE_MEM
,
79 static struct plat_serial8250_port vulcan_uart_data
[] = {
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
,
87 .uartclk
= IXP4XX_UART_XTAL
,
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
,
96 .uartclk
= IXP4XX_UART_XTAL
,
99 .irq
= IXP4XX_GPIO_IRQ(4),
100 .irqflags
= IRQF_TRIGGER_LOW
,
101 .flags
= UPF_IOREMAP
| UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
,
106 .irq
= IXP4XX_GPIO_IRQ(4),
107 .irqflags
= IRQF_TRIGGER_LOW
,
108 .flags
= UPF_IOREMAP
| UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
,
115 static struct platform_device vulcan_uart
= {
116 .name
= "serial8250",
117 .id
= PLAT8250_DEV_PLATFORM
,
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
[] = {
138 static struct platform_device vulcan_eth
[] = {
140 .name
= "ixp4xx_eth",
141 .id
= IXP4XX_ETH_NPEB
,
143 .platform_data
= &vulcan_plat_eth
[0],
147 .name
= "ixp4xx_eth",
148 .id
= IXP4XX_ETH_NPEC
,
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",
162 .resource
= &vulcan_max6369_resource
,
166 static struct gpiod_lookup_table vulcan_w1_gpiod_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
= {
182 .platform_data
= &vulcan_w1_gpio_pdata
,
186 static struct platform_device
*vulcan_devices
[] __initdata
= {
196 static void __init
vulcan_init(void)
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
,
259 .restart
= ixp4xx_restart
,