18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * arch/arm/mach-ixp4xx/avila-setup.c 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Gateworks Avila board-setup 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Author: Michael-Luke Jones <mlj28@cam.ac.uk> 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Based on ixdp-setup.c 108c2ecf20Sopenharmony_ci * Copyright (C) 2003-2005 MontaVista Software, Inc. 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * Author: Deepak Saxena <dsaxena@plexity.net> 138c2ecf20Sopenharmony_ci */ 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#include <linux/kernel.h> 168c2ecf20Sopenharmony_ci#include <linux/init.h> 178c2ecf20Sopenharmony_ci#include <linux/device.h> 188c2ecf20Sopenharmony_ci#include <linux/serial.h> 198c2ecf20Sopenharmony_ci#include <linux/tty.h> 208c2ecf20Sopenharmony_ci#include <linux/serial_8250.h> 218c2ecf20Sopenharmony_ci#include <linux/gpio/machine.h> 228c2ecf20Sopenharmony_ci#include <asm/types.h> 238c2ecf20Sopenharmony_ci#include <asm/setup.h> 248c2ecf20Sopenharmony_ci#include <asm/memory.h> 258c2ecf20Sopenharmony_ci#include <mach/hardware.h> 268c2ecf20Sopenharmony_ci#include <asm/mach-types.h> 278c2ecf20Sopenharmony_ci#include <asm/irq.h> 288c2ecf20Sopenharmony_ci#include <asm/mach/arch.h> 298c2ecf20Sopenharmony_ci#include <asm/mach/flash.h> 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#include "irqs.h" 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#define AVILA_SDA_PIN 7 348c2ecf20Sopenharmony_ci#define AVILA_SCL_PIN 6 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_cistatic struct flash_platform_data avila_flash_data = { 378c2ecf20Sopenharmony_ci .map_name = "cfi_probe", 388c2ecf20Sopenharmony_ci .width = 2, 398c2ecf20Sopenharmony_ci}; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_cistatic struct resource avila_flash_resource = { 428c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 438c2ecf20Sopenharmony_ci}; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_cistatic struct platform_device avila_flash = { 468c2ecf20Sopenharmony_ci .name = "IXP4XX-Flash", 478c2ecf20Sopenharmony_ci .id = 0, 488c2ecf20Sopenharmony_ci .dev = { 498c2ecf20Sopenharmony_ci .platform_data = &avila_flash_data, 508c2ecf20Sopenharmony_ci }, 518c2ecf20Sopenharmony_ci .num_resources = 1, 528c2ecf20Sopenharmony_ci .resource = &avila_flash_resource, 538c2ecf20Sopenharmony_ci}; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_cistatic struct gpiod_lookup_table avila_i2c_gpiod_table = { 568c2ecf20Sopenharmony_ci .dev_id = "i2c-gpio.0", 578c2ecf20Sopenharmony_ci .table = { 588c2ecf20Sopenharmony_ci GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", AVILA_SDA_PIN, 598c2ecf20Sopenharmony_ci NULL, 0, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), 608c2ecf20Sopenharmony_ci GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", AVILA_SCL_PIN, 618c2ecf20Sopenharmony_ci NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), 628c2ecf20Sopenharmony_ci }, 638c2ecf20Sopenharmony_ci}; 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_cistatic struct platform_device avila_i2c_gpio = { 668c2ecf20Sopenharmony_ci .name = "i2c-gpio", 678c2ecf20Sopenharmony_ci .id = 0, 688c2ecf20Sopenharmony_ci .dev = { 698c2ecf20Sopenharmony_ci .platform_data = NULL, 708c2ecf20Sopenharmony_ci }, 718c2ecf20Sopenharmony_ci}; 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_cistatic struct resource avila_uart_resources[] = { 748c2ecf20Sopenharmony_ci { 758c2ecf20Sopenharmony_ci .start = IXP4XX_UART1_BASE_PHYS, 768c2ecf20Sopenharmony_ci .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, 778c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM 788c2ecf20Sopenharmony_ci }, 798c2ecf20Sopenharmony_ci { 808c2ecf20Sopenharmony_ci .start = IXP4XX_UART2_BASE_PHYS, 818c2ecf20Sopenharmony_ci .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, 828c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM 838c2ecf20Sopenharmony_ci } 848c2ecf20Sopenharmony_ci}; 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_cistatic struct plat_serial8250_port avila_uart_data[] = { 878c2ecf20Sopenharmony_ci { 888c2ecf20Sopenharmony_ci .mapbase = IXP4XX_UART1_BASE_PHYS, 898c2ecf20Sopenharmony_ci .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, 908c2ecf20Sopenharmony_ci .irq = IRQ_IXP4XX_UART1, 918c2ecf20Sopenharmony_ci .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 928c2ecf20Sopenharmony_ci .iotype = UPIO_MEM, 938c2ecf20Sopenharmony_ci .regshift = 2, 948c2ecf20Sopenharmony_ci .uartclk = IXP4XX_UART_XTAL, 958c2ecf20Sopenharmony_ci }, 968c2ecf20Sopenharmony_ci { 978c2ecf20Sopenharmony_ci .mapbase = IXP4XX_UART2_BASE_PHYS, 988c2ecf20Sopenharmony_ci .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, 998c2ecf20Sopenharmony_ci .irq = IRQ_IXP4XX_UART2, 1008c2ecf20Sopenharmony_ci .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 1018c2ecf20Sopenharmony_ci .iotype = UPIO_MEM, 1028c2ecf20Sopenharmony_ci .regshift = 2, 1038c2ecf20Sopenharmony_ci .uartclk = IXP4XX_UART_XTAL, 1048c2ecf20Sopenharmony_ci }, 1058c2ecf20Sopenharmony_ci { }, 1068c2ecf20Sopenharmony_ci}; 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_cistatic struct platform_device avila_uart = { 1098c2ecf20Sopenharmony_ci .name = "serial8250", 1108c2ecf20Sopenharmony_ci .id = PLAT8250_DEV_PLATFORM, 1118c2ecf20Sopenharmony_ci .dev.platform_data = avila_uart_data, 1128c2ecf20Sopenharmony_ci .num_resources = 2, 1138c2ecf20Sopenharmony_ci .resource = avila_uart_resources 1148c2ecf20Sopenharmony_ci}; 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_cistatic struct resource avila_pata_resources[] = { 1178c2ecf20Sopenharmony_ci { 1188c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM 1198c2ecf20Sopenharmony_ci }, 1208c2ecf20Sopenharmony_ci { 1218c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 1228c2ecf20Sopenharmony_ci }, 1238c2ecf20Sopenharmony_ci { 1248c2ecf20Sopenharmony_ci .name = "intrq", 1258c2ecf20Sopenharmony_ci .start = IRQ_IXP4XX_GPIO12, 1268c2ecf20Sopenharmony_ci .end = IRQ_IXP4XX_GPIO12, 1278c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 1288c2ecf20Sopenharmony_ci }, 1298c2ecf20Sopenharmony_ci}; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_cistatic struct ixp4xx_pata_data avila_pata_data = { 1328c2ecf20Sopenharmony_ci .cs0_bits = 0xbfff0043, 1338c2ecf20Sopenharmony_ci .cs1_bits = 0xbfff0043, 1348c2ecf20Sopenharmony_ci}; 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_cistatic struct platform_device avila_pata = { 1378c2ecf20Sopenharmony_ci .name = "pata_ixp4xx_cf", 1388c2ecf20Sopenharmony_ci .id = 0, 1398c2ecf20Sopenharmony_ci .dev.platform_data = &avila_pata_data, 1408c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(avila_pata_resources), 1418c2ecf20Sopenharmony_ci .resource = avila_pata_resources, 1428c2ecf20Sopenharmony_ci}; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_cistatic struct platform_device *avila_devices[] __initdata = { 1458c2ecf20Sopenharmony_ci &avila_i2c_gpio, 1468c2ecf20Sopenharmony_ci &avila_flash, 1478c2ecf20Sopenharmony_ci &avila_uart 1488c2ecf20Sopenharmony_ci}; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_cistatic void __init avila_init(void) 1518c2ecf20Sopenharmony_ci{ 1528c2ecf20Sopenharmony_ci ixp4xx_sys_init(); 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); 1558c2ecf20Sopenharmony_ci avila_flash_resource.end = 1568c2ecf20Sopenharmony_ci IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci gpiod_add_lookup_table(&avila_i2c_gpiod_table); 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices)); 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1); 1638c2ecf20Sopenharmony_ci avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1); 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2); 1668c2ecf20Sopenharmony_ci avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(2); 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci avila_pata_data.cs0_cfg = IXP4XX_EXP_CS1; 1698c2ecf20Sopenharmony_ci avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2; 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci platform_device_register(&avila_pata); 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci} 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ciMACHINE_START(AVILA, "Gateworks Avila Network Platform") 1768c2ecf20Sopenharmony_ci /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ 1778c2ecf20Sopenharmony_ci .map_io = ixp4xx_map_io, 1788c2ecf20Sopenharmony_ci .init_early = ixp4xx_init_early, 1798c2ecf20Sopenharmony_ci .init_irq = ixp4xx_init_irq, 1808c2ecf20Sopenharmony_ci .init_time = ixp4xx_timer_init, 1818c2ecf20Sopenharmony_ci .atag_offset = 0x100, 1828c2ecf20Sopenharmony_ci .init_machine = avila_init, 1838c2ecf20Sopenharmony_ci#if defined(CONFIG_PCI) 1848c2ecf20Sopenharmony_ci .dma_zone_size = SZ_64M, 1858c2ecf20Sopenharmony_ci#endif 1868c2ecf20Sopenharmony_ci .restart = ixp4xx_restart, 1878c2ecf20Sopenharmony_ciMACHINE_END 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci /* 1908c2ecf20Sopenharmony_ci * Loft is functionally equivalent to Avila except that it has a 1918c2ecf20Sopenharmony_ci * different number for the maximum PCI devices. The MACHINE 1928c2ecf20Sopenharmony_ci * structure below is identical to Avila except for the comment. 1938c2ecf20Sopenharmony_ci */ 1948c2ecf20Sopenharmony_ci#ifdef CONFIG_MACH_LOFT 1958c2ecf20Sopenharmony_ciMACHINE_START(LOFT, "Giant Shoulder Inc Loft board") 1968c2ecf20Sopenharmony_ci /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */ 1978c2ecf20Sopenharmony_ci .map_io = ixp4xx_map_io, 1988c2ecf20Sopenharmony_ci .init_early = ixp4xx_init_early, 1998c2ecf20Sopenharmony_ci .init_irq = ixp4xx_init_irq, 2008c2ecf20Sopenharmony_ci .init_time = ixp4xx_timer_init, 2018c2ecf20Sopenharmony_ci .atag_offset = 0x100, 2028c2ecf20Sopenharmony_ci .init_machine = avila_init, 2038c2ecf20Sopenharmony_ci#if defined(CONFIG_PCI) 2048c2ecf20Sopenharmony_ci .dma_zone_size = SZ_64M, 2058c2ecf20Sopenharmony_ci#endif 2068c2ecf20Sopenharmony_ci .restart = ixp4xx_restart, 2078c2ecf20Sopenharmony_ciMACHINE_END 2088c2ecf20Sopenharmony_ci#endif 2098c2ecf20Sopenharmony_ci 210