board-lager-reference.c 2.2 KB

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