simone.c 3.2 KB

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