clk-exynos7.c 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320
  1. /*
  2. * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  3. * Author: Naveen Krishna Ch <naveenkrishna.ch@gmail.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. */
  10. #include <linux/clk-provider.h>
  11. #include <linux/of.h>
  12. #include "clk.h"
  13. #include <dt-bindings/clock/exynos7-clk.h>
  14. /* Register Offset definitions for CMU_TOPC (0x10570000) */
  15. #define CC_PLL_LOCK 0x0000
  16. #define BUS0_PLL_LOCK 0x0004
  17. #define BUS1_DPLL_LOCK 0x0008
  18. #define MFC_PLL_LOCK 0x000C
  19. #define AUD_PLL_LOCK 0x0010
  20. #define CC_PLL_CON0 0x0100
  21. #define BUS0_PLL_CON0 0x0110
  22. #define BUS1_DPLL_CON0 0x0120
  23. #define MFC_PLL_CON0 0x0130
  24. #define AUD_PLL_CON0 0x0140
  25. #define MUX_SEL_TOPC0 0x0200
  26. #define MUX_SEL_TOPC1 0x0204
  27. #define MUX_SEL_TOPC2 0x0208
  28. #define MUX_SEL_TOPC3 0x020C
  29. #define DIV_TOPC0 0x0600
  30. #define DIV_TOPC1 0x0604
  31. #define DIV_TOPC3 0x060C
  32. #define ENABLE_ACLK_TOPC0 0x0800
  33. #define ENABLE_ACLK_TOPC1 0x0804
  34. #define ENABLE_SCLK_TOPC1 0x0A04
  35. static const struct samsung_fixed_factor_clock topc_fixed_factor_clks[] __initconst = {
  36. FFACTOR(0, "ffac_topc_bus0_pll_div2", "mout_topc_bus0_pll", 1, 2, 0),
  37. FFACTOR(0, "ffac_topc_bus0_pll_div4",
  38. "ffac_topc_bus0_pll_div2", 1, 2, 0),
  39. FFACTOR(0, "ffac_topc_bus1_pll_div2", "mout_topc_bus1_pll", 1, 2, 0),
  40. FFACTOR(0, "ffac_topc_cc_pll_div2", "mout_topc_cc_pll", 1, 2, 0),
  41. FFACTOR(0, "ffac_topc_mfc_pll_div2", "mout_topc_mfc_pll", 1, 2, 0),
  42. };
  43. /* List of parent clocks for Muxes in CMU_TOPC */
  44. PNAME(mout_topc_aud_pll_ctrl_p) = { "fin_pll", "fout_aud_pll" };
  45. PNAME(mout_topc_bus0_pll_ctrl_p) = { "fin_pll", "fout_bus0_pll" };
  46. PNAME(mout_topc_bus1_pll_ctrl_p) = { "fin_pll", "fout_bus1_pll" };
  47. PNAME(mout_topc_cc_pll_ctrl_p) = { "fin_pll", "fout_cc_pll" };
  48. PNAME(mout_topc_mfc_pll_ctrl_p) = { "fin_pll", "fout_mfc_pll" };
  49. PNAME(mout_topc_group2) = { "mout_topc_bus0_pll_half",
  50. "mout_topc_bus1_pll_half", "mout_topc_cc_pll_half",
  51. "mout_topc_mfc_pll_half" };
  52. PNAME(mout_topc_bus0_pll_half_p) = { "mout_topc_bus0_pll",
  53. "ffac_topc_bus0_pll_div2", "ffac_topc_bus0_pll_div4"};
  54. PNAME(mout_topc_bus1_pll_half_p) = { "mout_topc_bus1_pll",
  55. "ffac_topc_bus1_pll_div2"};
  56. PNAME(mout_topc_cc_pll_half_p) = { "mout_topc_cc_pll",
  57. "ffac_topc_cc_pll_div2"};
  58. PNAME(mout_topc_mfc_pll_half_p) = { "mout_topc_mfc_pll",
  59. "ffac_topc_mfc_pll_div2"};
  60. PNAME(mout_topc_bus0_pll_out_p) = {"mout_topc_bus0_pll",
  61. "ffac_topc_bus0_pll_div2"};
  62. static const unsigned long topc_clk_regs[] __initconst = {
  63. CC_PLL_LOCK,
  64. BUS0_PLL_LOCK,
  65. BUS1_DPLL_LOCK,
  66. MFC_PLL_LOCK,
  67. AUD_PLL_LOCK,
  68. CC_PLL_CON0,
  69. BUS0_PLL_CON0,
  70. BUS1_DPLL_CON0,
  71. MFC_PLL_CON0,
  72. AUD_PLL_CON0,
  73. MUX_SEL_TOPC0,
  74. MUX_SEL_TOPC1,
  75. MUX_SEL_TOPC2,
  76. MUX_SEL_TOPC3,
  77. DIV_TOPC0,
  78. DIV_TOPC1,
  79. DIV_TOPC3,
  80. };
  81. static const struct samsung_mux_clock topc_mux_clks[] __initconst = {
  82. MUX(0, "mout_topc_bus0_pll", mout_topc_bus0_pll_ctrl_p,
  83. MUX_SEL_TOPC0, 0, 1),
  84. MUX(0, "mout_topc_bus1_pll", mout_topc_bus1_pll_ctrl_p,
  85. MUX_SEL_TOPC0, 4, 1),
  86. MUX(0, "mout_topc_cc_pll", mout_topc_cc_pll_ctrl_p,
  87. MUX_SEL_TOPC0, 8, 1),
  88. MUX(0, "mout_topc_mfc_pll", mout_topc_mfc_pll_ctrl_p,
  89. MUX_SEL_TOPC0, 12, 1),
  90. MUX(0, "mout_topc_bus0_pll_half", mout_topc_bus0_pll_half_p,
  91. MUX_SEL_TOPC0, 16, 2),
  92. MUX(0, "mout_topc_bus1_pll_half", mout_topc_bus1_pll_half_p,
  93. MUX_SEL_TOPC0, 20, 1),
  94. MUX(0, "mout_topc_cc_pll_half", mout_topc_cc_pll_half_p,
  95. MUX_SEL_TOPC0, 24, 1),
  96. MUX(0, "mout_topc_mfc_pll_half", mout_topc_mfc_pll_half_p,
  97. MUX_SEL_TOPC0, 28, 1),
  98. MUX(0, "mout_topc_aud_pll", mout_topc_aud_pll_ctrl_p,
  99. MUX_SEL_TOPC1, 0, 1),
  100. MUX(0, "mout_topc_bus0_pll_out", mout_topc_bus0_pll_out_p,
  101. MUX_SEL_TOPC1, 16, 1),
  102. MUX(0, "mout_aclk_ccore_133", mout_topc_group2, MUX_SEL_TOPC2, 4, 2),
  103. MUX(0, "mout_aclk_mscl_532", mout_topc_group2, MUX_SEL_TOPC3, 20, 2),
  104. MUX(0, "mout_aclk_peris_66", mout_topc_group2, MUX_SEL_TOPC3, 24, 2),
  105. };
  106. static const struct samsung_div_clock topc_div_clks[] __initconst = {
  107. DIV(DOUT_ACLK_CCORE_133, "dout_aclk_ccore_133", "mout_aclk_ccore_133",
  108. DIV_TOPC0, 4, 4),
  109. DIV(DOUT_ACLK_MSCL_532, "dout_aclk_mscl_532", "mout_aclk_mscl_532",
  110. DIV_TOPC1, 20, 4),
  111. DIV(DOUT_ACLK_PERIS, "dout_aclk_peris_66", "mout_aclk_peris_66",
  112. DIV_TOPC1, 24, 4),
  113. DIV(DOUT_SCLK_BUS0_PLL, "dout_sclk_bus0_pll", "mout_topc_bus0_pll_out",
  114. DIV_TOPC3, 0, 4),
  115. DIV(DOUT_SCLK_BUS1_PLL, "dout_sclk_bus1_pll", "mout_topc_bus1_pll",
  116. DIV_TOPC3, 8, 4),
  117. DIV(DOUT_SCLK_CC_PLL, "dout_sclk_cc_pll", "mout_topc_cc_pll",
  118. DIV_TOPC3, 12, 4),
  119. DIV(DOUT_SCLK_MFC_PLL, "dout_sclk_mfc_pll", "mout_topc_mfc_pll",
  120. DIV_TOPC3, 16, 4),
  121. DIV(DOUT_SCLK_AUD_PLL, "dout_sclk_aud_pll", "mout_topc_aud_pll",
  122. DIV_TOPC3, 28, 4),
  123. };
  124. static const struct samsung_pll_rate_table pll1460x_24mhz_tbl[] __initconst = {
  125. PLL_36XX_RATE(24 * MHZ, 491519897, 20, 1, 0, 31457),
  126. {},
  127. };
  128. static const struct samsung_gate_clock topc_gate_clks[] __initconst = {
  129. GATE(ACLK_CCORE_133, "aclk_ccore_133", "dout_aclk_ccore_133",
  130. ENABLE_ACLK_TOPC0, 4, CLK_IS_CRITICAL, 0),
  131. GATE(ACLK_MSCL_532, "aclk_mscl_532", "dout_aclk_mscl_532",
  132. ENABLE_ACLK_TOPC1, 20, 0, 0),
  133. GATE(ACLK_PERIS_66, "aclk_peris_66", "dout_aclk_peris_66",
  134. ENABLE_ACLK_TOPC1, 24, 0, 0),
  135. GATE(SCLK_AUD_PLL, "sclk_aud_pll", "dout_sclk_aud_pll",
  136. ENABLE_SCLK_TOPC1, 20, 0, 0),
  137. GATE(SCLK_MFC_PLL_B, "sclk_mfc_pll_b", "dout_sclk_mfc_pll",
  138. ENABLE_SCLK_TOPC1, 17, 0, 0),
  139. GATE(SCLK_MFC_PLL_A, "sclk_mfc_pll_a", "dout_sclk_mfc_pll",
  140. ENABLE_SCLK_TOPC1, 16, 0, 0),
  141. GATE(SCLK_BUS1_PLL_B, "sclk_bus1_pll_b", "dout_sclk_bus1_pll",
  142. ENABLE_SCLK_TOPC1, 13, 0, 0),
  143. GATE(SCLK_BUS1_PLL_A, "sclk_bus1_pll_a", "dout_sclk_bus1_pll",
  144. ENABLE_SCLK_TOPC1, 12, 0, 0),
  145. GATE(SCLK_BUS0_PLL_B, "sclk_bus0_pll_b", "dout_sclk_bus0_pll",
  146. ENABLE_SCLK_TOPC1, 5, 0, 0),
  147. GATE(SCLK_BUS0_PLL_A, "sclk_bus0_pll_a", "dout_sclk_bus0_pll",
  148. ENABLE_SCLK_TOPC1, 4, 0, 0),
  149. GATE(SCLK_CC_PLL_B, "sclk_cc_pll_b", "dout_sclk_cc_pll",
  150. ENABLE_SCLK_TOPC1, 1, 0, 0),
  151. GATE(SCLK_CC_PLL_A, "sclk_cc_pll_a", "dout_sclk_cc_pll",
  152. ENABLE_SCLK_TOPC1, 0, 0, 0),
  153. };
  154. static const struct samsung_pll_clock topc_pll_clks[] __initconst = {
  155. PLL(pll_1451x, 0, "fout_bus0_pll", "fin_pll", BUS0_PLL_LOCK,
  156. BUS0_PLL_CON0, NULL),
  157. PLL(pll_1452x, 0, "fout_cc_pll", "fin_pll", CC_PLL_LOCK,
  158. CC_PLL_CON0, NULL),
  159. PLL(pll_1452x, 0, "fout_bus1_pll", "fin_pll", BUS1_DPLL_LOCK,
  160. BUS1_DPLL_CON0, NULL),
  161. PLL(pll_1452x, 0, "fout_mfc_pll", "fin_pll", MFC_PLL_LOCK,
  162. MFC_PLL_CON0, NULL),
  163. PLL(pll_1460x, FOUT_AUD_PLL, "fout_aud_pll", "fin_pll", AUD_PLL_LOCK,
  164. AUD_PLL_CON0, pll1460x_24mhz_tbl),
  165. };
  166. static const struct samsung_cmu_info topc_cmu_info __initconst = {
  167. .pll_clks = topc_pll_clks,
  168. .nr_pll_clks = ARRAY_SIZE(topc_pll_clks),
  169. .mux_clks = topc_mux_clks,
  170. .nr_mux_clks = ARRAY_SIZE(topc_mux_clks),
  171. .div_clks = topc_div_clks,
  172. .nr_div_clks = ARRAY_SIZE(topc_div_clks),
  173. .gate_clks = topc_gate_clks,
  174. .nr_gate_clks = ARRAY_SIZE(topc_gate_clks),
  175. .fixed_factor_clks = topc_fixed_factor_clks,
  176. .nr_fixed_factor_clks = ARRAY_SIZE(topc_fixed_factor_clks),
  177. .nr_clk_ids = TOPC_NR_CLK,
  178. .clk_regs = topc_clk_regs,
  179. .nr_clk_regs = ARRAY_SIZE(topc_clk_regs),
  180. };
  181. static void __init exynos7_clk_topc_init(struct device_node *np)
  182. {
  183. samsung_cmu_register_one(np, &topc_cmu_info);
  184. }
  185. CLK_OF_DECLARE(exynos7_clk_topc, "samsung,exynos7-clock-topc",
  186. exynos7_clk_topc_init);
  187. /* Register Offset definitions for CMU_TOP0 (0x105D0000) */
  188. #define MUX_SEL_TOP00 0x0200
  189. #define MUX_SEL_TOP01 0x0204
  190. #define MUX_SEL_TOP03 0x020C
  191. #define MUX_SEL_TOP0_PERIC0 0x0230
  192. #define MUX_SEL_TOP0_PERIC1 0x0234
  193. #define MUX_SEL_TOP0_PERIC2 0x0238
  194. #define MUX_SEL_TOP0_PERIC3 0x023C
  195. #define DIV_TOP03 0x060C
  196. #define DIV_TOP0_PERIC0 0x0630
  197. #define DIV_TOP0_PERIC1 0x0634
  198. #define DIV_TOP0_PERIC2 0x0638
  199. #define DIV_TOP0_PERIC3 0x063C
  200. #define ENABLE_ACLK_TOP03 0x080C
  201. #define ENABLE_SCLK_TOP0_PERIC0 0x0A30
  202. #define ENABLE_SCLK_TOP0_PERIC1 0x0A34
  203. #define ENABLE_SCLK_TOP0_PERIC2 0x0A38
  204. #define ENABLE_SCLK_TOP0_PERIC3 0x0A3C
  205. /* List of parent clocks for Muxes in CMU_TOP0 */
  206. PNAME(mout_top0_bus0_pll_user_p) = { "fin_pll", "sclk_bus0_pll_a" };
  207. PNAME(mout_top0_bus1_pll_user_p) = { "fin_pll", "sclk_bus1_pll_a" };
  208. PNAME(mout_top0_cc_pll_user_p) = { "fin_pll", "sclk_cc_pll_a" };
  209. PNAME(mout_top0_mfc_pll_user_p) = { "fin_pll", "sclk_mfc_pll_a" };
  210. PNAME(mout_top0_aud_pll_user_p) = { "fin_pll", "sclk_aud_pll" };
  211. PNAME(mout_top0_bus0_pll_half_p) = {"mout_top0_bus0_pll_user",
  212. "ffac_top0_bus0_pll_div2"};
  213. PNAME(mout_top0_bus1_pll_half_p) = {"mout_top0_bus1_pll_user",
  214. "ffac_top0_bus1_pll_div2"};
  215. PNAME(mout_top0_cc_pll_half_p) = {"mout_top0_cc_pll_user",
  216. "ffac_top0_cc_pll_div2"};
  217. PNAME(mout_top0_mfc_pll_half_p) = {"mout_top0_mfc_pll_user",
  218. "ffac_top0_mfc_pll_div2"};
  219. PNAME(mout_top0_group1) = {"mout_top0_bus0_pll_half",
  220. "mout_top0_bus1_pll_half", "mout_top0_cc_pll_half",
  221. "mout_top0_mfc_pll_half"};
  222. PNAME(mout_top0_group3) = {"ioclk_audiocdclk0",
  223. "ioclk_audiocdclk1", "ioclk_spdif_extclk",
  224. "mout_top0_aud_pll_user", "mout_top0_bus0_pll_half",
  225. "mout_top0_bus1_pll_half"};
  226. PNAME(mout_top0_group4) = {"ioclk_audiocdclk1", "mout_top0_aud_pll_user",
  227. "mout_top0_bus0_pll_half", "mout_top0_bus1_pll_half"};
  228. static const unsigned long top0_clk_regs[] __initconst = {
  229. MUX_SEL_TOP00,
  230. MUX_SEL_TOP01,
  231. MUX_SEL_TOP03,
  232. MUX_SEL_TOP0_PERIC0,
  233. MUX_SEL_TOP0_PERIC1,
  234. MUX_SEL_TOP0_PERIC2,
  235. MUX_SEL_TOP0_PERIC3,
  236. DIV_TOP03,
  237. DIV_TOP0_PERIC0,
  238. DIV_TOP0_PERIC1,
  239. DIV_TOP0_PERIC2,
  240. DIV_TOP0_PERIC3,
  241. ENABLE_SCLK_TOP0_PERIC0,
  242. ENABLE_SCLK_TOP0_PERIC1,
  243. ENABLE_SCLK_TOP0_PERIC2,
  244. ENABLE_SCLK_TOP0_PERIC3,
  245. };
  246. static const struct samsung_mux_clock top0_mux_clks[] __initconst = {
  247. MUX(0, "mout_top0_aud_pll_user", mout_top0_aud_pll_user_p,
  248. MUX_SEL_TOP00, 0, 1),
  249. MUX(0, "mout_top0_mfc_pll_user", mout_top0_mfc_pll_user_p,
  250. MUX_SEL_TOP00, 4, 1),
  251. MUX(0, "mout_top0_cc_pll_user", mout_top0_cc_pll_user_p,
  252. MUX_SEL_TOP00, 8, 1),
  253. MUX(0, "mout_top0_bus1_pll_user", mout_top0_bus1_pll_user_p,
  254. MUX_SEL_TOP00, 12, 1),
  255. MUX(0, "mout_top0_bus0_pll_user", mout_top0_bus0_pll_user_p,
  256. MUX_SEL_TOP00, 16, 1),
  257. MUX(0, "mout_top0_mfc_pll_half", mout_top0_mfc_pll_half_p,
  258. MUX_SEL_TOP01, 4, 1),
  259. MUX(0, "mout_top0_cc_pll_half", mout_top0_cc_pll_half_p,
  260. MUX_SEL_TOP01, 8, 1),
  261. MUX(0, "mout_top0_bus1_pll_half", mout_top0_bus1_pll_half_p,
  262. MUX_SEL_TOP01, 12, 1),
  263. MUX(0, "mout_top0_bus0_pll_half", mout_top0_bus0_pll_half_p,
  264. MUX_SEL_TOP01, 16, 1),
  265. MUX(0, "mout_aclk_peric1_66", mout_top0_group1, MUX_SEL_TOP03, 12, 2),
  266. MUX(0, "mout_aclk_peric0_66", mout_top0_group1, MUX_SEL_TOP03, 20, 2),
  267. MUX(0, "mout_sclk_spdif", mout_top0_group3, MUX_SEL_TOP0_PERIC0, 4, 3),
  268. MUX(0, "mout_sclk_pcm1", mout_top0_group4, MUX_SEL_TOP0_PERIC0, 8, 2),
  269. MUX(0, "mout_sclk_i2s1", mout_top0_group4, MUX_SEL_TOP0_PERIC0, 20, 2),
  270. MUX(0, "mout_sclk_spi1", mout_top0_group1, MUX_SEL_TOP0_PERIC1, 8, 2),
  271. MUX(0, "mout_sclk_spi0", mout_top0_group1, MUX_SEL_TOP0_PERIC1, 20, 2),
  272. MUX(0, "mout_sclk_spi3", mout_top0_group1, MUX_SEL_TOP0_PERIC2, 8, 2),
  273. MUX(0, "mout_sclk_spi2", mout_top0_group1, MUX_SEL_TOP0_PERIC2, 20, 2),
  274. MUX(0, "mout_sclk_uart3", mout_top0_group1, MUX_SEL_TOP0_PERIC3, 4, 2),
  275. MUX(0, "mout_sclk_uart2", mout_top0_group1, MUX_SEL_TOP0_PERIC3, 8, 2),
  276. MUX(0, "mout_sclk_uart1", mout_top0_group1, MUX_SEL_TOP0_PERIC3, 12, 2),
  277. MUX(0, "mout_sclk_uart0", mout_top0_group1, MUX_SEL_TOP0_PERIC3, 16, 2),
  278. MUX(0, "mout_sclk_spi4", mout_top0_group1, MUX_SEL_TOP0_PERIC3, 20, 2),
  279. };
  280. static const struct samsung_div_clock top0_div_clks[] __initconst = {
  281. DIV(DOUT_ACLK_PERIC1, "dout_aclk_peric1_66", "mout_aclk_peric1_66",
  282. DIV_TOP03, 12, 6),
  283. DIV(DOUT_ACLK_PERIC0, "dout_aclk_peric0_66", "mout_aclk_peric0_66",
  284. DIV_TOP03, 20, 6),
  285. DIV(0, "dout_sclk_spdif", "mout_sclk_spdif", DIV_TOP0_PERIC0, 4, 4),
  286. DIV(0, "dout_sclk_pcm1", "mout_sclk_pcm1", DIV_TOP0_PERIC0, 8, 12),
  287. DIV(0, "dout_sclk_i2s1", "mout_sclk_i2s1", DIV_TOP0_PERIC0, 20, 10),
  288. DIV(0, "dout_sclk_spi1", "mout_sclk_spi1", DIV_TOP0_PERIC1, 8, 12),
  289. DIV(0, "dout_sclk_spi0", "mout_sclk_spi0", DIV_TOP0_PERIC1, 20, 12),
  290. DIV(0, "dout_sclk_spi3", "mout_sclk_spi3", DIV_TOP0_PERIC2, 8, 12),
  291. DIV(0, "dout_sclk_spi2", "mout_sclk_spi2", DIV_TOP0_PERIC2, 20, 12),
  292. DIV(0, "dout_sclk_uart3", "mout_sclk_uart3", DIV_TOP0_PERIC3, 4, 4),
  293. DIV(0, "dout_sclk_uart2", "mout_sclk_uart2", DIV_TOP0_PERIC3, 8, 4),
  294. DIV(0, "dout_sclk_uart1", "mout_sclk_uart1", DIV_TOP0_PERIC3, 12, 4),
  295. DIV(0, "dout_sclk_uart0", "mout_sclk_uart0", DIV_TOP0_PERIC3, 16, 4),
  296. DIV(0, "dout_sclk_spi4", "mout_sclk_spi4", DIV_TOP0_PERIC3, 20, 12),
  297. };
  298. static const struct samsung_gate_clock top0_gate_clks[] __initconst = {
  299. GATE(CLK_ACLK_PERIC0_66, "aclk_peric0_66", "dout_aclk_peric0_66",
  300. ENABLE_ACLK_TOP03, 20, CLK_SET_RATE_PARENT, 0),
  301. GATE(CLK_ACLK_PERIC1_66, "aclk_peric1_66", "dout_aclk_peric1_66",
  302. ENABLE_ACLK_TOP03, 12, CLK_SET_RATE_PARENT, 0),
  303. GATE(CLK_SCLK_SPDIF, "sclk_spdif", "dout_sclk_spdif",
  304. ENABLE_SCLK_TOP0_PERIC0, 4, CLK_SET_RATE_PARENT, 0),
  305. GATE(CLK_SCLK_PCM1, "sclk_pcm1", "dout_sclk_pcm1",
  306. ENABLE_SCLK_TOP0_PERIC0, 8, CLK_SET_RATE_PARENT, 0),
  307. GATE(CLK_SCLK_I2S1, "sclk_i2s1", "dout_sclk_i2s1",
  308. ENABLE_SCLK_TOP0_PERIC0, 20, CLK_SET_RATE_PARENT, 0),
  309. GATE(CLK_SCLK_SPI1, "sclk_spi1", "dout_sclk_spi1",
  310. ENABLE_SCLK_TOP0_PERIC1, 8, CLK_SET_RATE_PARENT, 0),
  311. GATE(CLK_SCLK_SPI0, "sclk_spi0", "dout_sclk_spi0",
  312. ENABLE_SCLK_TOP0_PERIC1, 20, CLK_SET_RATE_PARENT, 0),
  313. GATE(CLK_SCLK_SPI3, "sclk_spi3", "dout_sclk_spi3",
  314. ENABLE_SCLK_TOP0_PERIC2, 8, CLK_SET_RATE_PARENT, 0),
  315. GATE(CLK_SCLK_SPI2, "sclk_spi2", "dout_sclk_spi2",
  316. ENABLE_SCLK_TOP0_PERIC2, 20, CLK_SET_RATE_PARENT, 0),
  317. GATE(CLK_SCLK_UART3, "sclk_uart3", "dout_sclk_uart3",
  318. ENABLE_SCLK_TOP0_PERIC3, 4, 0, 0),
  319. GATE(CLK_SCLK_UART2, "sclk_uart2", "dout_sclk_uart2",
  320. ENABLE_SCLK_TOP0_PERIC3, 8, 0, 0),
  321. GATE(CLK_SCLK_UART1, "sclk_uart1", "dout_sclk_uart1",
  322. ENABLE_SCLK_TOP0_PERIC3, 12, 0, 0),
  323. GATE(CLK_SCLK_UART0, "sclk_uart0", "dout_sclk_uart0",
  324. ENABLE_SCLK_TOP0_PERIC3, 16, 0, 0),
  325. GATE(CLK_SCLK_SPI4, "sclk_spi4", "dout_sclk_spi4",
  326. ENABLE_SCLK_TOP0_PERIC3, 20, CLK_SET_RATE_PARENT, 0),
  327. };
  328. static const struct samsung_fixed_factor_clock top0_fixed_factor_clks[] __initconst = {
  329. FFACTOR(0, "ffac_top0_bus0_pll_div2", "mout_top0_bus0_pll_user",
  330. 1, 2, 0),
  331. FFACTOR(0, "ffac_top0_bus1_pll_div2", "mout_top0_bus1_pll_user",
  332. 1, 2, 0),
  333. FFACTOR(0, "ffac_top0_cc_pll_div2", "mout_top0_cc_pll_user", 1, 2, 0),
  334. FFACTOR(0, "ffac_top0_mfc_pll_div2", "mout_top0_mfc_pll_user", 1, 2, 0),
  335. };
  336. static const struct samsung_cmu_info top0_cmu_info __initconst = {
  337. .mux_clks = top0_mux_clks,
  338. .nr_mux_clks = ARRAY_SIZE(top0_mux_clks),
  339. .div_clks = top0_div_clks,
  340. .nr_div_clks = ARRAY_SIZE(top0_div_clks),
  341. .gate_clks = top0_gate_clks,
  342. .nr_gate_clks = ARRAY_SIZE(top0_gate_clks),
  343. .fixed_factor_clks = top0_fixed_factor_clks,
  344. .nr_fixed_factor_clks = ARRAY_SIZE(top0_fixed_factor_clks),
  345. .nr_clk_ids = TOP0_NR_CLK,
  346. .clk_regs = top0_clk_regs,
  347. .nr_clk_regs = ARRAY_SIZE(top0_clk_regs),
  348. };
  349. static void __init exynos7_clk_top0_init(struct device_node *np)
  350. {
  351. samsung_cmu_register_one(np, &top0_cmu_info);
  352. }
  353. CLK_OF_DECLARE(exynos7_clk_top0, "samsung,exynos7-clock-top0",
  354. exynos7_clk_top0_init);
  355. /* Register Offset definitions for CMU_TOP1 (0x105E0000) */
  356. #define MUX_SEL_TOP10 0x0200
  357. #define MUX_SEL_TOP11 0x0204
  358. #define MUX_SEL_TOP13 0x020C
  359. #define MUX_SEL_TOP1_FSYS0 0x0224
  360. #define MUX_SEL_TOP1_FSYS1 0x0228
  361. #define MUX_SEL_TOP1_FSYS11 0x022C
  362. #define DIV_TOP13 0x060C
  363. #define DIV_TOP1_FSYS0 0x0624
  364. #define DIV_TOP1_FSYS1 0x0628
  365. #define DIV_TOP1_FSYS11 0x062C
  366. #define ENABLE_ACLK_TOP13 0x080C
  367. #define ENABLE_SCLK_TOP1_FSYS0 0x0A24
  368. #define ENABLE_SCLK_TOP1_FSYS1 0x0A28
  369. #define ENABLE_SCLK_TOP1_FSYS11 0x0A2C
  370. /* List of parent clocks for Muxes in CMU_TOP1 */
  371. PNAME(mout_top1_bus0_pll_user_p) = { "fin_pll", "sclk_bus0_pll_b" };
  372. PNAME(mout_top1_bus1_pll_user_p) = { "fin_pll", "sclk_bus1_pll_b" };
  373. PNAME(mout_top1_cc_pll_user_p) = { "fin_pll", "sclk_cc_pll_b" };
  374. PNAME(mout_top1_mfc_pll_user_p) = { "fin_pll", "sclk_mfc_pll_b" };
  375. PNAME(mout_top1_bus0_pll_half_p) = {"mout_top1_bus0_pll_user",
  376. "ffac_top1_bus0_pll_div2"};
  377. PNAME(mout_top1_bus1_pll_half_p) = {"mout_top1_bus1_pll_user",
  378. "ffac_top1_bus1_pll_div2"};
  379. PNAME(mout_top1_cc_pll_half_p) = {"mout_top1_cc_pll_user",
  380. "ffac_top1_cc_pll_div2"};
  381. PNAME(mout_top1_mfc_pll_half_p) = {"mout_top1_mfc_pll_user",
  382. "ffac_top1_mfc_pll_div2"};
  383. PNAME(mout_top1_group1) = {"mout_top1_bus0_pll_half",
  384. "mout_top1_bus1_pll_half", "mout_top1_cc_pll_half",
  385. "mout_top1_mfc_pll_half"};
  386. static const unsigned long top1_clk_regs[] __initconst = {
  387. MUX_SEL_TOP10,
  388. MUX_SEL_TOP11,
  389. MUX_SEL_TOP13,
  390. MUX_SEL_TOP1_FSYS0,
  391. MUX_SEL_TOP1_FSYS1,
  392. MUX_SEL_TOP1_FSYS11,
  393. DIV_TOP13,
  394. DIV_TOP1_FSYS0,
  395. DIV_TOP1_FSYS1,
  396. DIV_TOP1_FSYS11,
  397. ENABLE_ACLK_TOP13,
  398. ENABLE_SCLK_TOP1_FSYS0,
  399. ENABLE_SCLK_TOP1_FSYS1,
  400. ENABLE_SCLK_TOP1_FSYS11,
  401. };
  402. static const struct samsung_mux_clock top1_mux_clks[] __initconst = {
  403. MUX(0, "mout_top1_mfc_pll_user", mout_top1_mfc_pll_user_p,
  404. MUX_SEL_TOP10, 4, 1),
  405. MUX(0, "mout_top1_cc_pll_user", mout_top1_cc_pll_user_p,
  406. MUX_SEL_TOP10, 8, 1),
  407. MUX(0, "mout_top1_bus1_pll_user", mout_top1_bus1_pll_user_p,
  408. MUX_SEL_TOP10, 12, 1),
  409. MUX(0, "mout_top1_bus0_pll_user", mout_top1_bus0_pll_user_p,
  410. MUX_SEL_TOP10, 16, 1),
  411. MUX(0, "mout_top1_mfc_pll_half", mout_top1_mfc_pll_half_p,
  412. MUX_SEL_TOP11, 4, 1),
  413. MUX(0, "mout_top1_cc_pll_half", mout_top1_cc_pll_half_p,
  414. MUX_SEL_TOP11, 8, 1),
  415. MUX(0, "mout_top1_bus1_pll_half", mout_top1_bus1_pll_half_p,
  416. MUX_SEL_TOP11, 12, 1),
  417. MUX(0, "mout_top1_bus0_pll_half", mout_top1_bus0_pll_half_p,
  418. MUX_SEL_TOP11, 16, 1),
  419. MUX(0, "mout_aclk_fsys1_200", mout_top1_group1, MUX_SEL_TOP13, 24, 2),
  420. MUX(0, "mout_aclk_fsys0_200", mout_top1_group1, MUX_SEL_TOP13, 28, 2),
  421. MUX(0, "mout_sclk_phy_fsys0_26m", mout_top1_group1,
  422. MUX_SEL_TOP1_FSYS0, 0, 2),
  423. MUX(0, "mout_sclk_mmc2", mout_top1_group1, MUX_SEL_TOP1_FSYS0, 16, 2),
  424. MUX(0, "mout_sclk_usbdrd300", mout_top1_group1,
  425. MUX_SEL_TOP1_FSYS0, 28, 2),
  426. MUX(0, "mout_sclk_phy_fsys1", mout_top1_group1,
  427. MUX_SEL_TOP1_FSYS1, 0, 2),
  428. MUX(0, "mout_sclk_ufsunipro20", mout_top1_group1,
  429. MUX_SEL_TOP1_FSYS1, 16, 2),
  430. MUX(0, "mout_sclk_mmc1", mout_top1_group1, MUX_SEL_TOP1_FSYS11, 0, 2),
  431. MUX(0, "mout_sclk_mmc0", mout_top1_group1, MUX_SEL_TOP1_FSYS11, 12, 2),
  432. MUX(0, "mout_sclk_phy_fsys1_26m", mout_top1_group1,
  433. MUX_SEL_TOP1_FSYS11, 24, 2),
  434. };
  435. static const struct samsung_div_clock top1_div_clks[] __initconst = {
  436. DIV(DOUT_ACLK_FSYS1_200, "dout_aclk_fsys1_200", "mout_aclk_fsys1_200",
  437. DIV_TOP13, 24, 4),
  438. DIV(DOUT_ACLK_FSYS0_200, "dout_aclk_fsys0_200", "mout_aclk_fsys0_200",
  439. DIV_TOP13, 28, 4),
  440. DIV(DOUT_SCLK_PHY_FSYS1, "dout_sclk_phy_fsys1",
  441. "mout_sclk_phy_fsys1", DIV_TOP1_FSYS1, 0, 6),
  442. DIV(DOUT_SCLK_UFSUNIPRO20, "dout_sclk_ufsunipro20",
  443. "mout_sclk_ufsunipro20",
  444. DIV_TOP1_FSYS1, 16, 6),
  445. DIV(DOUT_SCLK_MMC2, "dout_sclk_mmc2", "mout_sclk_mmc2",
  446. DIV_TOP1_FSYS0, 16, 10),
  447. DIV(0, "dout_sclk_usbdrd300", "mout_sclk_usbdrd300",
  448. DIV_TOP1_FSYS0, 28, 4),
  449. DIV(DOUT_SCLK_MMC1, "dout_sclk_mmc1", "mout_sclk_mmc1",
  450. DIV_TOP1_FSYS11, 0, 10),
  451. DIV(DOUT_SCLK_MMC0, "dout_sclk_mmc0", "mout_sclk_mmc0",
  452. DIV_TOP1_FSYS11, 12, 10),
  453. DIV(DOUT_SCLK_PHY_FSYS1_26M, "dout_sclk_phy_fsys1_26m",
  454. "mout_sclk_phy_fsys1_26m", DIV_TOP1_FSYS11, 24, 6),
  455. };
  456. static const struct samsung_gate_clock top1_gate_clks[] __initconst = {
  457. GATE(CLK_SCLK_MMC2, "sclk_mmc2", "dout_sclk_mmc2",
  458. ENABLE_SCLK_TOP1_FSYS0, 16, CLK_SET_RATE_PARENT, 0),
  459. GATE(0, "sclk_usbdrd300", "dout_sclk_usbdrd300",
  460. ENABLE_SCLK_TOP1_FSYS0, 28, 0, 0),
  461. GATE(CLK_SCLK_PHY_FSYS1, "sclk_phy_fsys1", "dout_sclk_phy_fsys1",
  462. ENABLE_SCLK_TOP1_FSYS1, 0, CLK_SET_RATE_PARENT, 0),
  463. GATE(CLK_SCLK_UFSUNIPRO20, "sclk_ufsunipro20", "dout_sclk_ufsunipro20",
  464. ENABLE_SCLK_TOP1_FSYS1, 16, CLK_SET_RATE_PARENT, 0),
  465. GATE(CLK_SCLK_MMC1, "sclk_mmc1", "dout_sclk_mmc1",
  466. ENABLE_SCLK_TOP1_FSYS11, 0, CLK_SET_RATE_PARENT, 0),
  467. GATE(CLK_SCLK_MMC0, "sclk_mmc0", "dout_sclk_mmc0",
  468. ENABLE_SCLK_TOP1_FSYS11, 12, CLK_SET_RATE_PARENT, 0),
  469. GATE(CLK_ACLK_FSYS0_200, "aclk_fsys0_200", "dout_aclk_fsys0_200",
  470. ENABLE_ACLK_TOP13, 28, CLK_SET_RATE_PARENT |
  471. CLK_IS_CRITICAL, 0),
  472. /*
  473. * This clock is required for the CMU_FSYS1 registers access, keep it
  474. * enabled permanently until proper runtime PM support is added.
  475. */
  476. GATE(CLK_ACLK_FSYS1_200, "aclk_fsys1_200", "dout_aclk_fsys1_200",
  477. ENABLE_ACLK_TOP13, 24, CLK_SET_RATE_PARENT |
  478. CLK_IS_CRITICAL, 0),
  479. GATE(CLK_SCLK_PHY_FSYS1_26M, "sclk_phy_fsys1_26m",
  480. "dout_sclk_phy_fsys1_26m", ENABLE_SCLK_TOP1_FSYS11,
  481. 24, CLK_SET_RATE_PARENT, 0),
  482. };
  483. static const struct samsung_fixed_factor_clock top1_fixed_factor_clks[] __initconst = {
  484. FFACTOR(0, "ffac_top1_bus0_pll_div2", "mout_top1_bus0_pll_user",
  485. 1, 2, 0),
  486. FFACTOR(0, "ffac_top1_bus1_pll_div2", "mout_top1_bus1_pll_user",
  487. 1, 2, 0),
  488. FFACTOR(0, "ffac_top1_cc_pll_div2", "mout_top1_cc_pll_user", 1, 2, 0),
  489. FFACTOR(0, "ffac_top1_mfc_pll_div2", "mout_top1_mfc_pll_user", 1, 2, 0),
  490. };
  491. static const struct samsung_cmu_info top1_cmu_info __initconst = {
  492. .mux_clks = top1_mux_clks,
  493. .nr_mux_clks = ARRAY_SIZE(top1_mux_clks),
  494. .div_clks = top1_div_clks,
  495. .nr_div_clks = ARRAY_SIZE(top1_div_clks),
  496. .gate_clks = top1_gate_clks,
  497. .nr_gate_clks = ARRAY_SIZE(top1_gate_clks),
  498. .fixed_factor_clks = top1_fixed_factor_clks,
  499. .nr_fixed_factor_clks = ARRAY_SIZE(top1_fixed_factor_clks),
  500. .nr_clk_ids = TOP1_NR_CLK,
  501. .clk_regs = top1_clk_regs,
  502. .nr_clk_regs = ARRAY_SIZE(top1_clk_regs),
  503. };
  504. static void __init exynos7_clk_top1_init(struct device_node *np)
  505. {
  506. samsung_cmu_register_one(np, &top1_cmu_info);
  507. }
  508. CLK_OF_DECLARE(exynos7_clk_top1, "samsung,exynos7-clock-top1",
  509. exynos7_clk_top1_init);
  510. /* Register Offset definitions for CMU_CCORE (0x105B0000) */
  511. #define MUX_SEL_CCORE 0x0200
  512. #define DIV_CCORE 0x0600
  513. #define ENABLE_ACLK_CCORE0 0x0800
  514. #define ENABLE_ACLK_CCORE1 0x0804
  515. #define ENABLE_PCLK_CCORE 0x0900
  516. /*
  517. * List of parent clocks for Muxes in CMU_CCORE
  518. */
  519. PNAME(mout_aclk_ccore_133_user_p) = { "fin_pll", "aclk_ccore_133" };
  520. static const unsigned long ccore_clk_regs[] __initconst = {
  521. MUX_SEL_CCORE,
  522. ENABLE_PCLK_CCORE,
  523. };
  524. static const struct samsung_mux_clock ccore_mux_clks[] __initconst = {
  525. MUX(0, "mout_aclk_ccore_133_user", mout_aclk_ccore_133_user_p,
  526. MUX_SEL_CCORE, 1, 1),
  527. };
  528. static const struct samsung_gate_clock ccore_gate_clks[] __initconst = {
  529. GATE(PCLK_RTC, "pclk_rtc", "mout_aclk_ccore_133_user",
  530. ENABLE_PCLK_CCORE, 8, 0, 0),
  531. };
  532. static const struct samsung_cmu_info ccore_cmu_info __initconst = {
  533. .mux_clks = ccore_mux_clks,
  534. .nr_mux_clks = ARRAY_SIZE(ccore_mux_clks),
  535. .gate_clks = ccore_gate_clks,
  536. .nr_gate_clks = ARRAY_SIZE(ccore_gate_clks),
  537. .nr_clk_ids = CCORE_NR_CLK,
  538. .clk_regs = ccore_clk_regs,
  539. .nr_clk_regs = ARRAY_SIZE(ccore_clk_regs),
  540. };
  541. static void __init exynos7_clk_ccore_init(struct device_node *np)
  542. {
  543. samsung_cmu_register_one(np, &ccore_cmu_info);
  544. }
  545. CLK_OF_DECLARE(exynos7_clk_ccore, "samsung,exynos7-clock-ccore",
  546. exynos7_clk_ccore_init);
  547. /* Register Offset definitions for CMU_PERIC0 (0x13610000) */
  548. #define MUX_SEL_PERIC0 0x0200
  549. #define ENABLE_PCLK_PERIC0 0x0900
  550. #define ENABLE_SCLK_PERIC0 0x0A00
  551. /* List of parent clocks for Muxes in CMU_PERIC0 */
  552. PNAME(mout_aclk_peric0_66_user_p) = { "fin_pll", "aclk_peric0_66" };
  553. PNAME(mout_sclk_uart0_user_p) = { "fin_pll", "sclk_uart0" };
  554. static const unsigned long peric0_clk_regs[] __initconst = {
  555. MUX_SEL_PERIC0,
  556. ENABLE_PCLK_PERIC0,
  557. ENABLE_SCLK_PERIC0,
  558. };
  559. static const struct samsung_mux_clock peric0_mux_clks[] __initconst = {
  560. MUX(0, "mout_aclk_peric0_66_user", mout_aclk_peric0_66_user_p,
  561. MUX_SEL_PERIC0, 0, 1),
  562. MUX(0, "mout_sclk_uart0_user", mout_sclk_uart0_user_p,
  563. MUX_SEL_PERIC0, 16, 1),
  564. };
  565. static const struct samsung_gate_clock peric0_gate_clks[] __initconst = {
  566. GATE(PCLK_HSI2C0, "pclk_hsi2c0", "mout_aclk_peric0_66_user",
  567. ENABLE_PCLK_PERIC0, 8, 0, 0),
  568. GATE(PCLK_HSI2C1, "pclk_hsi2c1", "mout_aclk_peric0_66_user",
  569. ENABLE_PCLK_PERIC0, 9, 0, 0),
  570. GATE(PCLK_HSI2C4, "pclk_hsi2c4", "mout_aclk_peric0_66_user",
  571. ENABLE_PCLK_PERIC0, 10, 0, 0),
  572. GATE(PCLK_HSI2C5, "pclk_hsi2c5", "mout_aclk_peric0_66_user",
  573. ENABLE_PCLK_PERIC0, 11, 0, 0),
  574. GATE(PCLK_HSI2C9, "pclk_hsi2c9", "mout_aclk_peric0_66_user",
  575. ENABLE_PCLK_PERIC0, 12, 0, 0),
  576. GATE(PCLK_HSI2C10, "pclk_hsi2c10", "mout_aclk_peric0_66_user",
  577. ENABLE_PCLK_PERIC0, 13, 0, 0),
  578. GATE(PCLK_HSI2C11, "pclk_hsi2c11", "mout_aclk_peric0_66_user",
  579. ENABLE_PCLK_PERIC0, 14, 0, 0),
  580. GATE(PCLK_UART0, "pclk_uart0", "mout_aclk_peric0_66_user",
  581. ENABLE_PCLK_PERIC0, 16, 0, 0),
  582. GATE(PCLK_ADCIF, "pclk_adcif", "mout_aclk_peric0_66_user",
  583. ENABLE_PCLK_PERIC0, 20, 0, 0),
  584. GATE(PCLK_PWM, "pclk_pwm", "mout_aclk_peric0_66_user",
  585. ENABLE_PCLK_PERIC0, 21, 0, 0),
  586. GATE(SCLK_UART0, "sclk_uart0_user", "mout_sclk_uart0_user",
  587. ENABLE_SCLK_PERIC0, 16, 0, 0),
  588. GATE(SCLK_PWM, "sclk_pwm", "fin_pll", ENABLE_SCLK_PERIC0, 21, 0, 0),
  589. };
  590. static const struct samsung_cmu_info peric0_cmu_info __initconst = {
  591. .mux_clks = peric0_mux_clks,
  592. .nr_mux_clks = ARRAY_SIZE(peric0_mux_clks),
  593. .gate_clks = peric0_gate_clks,
  594. .nr_gate_clks = ARRAY_SIZE(peric0_gate_clks),
  595. .nr_clk_ids = PERIC0_NR_CLK,
  596. .clk_regs = peric0_clk_regs,
  597. .nr_clk_regs = ARRAY_SIZE(peric0_clk_regs),
  598. };
  599. static void __init exynos7_clk_peric0_init(struct device_node *np)
  600. {
  601. samsung_cmu_register_one(np, &peric0_cmu_info);
  602. }
  603. /* Register Offset definitions for CMU_PERIC1 (0x14C80000) */
  604. #define MUX_SEL_PERIC10 0x0200
  605. #define MUX_SEL_PERIC11 0x0204
  606. #define MUX_SEL_PERIC12 0x0208
  607. #define ENABLE_PCLK_PERIC1 0x0900
  608. #define ENABLE_SCLK_PERIC10 0x0A00
  609. CLK_OF_DECLARE(exynos7_clk_peric0, "samsung,exynos7-clock-peric0",
  610. exynos7_clk_peric0_init);
  611. /* List of parent clocks for Muxes in CMU_PERIC1 */
  612. PNAME(mout_aclk_peric1_66_user_p) = { "fin_pll", "aclk_peric1_66" };
  613. PNAME(mout_sclk_uart1_user_p) = { "fin_pll", "sclk_uart1" };
  614. PNAME(mout_sclk_uart2_user_p) = { "fin_pll", "sclk_uart2" };
  615. PNAME(mout_sclk_uart3_user_p) = { "fin_pll", "sclk_uart3" };
  616. PNAME(mout_sclk_spi0_user_p) = { "fin_pll", "sclk_spi0" };
  617. PNAME(mout_sclk_spi1_user_p) = { "fin_pll", "sclk_spi1" };
  618. PNAME(mout_sclk_spi2_user_p) = { "fin_pll", "sclk_spi2" };
  619. PNAME(mout_sclk_spi3_user_p) = { "fin_pll", "sclk_spi3" };
  620. PNAME(mout_sclk_spi4_user_p) = { "fin_pll", "sclk_spi4" };
  621. static const unsigned long peric1_clk_regs[] __initconst = {
  622. MUX_SEL_PERIC10,
  623. MUX_SEL_PERIC11,
  624. MUX_SEL_PERIC12,
  625. ENABLE_PCLK_PERIC1,
  626. ENABLE_SCLK_PERIC10,
  627. };
  628. static const struct samsung_mux_clock peric1_mux_clks[] __initconst = {
  629. MUX(0, "mout_aclk_peric1_66_user", mout_aclk_peric1_66_user_p,
  630. MUX_SEL_PERIC10, 0, 1),
  631. MUX_F(0, "mout_sclk_spi0_user", mout_sclk_spi0_user_p,
  632. MUX_SEL_PERIC11, 0, 1, CLK_SET_RATE_PARENT, 0),
  633. MUX_F(0, "mout_sclk_spi1_user", mout_sclk_spi1_user_p,
  634. MUX_SEL_PERIC11, 4, 1, CLK_SET_RATE_PARENT, 0),
  635. MUX_F(0, "mout_sclk_spi2_user", mout_sclk_spi2_user_p,
  636. MUX_SEL_PERIC11, 8, 1, CLK_SET_RATE_PARENT, 0),
  637. MUX_F(0, "mout_sclk_spi3_user", mout_sclk_spi3_user_p,
  638. MUX_SEL_PERIC11, 12, 1, CLK_SET_RATE_PARENT, 0),
  639. MUX_F(0, "mout_sclk_spi4_user", mout_sclk_spi4_user_p,
  640. MUX_SEL_PERIC11, 16, 1, CLK_SET_RATE_PARENT, 0),
  641. MUX(0, "mout_sclk_uart1_user", mout_sclk_uart1_user_p,
  642. MUX_SEL_PERIC11, 20, 1),
  643. MUX(0, "mout_sclk_uart2_user", mout_sclk_uart2_user_p,
  644. MUX_SEL_PERIC11, 24, 1),
  645. MUX(0, "mout_sclk_uart3_user", mout_sclk_uart3_user_p,
  646. MUX_SEL_PERIC11, 28, 1),
  647. };
  648. static const struct samsung_gate_clock peric1_gate_clks[] __initconst = {
  649. GATE(PCLK_HSI2C2, "pclk_hsi2c2", "mout_aclk_peric1_66_user",
  650. ENABLE_PCLK_PERIC1, 4, 0, 0),
  651. GATE(PCLK_HSI2C3, "pclk_hsi2c3", "mout_aclk_peric1_66_user",
  652. ENABLE_PCLK_PERIC1, 5, 0, 0),
  653. GATE(PCLK_HSI2C6, "pclk_hsi2c6", "mout_aclk_peric1_66_user",
  654. ENABLE_PCLK_PERIC1, 6, 0, 0),
  655. GATE(PCLK_HSI2C7, "pclk_hsi2c7", "mout_aclk_peric1_66_user",
  656. ENABLE_PCLK_PERIC1, 7, 0, 0),
  657. GATE(PCLK_HSI2C8, "pclk_hsi2c8", "mout_aclk_peric1_66_user",
  658. ENABLE_PCLK_PERIC1, 8, 0, 0),
  659. GATE(PCLK_UART1, "pclk_uart1", "mout_aclk_peric1_66_user",
  660. ENABLE_PCLK_PERIC1, 9, 0, 0),
  661. GATE(PCLK_UART2, "pclk_uart2", "mout_aclk_peric1_66_user",
  662. ENABLE_PCLK_PERIC1, 10, 0, 0),
  663. GATE(PCLK_UART3, "pclk_uart3", "mout_aclk_peric1_66_user",
  664. ENABLE_PCLK_PERIC1, 11, 0, 0),
  665. GATE(PCLK_SPI0, "pclk_spi0", "mout_aclk_peric1_66_user",
  666. ENABLE_PCLK_PERIC1, 12, 0, 0),
  667. GATE(PCLK_SPI1, "pclk_spi1", "mout_aclk_peric1_66_user",
  668. ENABLE_PCLK_PERIC1, 13, 0, 0),
  669. GATE(PCLK_SPI2, "pclk_spi2", "mout_aclk_peric1_66_user",
  670. ENABLE_PCLK_PERIC1, 14, 0, 0),
  671. GATE(PCLK_SPI3, "pclk_spi3", "mout_aclk_peric1_66_user",
  672. ENABLE_PCLK_PERIC1, 15, 0, 0),
  673. GATE(PCLK_SPI4, "pclk_spi4", "mout_aclk_peric1_66_user",
  674. ENABLE_PCLK_PERIC1, 16, 0, 0),
  675. GATE(PCLK_I2S1, "pclk_i2s1", "mout_aclk_peric1_66_user",
  676. ENABLE_PCLK_PERIC1, 17, CLK_SET_RATE_PARENT, 0),
  677. GATE(PCLK_PCM1, "pclk_pcm1", "mout_aclk_peric1_66_user",
  678. ENABLE_PCLK_PERIC1, 18, 0, 0),
  679. GATE(PCLK_SPDIF, "pclk_spdif", "mout_aclk_peric1_66_user",
  680. ENABLE_PCLK_PERIC1, 19, 0, 0),
  681. GATE(SCLK_UART1, "sclk_uart1_user", "mout_sclk_uart1_user",
  682. ENABLE_SCLK_PERIC10, 9, 0, 0),
  683. GATE(SCLK_UART2, "sclk_uart2_user", "mout_sclk_uart2_user",
  684. ENABLE_SCLK_PERIC10, 10, 0, 0),
  685. GATE(SCLK_UART3, "sclk_uart3_user", "mout_sclk_uart3_user",
  686. ENABLE_SCLK_PERIC10, 11, 0, 0),
  687. GATE(SCLK_SPI0, "sclk_spi0_user", "mout_sclk_spi0_user",
  688. ENABLE_SCLK_PERIC10, 12, CLK_SET_RATE_PARENT, 0),
  689. GATE(SCLK_SPI1, "sclk_spi1_user", "mout_sclk_spi1_user",
  690. ENABLE_SCLK_PERIC10, 13, CLK_SET_RATE_PARENT, 0),
  691. GATE(SCLK_SPI2, "sclk_spi2_user", "mout_sclk_spi2_user",
  692. ENABLE_SCLK_PERIC10, 14, CLK_SET_RATE_PARENT, 0),
  693. GATE(SCLK_SPI3, "sclk_spi3_user", "mout_sclk_spi3_user",
  694. ENABLE_SCLK_PERIC10, 15, CLK_SET_RATE_PARENT, 0),
  695. GATE(SCLK_SPI4, "sclk_spi4_user", "mout_sclk_spi4_user",
  696. ENABLE_SCLK_PERIC10, 16, CLK_SET_RATE_PARENT, 0),
  697. GATE(SCLK_I2S1, "sclk_i2s1_user", "sclk_i2s1",
  698. ENABLE_SCLK_PERIC10, 17, CLK_SET_RATE_PARENT, 0),
  699. GATE(SCLK_PCM1, "sclk_pcm1_user", "sclk_pcm1",
  700. ENABLE_SCLK_PERIC10, 18, CLK_SET_RATE_PARENT, 0),
  701. GATE(SCLK_SPDIF, "sclk_spdif_user", "sclk_spdif",
  702. ENABLE_SCLK_PERIC10, 19, CLK_SET_RATE_PARENT, 0),
  703. };
  704. static const struct samsung_cmu_info peric1_cmu_info __initconst = {
  705. .mux_clks = peric1_mux_clks,
  706. .nr_mux_clks = ARRAY_SIZE(peric1_mux_clks),
  707. .gate_clks = peric1_gate_clks,
  708. .nr_gate_clks = ARRAY_SIZE(peric1_gate_clks),
  709. .nr_clk_ids = PERIC1_NR_CLK,
  710. .clk_regs = peric1_clk_regs,
  711. .nr_clk_regs = ARRAY_SIZE(peric1_clk_regs),
  712. };
  713. static void __init exynos7_clk_peric1_init(struct device_node *np)
  714. {
  715. samsung_cmu_register_one(np, &peric1_cmu_info);
  716. }
  717. CLK_OF_DECLARE(exynos7_clk_peric1, "samsung,exynos7-clock-peric1",
  718. exynos7_clk_peric1_init);
  719. /* Register Offset definitions for CMU_PERIS (0x10040000) */
  720. #define MUX_SEL_PERIS 0x0200
  721. #define ENABLE_PCLK_PERIS 0x0900
  722. #define ENABLE_PCLK_PERIS_SECURE_CHIPID 0x0910
  723. #define ENABLE_SCLK_PERIS 0x0A00
  724. #define ENABLE_SCLK_PERIS_SECURE_CHIPID 0x0A10
  725. /* List of parent clocks for Muxes in CMU_PERIS */
  726. PNAME(mout_aclk_peris_66_user_p) = { "fin_pll", "aclk_peris_66" };
  727. static const unsigned long peris_clk_regs[] __initconst = {
  728. MUX_SEL_PERIS,
  729. ENABLE_PCLK_PERIS,
  730. ENABLE_PCLK_PERIS_SECURE_CHIPID,
  731. ENABLE_SCLK_PERIS,
  732. ENABLE_SCLK_PERIS_SECURE_CHIPID,
  733. };
  734. static const struct samsung_mux_clock peris_mux_clks[] __initconst = {
  735. MUX(0, "mout_aclk_peris_66_user",
  736. mout_aclk_peris_66_user_p, MUX_SEL_PERIS, 0, 1),
  737. };
  738. static const struct samsung_gate_clock peris_gate_clks[] __initconst = {
  739. GATE(PCLK_WDT, "pclk_wdt", "mout_aclk_peris_66_user",
  740. ENABLE_PCLK_PERIS, 6, 0, 0),
  741. GATE(PCLK_TMU, "pclk_tmu_apbif", "mout_aclk_peris_66_user",
  742. ENABLE_PCLK_PERIS, 10, 0, 0),
  743. GATE(PCLK_CHIPID, "pclk_chipid", "mout_aclk_peris_66_user",
  744. ENABLE_PCLK_PERIS_SECURE_CHIPID, 0, 0, 0),
  745. GATE(SCLK_CHIPID, "sclk_chipid", "fin_pll",
  746. ENABLE_SCLK_PERIS_SECURE_CHIPID, 0, 0, 0),
  747. GATE(SCLK_TMU, "sclk_tmu", "fin_pll", ENABLE_SCLK_PERIS, 10, 0, 0),
  748. };
  749. static const struct samsung_cmu_info peris_cmu_info __initconst = {
  750. .mux_clks = peris_mux_clks,
  751. .nr_mux_clks = ARRAY_SIZE(peris_mux_clks),
  752. .gate_clks = peris_gate_clks,
  753. .nr_gate_clks = ARRAY_SIZE(peris_gate_clks),
  754. .nr_clk_ids = PERIS_NR_CLK,
  755. .clk_regs = peris_clk_regs,
  756. .nr_clk_regs = ARRAY_SIZE(peris_clk_regs),
  757. };
  758. static void __init exynos7_clk_peris_init(struct device_node *np)
  759. {
  760. samsung_cmu_register_one(np, &peris_cmu_info);
  761. }
  762. CLK_OF_DECLARE(exynos7_clk_peris, "samsung,exynos7-clock-peris",
  763. exynos7_clk_peris_init);
  764. /* Register Offset definitions for CMU_FSYS0 (0x10E90000) */
  765. #define MUX_SEL_FSYS00 0x0200
  766. #define MUX_SEL_FSYS01 0x0204
  767. #define MUX_SEL_FSYS02 0x0208
  768. #define ENABLE_ACLK_FSYS00 0x0800
  769. #define ENABLE_ACLK_FSYS01 0x0804
  770. #define ENABLE_SCLK_FSYS01 0x0A04
  771. #define ENABLE_SCLK_FSYS02 0x0A08
  772. #define ENABLE_SCLK_FSYS04 0x0A10
  773. /*
  774. * List of parent clocks for Muxes in CMU_FSYS0
  775. */
  776. PNAME(mout_aclk_fsys0_200_user_p) = { "fin_pll", "aclk_fsys0_200" };
  777. PNAME(mout_sclk_mmc2_user_p) = { "fin_pll", "sclk_mmc2" };
  778. PNAME(mout_sclk_usbdrd300_user_p) = { "fin_pll", "sclk_usbdrd300" };
  779. PNAME(mout_phyclk_usbdrd300_udrd30_phyclk_user_p) = { "fin_pll",
  780. "phyclk_usbdrd300_udrd30_phyclock" };
  781. PNAME(mout_phyclk_usbdrd300_udrd30_pipe_pclk_user_p) = { "fin_pll",
  782. "phyclk_usbdrd300_udrd30_pipe_pclk" };
  783. /* fixed rate clocks used in the FSYS0 block */
  784. static const struct samsung_fixed_rate_clock fixed_rate_clks_fsys0[] __initconst = {
  785. FRATE(0, "phyclk_usbdrd300_udrd30_phyclock", NULL, 0, 60000000),
  786. FRATE(0, "phyclk_usbdrd300_udrd30_pipe_pclk", NULL, 0, 125000000),
  787. };
  788. static const unsigned long fsys0_clk_regs[] __initconst = {
  789. MUX_SEL_FSYS00,
  790. MUX_SEL_FSYS01,
  791. MUX_SEL_FSYS02,
  792. ENABLE_ACLK_FSYS00,
  793. ENABLE_ACLK_FSYS01,
  794. ENABLE_SCLK_FSYS01,
  795. ENABLE_SCLK_FSYS02,
  796. ENABLE_SCLK_FSYS04,
  797. };
  798. static const struct samsung_mux_clock fsys0_mux_clks[] __initconst = {
  799. MUX(0, "mout_aclk_fsys0_200_user", mout_aclk_fsys0_200_user_p,
  800. MUX_SEL_FSYS00, 24, 1),
  801. MUX(0, "mout_sclk_mmc2_user", mout_sclk_mmc2_user_p,
  802. MUX_SEL_FSYS01, 24, 1),
  803. MUX(0, "mout_sclk_usbdrd300_user", mout_sclk_usbdrd300_user_p,
  804. MUX_SEL_FSYS01, 28, 1),
  805. MUX(0, "mout_phyclk_usbdrd300_udrd30_pipe_pclk_user",
  806. mout_phyclk_usbdrd300_udrd30_pipe_pclk_user_p,
  807. MUX_SEL_FSYS02, 24, 1),
  808. MUX(0, "mout_phyclk_usbdrd300_udrd30_phyclk_user",
  809. mout_phyclk_usbdrd300_udrd30_phyclk_user_p,
  810. MUX_SEL_FSYS02, 28, 1),
  811. };
  812. static const struct samsung_gate_clock fsys0_gate_clks[] __initconst = {
  813. GATE(ACLK_PDMA1, "aclk_pdma1", "mout_aclk_fsys0_200_user",
  814. ENABLE_ACLK_FSYS00, 3, 0, 0),
  815. GATE(ACLK_PDMA0, "aclk_pdma0", "mout_aclk_fsys0_200_user",
  816. ENABLE_ACLK_FSYS00, 4, 0, 0),
  817. GATE(ACLK_AXIUS_USBDRD30X_FSYS0X, "aclk_axius_usbdrd30x_fsys0x",
  818. "mout_aclk_fsys0_200_user",
  819. ENABLE_ACLK_FSYS00, 19, 0, 0),
  820. GATE(ACLK_USBDRD300, "aclk_usbdrd300", "mout_aclk_fsys0_200_user",
  821. ENABLE_ACLK_FSYS01, 29, 0, 0),
  822. GATE(ACLK_MMC2, "aclk_mmc2", "mout_aclk_fsys0_200_user",
  823. ENABLE_ACLK_FSYS01, 31, 0, 0),
  824. GATE(SCLK_USBDRD300_SUSPENDCLK, "sclk_usbdrd300_suspendclk",
  825. "mout_sclk_usbdrd300_user",
  826. ENABLE_SCLK_FSYS01, 4, 0, 0),
  827. GATE(SCLK_USBDRD300_REFCLK, "sclk_usbdrd300_refclk", "fin_pll",
  828. ENABLE_SCLK_FSYS01, 8, 0, 0),
  829. GATE(PHYCLK_USBDRD300_UDRD30_PIPE_PCLK_USER,
  830. "phyclk_usbdrd300_udrd30_pipe_pclk_user",
  831. "mout_phyclk_usbdrd300_udrd30_pipe_pclk_user",
  832. ENABLE_SCLK_FSYS02, 24, 0, 0),
  833. GATE(PHYCLK_USBDRD300_UDRD30_PHYCLK_USER,
  834. "phyclk_usbdrd300_udrd30_phyclk_user",
  835. "mout_phyclk_usbdrd300_udrd30_phyclk_user",
  836. ENABLE_SCLK_FSYS02, 28, 0, 0),
  837. GATE(OSCCLK_PHY_CLKOUT_USB30_PHY, "oscclk_phy_clkout_usb30_phy",
  838. "fin_pll",
  839. ENABLE_SCLK_FSYS04, 28, 0, 0),
  840. };
  841. static const struct samsung_cmu_info fsys0_cmu_info __initconst = {
  842. .fixed_clks = fixed_rate_clks_fsys0,
  843. .nr_fixed_clks = ARRAY_SIZE(fixed_rate_clks_fsys0),
  844. .mux_clks = fsys0_mux_clks,
  845. .nr_mux_clks = ARRAY_SIZE(fsys0_mux_clks),
  846. .gate_clks = fsys0_gate_clks,
  847. .nr_gate_clks = ARRAY_SIZE(fsys0_gate_clks),
  848. .nr_clk_ids = FSYS0_NR_CLK,
  849. .clk_regs = fsys0_clk_regs,
  850. .nr_clk_regs = ARRAY_SIZE(fsys0_clk_regs),
  851. };
  852. static void __init exynos7_clk_fsys0_init(struct device_node *np)
  853. {
  854. samsung_cmu_register_one(np, &fsys0_cmu_info);
  855. }
  856. CLK_OF_DECLARE(exynos7_clk_fsys0, "samsung,exynos7-clock-fsys0",
  857. exynos7_clk_fsys0_init);
  858. /* Register Offset definitions for CMU_FSYS1 (0x156E0000) */
  859. #define MUX_SEL_FSYS10 0x0200
  860. #define MUX_SEL_FSYS11 0x0204
  861. #define MUX_SEL_FSYS12 0x0208
  862. #define DIV_FSYS1 0x0600
  863. #define ENABLE_ACLK_FSYS1 0x0800
  864. #define ENABLE_PCLK_FSYS1 0x0900
  865. #define ENABLE_SCLK_FSYS11 0x0A04
  866. #define ENABLE_SCLK_FSYS12 0x0A08
  867. #define ENABLE_SCLK_FSYS13 0x0A0C
  868. /*
  869. * List of parent clocks for Muxes in CMU_FSYS1
  870. */
  871. PNAME(mout_aclk_fsys1_200_user_p) = { "fin_pll", "aclk_fsys1_200" };
  872. PNAME(mout_fsys1_group_p) = { "fin_pll", "fin_pll_26m",
  873. "sclk_phy_fsys1_26m" };
  874. PNAME(mout_sclk_mmc0_user_p) = { "fin_pll", "sclk_mmc0" };
  875. PNAME(mout_sclk_mmc1_user_p) = { "fin_pll", "sclk_mmc1" };
  876. PNAME(mout_sclk_ufsunipro20_user_p) = { "fin_pll", "sclk_ufsunipro20" };
  877. PNAME(mout_phyclk_ufs20_tx0_user_p) = { "fin_pll", "phyclk_ufs20_tx0_symbol" };
  878. PNAME(mout_phyclk_ufs20_rx0_user_p) = { "fin_pll", "phyclk_ufs20_rx0_symbol" };
  879. PNAME(mout_phyclk_ufs20_rx1_user_p) = { "fin_pll", "phyclk_ufs20_rx1_symbol" };
  880. /* fixed rate clocks used in the FSYS1 block */
  881. static const struct samsung_fixed_rate_clock fixed_rate_clks_fsys1[] __initconst = {
  882. FRATE(PHYCLK_UFS20_TX0_SYMBOL, "phyclk_ufs20_tx0_symbol", NULL,
  883. 0, 300000000),
  884. FRATE(PHYCLK_UFS20_RX0_SYMBOL, "phyclk_ufs20_rx0_symbol", NULL,
  885. 0, 300000000),
  886. FRATE(PHYCLK_UFS20_RX1_SYMBOL, "phyclk_ufs20_rx1_symbol", NULL,
  887. 0, 300000000),
  888. };
  889. static const unsigned long fsys1_clk_regs[] __initconst = {
  890. MUX_SEL_FSYS10,
  891. MUX_SEL_FSYS11,
  892. MUX_SEL_FSYS12,
  893. DIV_FSYS1,
  894. ENABLE_ACLK_FSYS1,
  895. ENABLE_PCLK_FSYS1,
  896. ENABLE_SCLK_FSYS11,
  897. ENABLE_SCLK_FSYS12,
  898. ENABLE_SCLK_FSYS13,
  899. };
  900. static const struct samsung_mux_clock fsys1_mux_clks[] __initconst = {
  901. MUX(MOUT_FSYS1_PHYCLK_SEL1, "mout_fsys1_phyclk_sel1",
  902. mout_fsys1_group_p, MUX_SEL_FSYS10, 16, 2),
  903. MUX(0, "mout_fsys1_phyclk_sel0", mout_fsys1_group_p,
  904. MUX_SEL_FSYS10, 20, 2),
  905. MUX(0, "mout_aclk_fsys1_200_user", mout_aclk_fsys1_200_user_p,
  906. MUX_SEL_FSYS10, 28, 1),
  907. MUX(0, "mout_sclk_mmc1_user", mout_sclk_mmc1_user_p,
  908. MUX_SEL_FSYS11, 24, 1),
  909. MUX(0, "mout_sclk_mmc0_user", mout_sclk_mmc0_user_p,
  910. MUX_SEL_FSYS11, 28, 1),
  911. MUX(0, "mout_sclk_ufsunipro20_user", mout_sclk_ufsunipro20_user_p,
  912. MUX_SEL_FSYS11, 20, 1),
  913. MUX(0, "mout_phyclk_ufs20_rx1_symbol_user",
  914. mout_phyclk_ufs20_rx1_user_p, MUX_SEL_FSYS12, 16, 1),
  915. MUX(0, "mout_phyclk_ufs20_rx0_symbol_user",
  916. mout_phyclk_ufs20_rx0_user_p, MUX_SEL_FSYS12, 24, 1),
  917. MUX(0, "mout_phyclk_ufs20_tx0_symbol_user",
  918. mout_phyclk_ufs20_tx0_user_p, MUX_SEL_FSYS12, 28, 1),
  919. };
  920. static const struct samsung_div_clock fsys1_div_clks[] __initconst = {
  921. DIV(DOUT_PCLK_FSYS1, "dout_pclk_fsys1", "mout_aclk_fsys1_200_user",
  922. DIV_FSYS1, 0, 2),
  923. };
  924. static const struct samsung_gate_clock fsys1_gate_clks[] __initconst = {
  925. GATE(SCLK_UFSUNIPRO20_USER, "sclk_ufsunipro20_user",
  926. "mout_sclk_ufsunipro20_user",
  927. ENABLE_SCLK_FSYS11, 20, 0, 0),
  928. GATE(ACLK_MMC1, "aclk_mmc1", "mout_aclk_fsys1_200_user",
  929. ENABLE_ACLK_FSYS1, 29, 0, 0),
  930. GATE(ACLK_MMC0, "aclk_mmc0", "mout_aclk_fsys1_200_user",
  931. ENABLE_ACLK_FSYS1, 30, 0, 0),
  932. GATE(ACLK_UFS20_LINK, "aclk_ufs20_link", "dout_pclk_fsys1",
  933. ENABLE_ACLK_FSYS1, 31, 0, 0),
  934. GATE(PCLK_GPIO_FSYS1, "pclk_gpio_fsys1", "mout_aclk_fsys1_200_user",
  935. ENABLE_PCLK_FSYS1, 30, 0, 0),
  936. GATE(PHYCLK_UFS20_RX1_SYMBOL_USER, "phyclk_ufs20_rx1_symbol_user",
  937. "mout_phyclk_ufs20_rx1_symbol_user",
  938. ENABLE_SCLK_FSYS12, 16, 0, 0),
  939. GATE(PHYCLK_UFS20_RX0_SYMBOL_USER, "phyclk_ufs20_rx0_symbol_user",
  940. "mout_phyclk_ufs20_rx0_symbol_user",
  941. ENABLE_SCLK_FSYS12, 24, 0, 0),
  942. GATE(PHYCLK_UFS20_TX0_SYMBOL_USER, "phyclk_ufs20_tx0_symbol_user",
  943. "mout_phyclk_ufs20_tx0_symbol_user",
  944. ENABLE_SCLK_FSYS12, 28, 0, 0),
  945. GATE(OSCCLK_PHY_CLKOUT_EMBEDDED_COMBO_PHY,
  946. "oscclk_phy_clkout_embedded_combo_phy",
  947. "fin_pll",
  948. ENABLE_SCLK_FSYS12, 4, CLK_IGNORE_UNUSED, 0),
  949. GATE(SCLK_COMBO_PHY_EMBEDDED_26M, "sclk_combo_phy_embedded_26m",
  950. "mout_fsys1_phyclk_sel1",
  951. ENABLE_SCLK_FSYS13, 24, CLK_IGNORE_UNUSED, 0),
  952. };
  953. static const struct samsung_cmu_info fsys1_cmu_info __initconst = {
  954. .fixed_clks = fixed_rate_clks_fsys1,
  955. .nr_fixed_clks = ARRAY_SIZE(fixed_rate_clks_fsys1),
  956. .mux_clks = fsys1_mux_clks,
  957. .nr_mux_clks = ARRAY_SIZE(fsys1_mux_clks),
  958. .div_clks = fsys1_div_clks,
  959. .nr_div_clks = ARRAY_SIZE(fsys1_div_clks),
  960. .gate_clks = fsys1_gate_clks,
  961. .nr_gate_clks = ARRAY_SIZE(fsys1_gate_clks),
  962. .nr_clk_ids = FSYS1_NR_CLK,
  963. .clk_regs = fsys1_clk_regs,
  964. .nr_clk_regs = ARRAY_SIZE(fsys1_clk_regs),
  965. };
  966. static void __init exynos7_clk_fsys1_init(struct device_node *np)
  967. {
  968. samsung_cmu_register_one(np, &fsys1_cmu_info);
  969. }
  970. CLK_OF_DECLARE(exynos7_clk_fsys1, "samsung,exynos7-clock-fsys1",
  971. exynos7_clk_fsys1_init);
  972. #define MUX_SEL_MSCL 0x0200
  973. #define DIV_MSCL 0x0600
  974. #define ENABLE_ACLK_MSCL 0x0800
  975. #define ENABLE_PCLK_MSCL 0x0900
  976. /* List of parent clocks for Muxes in CMU_MSCL */
  977. PNAME(mout_aclk_mscl_532_user_p) = { "fin_pll", "aclk_mscl_532" };
  978. static const unsigned long mscl_clk_regs[] __initconst = {
  979. MUX_SEL_MSCL,
  980. DIV_MSCL,
  981. ENABLE_ACLK_MSCL,
  982. ENABLE_PCLK_MSCL,
  983. };
  984. static const struct samsung_mux_clock mscl_mux_clks[] __initconst = {
  985. MUX(USERMUX_ACLK_MSCL_532, "usermux_aclk_mscl_532",
  986. mout_aclk_mscl_532_user_p, MUX_SEL_MSCL, 0, 1),
  987. };
  988. static const struct samsung_div_clock mscl_div_clks[] __initconst = {
  989. DIV(DOUT_PCLK_MSCL, "dout_pclk_mscl", "usermux_aclk_mscl_532",
  990. DIV_MSCL, 0, 3),
  991. };
  992. static const struct samsung_gate_clock mscl_gate_clks[] __initconst = {
  993. GATE(ACLK_MSCL_0, "aclk_mscl_0", "usermux_aclk_mscl_532",
  994. ENABLE_ACLK_MSCL, 31, 0, 0),
  995. GATE(ACLK_MSCL_1, "aclk_mscl_1", "usermux_aclk_mscl_532",
  996. ENABLE_ACLK_MSCL, 30, 0, 0),
  997. GATE(ACLK_JPEG, "aclk_jpeg", "usermux_aclk_mscl_532",
  998. ENABLE_ACLK_MSCL, 29, 0, 0),
  999. GATE(ACLK_G2D, "aclk_g2d", "usermux_aclk_mscl_532",
  1000. ENABLE_ACLK_MSCL, 28, 0, 0),
  1001. GATE(ACLK_LH_ASYNC_SI_MSCL_0, "aclk_lh_async_si_mscl_0",
  1002. "usermux_aclk_mscl_532",
  1003. ENABLE_ACLK_MSCL, 27, 0, 0),
  1004. GATE(ACLK_LH_ASYNC_SI_MSCL_1, "aclk_lh_async_si_mscl_1",
  1005. "usermux_aclk_mscl_532",
  1006. ENABLE_ACLK_MSCL, 26, 0, 0),
  1007. GATE(ACLK_XIU_MSCLX_0, "aclk_xiu_msclx_0", "usermux_aclk_mscl_532",
  1008. ENABLE_ACLK_MSCL, 25, 0, 0),
  1009. GATE(ACLK_XIU_MSCLX_1, "aclk_xiu_msclx_1", "usermux_aclk_mscl_532",
  1010. ENABLE_ACLK_MSCL, 24, 0, 0),
  1011. GATE(ACLK_AXI2ACEL_BRIDGE, "aclk_axi2acel_bridge",
  1012. "usermux_aclk_mscl_532",
  1013. ENABLE_ACLK_MSCL, 23, 0, 0),
  1014. GATE(ACLK_QE_MSCL_0, "aclk_qe_mscl_0", "usermux_aclk_mscl_532",
  1015. ENABLE_ACLK_MSCL, 22, 0, 0),
  1016. GATE(ACLK_QE_MSCL_1, "aclk_qe_mscl_1", "usermux_aclk_mscl_532",
  1017. ENABLE_ACLK_MSCL, 21, 0, 0),
  1018. GATE(ACLK_QE_JPEG, "aclk_qe_jpeg", "usermux_aclk_mscl_532",
  1019. ENABLE_ACLK_MSCL, 20, 0, 0),
  1020. GATE(ACLK_QE_G2D, "aclk_qe_g2d", "usermux_aclk_mscl_532",
  1021. ENABLE_ACLK_MSCL, 19, 0, 0),
  1022. GATE(ACLK_PPMU_MSCL_0, "aclk_ppmu_mscl_0", "usermux_aclk_mscl_532",
  1023. ENABLE_ACLK_MSCL, 18, 0, 0),
  1024. GATE(ACLK_PPMU_MSCL_1, "aclk_ppmu_mscl_1", "usermux_aclk_mscl_532",
  1025. ENABLE_ACLK_MSCL, 17, 0, 0),
  1026. GATE(ACLK_MSCLNP_133, "aclk_msclnp_133", "usermux_aclk_mscl_532",
  1027. ENABLE_ACLK_MSCL, 16, 0, 0),
  1028. GATE(ACLK_AHB2APB_MSCL0P, "aclk_ahb2apb_mscl0p",
  1029. "usermux_aclk_mscl_532",
  1030. ENABLE_ACLK_MSCL, 15, 0, 0),
  1031. GATE(ACLK_AHB2APB_MSCL1P, "aclk_ahb2apb_mscl1p",
  1032. "usermux_aclk_mscl_532",
  1033. ENABLE_ACLK_MSCL, 14, 0, 0),
  1034. GATE(PCLK_MSCL_0, "pclk_mscl_0", "dout_pclk_mscl",
  1035. ENABLE_PCLK_MSCL, 31, 0, 0),
  1036. GATE(PCLK_MSCL_1, "pclk_mscl_1", "dout_pclk_mscl",
  1037. ENABLE_PCLK_MSCL, 30, 0, 0),
  1038. GATE(PCLK_JPEG, "pclk_jpeg", "dout_pclk_mscl",
  1039. ENABLE_PCLK_MSCL, 29, 0, 0),
  1040. GATE(PCLK_G2D, "pclk_g2d", "dout_pclk_mscl",
  1041. ENABLE_PCLK_MSCL, 28, 0, 0),
  1042. GATE(PCLK_QE_MSCL_0, "pclk_qe_mscl_0", "dout_pclk_mscl",
  1043. ENABLE_PCLK_MSCL, 27, 0, 0),
  1044. GATE(PCLK_QE_MSCL_1, "pclk_qe_mscl_1", "dout_pclk_mscl",
  1045. ENABLE_PCLK_MSCL, 26, 0, 0),
  1046. GATE(PCLK_QE_JPEG, "pclk_qe_jpeg", "dout_pclk_mscl",
  1047. ENABLE_PCLK_MSCL, 25, 0, 0),
  1048. GATE(PCLK_QE_G2D, "pclk_qe_g2d", "dout_pclk_mscl",
  1049. ENABLE_PCLK_MSCL, 24, 0, 0),
  1050. GATE(PCLK_PPMU_MSCL_0, "pclk_ppmu_mscl_0", "dout_pclk_mscl",
  1051. ENABLE_PCLK_MSCL, 23, 0, 0),
  1052. GATE(PCLK_PPMU_MSCL_1, "pclk_ppmu_mscl_1", "dout_pclk_mscl",
  1053. ENABLE_PCLK_MSCL, 22, 0, 0),
  1054. GATE(PCLK_AXI2ACEL_BRIDGE, "pclk_axi2acel_bridge", "dout_pclk_mscl",
  1055. ENABLE_PCLK_MSCL, 21, 0, 0),
  1056. GATE(PCLK_PMU_MSCL, "pclk_pmu_mscl", "dout_pclk_mscl",
  1057. ENABLE_PCLK_MSCL, 20, 0, 0),
  1058. };
  1059. static const struct samsung_cmu_info mscl_cmu_info __initconst = {
  1060. .mux_clks = mscl_mux_clks,
  1061. .nr_mux_clks = ARRAY_SIZE(mscl_mux_clks),
  1062. .div_clks = mscl_div_clks,
  1063. .nr_div_clks = ARRAY_SIZE(mscl_div_clks),
  1064. .gate_clks = mscl_gate_clks,
  1065. .nr_gate_clks = ARRAY_SIZE(mscl_gate_clks),
  1066. .nr_clk_ids = MSCL_NR_CLK,
  1067. .clk_regs = mscl_clk_regs,
  1068. .nr_clk_regs = ARRAY_SIZE(mscl_clk_regs),
  1069. };
  1070. static void __init exynos7_clk_mscl_init(struct device_node *np)
  1071. {
  1072. samsung_cmu_register_one(np, &mscl_cmu_info);
  1073. }
  1074. CLK_OF_DECLARE(exynos7_clk_mscl, "samsung,exynos7-clock-mscl",
  1075. exynos7_clk_mscl_init);
  1076. /* Register Offset definitions for CMU_AUD (0x114C0000) */
  1077. #define MUX_SEL_AUD 0x0200
  1078. #define DIV_AUD0 0x0600
  1079. #define DIV_AUD1 0x0604
  1080. #define ENABLE_ACLK_AUD 0x0800
  1081. #define ENABLE_PCLK_AUD 0x0900
  1082. #define ENABLE_SCLK_AUD 0x0A00
  1083. /*
  1084. * List of parent clocks for Muxes in CMU_AUD
  1085. */
  1086. PNAME(mout_aud_pll_user_p) = { "fin_pll", "fout_aud_pll" };
  1087. PNAME(mout_aud_group_p) = { "dout_aud_cdclk", "ioclk_audiocdclk0" };
  1088. static const unsigned long aud_clk_regs[] __initconst = {
  1089. MUX_SEL_AUD,
  1090. DIV_AUD0,
  1091. DIV_AUD1,
  1092. ENABLE_ACLK_AUD,
  1093. ENABLE_PCLK_AUD,
  1094. ENABLE_SCLK_AUD,
  1095. };
  1096. static const struct samsung_mux_clock aud_mux_clks[] __initconst = {
  1097. MUX(0, "mout_sclk_i2s", mout_aud_group_p, MUX_SEL_AUD, 12, 1),
  1098. MUX(0, "mout_sclk_pcm", mout_aud_group_p, MUX_SEL_AUD, 16, 1),
  1099. MUX(0, "mout_aud_pll_user", mout_aud_pll_user_p, MUX_SEL_AUD, 20, 1),
  1100. };
  1101. static const struct samsung_div_clock aud_div_clks[] __initconst = {
  1102. DIV(0, "dout_aud_ca5", "mout_aud_pll_user", DIV_AUD0, 0, 4),
  1103. DIV(0, "dout_aclk_aud", "dout_aud_ca5", DIV_AUD0, 4, 4),
  1104. DIV(0, "dout_aud_pclk_dbg", "dout_aud_ca5", DIV_AUD0, 8, 4),
  1105. DIV(0, "dout_sclk_i2s", "mout_sclk_i2s", DIV_AUD1, 0, 4),
  1106. DIV(0, "dout_sclk_pcm", "mout_sclk_pcm", DIV_AUD1, 4, 8),
  1107. DIV(0, "dout_sclk_uart", "dout_aud_cdclk", DIV_AUD1, 12, 4),
  1108. DIV(0, "dout_sclk_slimbus", "dout_aud_cdclk", DIV_AUD1, 16, 5),
  1109. DIV(0, "dout_aud_cdclk", "mout_aud_pll_user", DIV_AUD1, 24, 4),
  1110. };
  1111. static const struct samsung_gate_clock aud_gate_clks[] __initconst = {
  1112. GATE(SCLK_PCM, "sclk_pcm", "dout_sclk_pcm",
  1113. ENABLE_SCLK_AUD, 27, CLK_SET_RATE_PARENT, 0),
  1114. GATE(SCLK_I2S, "sclk_i2s", "dout_sclk_i2s",
  1115. ENABLE_SCLK_AUD, 28, CLK_SET_RATE_PARENT, 0),
  1116. GATE(0, "sclk_uart", "dout_sclk_uart", ENABLE_SCLK_AUD, 29, 0, 0),
  1117. GATE(0, "sclk_slimbus", "dout_sclk_slimbus",
  1118. ENABLE_SCLK_AUD, 30, 0, 0),
  1119. GATE(0, "pclk_dbg_aud", "dout_aud_pclk_dbg", ENABLE_PCLK_AUD, 19, 0, 0),
  1120. GATE(0, "pclk_gpio_aud", "dout_aclk_aud", ENABLE_PCLK_AUD, 20, 0, 0),
  1121. GATE(0, "pclk_wdt1", "dout_aclk_aud", ENABLE_PCLK_AUD, 22, 0, 0),
  1122. GATE(0, "pclk_wdt0", "dout_aclk_aud", ENABLE_PCLK_AUD, 23, 0, 0),
  1123. GATE(0, "pclk_slimbus", "dout_aclk_aud", ENABLE_PCLK_AUD, 24, 0, 0),
  1124. GATE(0, "pclk_uart", "dout_aclk_aud", ENABLE_PCLK_AUD, 25, 0, 0),
  1125. GATE(PCLK_PCM, "pclk_pcm", "dout_aclk_aud",
  1126. ENABLE_PCLK_AUD, 26, CLK_SET_RATE_PARENT, 0),
  1127. GATE(PCLK_I2S, "pclk_i2s", "dout_aclk_aud",
  1128. ENABLE_PCLK_AUD, 27, CLK_SET_RATE_PARENT, 0),
  1129. GATE(0, "pclk_timer", "dout_aclk_aud", ENABLE_PCLK_AUD, 28, 0, 0),
  1130. GATE(0, "pclk_smmu_aud", "dout_aclk_aud", ENABLE_PCLK_AUD, 31, 0, 0),
  1131. GATE(0, "aclk_smmu_aud", "dout_aclk_aud", ENABLE_ACLK_AUD, 27, 0, 0),
  1132. GATE(0, "aclk_acel_lh_async_si_top", "dout_aclk_aud",
  1133. ENABLE_ACLK_AUD, 28, 0, 0),
  1134. GATE(ACLK_ADMA, "aclk_dmac", "dout_aclk_aud", ENABLE_ACLK_AUD, 31, 0, 0),
  1135. };
  1136. static const struct samsung_cmu_info aud_cmu_info __initconst = {
  1137. .mux_clks = aud_mux_clks,
  1138. .nr_mux_clks = ARRAY_SIZE(aud_mux_clks),
  1139. .div_clks = aud_div_clks,
  1140. .nr_div_clks = ARRAY_SIZE(aud_div_clks),
  1141. .gate_clks = aud_gate_clks,
  1142. .nr_gate_clks = ARRAY_SIZE(aud_gate_clks),
  1143. .nr_clk_ids = AUD_NR_CLK,
  1144. .clk_regs = aud_clk_regs,
  1145. .nr_clk_regs = ARRAY_SIZE(aud_clk_regs),
  1146. };
  1147. static void __init exynos7_clk_aud_init(struct device_node *np)
  1148. {
  1149. samsung_cmu_register_one(np, &aud_cmu_info);
  1150. }
  1151. CLK_OF_DECLARE(exynos7_clk_aud, "samsung,exynos7-clock-aud",
  1152. exynos7_clk_aud_init);