18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * arch/arm/mach-ep93xx/simone.c 48c2ecf20Sopenharmony_ci * Simplemachines Sim.One support. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2010 Ryan Mallon 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Based on the 2.6.24.7 support: 98c2ecf20Sopenharmony_ci * Copyright (C) 2009 Simplemachines 108c2ecf20Sopenharmony_ci * MMC support by Peter Ivanov <ivanovp@gmail.com>, 2007 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <linux/kernel.h> 148c2ecf20Sopenharmony_ci#include <linux/init.h> 158c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 168c2ecf20Sopenharmony_ci#include <linux/i2c.h> 178c2ecf20Sopenharmony_ci#include <linux/mmc/host.h> 188c2ecf20Sopenharmony_ci#include <linux/spi/spi.h> 198c2ecf20Sopenharmony_ci#include <linux/spi/mmc_spi.h> 208c2ecf20Sopenharmony_ci#include <linux/platform_data/video-ep93xx.h> 218c2ecf20Sopenharmony_ci#include <linux/platform_data/spi-ep93xx.h> 228c2ecf20Sopenharmony_ci#include <linux/gpio.h> 238c2ecf20Sopenharmony_ci#include <linux/gpio/machine.h> 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#include "hardware.h" 268c2ecf20Sopenharmony_ci#include "gpio-ep93xx.h" 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#include <asm/mach-types.h> 298c2ecf20Sopenharmony_ci#include <asm/mach/arch.h> 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#include "soc.h" 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_cistatic struct ep93xx_eth_data __initdata simone_eth_data = { 348c2ecf20Sopenharmony_ci .phy_id = 1, 358c2ecf20Sopenharmony_ci}; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cistatic struct ep93xxfb_mach_info __initdata simone_fb_info = { 388c2ecf20Sopenharmony_ci .flags = EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING, 398c2ecf20Sopenharmony_ci}; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_cistatic struct mmc_spi_platform_data simone_mmc_spi_data = { 428c2ecf20Sopenharmony_ci .detect_delay = 500, 438c2ecf20Sopenharmony_ci .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 448c2ecf20Sopenharmony_ci}; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_cistatic struct gpiod_lookup_table simone_mmc_spi_gpio_table = { 478c2ecf20Sopenharmony_ci .dev_id = "mmc_spi.0", /* "mmc_spi" @ CS0 */ 488c2ecf20Sopenharmony_ci .table = { 498c2ecf20Sopenharmony_ci /* Card detect */ 508c2ecf20Sopenharmony_ci GPIO_LOOKUP_IDX("A", 0, NULL, 0, GPIO_ACTIVE_LOW), 518c2ecf20Sopenharmony_ci { }, 528c2ecf20Sopenharmony_ci }, 538c2ecf20Sopenharmony_ci}; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_cistatic struct spi_board_info simone_spi_devices[] __initdata = { 568c2ecf20Sopenharmony_ci { 578c2ecf20Sopenharmony_ci .modalias = "mmc_spi", 588c2ecf20Sopenharmony_ci .platform_data = &simone_mmc_spi_data, 598c2ecf20Sopenharmony_ci /* 608c2ecf20Sopenharmony_ci * We use 10 MHz even though the maximum is 3.7 MHz. The driver 618c2ecf20Sopenharmony_ci * will limit it automatically to max. frequency. 628c2ecf20Sopenharmony_ci */ 638c2ecf20Sopenharmony_ci .max_speed_hz = 10 * 1000 * 1000, 648c2ecf20Sopenharmony_ci .bus_num = 0, 658c2ecf20Sopenharmony_ci .chip_select = 0, 668c2ecf20Sopenharmony_ci .mode = SPI_MODE_3, 678c2ecf20Sopenharmony_ci }, 688c2ecf20Sopenharmony_ci}; 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci/* 718c2ecf20Sopenharmony_ci * Up to v1.3, the Sim.One used SFRMOUT as SD card chip select, but this goes 728c2ecf20Sopenharmony_ci * low between multi-message command blocks. From v1.4, it uses a GPIO instead. 738c2ecf20Sopenharmony_ci * v1.3 parts will still work, since the signal on SFRMOUT is automatic. 748c2ecf20Sopenharmony_ci */ 758c2ecf20Sopenharmony_cistatic struct gpiod_lookup_table simone_spi_cs_gpio_table = { 768c2ecf20Sopenharmony_ci .dev_id = "spi0", 778c2ecf20Sopenharmony_ci .table = { 788c2ecf20Sopenharmony_ci GPIO_LOOKUP("A", 1, "cs", GPIO_ACTIVE_LOW), 798c2ecf20Sopenharmony_ci { }, 808c2ecf20Sopenharmony_ci }, 818c2ecf20Sopenharmony_ci}; 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_cistatic struct ep93xx_spi_info simone_spi_info __initdata = { 848c2ecf20Sopenharmony_ci .use_dma = 1, 858c2ecf20Sopenharmony_ci}; 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_cistatic struct i2c_board_info __initdata simone_i2c_board_info[] = { 888c2ecf20Sopenharmony_ci { 898c2ecf20Sopenharmony_ci I2C_BOARD_INFO("ds1337", 0x68), 908c2ecf20Sopenharmony_ci }, 918c2ecf20Sopenharmony_ci}; 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_cistatic struct platform_device simone_audio_device = { 948c2ecf20Sopenharmony_ci .name = "simone-audio", 958c2ecf20Sopenharmony_ci .id = -1, 968c2ecf20Sopenharmony_ci}; 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_cistatic void __init simone_register_audio(void) 998c2ecf20Sopenharmony_ci{ 1008c2ecf20Sopenharmony_ci ep93xx_register_ac97(); 1018c2ecf20Sopenharmony_ci platform_device_register(&simone_audio_device); 1028c2ecf20Sopenharmony_ci} 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_cistatic void __init simone_init_machine(void) 1058c2ecf20Sopenharmony_ci{ 1068c2ecf20Sopenharmony_ci ep93xx_init_devices(); 1078c2ecf20Sopenharmony_ci ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_8M); 1088c2ecf20Sopenharmony_ci ep93xx_register_eth(&simone_eth_data, 1); 1098c2ecf20Sopenharmony_ci ep93xx_register_fb(&simone_fb_info); 1108c2ecf20Sopenharmony_ci ep93xx_register_i2c(simone_i2c_board_info, 1118c2ecf20Sopenharmony_ci ARRAY_SIZE(simone_i2c_board_info)); 1128c2ecf20Sopenharmony_ci gpiod_add_lookup_table(&simone_mmc_spi_gpio_table); 1138c2ecf20Sopenharmony_ci gpiod_add_lookup_table(&simone_spi_cs_gpio_table); 1148c2ecf20Sopenharmony_ci ep93xx_register_spi(&simone_spi_info, simone_spi_devices, 1158c2ecf20Sopenharmony_ci ARRAY_SIZE(simone_spi_devices)); 1168c2ecf20Sopenharmony_ci simone_register_audio(); 1178c2ecf20Sopenharmony_ci} 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ciMACHINE_START(SIM_ONE, "Simplemachines Sim.One Board") 1208c2ecf20Sopenharmony_ci /* Maintainer: Ryan Mallon */ 1218c2ecf20Sopenharmony_ci .atag_offset = 0x100, 1228c2ecf20Sopenharmony_ci .map_io = ep93xx_map_io, 1238c2ecf20Sopenharmony_ci .init_irq = ep93xx_init_irq, 1248c2ecf20Sopenharmony_ci .init_time = ep93xx_timer_init, 1258c2ecf20Sopenharmony_ci .init_machine = simone_init_machine, 1268c2ecf20Sopenharmony_ci .init_late = ep93xx_init_late, 1278c2ecf20Sopenharmony_ci .restart = ep93xx_restart, 1288c2ecf20Sopenharmony_ciMACHINE_END 129