board-dt.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*
  2. * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
  3. *
  4. * arch/arm/mach-kirkwood/board-dt.c
  5. *
  6. * Flattened Device Tree board initialization
  7. *
  8. * This file is licensed under the terms of the GNU General Public
  9. * License version 2. This program is licensed "as is" without any
  10. * warranty of any kind, whether express or implied.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/of.h>
  15. #include <linux/of_platform.h>
  16. #include <linux/clk-provider.h>
  17. #include <linux/clk/mvebu.h>
  18. #include <linux/kexec.h>
  19. #include <asm/mach/arch.h>
  20. #include <asm/mach/map.h>
  21. #include <mach/bridge-regs.h>
  22. #include <linux/platform_data/usb-ehci-orion.h>
  23. #include <linux/platform_data/dma-mv_xor.h>
  24. #include <plat/irq.h>
  25. #include <plat/common.h>
  26. #include "common.h"
  27. static struct of_device_id kirkwood_dt_match_table[] __initdata = {
  28. { .compatible = "simple-bus", },
  29. { }
  30. };
  31. /*
  32. * There are still devices that doesn't know about DT yet. Get clock
  33. * gates here and add a clock lookup alias, so that old platform
  34. * devices still work.
  35. */
  36. static void __init kirkwood_legacy_clk_init(void)
  37. {
  38. struct device_node *np = of_find_compatible_node(
  39. NULL, NULL, "marvell,kirkwood-gating-clock");
  40. struct of_phandle_args clkspec;
  41. clkspec.np = np;
  42. clkspec.args_count = 1;
  43. clkspec.args[0] = CGC_BIT_GE0;
  44. orion_clkdev_add(NULL, "mv643xx_eth_port.0",
  45. of_clk_get_from_provider(&clkspec));
  46. clkspec.args[0] = CGC_BIT_PEX0;
  47. orion_clkdev_add("0", "pcie",
  48. of_clk_get_from_provider(&clkspec));
  49. clkspec.args[0] = CGC_BIT_USB0;
  50. orion_clkdev_add(NULL, "orion-ehci.0",
  51. of_clk_get_from_provider(&clkspec));
  52. clkspec.args[0] = CGC_BIT_XOR0;
  53. orion_clkdev_add(NULL, MV_XOR_NAME ".0",
  54. of_clk_get_from_provider(&clkspec));
  55. clkspec.args[0] = CGC_BIT_XOR1;
  56. orion_clkdev_add(NULL, MV_XOR_NAME ".1",
  57. of_clk_get_from_provider(&clkspec));
  58. clkspec.args[0] = CGC_BIT_PEX1;
  59. orion_clkdev_add("1", "pcie",
  60. of_clk_get_from_provider(&clkspec));
  61. clkspec.args[0] = CGC_BIT_GE1;
  62. orion_clkdev_add(NULL, "mv643xx_eth_port.1",
  63. of_clk_get_from_provider(&clkspec));
  64. }
  65. static void __init kirkwood_of_clk_init(void)
  66. {
  67. mvebu_clocks_init();
  68. kirkwood_legacy_clk_init();
  69. }
  70. static void __init kirkwood_dt_init(void)
  71. {
  72. pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
  73. /*
  74. * Disable propagation of mbus errors to the CPU local bus,
  75. * as this causes mbus errors (which can occur for example
  76. * for PCI aborts) to throw CPU aborts, which we're not set
  77. * up to deal with.
  78. */
  79. writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
  80. kirkwood_setup_cpu_mbus();
  81. kirkwood_l2_init();
  82. /* Setup root of clk tree */
  83. kirkwood_of_clk_init();
  84. /* internal devices that every board has */
  85. kirkwood_xor0_init();
  86. kirkwood_xor1_init();
  87. #ifdef CONFIG_KEXEC
  88. kexec_reinit = kirkwood_enable_pcie;
  89. #endif
  90. if (of_machine_is_compatible("globalscale,dreamplug"))
  91. dreamplug_init();
  92. if (of_machine_is_compatible("dlink,dns-kirkwood"))
  93. dnskw_init();
  94. if (of_machine_is_compatible("iom,iconnect"))
  95. iconnect_init();
  96. if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
  97. ib62x0_init();
  98. if (of_machine_is_compatible("qnap,ts219"))
  99. qnap_dt_ts219_init();
  100. if (of_machine_is_compatible("seagate,dockstar"))
  101. dockstar_dt_init();
  102. if (of_machine_is_compatible("seagate,goflexnet"))
  103. goflexnet_init();
  104. if (of_machine_is_compatible("buffalo,lsxl"))
  105. lsxl_init();
  106. if (of_machine_is_compatible("iom,ix2-200"))
  107. iomega_ix2_200_init();
  108. if (of_machine_is_compatible("keymile,km_kirkwood"))
  109. km_kirkwood_init();
  110. of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
  111. }
  112. static const char *kirkwood_dt_board_compat[] = {
  113. "globalscale,dreamplug",
  114. "dlink,dns-320",
  115. "dlink,dns-325",
  116. "iom,iconnect",
  117. "raidsonic,ib-nas62x0",
  118. "qnap,ts219",
  119. "seagate,dockstar",
  120. "seagate,goflexnet",
  121. "buffalo,lsxl",
  122. "iom,ix2-200",
  123. "keymile,km_kirkwood",
  124. NULL
  125. };
  126. DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
  127. /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
  128. .map_io = kirkwood_map_io,
  129. .init_early = kirkwood_init_early,
  130. .init_irq = orion_dt_init_irq,
  131. .timer = &kirkwood_timer,
  132. .init_machine = kirkwood_dt_init,
  133. .restart = kirkwood_restart,
  134. .dt_compat = kirkwood_dt_board_compat,
  135. MACHINE_END