board-lager-reference.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. .pixelclock = 65000000,
  43. .hactive = 1024,
  44. .hfront_porch = 20,
  45. .hback_porch = 160,
  46. .hsync_len = 136,
  47. .vactive = 768,
  48. .vfront_porch = 3,
  49. .vback_porch = 29,
  50. .vsync_len = 6,
  51. },
  52. },
  53. },
  54. };
  55. static struct rcar_du_platform_data lager_du_pdata = {
  56. .encoders = lager_du_encoders,
  57. .num_encoders = ARRAY_SIZE(lager_du_encoders),
  58. };
  59. static const struct resource du_resources[] __initconst = {
  60. DEFINE_RES_MEM(0xfeb00000, 0x70000),
  61. DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
  62. DEFINE_RES_MEM_NAMED(0xfeb94000, 0x1c, "lvds.1"),
  63. DEFINE_RES_IRQ(gic_spi(256)),
  64. DEFINE_RES_IRQ(gic_spi(268)),
  65. DEFINE_RES_IRQ(gic_spi(269)),
  66. };
  67. static void __init lager_add_du_device(void)
  68. {
  69. struct platform_device_info info = {
  70. .name = "rcar-du-r8a7790",
  71. .id = -1,
  72. .res = du_resources,
  73. .num_res = ARRAY_SIZE(du_resources),
  74. .data = &lager_du_pdata,
  75. .size_data = sizeof(lager_du_pdata),
  76. .dma_mask = DMA_BIT_MASK(32),
  77. };
  78. platform_device_register_full(&info);
  79. }
  80. /*
  81. * This is a really crude hack to provide clkdev support to platform
  82. * devices until they get moved to DT.
  83. */
  84. static const struct clk_name clk_names[] __initconst = {
  85. { "du0", "du.0", "rcar-du-r8a7790" },
  86. { "du1", "du.1", "rcar-du-r8a7790" },
  87. { "du2", "du.2", "rcar-du-r8a7790" },
  88. { "lvds0", "lvds.0", "rcar-du-r8a7790" },
  89. { "lvds1", "lvds.1", "rcar-du-r8a7790" },
  90. };
  91. static void __init lager_add_standard_devices(void)
  92. {
  93. shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
  94. of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  95. lager_add_du_device();
  96. }
  97. static const char *lager_boards_compat_dt[] __initdata = {
  98. "renesas,lager",
  99. "renesas,lager-reference",
  100. NULL,
  101. };
  102. DT_MACHINE_START(LAGER_DT, "lager")
  103. .smp = smp_ops(r8a7790_smp_ops),
  104. .init_early = shmobile_init_delay,
  105. .init_time = rcar_gen2_timer_init,
  106. .init_machine = lager_add_standard_devices,
  107. .init_late = shmobile_init_late,
  108. .reserve = rcar_gen2_reserve,
  109. .dt_compat = lager_boards_compat_dt,
  110. MACHINE_END