board-koelsch-reference.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * Koelsch board support - Reference DT implementation
  3. *
  4. * Copyright (C) 2013 Renesas Electronics Corporation
  5. * Copyright (C) 2013 Renesas Solutions Corp.
  6. * Copyright (C) 2013 Magnus Damm
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; version 2 of the License.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include <linux/dma-mapping.h>
  22. #include <linux/kernel.h>
  23. #include <linux/of_platform.h>
  24. #include <linux/platform_data/rcar-du.h>
  25. #include <mach/clock.h>
  26. #include <mach/common.h>
  27. #include <mach/irqs.h>
  28. #include <mach/rcar-gen2.h>
  29. #include <mach/r8a7791.h>
  30. #include <asm/mach/arch.h>
  31. /* DU */
  32. static struct rcar_du_encoder_data koelsch_du_encoders[] = {
  33. {
  34. .type = RCAR_DU_ENCODER_NONE,
  35. .output = RCAR_DU_OUTPUT_LVDS0,
  36. .connector.lvds.panel = {
  37. .width_mm = 210,
  38. .height_mm = 158,
  39. .mode = {
  40. .clock = 65000,
  41. .hdisplay = 1024,
  42. .hsync_start = 1048,
  43. .hsync_end = 1184,
  44. .htotal = 1344,
  45. .vdisplay = 768,
  46. .vsync_start = 771,
  47. .vsync_end = 777,
  48. .vtotal = 806,
  49. .flags = 0,
  50. },
  51. },
  52. },
  53. };
  54. static struct rcar_du_platform_data koelsch_du_pdata = {
  55. .encoders = koelsch_du_encoders,
  56. .num_encoders = ARRAY_SIZE(koelsch_du_encoders),
  57. };
  58. static const struct resource du_resources[] __initconst = {
  59. DEFINE_RES_MEM(0xfeb00000, 0x40000),
  60. DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
  61. DEFINE_RES_IRQ(gic_spi(256)),
  62. DEFINE_RES_IRQ(gic_spi(268)),
  63. };
  64. static void __init koelsch_add_du_device(void)
  65. {
  66. struct platform_device_info info = {
  67. .name = "rcar-du-r8a7791",
  68. .id = -1,
  69. .res = du_resources,
  70. .num_res = ARRAY_SIZE(du_resources),
  71. .data = &koelsch_du_pdata,
  72. .size_data = sizeof(koelsch_du_pdata),
  73. .dma_mask = DMA_BIT_MASK(32),
  74. };
  75. platform_device_register_full(&info);
  76. }
  77. /*
  78. * This is a really crude hack to provide clkdev support to platform
  79. * devices until they get moved to DT.
  80. */
  81. static const struct clk_name clk_names[] __initconst = {
  82. { "cmt0", "fck", "sh-cmt-48-gen2.0" },
  83. { "du0", "du.0", "rcar-du-r8a7791" },
  84. { "du1", "du.1", "rcar-du-r8a7791" },
  85. { "lvds0", "lvds.0", "rcar-du-r8a7791" },
  86. };
  87. /*
  88. * This is a really crude hack to work around core platform clock issues
  89. */
  90. static const struct clk_name clk_enables[] __initconst = {
  91. { "ether", NULL, "ee700000.ethernet" },
  92. { "i2c2", NULL, "e6530000.i2c" },
  93. { "msiof0", NULL, "e6e20000.spi" },
  94. { "qspi_mod", NULL, "e6b10000.spi" },
  95. { "sdhi0", NULL, "ee100000.sd" },
  96. { "sdhi1", NULL, "ee140000.sd" },
  97. { "sdhi2", NULL, "ee160000.sd" },
  98. { "thermal", NULL, "e61f0000.thermal" },
  99. };
  100. static void __init koelsch_add_standard_devices(void)
  101. {
  102. shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
  103. shmobile_clk_workaround(clk_enables, ARRAY_SIZE(clk_enables), true);
  104. r8a7791_add_dt_devices();
  105. of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  106. koelsch_add_du_device();
  107. }
  108. static const char * const koelsch_boards_compat_dt[] __initconst = {
  109. "renesas,koelsch",
  110. "renesas,koelsch-reference",
  111. NULL,
  112. };
  113. DT_MACHINE_START(KOELSCH_DT, "koelsch")
  114. .smp = smp_ops(r8a7791_smp_ops),
  115. .init_early = shmobile_init_delay,
  116. .init_time = rcar_gen2_timer_init,
  117. .init_machine = koelsch_add_standard_devices,
  118. .init_late = shmobile_init_late,
  119. .dt_compat = koelsch_boards_compat_dt,
  120. MACHINE_END