Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * arch/arm/mach-ep93xx/simone.c
0004  * Simplemachines Sim.One support.
0005  *
0006  * Copyright (C) 2010 Ryan Mallon
0007  *
0008  * Based on the 2.6.24.7 support:
0009  *   Copyright (C) 2009 Simplemachines
0010  *   MMC support by Peter Ivanov <ivanovp@gmail.com>, 2007
0011  */
0012 
0013 #include <linux/kernel.h>
0014 #include <linux/init.h>
0015 #include <linux/platform_device.h>
0016 #include <linux/i2c.h>
0017 #include <linux/mmc/host.h>
0018 #include <linux/spi/spi.h>
0019 #include <linux/spi/mmc_spi.h>
0020 #include <linux/platform_data/video-ep93xx.h>
0021 #include <linux/platform_data/spi-ep93xx.h>
0022 #include <linux/gpio.h>
0023 #include <linux/gpio/machine.h>
0024 
0025 #include "hardware.h"
0026 #include "gpio-ep93xx.h"
0027 
0028 #include <asm/mach-types.h>
0029 #include <asm/mach/arch.h>
0030 
0031 #include "soc.h"
0032 
0033 static struct ep93xx_eth_data __initdata simone_eth_data = {
0034     .phy_id     = 1,
0035 };
0036 
0037 static struct ep93xxfb_mach_info __initdata simone_fb_info = {
0038     .flags      = EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING,
0039 };
0040 
0041 static struct mmc_spi_platform_data simone_mmc_spi_data = {
0042     .detect_delay   = 500,
0043     .ocr_mask   = MMC_VDD_32_33 | MMC_VDD_33_34,
0044 };
0045 
0046 static struct gpiod_lookup_table simone_mmc_spi_gpio_table = {
0047     .dev_id = "mmc_spi.0", /* "mmc_spi" @ CS0 */
0048     .table = {
0049         /* Card detect */
0050         GPIO_LOOKUP_IDX("A", 0, NULL, 0, GPIO_ACTIVE_LOW),
0051         { },
0052     },
0053 };
0054 
0055 static struct spi_board_info simone_spi_devices[] __initdata = {
0056     {
0057         .modalias       = "mmc_spi",
0058         .platform_data      = &simone_mmc_spi_data,
0059         /*
0060          * We use 10 MHz even though the maximum is 3.7 MHz. The driver
0061          * will limit it automatically to max. frequency.
0062          */
0063         .max_speed_hz       = 10 * 1000 * 1000,
0064         .bus_num        = 0,
0065         .chip_select        = 0,
0066         .mode           = SPI_MODE_3,
0067     },
0068 };
0069 
0070 /*
0071  * Up to v1.3, the Sim.One used SFRMOUT as SD card chip select, but this goes
0072  * low between multi-message command blocks. From v1.4, it uses a GPIO instead.
0073  * v1.3 parts will still work, since the signal on SFRMOUT is automatic.
0074  */
0075 static struct gpiod_lookup_table simone_spi_cs_gpio_table = {
0076     .dev_id = "spi0",
0077     .table = {
0078         GPIO_LOOKUP("A", 1, "cs", GPIO_ACTIVE_LOW),
0079         { },
0080     },
0081 };
0082 
0083 static struct ep93xx_spi_info simone_spi_info __initdata = {
0084     .use_dma = 1,
0085 };
0086 
0087 static struct i2c_board_info __initdata simone_i2c_board_info[] = {
0088     {
0089         I2C_BOARD_INFO("ds1337", 0x68),
0090     },
0091 };
0092 
0093 static struct platform_device simone_audio_device = {
0094     .name       = "simone-audio",
0095     .id     = -1,
0096 };
0097 
0098 static void __init simone_register_audio(void)
0099 {
0100     ep93xx_register_ac97();
0101     platform_device_register(&simone_audio_device);
0102 }
0103 
0104 static void __init simone_init_machine(void)
0105 {
0106     ep93xx_init_devices();
0107     ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_8M);
0108     ep93xx_register_eth(&simone_eth_data, 1);
0109     ep93xx_register_fb(&simone_fb_info);
0110     ep93xx_register_i2c(simone_i2c_board_info,
0111                 ARRAY_SIZE(simone_i2c_board_info));
0112     gpiod_add_lookup_table(&simone_mmc_spi_gpio_table);
0113     gpiod_add_lookup_table(&simone_spi_cs_gpio_table);
0114     ep93xx_register_spi(&simone_spi_info, simone_spi_devices,
0115                 ARRAY_SIZE(simone_spi_devices));
0116     simone_register_audio();
0117 }
0118 
0119 MACHINE_START(SIM_ONE, "Simplemachines Sim.One Board")
0120     /* Maintainer: Ryan Mallon */
0121     .atag_offset    = 0x100,
0122     .nr_irqs    = NR_EP93XX_IRQS,
0123     .map_io     = ep93xx_map_io,
0124     .init_irq   = ep93xx_init_irq,
0125     .init_time  = ep93xx_timer_init,
0126     .init_machine   = simone_init_machine,
0127     .restart    = ep93xx_restart,
0128 MACHINE_END