simone.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * arch/arm/mach-ep93xx/simone.c
  4. * Simplemachines Sim.One support.
  5. *
  6. * Copyright (C) 2010 Ryan Mallon
  7. *
  8. * Based on the 2.6.24.7 support:
  9. * Copyright (C) 2009 Simplemachines
  10. * MMC support by Peter Ivanov <[email protected]>, 2007
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/i2c.h>
  16. #include <linux/mmc/host.h>
  17. #include <linux/spi/spi.h>
  18. #include <linux/spi/mmc_spi.h>
  19. #include <linux/platform_data/video-ep93xx.h>
  20. #include <linux/platform_data/spi-ep93xx.h>
  21. #include <linux/gpio.h>
  22. #include <linux/gpio/machine.h>
  23. #include "hardware.h"
  24. #include "gpio-ep93xx.h"
  25. #include <asm/mach-types.h>
  26. #include <asm/mach/arch.h>
  27. #include "soc.h"
  28. static struct ep93xx_eth_data __initdata simone_eth_data = {
  29. .phy_id = 1,
  30. };
  31. static struct ep93xxfb_mach_info __initdata simone_fb_info = {
  32. .flags = EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING,
  33. };
  34. static struct mmc_spi_platform_data simone_mmc_spi_data = {
  35. .detect_delay = 500,
  36. .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  37. };
  38. static struct gpiod_lookup_table simone_mmc_spi_gpio_table = {
  39. .dev_id = "mmc_spi.0", /* "mmc_spi" @ CS0 */
  40. .table = {
  41. /* Card detect */
  42. GPIO_LOOKUP_IDX("A", 0, NULL, 0, GPIO_ACTIVE_LOW),
  43. { },
  44. },
  45. };
  46. static struct spi_board_info simone_spi_devices[] __initdata = {
  47. {
  48. .modalias = "mmc_spi",
  49. .platform_data = &simone_mmc_spi_data,
  50. /*
  51. * We use 10 MHz even though the maximum is 3.7 MHz. The driver
  52. * will limit it automatically to max. frequency.
  53. */
  54. .max_speed_hz = 10 * 1000 * 1000,
  55. .bus_num = 0,
  56. .chip_select = 0,
  57. .mode = SPI_MODE_3,
  58. },
  59. };
  60. /*
  61. * Up to v1.3, the Sim.One used SFRMOUT as SD card chip select, but this goes
  62. * low between multi-message command blocks. From v1.4, it uses a GPIO instead.
  63. * v1.3 parts will still work, since the signal on SFRMOUT is automatic.
  64. */
  65. static struct gpiod_lookup_table simone_spi_cs_gpio_table = {
  66. .dev_id = "spi0",
  67. .table = {
  68. GPIO_LOOKUP("A", 1, "cs", GPIO_ACTIVE_LOW),
  69. { },
  70. },
  71. };
  72. static struct ep93xx_spi_info simone_spi_info __initdata = {
  73. .use_dma = 1,
  74. };
  75. static struct i2c_board_info __initdata simone_i2c_board_info[] = {
  76. {
  77. I2C_BOARD_INFO("ds1337", 0x68),
  78. },
  79. };
  80. static struct platform_device simone_audio_device = {
  81. .name = "simone-audio",
  82. .id = -1,
  83. };
  84. static void __init simone_register_audio(void)
  85. {
  86. ep93xx_register_ac97();
  87. platform_device_register(&simone_audio_device);
  88. }
  89. static void __init simone_init_machine(void)
  90. {
  91. ep93xx_init_devices();
  92. ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_8M);
  93. ep93xx_register_eth(&simone_eth_data, 1);
  94. ep93xx_register_fb(&simone_fb_info);
  95. ep93xx_register_i2c(simone_i2c_board_info,
  96. ARRAY_SIZE(simone_i2c_board_info));
  97. gpiod_add_lookup_table(&simone_mmc_spi_gpio_table);
  98. gpiod_add_lookup_table(&simone_spi_cs_gpio_table);
  99. ep93xx_register_spi(&simone_spi_info, simone_spi_devices,
  100. ARRAY_SIZE(simone_spi_devices));
  101. simone_register_audio();
  102. }
  103. MACHINE_START(SIM_ONE, "Simplemachines Sim.One Board")
  104. /* Maintainer: Ryan Mallon */
  105. .atag_offset = 0x100,
  106. .nr_irqs = NR_EP93XX_IRQS,
  107. .map_io = ep93xx_map_io,
  108. .init_irq = ep93xx_init_irq,
  109. .init_time = ep93xx_timer_init,
  110. .init_machine = simone_init_machine,
  111. .restart = ep93xx_restart,
  112. MACHINE_END