board-dt.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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/kexec.h>
  18. #include <asm/mach/arch.h>
  19. #include <asm/mach/map.h>
  20. #include <mach/bridge-regs.h>
  21. #include <linux/platform_data/usb-ehci-orion.h>
  22. #include <plat/irq.h>
  23. #include <plat/common.h>
  24. #include "common.h"
  25. /*
  26. * There are still devices that doesn't know about DT yet. Get clock
  27. * gates here and add a clock lookup alias, so that old platform
  28. * devices still work.
  29. */
  30. static void __init kirkwood_legacy_clk_init(void)
  31. {
  32. struct device_node *np = of_find_compatible_node(
  33. NULL, NULL, "marvell,kirkwood-gating-clock");
  34. struct of_phandle_args clkspec;
  35. struct clk *clk;
  36. clkspec.np = np;
  37. clkspec.args_count = 1;
  38. clkspec.args[0] = CGC_BIT_PEX0;
  39. orion_clkdev_add("0", "pcie",
  40. of_clk_get_from_provider(&clkspec));
  41. clkspec.args[0] = CGC_BIT_PEX1;
  42. orion_clkdev_add("1", "pcie",
  43. of_clk_get_from_provider(&clkspec));
  44. clkspec.args[0] = CGC_BIT_SDIO;
  45. orion_clkdev_add(NULL, "mvsdio",
  46. of_clk_get_from_provider(&clkspec));
  47. /*
  48. * The ethernet interfaces forget the MAC address assigned by
  49. * u-boot if the clocks are turned off. Until proper DT support
  50. * is available we always enable them for now.
  51. */
  52. clkspec.args[0] = CGC_BIT_GE0;
  53. clk = of_clk_get_from_provider(&clkspec);
  54. orion_clkdev_add(NULL, "mv643xx_eth_port.0", clk);
  55. clk_prepare_enable(clk);
  56. clkspec.args[0] = CGC_BIT_GE1;
  57. clk = of_clk_get_from_provider(&clkspec);
  58. orion_clkdev_add(NULL, "mv643xx_eth_port.1", clk);
  59. clk_prepare_enable(clk);
  60. }
  61. static void __init kirkwood_of_clk_init(void)
  62. {
  63. of_clk_init(NULL);
  64. kirkwood_legacy_clk_init();
  65. }
  66. static void __init kirkwood_dt_init(void)
  67. {
  68. pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
  69. /*
  70. * Disable propagation of mbus errors to the CPU local bus,
  71. * as this causes mbus errors (which can occur for example
  72. * for PCI aborts) to throw CPU aborts, which we're not set
  73. * up to deal with.
  74. */
  75. writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
  76. BUG_ON(mvebu_mbus_dt_init());
  77. kirkwood_setup_wins();
  78. kirkwood_l2_init();
  79. kirkwood_cpufreq_init();
  80. /* Setup root of clk tree */
  81. kirkwood_of_clk_init();
  82. kirkwood_cpuidle_init();
  83. #ifdef CONFIG_KEXEC
  84. kexec_reinit = kirkwood_enable_pcie;
  85. #endif
  86. if (of_machine_is_compatible("globalscale,dreamplug"))
  87. dreamplug_init();
  88. if (of_machine_is_compatible("globalscale,guruplug"))
  89. guruplug_dt_init();
  90. if (of_machine_is_compatible("globalscale,sheevaplug"))
  91. sheevaplug_dt_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. if (of_machine_is_compatible("lacie,cloudbox") ||
  111. of_machine_is_compatible("lacie,inetspace_v2") ||
  112. of_machine_is_compatible("lacie,netspace_lite_v2") ||
  113. of_machine_is_compatible("lacie,netspace_max_v2") ||
  114. of_machine_is_compatible("lacie,netspace_mini_v2") ||
  115. of_machine_is_compatible("lacie,netspace_v2"))
  116. ns2_init();
  117. if (of_machine_is_compatible("marvell,db-88f6281-bp") ||
  118. of_machine_is_compatible("marvell,db-88f6282-bp"))
  119. db88f628x_init();
  120. if (of_machine_is_compatible("mpl,cec4"))
  121. mplcec4_init();
  122. if (of_machine_is_compatible("netgear,readynas-duo-v2"))
  123. netgear_readynas_init();
  124. if (of_machine_is_compatible("plathome,openblocks-a6"))
  125. openblocks_a6_init();
  126. if (of_machine_is_compatible("usi,topkick"))
  127. usi_topkick_init();
  128. of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  129. }
  130. static const char * const kirkwood_dt_board_compat[] = {
  131. "globalscale,dreamplug",
  132. "globalscale,guruplug",
  133. "globalscale,sheevaplug",
  134. "dlink,dns-320",
  135. "dlink,dns-325",
  136. "iom,iconnect",
  137. "raidsonic,ib-nas62x0",
  138. "qnap,ts219",
  139. "seagate,dockstar",
  140. "seagate,goflexnet",
  141. "buffalo,lsxl",
  142. "iom,ix2-200",
  143. "keymile,km_kirkwood",
  144. "lacie,cloudbox",
  145. "lacie,inetspace_v2",
  146. "lacie,netspace_lite_v2",
  147. "lacie,netspace_max_v2",
  148. "lacie,netspace_mini_v2",
  149. "lacie,netspace_v2",
  150. "marvell,db-88f6281-bp",
  151. "marvell,db-88f6282-bp",
  152. "mpl,cec4",
  153. "netgear,readynas-duo-v2",
  154. "plathome,openblocks-a6",
  155. "usi,topkick",
  156. "zyxel,nsa310",
  157. NULL
  158. };
  159. DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
  160. /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
  161. .map_io = kirkwood_map_io,
  162. .init_early = kirkwood_init_early,
  163. .init_irq = orion_dt_init_irq,
  164. .init_time = kirkwood_timer_init,
  165. .init_machine = kirkwood_dt_init,
  166. .restart = kirkwood_restart,
  167. .dt_compat = kirkwood_dt_board_compat,
  168. MACHINE_END