18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * arch/arm/mach-ixp4xx/vulcan-setup.c 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Arcom/Eurotech Vulcan board-setup 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (C) 2010 Marc Zyngier <maz@misterjones.org> 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * based on fsg-setup.c: 108c2ecf20Sopenharmony_ci * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au> 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <linux/if_ether.h> 148c2ecf20Sopenharmony_ci#include <linux/irq.h> 158c2ecf20Sopenharmony_ci#include <linux/serial.h> 168c2ecf20Sopenharmony_ci#include <linux/serial_8250.h> 178c2ecf20Sopenharmony_ci#include <linux/io.h> 188c2ecf20Sopenharmony_ci#include <linux/w1-gpio.h> 198c2ecf20Sopenharmony_ci#include <linux/gpio/machine.h> 208c2ecf20Sopenharmony_ci#include <linux/mtd/plat-ram.h> 218c2ecf20Sopenharmony_ci#include <asm/mach-types.h> 228c2ecf20Sopenharmony_ci#include <asm/mach/arch.h> 238c2ecf20Sopenharmony_ci#include <asm/mach/flash.h> 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#include "irqs.h" 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_cistatic struct flash_platform_data vulcan_flash_data = { 288c2ecf20Sopenharmony_ci .map_name = "cfi_probe", 298c2ecf20Sopenharmony_ci .width = 2, 308c2ecf20Sopenharmony_ci}; 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_cistatic struct resource vulcan_flash_resource = { 338c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 348c2ecf20Sopenharmony_ci}; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_cistatic struct platform_device vulcan_flash = { 378c2ecf20Sopenharmony_ci .name = "IXP4XX-Flash", 388c2ecf20Sopenharmony_ci .id = 0, 398c2ecf20Sopenharmony_ci .dev = { 408c2ecf20Sopenharmony_ci .platform_data = &vulcan_flash_data, 418c2ecf20Sopenharmony_ci }, 428c2ecf20Sopenharmony_ci .resource = &vulcan_flash_resource, 438c2ecf20Sopenharmony_ci .num_resources = 1, 448c2ecf20Sopenharmony_ci}; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_cistatic struct platdata_mtd_ram vulcan_sram_data = { 478c2ecf20Sopenharmony_ci .mapname = "Vulcan SRAM", 488c2ecf20Sopenharmony_ci .bankwidth = 1, 498c2ecf20Sopenharmony_ci}; 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_cistatic struct resource vulcan_sram_resource = { 528c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 538c2ecf20Sopenharmony_ci}; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_cistatic struct platform_device vulcan_sram = { 568c2ecf20Sopenharmony_ci .name = "mtd-ram", 578c2ecf20Sopenharmony_ci .id = 0, 588c2ecf20Sopenharmony_ci .dev = { 598c2ecf20Sopenharmony_ci .platform_data = &vulcan_sram_data, 608c2ecf20Sopenharmony_ci }, 618c2ecf20Sopenharmony_ci .resource = &vulcan_sram_resource, 628c2ecf20Sopenharmony_ci .num_resources = 1, 638c2ecf20Sopenharmony_ci}; 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_cistatic struct resource vulcan_uart_resources[] = { 668c2ecf20Sopenharmony_ci [0] = { 678c2ecf20Sopenharmony_ci .start = IXP4XX_UART1_BASE_PHYS, 688c2ecf20Sopenharmony_ci .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, 698c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 708c2ecf20Sopenharmony_ci }, 718c2ecf20Sopenharmony_ci [1] = { 728c2ecf20Sopenharmony_ci .start = IXP4XX_UART2_BASE_PHYS, 738c2ecf20Sopenharmony_ci .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, 748c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 758c2ecf20Sopenharmony_ci }, 768c2ecf20Sopenharmony_ci [2] = { 778c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 788c2ecf20Sopenharmony_ci }, 798c2ecf20Sopenharmony_ci}; 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_cistatic struct plat_serial8250_port vulcan_uart_data[] = { 828c2ecf20Sopenharmony_ci [0] = { 838c2ecf20Sopenharmony_ci .mapbase = IXP4XX_UART1_BASE_PHYS, 848c2ecf20Sopenharmony_ci .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, 858c2ecf20Sopenharmony_ci .irq = IRQ_IXP4XX_UART1, 868c2ecf20Sopenharmony_ci .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 878c2ecf20Sopenharmony_ci .iotype = UPIO_MEM, 888c2ecf20Sopenharmony_ci .regshift = 2, 898c2ecf20Sopenharmony_ci .uartclk = IXP4XX_UART_XTAL, 908c2ecf20Sopenharmony_ci }, 918c2ecf20Sopenharmony_ci [1] = { 928c2ecf20Sopenharmony_ci .mapbase = IXP4XX_UART2_BASE_PHYS, 938c2ecf20Sopenharmony_ci .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, 948c2ecf20Sopenharmony_ci .irq = IRQ_IXP4XX_UART2, 958c2ecf20Sopenharmony_ci .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 968c2ecf20Sopenharmony_ci .iotype = UPIO_MEM, 978c2ecf20Sopenharmony_ci .regshift = 2, 988c2ecf20Sopenharmony_ci .uartclk = IXP4XX_UART_XTAL, 998c2ecf20Sopenharmony_ci }, 1008c2ecf20Sopenharmony_ci [2] = { 1018c2ecf20Sopenharmony_ci .irq = IXP4XX_GPIO_IRQ(4), 1028c2ecf20Sopenharmony_ci .irqflags = IRQF_TRIGGER_LOW, 1038c2ecf20Sopenharmony_ci .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 1048c2ecf20Sopenharmony_ci .iotype = UPIO_MEM, 1058c2ecf20Sopenharmony_ci .uartclk = 1843200, 1068c2ecf20Sopenharmony_ci }, 1078c2ecf20Sopenharmony_ci [3] = { 1088c2ecf20Sopenharmony_ci .irq = IXP4XX_GPIO_IRQ(4), 1098c2ecf20Sopenharmony_ci .irqflags = IRQF_TRIGGER_LOW, 1108c2ecf20Sopenharmony_ci .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 1118c2ecf20Sopenharmony_ci .iotype = UPIO_MEM, 1128c2ecf20Sopenharmony_ci .uartclk = 1843200, 1138c2ecf20Sopenharmony_ci }, 1148c2ecf20Sopenharmony_ci { } 1158c2ecf20Sopenharmony_ci}; 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_cistatic struct platform_device vulcan_uart = { 1188c2ecf20Sopenharmony_ci .name = "serial8250", 1198c2ecf20Sopenharmony_ci .id = PLAT8250_DEV_PLATFORM, 1208c2ecf20Sopenharmony_ci .dev = { 1218c2ecf20Sopenharmony_ci .platform_data = vulcan_uart_data, 1228c2ecf20Sopenharmony_ci }, 1238c2ecf20Sopenharmony_ci .resource = vulcan_uart_resources, 1248c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(vulcan_uart_resources), 1258c2ecf20Sopenharmony_ci}; 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_cistatic struct resource vulcan_npeb_resources[] = { 1288c2ecf20Sopenharmony_ci { 1298c2ecf20Sopenharmony_ci .start = IXP4XX_EthB_BASE_PHYS, 1308c2ecf20Sopenharmony_ci .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, 1318c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 1328c2ecf20Sopenharmony_ci }, 1338c2ecf20Sopenharmony_ci}; 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_cistatic struct resource vulcan_npec_resources[] = { 1368c2ecf20Sopenharmony_ci { 1378c2ecf20Sopenharmony_ci .start = IXP4XX_EthC_BASE_PHYS, 1388c2ecf20Sopenharmony_ci .end = IXP4XX_EthC_BASE_PHYS + 0x0fff, 1398c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 1408c2ecf20Sopenharmony_ci }, 1418c2ecf20Sopenharmony_ci}; 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_cistatic struct eth_plat_info vulcan_plat_eth[] = { 1448c2ecf20Sopenharmony_ci [0] = { 1458c2ecf20Sopenharmony_ci .phy = 0, 1468c2ecf20Sopenharmony_ci .rxq = 3, 1478c2ecf20Sopenharmony_ci .txreadyq = 20, 1488c2ecf20Sopenharmony_ci }, 1498c2ecf20Sopenharmony_ci [1] = { 1508c2ecf20Sopenharmony_ci .phy = 1, 1518c2ecf20Sopenharmony_ci .rxq = 4, 1528c2ecf20Sopenharmony_ci .txreadyq = 21, 1538c2ecf20Sopenharmony_ci }, 1548c2ecf20Sopenharmony_ci}; 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_cistatic struct platform_device vulcan_eth[] = { 1578c2ecf20Sopenharmony_ci [0] = { 1588c2ecf20Sopenharmony_ci .name = "ixp4xx_eth", 1598c2ecf20Sopenharmony_ci .id = IXP4XX_ETH_NPEB, 1608c2ecf20Sopenharmony_ci .dev = { 1618c2ecf20Sopenharmony_ci .platform_data = &vulcan_plat_eth[0], 1628c2ecf20Sopenharmony_ci }, 1638c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(vulcan_npeb_resources), 1648c2ecf20Sopenharmony_ci .resource = vulcan_npeb_resources, 1658c2ecf20Sopenharmony_ci }, 1668c2ecf20Sopenharmony_ci [1] = { 1678c2ecf20Sopenharmony_ci .name = "ixp4xx_eth", 1688c2ecf20Sopenharmony_ci .id = IXP4XX_ETH_NPEC, 1698c2ecf20Sopenharmony_ci .dev = { 1708c2ecf20Sopenharmony_ci .platform_data = &vulcan_plat_eth[1], 1718c2ecf20Sopenharmony_ci }, 1728c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(vulcan_npec_resources), 1738c2ecf20Sopenharmony_ci .resource = vulcan_npec_resources, 1748c2ecf20Sopenharmony_ci }, 1758c2ecf20Sopenharmony_ci}; 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_cistatic struct resource vulcan_max6369_resource = { 1788c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 1798c2ecf20Sopenharmony_ci}; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_cistatic struct platform_device vulcan_max6369 = { 1828c2ecf20Sopenharmony_ci .name = "max6369_wdt", 1838c2ecf20Sopenharmony_ci .id = -1, 1848c2ecf20Sopenharmony_ci .resource = &vulcan_max6369_resource, 1858c2ecf20Sopenharmony_ci .num_resources = 1, 1868c2ecf20Sopenharmony_ci}; 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_cistatic struct gpiod_lookup_table vulcan_w1_gpiod_table = { 1898c2ecf20Sopenharmony_ci .dev_id = "w1-gpio", 1908c2ecf20Sopenharmony_ci .table = { 1918c2ecf20Sopenharmony_ci GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", 14, NULL, 0, 1928c2ecf20Sopenharmony_ci GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), 1938c2ecf20Sopenharmony_ci }, 1948c2ecf20Sopenharmony_ci}; 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_cistatic struct w1_gpio_platform_data vulcan_w1_gpio_pdata = { 1978c2ecf20Sopenharmony_ci /* Intentionally left blank */ 1988c2ecf20Sopenharmony_ci}; 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_cistatic struct platform_device vulcan_w1_gpio = { 2018c2ecf20Sopenharmony_ci .name = "w1-gpio", 2028c2ecf20Sopenharmony_ci .id = 0, 2038c2ecf20Sopenharmony_ci .dev = { 2048c2ecf20Sopenharmony_ci .platform_data = &vulcan_w1_gpio_pdata, 2058c2ecf20Sopenharmony_ci }, 2068c2ecf20Sopenharmony_ci}; 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_cistatic struct platform_device *vulcan_devices[] __initdata = { 2098c2ecf20Sopenharmony_ci &vulcan_uart, 2108c2ecf20Sopenharmony_ci &vulcan_flash, 2118c2ecf20Sopenharmony_ci &vulcan_sram, 2128c2ecf20Sopenharmony_ci &vulcan_max6369, 2138c2ecf20Sopenharmony_ci &vulcan_eth[0], 2148c2ecf20Sopenharmony_ci &vulcan_eth[1], 2158c2ecf20Sopenharmony_ci &vulcan_w1_gpio, 2168c2ecf20Sopenharmony_ci}; 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_cistatic void __init vulcan_init(void) 2198c2ecf20Sopenharmony_ci{ 2208c2ecf20Sopenharmony_ci ixp4xx_sys_init(); 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci /* Flash is spread over both CS0 and CS1 */ 2238c2ecf20Sopenharmony_ci vulcan_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); 2248c2ecf20Sopenharmony_ci vulcan_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; 2258c2ecf20Sopenharmony_ci *IXP4XX_EXP_CS0 = IXP4XX_EXP_BUS_CS_EN | 2268c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_STROBE_T(3) | 2278c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_SIZE(0xF) | 2288c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_BYTE_RD16 | 2298c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_WR_EN; 2308c2ecf20Sopenharmony_ci *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ci /* SRAM on CS2, (256kB, 8bit, writable) */ 2338c2ecf20Sopenharmony_ci vulcan_sram_resource.start = IXP4XX_EXP_BUS_BASE(2); 2348c2ecf20Sopenharmony_ci vulcan_sram_resource.end = IXP4XX_EXP_BUS_BASE(2) + SZ_256K - 1; 2358c2ecf20Sopenharmony_ci *IXP4XX_EXP_CS2 = IXP4XX_EXP_BUS_CS_EN | 2368c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_STROBE_T(1) | 2378c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_HOLD_T(2) | 2388c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_SIZE(9) | 2398c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_SPLT_EN | 2408c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_WR_EN | 2418c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_BYTE_EN; 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci /* XR16L2551 on CS3 (Moto style, 512 bytes, 8bits, writable) */ 2448c2ecf20Sopenharmony_ci vulcan_uart_resources[2].start = IXP4XX_EXP_BUS_BASE(3); 2458c2ecf20Sopenharmony_ci vulcan_uart_resources[2].end = IXP4XX_EXP_BUS_BASE(3) + 16 - 1; 2468c2ecf20Sopenharmony_ci vulcan_uart_data[2].mapbase = vulcan_uart_resources[2].start; 2478c2ecf20Sopenharmony_ci vulcan_uart_data[3].mapbase = vulcan_uart_data[2].mapbase + 8; 2488c2ecf20Sopenharmony_ci *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN | 2498c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_STROBE_T(3) | 2508c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_CYCLES(IXP4XX_EXP_BUS_CYCLES_MOTOROLA)| 2518c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_WR_EN | 2528c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_BYTE_EN; 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci /* GPIOS on CS4 (512 bytes, 8bits, writable) */ 2558c2ecf20Sopenharmony_ci *IXP4XX_EXP_CS4 = IXP4XX_EXP_BUS_CS_EN | 2568c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_WR_EN | 2578c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_BYTE_EN; 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci /* max6369 on CS5 (512 bytes, 8bits, writable) */ 2608c2ecf20Sopenharmony_ci vulcan_max6369_resource.start = IXP4XX_EXP_BUS_BASE(5); 2618c2ecf20Sopenharmony_ci vulcan_max6369_resource.end = IXP4XX_EXP_BUS_BASE(5); 2628c2ecf20Sopenharmony_ci *IXP4XX_EXP_CS5 = IXP4XX_EXP_BUS_CS_EN | 2638c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_WR_EN | 2648c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_BYTE_EN; 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci gpiod_add_lookup_table(&vulcan_w1_gpiod_table); 2678c2ecf20Sopenharmony_ci platform_add_devices(vulcan_devices, ARRAY_SIZE(vulcan_devices)); 2688c2ecf20Sopenharmony_ci} 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ciMACHINE_START(ARCOM_VULCAN, "Arcom/Eurotech Vulcan") 2718c2ecf20Sopenharmony_ci /* Maintainer: Marc Zyngier <maz@misterjones.org> */ 2728c2ecf20Sopenharmony_ci .map_io = ixp4xx_map_io, 2738c2ecf20Sopenharmony_ci .init_early = ixp4xx_init_early, 2748c2ecf20Sopenharmony_ci .init_irq = ixp4xx_init_irq, 2758c2ecf20Sopenharmony_ci .init_time = ixp4xx_timer_init, 2768c2ecf20Sopenharmony_ci .atag_offset = 0x100, 2778c2ecf20Sopenharmony_ci .init_machine = vulcan_init, 2788c2ecf20Sopenharmony_ci#if defined(CONFIG_PCI) 2798c2ecf20Sopenharmony_ci .dma_zone_size = SZ_64M, 2808c2ecf20Sopenharmony_ci#endif 2818c2ecf20Sopenharmony_ci .restart = ixp4xx_restart, 2828c2ecf20Sopenharmony_ciMACHINE_END 283