18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * arch/arm/mach-ep93xx/ts72xx.c 48c2ecf20Sopenharmony_ci * Technologic Systems TS72xx SBC support. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <linux/kernel.h> 128c2ecf20Sopenharmony_ci#include <linux/init.h> 138c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 148c2ecf20Sopenharmony_ci#include <linux/io.h> 158c2ecf20Sopenharmony_ci#include <linux/mtd/platnand.h> 168c2ecf20Sopenharmony_ci#include <linux/spi/spi.h> 178c2ecf20Sopenharmony_ci#include <linux/spi/flash.h> 188c2ecf20Sopenharmony_ci#include <linux/spi/mmc_spi.h> 198c2ecf20Sopenharmony_ci#include <linux/mmc/host.h> 208c2ecf20Sopenharmony_ci#include <linux/platform_data/spi-ep93xx.h> 218c2ecf20Sopenharmony_ci#include <linux/gpio/machine.h> 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#include "gpio-ep93xx.h" 248c2ecf20Sopenharmony_ci#include "hardware.h" 258c2ecf20Sopenharmony_ci#include <mach/irqs.h> 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#include <asm/mach-types.h> 288c2ecf20Sopenharmony_ci#include <asm/mach/map.h> 298c2ecf20Sopenharmony_ci#include <asm/mach/arch.h> 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#include "soc.h" 328c2ecf20Sopenharmony_ci#include "ts72xx.h" 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci/************************************************************************* 358c2ecf20Sopenharmony_ci * IO map 368c2ecf20Sopenharmony_ci *************************************************************************/ 378c2ecf20Sopenharmony_cistatic struct map_desc ts72xx_io_desc[] __initdata = { 388c2ecf20Sopenharmony_ci { 398c2ecf20Sopenharmony_ci .virtual = (unsigned long)TS72XX_MODEL_VIRT_BASE, 408c2ecf20Sopenharmony_ci .pfn = __phys_to_pfn(TS72XX_MODEL_PHYS_BASE), 418c2ecf20Sopenharmony_ci .length = TS72XX_MODEL_SIZE, 428c2ecf20Sopenharmony_ci .type = MT_DEVICE, 438c2ecf20Sopenharmony_ci }, { 448c2ecf20Sopenharmony_ci .virtual = (unsigned long)TS72XX_OPTIONS_VIRT_BASE, 458c2ecf20Sopenharmony_ci .pfn = __phys_to_pfn(TS72XX_OPTIONS_PHYS_BASE), 468c2ecf20Sopenharmony_ci .length = TS72XX_OPTIONS_SIZE, 478c2ecf20Sopenharmony_ci .type = MT_DEVICE, 488c2ecf20Sopenharmony_ci }, { 498c2ecf20Sopenharmony_ci .virtual = (unsigned long)TS72XX_OPTIONS2_VIRT_BASE, 508c2ecf20Sopenharmony_ci .pfn = __phys_to_pfn(TS72XX_OPTIONS2_PHYS_BASE), 518c2ecf20Sopenharmony_ci .length = TS72XX_OPTIONS2_SIZE, 528c2ecf20Sopenharmony_ci .type = MT_DEVICE, 538c2ecf20Sopenharmony_ci }, { 548c2ecf20Sopenharmony_ci .virtual = (unsigned long)TS72XX_CPLDVER_VIRT_BASE, 558c2ecf20Sopenharmony_ci .pfn = __phys_to_pfn(TS72XX_CPLDVER_PHYS_BASE), 568c2ecf20Sopenharmony_ci .length = TS72XX_CPLDVER_SIZE, 578c2ecf20Sopenharmony_ci .type = MT_DEVICE, 588c2ecf20Sopenharmony_ci } 598c2ecf20Sopenharmony_ci}; 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cistatic void __init ts72xx_map_io(void) 628c2ecf20Sopenharmony_ci{ 638c2ecf20Sopenharmony_ci ep93xx_map_io(); 648c2ecf20Sopenharmony_ci iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc)); 658c2ecf20Sopenharmony_ci} 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci/************************************************************************* 698c2ecf20Sopenharmony_ci * NAND flash 708c2ecf20Sopenharmony_ci *************************************************************************/ 718c2ecf20Sopenharmony_ci#define TS72XX_NAND_CONTROL_ADDR_LINE 22 /* 0xN0400000 */ 728c2ecf20Sopenharmony_ci#define TS72XX_NAND_BUSY_ADDR_LINE 23 /* 0xN0800000 */ 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_cistatic void ts72xx_nand_hwcontrol(struct nand_chip *chip, 758c2ecf20Sopenharmony_ci int cmd, unsigned int ctrl) 768c2ecf20Sopenharmony_ci{ 778c2ecf20Sopenharmony_ci if (ctrl & NAND_CTRL_CHANGE) { 788c2ecf20Sopenharmony_ci void __iomem *addr = chip->legacy.IO_ADDR_R; 798c2ecf20Sopenharmony_ci unsigned char bits; 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci addr += (1 << TS72XX_NAND_CONTROL_ADDR_LINE); 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci bits = __raw_readb(addr) & ~0x07; 848c2ecf20Sopenharmony_ci bits |= (ctrl & NAND_NCE) << 2; /* bit 0 -> bit 2 */ 858c2ecf20Sopenharmony_ci bits |= (ctrl & NAND_CLE); /* bit 1 -> bit 1 */ 868c2ecf20Sopenharmony_ci bits |= (ctrl & NAND_ALE) >> 2; /* bit 2 -> bit 0 */ 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci __raw_writeb(bits, addr); 898c2ecf20Sopenharmony_ci } 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci if (cmd != NAND_CMD_NONE) 928c2ecf20Sopenharmony_ci __raw_writeb(cmd, chip->legacy.IO_ADDR_W); 938c2ecf20Sopenharmony_ci} 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_cistatic int ts72xx_nand_device_ready(struct nand_chip *chip) 968c2ecf20Sopenharmony_ci{ 978c2ecf20Sopenharmony_ci void __iomem *addr = chip->legacy.IO_ADDR_R; 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci addr += (1 << TS72XX_NAND_BUSY_ADDR_LINE); 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci return !!(__raw_readb(addr) & 0x20); 1028c2ecf20Sopenharmony_ci} 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#define TS72XX_BOOTROM_PART_SIZE (SZ_16K) 1058c2ecf20Sopenharmony_ci#define TS72XX_REDBOOT_PART_SIZE (SZ_2M + SZ_1M) 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_cistatic struct mtd_partition ts72xx_nand_parts[] = { 1088c2ecf20Sopenharmony_ci { 1098c2ecf20Sopenharmony_ci .name = "TS-BOOTROM", 1108c2ecf20Sopenharmony_ci .offset = 0, 1118c2ecf20Sopenharmony_ci .size = TS72XX_BOOTROM_PART_SIZE, 1128c2ecf20Sopenharmony_ci .mask_flags = MTD_WRITEABLE, /* force read-only */ 1138c2ecf20Sopenharmony_ci }, { 1148c2ecf20Sopenharmony_ci .name = "Linux", 1158c2ecf20Sopenharmony_ci .offset = MTDPART_OFS_RETAIN, 1168c2ecf20Sopenharmony_ci .size = TS72XX_REDBOOT_PART_SIZE, 1178c2ecf20Sopenharmony_ci /* leave so much for last partition */ 1188c2ecf20Sopenharmony_ci }, { 1198c2ecf20Sopenharmony_ci .name = "RedBoot", 1208c2ecf20Sopenharmony_ci .offset = MTDPART_OFS_APPEND, 1218c2ecf20Sopenharmony_ci .size = MTDPART_SIZ_FULL, 1228c2ecf20Sopenharmony_ci .mask_flags = MTD_WRITEABLE, /* force read-only */ 1238c2ecf20Sopenharmony_ci }, 1248c2ecf20Sopenharmony_ci}; 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_cistatic struct platform_nand_data ts72xx_nand_data = { 1278c2ecf20Sopenharmony_ci .chip = { 1288c2ecf20Sopenharmony_ci .nr_chips = 1, 1298c2ecf20Sopenharmony_ci .chip_offset = 0, 1308c2ecf20Sopenharmony_ci .chip_delay = 15, 1318c2ecf20Sopenharmony_ci }, 1328c2ecf20Sopenharmony_ci .ctrl = { 1338c2ecf20Sopenharmony_ci .cmd_ctrl = ts72xx_nand_hwcontrol, 1348c2ecf20Sopenharmony_ci .dev_ready = ts72xx_nand_device_ready, 1358c2ecf20Sopenharmony_ci }, 1368c2ecf20Sopenharmony_ci}; 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_cistatic struct resource ts72xx_nand_resource[] = { 1398c2ecf20Sopenharmony_ci { 1408c2ecf20Sopenharmony_ci .start = 0, /* filled in later */ 1418c2ecf20Sopenharmony_ci .end = 0, /* filled in later */ 1428c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 1438c2ecf20Sopenharmony_ci }, 1448c2ecf20Sopenharmony_ci}; 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_cistatic struct platform_device ts72xx_nand_flash = { 1478c2ecf20Sopenharmony_ci .name = "gen_nand", 1488c2ecf20Sopenharmony_ci .id = -1, 1498c2ecf20Sopenharmony_ci .dev.platform_data = &ts72xx_nand_data, 1508c2ecf20Sopenharmony_ci .resource = ts72xx_nand_resource, 1518c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(ts72xx_nand_resource), 1528c2ecf20Sopenharmony_ci}; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_civoid __init ts72xx_register_flash(struct mtd_partition *parts, int n, 1558c2ecf20Sopenharmony_ci resource_size_t start) 1568c2ecf20Sopenharmony_ci{ 1578c2ecf20Sopenharmony_ci /* 1588c2ecf20Sopenharmony_ci * TS7200 has NOR flash all other TS72xx board have NAND flash. 1598c2ecf20Sopenharmony_ci */ 1608c2ecf20Sopenharmony_ci if (board_is_ts7200()) { 1618c2ecf20Sopenharmony_ci ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M); 1628c2ecf20Sopenharmony_ci } else { 1638c2ecf20Sopenharmony_ci ts72xx_nand_resource[0].start = start; 1648c2ecf20Sopenharmony_ci ts72xx_nand_resource[0].end = start + SZ_16M - 1; 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci ts72xx_nand_data.chip.partitions = parts; 1678c2ecf20Sopenharmony_ci ts72xx_nand_data.chip.nr_partitions = n; 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci platform_device_register(&ts72xx_nand_flash); 1708c2ecf20Sopenharmony_ci } 1718c2ecf20Sopenharmony_ci} 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci/************************************************************************* 1748c2ecf20Sopenharmony_ci * RTC M48T86 1758c2ecf20Sopenharmony_ci *************************************************************************/ 1768c2ecf20Sopenharmony_ci#define TS72XX_RTC_INDEX_PHYS_BASE (EP93XX_CS1_PHYS_BASE + 0x00800000) 1778c2ecf20Sopenharmony_ci#define TS72XX_RTC_DATA_PHYS_BASE (EP93XX_CS1_PHYS_BASE + 0x01700000) 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_cistatic struct resource ts72xx_rtc_resources[] = { 1808c2ecf20Sopenharmony_ci DEFINE_RES_MEM(TS72XX_RTC_INDEX_PHYS_BASE, 0x01), 1818c2ecf20Sopenharmony_ci DEFINE_RES_MEM(TS72XX_RTC_DATA_PHYS_BASE, 0x01), 1828c2ecf20Sopenharmony_ci}; 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_cistatic struct platform_device ts72xx_rtc_device = { 1858c2ecf20Sopenharmony_ci .name = "rtc-m48t86", 1868c2ecf20Sopenharmony_ci .id = -1, 1878c2ecf20Sopenharmony_ci .resource = ts72xx_rtc_resources, 1888c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(ts72xx_rtc_resources), 1898c2ecf20Sopenharmony_ci}; 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci/************************************************************************* 1928c2ecf20Sopenharmony_ci * Watchdog (in CPLD) 1938c2ecf20Sopenharmony_ci *************************************************************************/ 1948c2ecf20Sopenharmony_ci#define TS72XX_WDT_CONTROL_PHYS_BASE (EP93XX_CS2_PHYS_BASE + 0x03800000) 1958c2ecf20Sopenharmony_ci#define TS72XX_WDT_FEED_PHYS_BASE (EP93XX_CS2_PHYS_BASE + 0x03c00000) 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_cistatic struct resource ts72xx_wdt_resources[] = { 1988c2ecf20Sopenharmony_ci DEFINE_RES_MEM(TS72XX_WDT_CONTROL_PHYS_BASE, 0x01), 1998c2ecf20Sopenharmony_ci DEFINE_RES_MEM(TS72XX_WDT_FEED_PHYS_BASE, 0x01), 2008c2ecf20Sopenharmony_ci}; 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_cistatic struct platform_device ts72xx_wdt_device = { 2038c2ecf20Sopenharmony_ci .name = "ts72xx-wdt", 2048c2ecf20Sopenharmony_ci .id = -1, 2058c2ecf20Sopenharmony_ci .resource = ts72xx_wdt_resources, 2068c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(ts72xx_wdt_resources), 2078c2ecf20Sopenharmony_ci}; 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci/************************************************************************* 2108c2ecf20Sopenharmony_ci * ETH 2118c2ecf20Sopenharmony_ci *************************************************************************/ 2128c2ecf20Sopenharmony_cistatic struct ep93xx_eth_data __initdata ts72xx_eth_data = { 2138c2ecf20Sopenharmony_ci .phy_id = 1, 2148c2ecf20Sopenharmony_ci}; 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ci/************************************************************************* 2178c2ecf20Sopenharmony_ci * SPI SD/MMC host 2188c2ecf20Sopenharmony_ci *************************************************************************/ 2198c2ecf20Sopenharmony_ci#define BK3_EN_SDCARD_PHYS_BASE 0x12400000 2208c2ecf20Sopenharmony_ci#define BK3_EN_SDCARD_PWR 0x0 2218c2ecf20Sopenharmony_ci#define BK3_DIS_SDCARD_PWR 0x0C 2228c2ecf20Sopenharmony_cistatic void bk3_mmc_spi_setpower(struct device *dev, unsigned int vdd) 2238c2ecf20Sopenharmony_ci{ 2248c2ecf20Sopenharmony_ci void __iomem *pwr_sd = ioremap(BK3_EN_SDCARD_PHYS_BASE, SZ_4K); 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci if (!pwr_sd) { 2278c2ecf20Sopenharmony_ci pr_err("Failed to enable SD card power!"); 2288c2ecf20Sopenharmony_ci return; 2298c2ecf20Sopenharmony_ci } 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci pr_debug("%s: SD card pwr %s VDD:0x%x\n", __func__, 2328c2ecf20Sopenharmony_ci !!vdd ? "ON" : "OFF", vdd); 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci if (!!vdd) 2358c2ecf20Sopenharmony_ci __raw_writeb(BK3_EN_SDCARD_PWR, pwr_sd); 2368c2ecf20Sopenharmony_ci else 2378c2ecf20Sopenharmony_ci __raw_writeb(BK3_DIS_SDCARD_PWR, pwr_sd); 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci iounmap(pwr_sd); 2408c2ecf20Sopenharmony_ci} 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_cistatic struct mmc_spi_platform_data bk3_spi_mmc_data = { 2438c2ecf20Sopenharmony_ci .detect_delay = 500, 2448c2ecf20Sopenharmony_ci .powerup_msecs = 100, 2458c2ecf20Sopenharmony_ci .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 2468c2ecf20Sopenharmony_ci .caps = MMC_CAP_NONREMOVABLE, 2478c2ecf20Sopenharmony_ci .setpower = bk3_mmc_spi_setpower, 2488c2ecf20Sopenharmony_ci}; 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci/************************************************************************* 2518c2ecf20Sopenharmony_ci * SPI Bus - SD card access 2528c2ecf20Sopenharmony_ci *************************************************************************/ 2538c2ecf20Sopenharmony_cistatic struct spi_board_info bk3_spi_board_info[] __initdata = { 2548c2ecf20Sopenharmony_ci { 2558c2ecf20Sopenharmony_ci .modalias = "mmc_spi", 2568c2ecf20Sopenharmony_ci .platform_data = &bk3_spi_mmc_data, 2578c2ecf20Sopenharmony_ci .max_speed_hz = 7.4E6, 2588c2ecf20Sopenharmony_ci .bus_num = 0, 2598c2ecf20Sopenharmony_ci .chip_select = 0, 2608c2ecf20Sopenharmony_ci .mode = SPI_MODE_0, 2618c2ecf20Sopenharmony_ci }, 2628c2ecf20Sopenharmony_ci}; 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci/* 2658c2ecf20Sopenharmony_ci * This is a stub -> the FGPIO[3] pin is not connected on the schematic 2668c2ecf20Sopenharmony_ci * The all work is performed automatically by !SPI_FRAME (SFRM1) and 2678c2ecf20Sopenharmony_ci * goes through CPLD 2688c2ecf20Sopenharmony_ci */ 2698c2ecf20Sopenharmony_cistatic struct gpiod_lookup_table bk3_spi_cs_gpio_table = { 2708c2ecf20Sopenharmony_ci .dev_id = "spi0", 2718c2ecf20Sopenharmony_ci .table = { 2728c2ecf20Sopenharmony_ci GPIO_LOOKUP("F", 3, "cs", GPIO_ACTIVE_LOW), 2738c2ecf20Sopenharmony_ci { }, 2748c2ecf20Sopenharmony_ci }, 2758c2ecf20Sopenharmony_ci}; 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_cistatic struct ep93xx_spi_info bk3_spi_master __initdata = { 2788c2ecf20Sopenharmony_ci .use_dma = 1, 2798c2ecf20Sopenharmony_ci}; 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci/************************************************************************* 2828c2ecf20Sopenharmony_ci * TS72XX support code 2838c2ecf20Sopenharmony_ci *************************************************************************/ 2848c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX) 2858c2ecf20Sopenharmony_ci 2868c2ecf20Sopenharmony_ci/* Relative to EP93XX_CS1_PHYS_BASE */ 2878c2ecf20Sopenharmony_ci#define TS73XX_FPGA_LOADER_BASE 0x03c00000 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_cistatic struct resource ts73xx_fpga_resources[] = { 2908c2ecf20Sopenharmony_ci { 2918c2ecf20Sopenharmony_ci .start = EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE, 2928c2ecf20Sopenharmony_ci .end = EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE + 1, 2938c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 2948c2ecf20Sopenharmony_ci }, 2958c2ecf20Sopenharmony_ci}; 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_cistatic struct platform_device ts73xx_fpga_device = { 2988c2ecf20Sopenharmony_ci .name = "ts73xx-fpga-mgr", 2998c2ecf20Sopenharmony_ci .id = -1, 3008c2ecf20Sopenharmony_ci .resource = ts73xx_fpga_resources, 3018c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(ts73xx_fpga_resources), 3028c2ecf20Sopenharmony_ci}; 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_ci#endif 3058c2ecf20Sopenharmony_ci 3068c2ecf20Sopenharmony_ci/************************************************************************* 3078c2ecf20Sopenharmony_ci * SPI Bus 3088c2ecf20Sopenharmony_ci *************************************************************************/ 3098c2ecf20Sopenharmony_cistatic struct spi_board_info ts72xx_spi_devices[] __initdata = { 3108c2ecf20Sopenharmony_ci { 3118c2ecf20Sopenharmony_ci .modalias = "tmp122", 3128c2ecf20Sopenharmony_ci .max_speed_hz = 2 * 1000 * 1000, 3138c2ecf20Sopenharmony_ci .bus_num = 0, 3148c2ecf20Sopenharmony_ci .chip_select = 0, 3158c2ecf20Sopenharmony_ci }, 3168c2ecf20Sopenharmony_ci}; 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_cistatic struct gpiod_lookup_table ts72xx_spi_cs_gpio_table = { 3198c2ecf20Sopenharmony_ci .dev_id = "spi0", 3208c2ecf20Sopenharmony_ci .table = { 3218c2ecf20Sopenharmony_ci /* DIO_17 */ 3228c2ecf20Sopenharmony_ci GPIO_LOOKUP("F", 2, "cs", GPIO_ACTIVE_LOW), 3238c2ecf20Sopenharmony_ci { }, 3248c2ecf20Sopenharmony_ci }, 3258c2ecf20Sopenharmony_ci}; 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_cistatic struct ep93xx_spi_info ts72xx_spi_info __initdata = { 3288c2ecf20Sopenharmony_ci /* Intentionally left blank */ 3298c2ecf20Sopenharmony_ci}; 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_cistatic void __init ts72xx_init_machine(void) 3328c2ecf20Sopenharmony_ci{ 3338c2ecf20Sopenharmony_ci ep93xx_init_devices(); 3348c2ecf20Sopenharmony_ci ts72xx_register_flash(ts72xx_nand_parts, ARRAY_SIZE(ts72xx_nand_parts), 3358c2ecf20Sopenharmony_ci is_ts9420_installed() ? 3368c2ecf20Sopenharmony_ci EP93XX_CS7_PHYS_BASE : EP93XX_CS6_PHYS_BASE); 3378c2ecf20Sopenharmony_ci platform_device_register(&ts72xx_rtc_device); 3388c2ecf20Sopenharmony_ci platform_device_register(&ts72xx_wdt_device); 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci ep93xx_register_eth(&ts72xx_eth_data, 1); 3418c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX) 3428c2ecf20Sopenharmony_ci if (board_is_ts7300()) 3438c2ecf20Sopenharmony_ci platform_device_register(&ts73xx_fpga_device); 3448c2ecf20Sopenharmony_ci#endif 3458c2ecf20Sopenharmony_ci gpiod_add_lookup_table(&ts72xx_spi_cs_gpio_table); 3468c2ecf20Sopenharmony_ci ep93xx_register_spi(&ts72xx_spi_info, ts72xx_spi_devices, 3478c2ecf20Sopenharmony_ci ARRAY_SIZE(ts72xx_spi_devices)); 3488c2ecf20Sopenharmony_ci} 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_ciMACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC") 3518c2ecf20Sopenharmony_ci /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ 3528c2ecf20Sopenharmony_ci .atag_offset = 0x100, 3538c2ecf20Sopenharmony_ci .map_io = ts72xx_map_io, 3548c2ecf20Sopenharmony_ci .init_irq = ep93xx_init_irq, 3558c2ecf20Sopenharmony_ci .init_time = ep93xx_timer_init, 3568c2ecf20Sopenharmony_ci .init_machine = ts72xx_init_machine, 3578c2ecf20Sopenharmony_ci .init_late = ep93xx_init_late, 3588c2ecf20Sopenharmony_ci .restart = ep93xx_restart, 3598c2ecf20Sopenharmony_ciMACHINE_END 3608c2ecf20Sopenharmony_ci 3618c2ecf20Sopenharmony_ci/************************************************************************* 3628c2ecf20Sopenharmony_ci * EP93xx I2S audio peripheral handling 3638c2ecf20Sopenharmony_ci *************************************************************************/ 3648c2ecf20Sopenharmony_cistatic struct resource ep93xx_i2s_resource[] = { 3658c2ecf20Sopenharmony_ci DEFINE_RES_MEM(EP93XX_I2S_PHYS_BASE, 0x100), 3668c2ecf20Sopenharmony_ci DEFINE_RES_IRQ_NAMED(IRQ_EP93XX_SAI, "spilink i2s slave"), 3678c2ecf20Sopenharmony_ci}; 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_cistatic struct platform_device ep93xx_i2s_device = { 3708c2ecf20Sopenharmony_ci .name = "ep93xx-spilink-i2s", 3718c2ecf20Sopenharmony_ci .id = -1, 3728c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(ep93xx_i2s_resource), 3738c2ecf20Sopenharmony_ci .resource = ep93xx_i2s_resource, 3748c2ecf20Sopenharmony_ci}; 3758c2ecf20Sopenharmony_ci 3768c2ecf20Sopenharmony_ci/************************************************************************* 3778c2ecf20Sopenharmony_ci * BK3 support code 3788c2ecf20Sopenharmony_ci *************************************************************************/ 3798c2ecf20Sopenharmony_cistatic struct mtd_partition bk3_nand_parts[] = { 3808c2ecf20Sopenharmony_ci { 3818c2ecf20Sopenharmony_ci .name = "System", 3828c2ecf20Sopenharmony_ci .offset = 0x00000000, 3838c2ecf20Sopenharmony_ci .size = 0x01e00000, 3848c2ecf20Sopenharmony_ci }, { 3858c2ecf20Sopenharmony_ci .name = "Data", 3868c2ecf20Sopenharmony_ci .offset = 0x01e00000, 3878c2ecf20Sopenharmony_ci .size = 0x05f20000 3888c2ecf20Sopenharmony_ci }, { 3898c2ecf20Sopenharmony_ci .name = "RedBoot", 3908c2ecf20Sopenharmony_ci .offset = 0x07d20000, 3918c2ecf20Sopenharmony_ci .size = 0x002e0000, 3928c2ecf20Sopenharmony_ci .mask_flags = MTD_WRITEABLE, /* force RO */ 3938c2ecf20Sopenharmony_ci }, 3948c2ecf20Sopenharmony_ci}; 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_cistatic void __init bk3_init_machine(void) 3978c2ecf20Sopenharmony_ci{ 3988c2ecf20Sopenharmony_ci ep93xx_init_devices(); 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_ci ts72xx_register_flash(bk3_nand_parts, ARRAY_SIZE(bk3_nand_parts), 4018c2ecf20Sopenharmony_ci EP93XX_CS6_PHYS_BASE); 4028c2ecf20Sopenharmony_ci 4038c2ecf20Sopenharmony_ci ep93xx_register_eth(&ts72xx_eth_data, 1); 4048c2ecf20Sopenharmony_ci 4058c2ecf20Sopenharmony_ci gpiod_add_lookup_table(&bk3_spi_cs_gpio_table); 4068c2ecf20Sopenharmony_ci ep93xx_register_spi(&bk3_spi_master, bk3_spi_board_info, 4078c2ecf20Sopenharmony_ci ARRAY_SIZE(bk3_spi_board_info)); 4088c2ecf20Sopenharmony_ci 4098c2ecf20Sopenharmony_ci /* Configure ep93xx's I2S to use AC97 pins */ 4108c2ecf20Sopenharmony_ci ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_I2SONAC97); 4118c2ecf20Sopenharmony_ci platform_device_register(&ep93xx_i2s_device); 4128c2ecf20Sopenharmony_ci} 4138c2ecf20Sopenharmony_ci 4148c2ecf20Sopenharmony_ciMACHINE_START(BK3, "Liebherr controller BK3.1") 4158c2ecf20Sopenharmony_ci /* Maintainer: Lukasz Majewski <lukma@denx.de> */ 4168c2ecf20Sopenharmony_ci .atag_offset = 0x100, 4178c2ecf20Sopenharmony_ci .map_io = ts72xx_map_io, 4188c2ecf20Sopenharmony_ci .init_irq = ep93xx_init_irq, 4198c2ecf20Sopenharmony_ci .init_time = ep93xx_timer_init, 4208c2ecf20Sopenharmony_ci .init_machine = bk3_init_machine, 4218c2ecf20Sopenharmony_ci .init_late = ep93xx_init_late, 4228c2ecf20Sopenharmony_ci .restart = ep93xx_restart, 4238c2ecf20Sopenharmony_ciMACHINE_END 424