board-marzen.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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 = 0,
  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. static struct platform_device *marzen_devices[] __initdata = {
  105. &eth_device,
  106. &sdhi0_device,
  107. };
  108. static void __init marzen_init(void)
  109. {
  110. regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
  111. ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
  112. regulator_register_fixed(0, dummy_supplies,
  113. ARRAY_SIZE(dummy_supplies));
  114. r8a7779_pinmux_init();
  115. /* SCIF2 (CN18: DEBUG0) */
  116. gpio_request(GPIO_FN_TX2_C, NULL);
  117. gpio_request(GPIO_FN_RX2_C, NULL);
  118. /* SCIF4 (CN19: DEBUG1) */
  119. gpio_request(GPIO_FN_TX4, NULL);
  120. gpio_request(GPIO_FN_RX4, NULL);
  121. /* LAN89218 */
  122. gpio_request(GPIO_FN_EX_CS0, NULL); /* nCS */
  123. gpio_request(GPIO_FN_IRQ1_B, NULL); /* IRQ + PME */
  124. /* SD0 (CN20) */
  125. gpio_request(GPIO_FN_SD0_CLK, NULL);
  126. gpio_request(GPIO_FN_SD0_CMD, NULL);
  127. gpio_request(GPIO_FN_SD0_DAT0, NULL);
  128. gpio_request(GPIO_FN_SD0_DAT1, NULL);
  129. gpio_request(GPIO_FN_SD0_DAT2, NULL);
  130. gpio_request(GPIO_FN_SD0_DAT3, NULL);
  131. gpio_request(GPIO_FN_SD0_CD, NULL);
  132. gpio_request(GPIO_FN_SD0_WP, NULL);
  133. r8a7779_add_standard_devices();
  134. platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
  135. }
  136. MACHINE_START(MARZEN, "marzen")
  137. .map_io = r8a7779_map_io,
  138. .init_early = r8a7779_add_early_devices,
  139. .nr_irqs = NR_IRQS_LEGACY,
  140. .init_irq = r8a7779_init_irq,
  141. .handle_irq = gic_handle_irq,
  142. .init_machine = marzen_init,
  143. .init_late = shmobile_init_late,
  144. .timer = &shmobile_timer,
  145. MACHINE_END