board-lager-reference.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * Lager board support - Reference DT implementation
  3. *
  4. * Copyright (C) 2013 Renesas Solutions Corp.
  5. * Copyright (C) 2013 Simon Horman
  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/dma-mapping.h>
  21. #include <linux/init.h>
  22. #include <linux/of_platform.h>
  23. #include <linux/platform_data/rcar-du.h>
  24. #include <asm/mach/arch.h>
  25. #include "clock.h"
  26. #include "common.h"
  27. #include "irqs.h"
  28. #include "r8a7790.h"
  29. #include "rcar-gen2.h"
  30. /* DU */
  31. static struct rcar_du_encoder_data lager_du_encoders[] = {
  32. {
  33. .type = RCAR_DU_ENCODER_VGA,
  34. .output = RCAR_DU_OUTPUT_DPAD0,
  35. }, {
  36. .type = RCAR_DU_ENCODER_NONE,
  37. .output = RCAR_DU_OUTPUT_LVDS1,
  38. .connector.lvds.panel = {
  39. .width_mm = 210,
  40. .height_mm = 158,
  41. .mode = {
  42. .clock = 65000,
  43. .hdisplay = 1024,
  44. .hsync_start = 1048,
  45. .hsync_end = 1184,
  46. .htotal = 1344,
  47. .vdisplay = 768,
  48. .vsync_start = 771,
  49. .vsync_end = 777,
  50. .vtotal = 806,
  51. .flags = 0,
  52. },
  53. },
  54. },
  55. };
  56. static struct rcar_du_platform_data lager_du_pdata = {
  57. .encoders = lager_du_encoders,
  58. .num_encoders = ARRAY_SIZE(lager_du_encoders),
  59. };
  60. static const struct resource du_resources[] __initconst = {
  61. DEFINE_RES_MEM(0xfeb00000, 0x70000),
  62. DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
  63. DEFINE_RES_MEM_NAMED(0xfeb94000, 0x1c, "lvds.1"),
  64. DEFINE_RES_IRQ(gic_spi(256)),
  65. DEFINE_RES_IRQ(gic_spi(268)),
  66. DEFINE_RES_IRQ(gic_spi(269)),
  67. };
  68. static void __init lager_add_du_device(void)
  69. {
  70. struct platform_device_info info = {
  71. .name = "rcar-du-r8a7790",
  72. .id = -1,
  73. .res = du_resources,
  74. .num_res = ARRAY_SIZE(du_resources),
  75. .data = &lager_du_pdata,
  76. .size_data = sizeof(lager_du_pdata),
  77. .dma_mask = DMA_BIT_MASK(32),
  78. };
  79. platform_device_register_full(&info);
  80. }
  81. /*
  82. * This is a really crude hack to provide clkdev support to platform
  83. * devices until they get moved to DT.
  84. */
  85. static const struct clk_name clk_names[] __initconst = {
  86. { "cmt0", "fck", "sh-cmt-48-gen2.0" },
  87. { "du0", "du.0", "rcar-du-r8a7790" },
  88. { "du1", "du.1", "rcar-du-r8a7790" },
  89. { "du2", "du.2", "rcar-du-r8a7790" },
  90. { "lvds0", "lvds.0", "rcar-du-r8a7790" },
  91. { "lvds1", "lvds.1", "rcar-du-r8a7790" },
  92. };
  93. static void __init lager_add_standard_devices(void)
  94. {
  95. shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
  96. r8a7790_add_dt_devices();
  97. of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  98. lager_add_du_device();
  99. }
  100. static const char *lager_boards_compat_dt[] __initdata = {
  101. "renesas,lager",
  102. "renesas,lager-reference",
  103. NULL,
  104. };
  105. DT_MACHINE_START(LAGER_DT, "lager")
  106. .smp = smp_ops(r8a7790_smp_ops),
  107. .init_early = shmobile_init_delay,
  108. .init_time = rcar_gen2_timer_init,
  109. .init_machine = lager_add_standard_devices,
  110. .init_late = shmobile_init_late,
  111. .reserve = rcar_gen2_reserve,
  112. .dt_compat = lager_boards_compat_dt,
  113. MACHINE_END