board-dt.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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 <plat/irq.h>
  24. #include <plat/common.h>
  25. #include "common.h"
  26. static struct of_device_id kirkwood_dt_match_table[] __initdata = {
  27. { .compatible = "simple-bus", },
  28. { }
  29. };
  30. /*
  31. * There are still devices that doesn't know about DT yet. Get clock
  32. * gates here and add a clock lookup alias, so that old platform
  33. * devices still work.
  34. */
  35. static void __init kirkwood_legacy_clk_init(void)
  36. {
  37. struct device_node *np = of_find_compatible_node(
  38. NULL, NULL, "marvell,kirkwood-gating-clock");
  39. struct of_phandle_args clkspec;
  40. clkspec.np = np;
  41. clkspec.args_count = 1;
  42. clkspec.args[0] = CGC_BIT_GE0;
  43. orion_clkdev_add(NULL, "mv643xx_eth_port.0",
  44. of_clk_get_from_provider(&clkspec));
  45. clkspec.args[0] = CGC_BIT_PEX0;
  46. orion_clkdev_add("0", "pcie",
  47. of_clk_get_from_provider(&clkspec));
  48. clkspec.args[0] = CGC_BIT_PEX1;
  49. orion_clkdev_add("1", "pcie",
  50. of_clk_get_from_provider(&clkspec));
  51. clkspec.args[0] = CGC_BIT_GE1;
  52. orion_clkdev_add(NULL, "mv643xx_eth_port.1",
  53. of_clk_get_from_provider(&clkspec));
  54. clkspec.args[0] = CGC_BIT_SDIO;
  55. orion_clkdev_add(NULL, "mvsdio",
  56. of_clk_get_from_provider(&clkspec));
  57. }
  58. static void __init kirkwood_of_clk_init(void)
  59. {
  60. mvebu_clocks_init();
  61. kirkwood_legacy_clk_init();
  62. }
  63. static void __init kirkwood_dt_init(void)
  64. {
  65. pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
  66. /*
  67. * Disable propagation of mbus errors to the CPU local bus,
  68. * as this causes mbus errors (which can occur for example
  69. * for PCI aborts) to throw CPU aborts, which we're not set
  70. * up to deal with.
  71. */
  72. writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
  73. kirkwood_setup_cpu_mbus();
  74. kirkwood_l2_init();
  75. /* Setup root of clk tree */
  76. kirkwood_of_clk_init();
  77. kirkwood_cpuidle_init();
  78. #ifdef CONFIG_KEXEC
  79. kexec_reinit = kirkwood_enable_pcie;
  80. #endif
  81. if (of_machine_is_compatible("globalscale,dreamplug"))
  82. dreamplug_init();
  83. if (of_machine_is_compatible("dlink,dns-kirkwood"))
  84. dnskw_init();
  85. if (of_machine_is_compatible("iom,iconnect"))
  86. iconnect_init();
  87. if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
  88. ib62x0_init();
  89. if (of_machine_is_compatible("qnap,ts219"))
  90. qnap_dt_ts219_init();
  91. if (of_machine_is_compatible("seagate,dockstar"))
  92. dockstar_dt_init();
  93. if (of_machine_is_compatible("seagate,goflexnet"))
  94. goflexnet_init();
  95. if (of_machine_is_compatible("buffalo,lsxl"))
  96. lsxl_init();
  97. if (of_machine_is_compatible("iom,ix2-200"))
  98. iomega_ix2_200_init();
  99. if (of_machine_is_compatible("keymile,km_kirkwood"))
  100. km_kirkwood_init();
  101. if (of_machine_is_compatible("lacie,inetspace_v2") ||
  102. of_machine_is_compatible("lacie,netspace_v2") ||
  103. of_machine_is_compatible("lacie,netspace_max_v2") ||
  104. of_machine_is_compatible("lacie,netspace_lite_v2") ||
  105. of_machine_is_compatible("lacie,netspace_mini_v2"))
  106. ns2_init();
  107. if (of_machine_is_compatible("mpl,cec4"))
  108. mplcec4_init();
  109. if (of_machine_is_compatible("plathome,openblocks-a6"))
  110. openblocks_a6_init();
  111. if (of_machine_is_compatible("usi,topkick"))
  112. usi_topkick_init();
  113. if (of_machine_is_compatible("zyxel,nsa310"))
  114. nsa310_init();
  115. of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
  116. }
  117. static const char * const kirkwood_dt_board_compat[] = {
  118. "globalscale,dreamplug",
  119. "dlink,dns-320",
  120. "dlink,dns-325",
  121. "iom,iconnect",
  122. "raidsonic,ib-nas62x0",
  123. "qnap,ts219",
  124. "seagate,dockstar",
  125. "seagate,goflexnet",
  126. "buffalo,lsxl",
  127. "iom,ix2-200",
  128. "keymile,km_kirkwood",
  129. "lacie,inetspace_v2",
  130. "lacie,netspace_max_v2",
  131. "lacie,netspace_v2",
  132. "lacie,netspace_lite_v2",
  133. "lacie,netspace_mini_v2",
  134. "mpl,cec4",
  135. "plathome,openblocks-a6",
  136. "usi,topkick",
  137. "zyxel,nsa310",
  138. NULL
  139. };
  140. DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
  141. /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
  142. .map_io = kirkwood_map_io,
  143. .init_early = kirkwood_init_early,
  144. .init_irq = orion_dt_init_irq,
  145. .init_time = kirkwood_timer_init,
  146. .init_machine = kirkwood_dt_init,
  147. .restart = kirkwood_restart,
  148. .dt_compat = kirkwood_dt_board_compat,
  149. MACHINE_END