board-koelsch-reference.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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/clk.h>
  22. #include <linux/clkdev.h>
  23. #include <linux/kernel.h>
  24. #include <linux/of_platform.h>
  25. #include <mach/common.h>
  26. #include <mach/rcar-gen2.h>
  27. #include <mach/r8a7791.h>
  28. #include <asm/mach/arch.h>
  29. static void __init koelsch_add_standard_devices(void)
  30. {
  31. #ifdef CONFIG_COMMON_CLK
  32. /*
  33. * This is a really crude hack to provide clkdev support to the SCIF
  34. * and CMT devices until they get moved to DT.
  35. */
  36. static const char * const scif_names[] = {
  37. "scifa0", "scifa1", "scifb0", "scifb1", "scifb2", "scifa2",
  38. "scif0", "scif1", "scif2", "scif3", "scif4", "scif5", "scifa3",
  39. "scifa4", "scifa5",
  40. };
  41. struct clk *clk;
  42. unsigned int i;
  43. for (i = 0; i < ARRAY_SIZE(scif_names); ++i) {
  44. clk = clk_get(NULL, scif_names[i]);
  45. if (clk) {
  46. clk_register_clkdev(clk, NULL, "sh-sci.%u", i);
  47. clk_put(clk);
  48. }
  49. }
  50. clk = clk_get(NULL, "cmt0");
  51. if (clk) {
  52. clk_register_clkdev(clk, NULL, "sh_cmt.0");
  53. clk_put(clk);
  54. }
  55. #else
  56. r8a7791_clock_init();
  57. #endif
  58. r8a7791_add_dt_devices();
  59. of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  60. }
  61. static const char * const koelsch_boards_compat_dt[] __initconst = {
  62. "renesas,koelsch",
  63. "renesas,koelsch-reference",
  64. NULL,
  65. };
  66. DT_MACHINE_START(KOELSCH_DT, "koelsch")
  67. .smp = smp_ops(r8a7791_smp_ops),
  68. .init_early = r8a7791_init_early,
  69. .init_time = rcar_gen2_timer_init,
  70. .init_machine = koelsch_add_standard_devices,
  71. .init_late = shmobile_init_late,
  72. .dt_compat = koelsch_boards_compat_dt,
  73. MACHINE_END