board-marzen.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * marzen board support
  3. *
  4. * Copyright (C) 2011 Renesas Solutions Corp.
  5. * Copyright (C) 2011 Magnus Damm
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; version 2 of the License.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include <linux/kernel.h>
  21. #include <linux/init.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/irq.h>
  24. #include <linux/platform_device.h>
  25. #include <linux/delay.h>
  26. #include <linux/io.h>
  27. #include <linux/gpio.h>
  28. #include <linux/dma-mapping.h>
  29. #include <linux/regulator/fixed.h>
  30. #include <linux/regulator/machine.h>
  31. #include <linux/smsc911x.h>
  32. #include <linux/mmc/sh_mobile_sdhi.h>
  33. #include <linux/mfd/tmio.h>
  34. #include <mach/hardware.h>
  35. #include <mach/r8a7779.h>
  36. #include <mach/common.h>
  37. #include <mach/irqs.h>
  38. #include <asm/mach-types.h>
  39. #include <asm/mach/arch.h>
  40. #include <asm/hardware/gic.h>
  41. #include <asm/traps.h>
  42. /* Fixed 3.3V regulator to be used by SDHI0 */
  43. static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
  44. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
  45. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
  46. };
  47. /* Dummy supplies, where voltage doesn't matter */
  48. static struct regulator_consumer_supply dummy_supplies[] = {
  49. REGULATOR_SUPPLY("vddvario", "smsc911x"),
  50. REGULATOR_SUPPLY("vdd33a", "smsc911x"),
  51. };
  52. /* SMSC LAN89218 */
  53. static struct resource smsc911x_resources[] = {
  54. [0] = {
  55. .start = 0x18000000, /* ExCS0 */
  56. .end = 0x180000ff, /* A1->A7 */
  57. .flags = IORESOURCE_MEM,
  58. },
  59. [1] = {
  60. .start = gic_spi(28), /* IRQ 1 */
  61. .flags = IORESOURCE_IRQ,
  62. },
  63. };
  64. static struct smsc911x_platform_config smsc911x_platdata = {
  65. .flags = SMSC911X_USE_32BIT, /* 32-bit SW on 16-bit HW bus */
  66. .phy_interface = PHY_INTERFACE_MODE_MII,
  67. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  68. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  69. };
  70. static struct platform_device eth_device = {
  71. .name = "smsc911x",
  72. .id = -1,
  73. .dev = {
  74. .platform_data = &smsc911x_platdata,
  75. },
  76. .resource = smsc911x_resources,
  77. .num_resources = ARRAY_SIZE(smsc911x_resources),
  78. };
  79. static struct resource sdhi0_resources[] = {
  80. [0] = {
  81. .name = "sdhi0",
  82. .start = 0xffe4c000,
  83. .end = 0xffe4c0ff,
  84. .flags = IORESOURCE_MEM,
  85. },
  86. [1] = {
  87. .start = gic_spi(104),
  88. .flags = IORESOURCE_IRQ,
  89. },
  90. };
  91. static struct sh_mobile_sdhi_info sdhi0_platform_data = {
  92. .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
  93. .tmio_caps = MMC_CAP_SD_HIGHSPEED,
  94. };
  95. static struct platform_device sdhi0_device = {
  96. .name = "sh_mobile_sdhi",
  97. .num_resources = ARRAY_SIZE(sdhi0_resources),
  98. .resource = sdhi0_resources,
  99. .id = 0,
  100. .dev = {
  101. .platform_data = &sdhi0_platform_data,
  102. }
  103. };
  104. /* Thermal */
  105. static struct resource thermal_resources[] = {
  106. [0] = {
  107. .start = 0xFFC48000,
  108. .end = 0xFFC48038 - 1,
  109. .flags = IORESOURCE_MEM,
  110. },
  111. };
  112. static struct platform_device thermal_device = {
  113. .name = "rcar_thermal",
  114. .resource = thermal_resources,
  115. .num_resources = ARRAY_SIZE(thermal_resources),
  116. };
  117. static struct platform_device *marzen_devices[] __initdata = {
  118. &eth_device,
  119. &sdhi0_device,
  120. &thermal_device,
  121. };
  122. static void __init marzen_init(void)
  123. {
  124. regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
  125. ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
  126. regulator_register_fixed(1, dummy_supplies,
  127. ARRAY_SIZE(dummy_supplies));
  128. r8a7779_pinmux_init();
  129. /* SCIF2 (CN18: DEBUG0) */
  130. gpio_request(GPIO_FN_TX2_C, NULL);
  131. gpio_request(GPIO_FN_RX2_C, NULL);
  132. /* SCIF4 (CN19: DEBUG1) */
  133. gpio_request(GPIO_FN_TX4, NULL);
  134. gpio_request(GPIO_FN_RX4, NULL);
  135. /* LAN89218 */
  136. gpio_request(GPIO_FN_EX_CS0, NULL); /* nCS */
  137. gpio_request(GPIO_FN_IRQ1_B, NULL); /* IRQ + PME */
  138. /* SD0 (CN20) */
  139. gpio_request(GPIO_FN_SD0_CLK, NULL);
  140. gpio_request(GPIO_FN_SD0_CMD, NULL);
  141. gpio_request(GPIO_FN_SD0_DAT0, NULL);
  142. gpio_request(GPIO_FN_SD0_DAT1, NULL);
  143. gpio_request(GPIO_FN_SD0_DAT2, NULL);
  144. gpio_request(GPIO_FN_SD0_DAT3, NULL);
  145. gpio_request(GPIO_FN_SD0_CD, NULL);
  146. gpio_request(GPIO_FN_SD0_WP, NULL);
  147. r8a7779_add_standard_devices();
  148. platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
  149. }
  150. MACHINE_START(MARZEN, "marzen")
  151. .smp = smp_ops(r8a7779_smp_ops),
  152. .map_io = r8a7779_map_io,
  153. .init_early = r8a7779_add_early_devices,
  154. .nr_irqs = NR_IRQS_LEGACY,
  155. .init_irq = r8a7779_init_irq,
  156. .handle_irq = gic_handle_irq,
  157. .init_machine = marzen_init,
  158. .init_late = shmobile_init_late,
  159. .timer = &shmobile_timer,
  160. MACHINE_END