tegra30_clocks_data.c 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425
  1. /*
  2. * arch/arm/mach-tegra/tegra30_clocks.c
  3. *
  4. * Copyright (c) 2010-2012 NVIDIA CORPORATION. All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; version 2 of the License.
  9. *
  10. * This program is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program; if not, write to the Free Software Foundation, Inc.,
  17. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. *
  19. */
  20. #include <linux/clk-private.h>
  21. #include <linux/kernel.h>
  22. #include <linux/module.h>
  23. #include <linux/list.h>
  24. #include <linux/spinlock.h>
  25. #include <linux/delay.h>
  26. #include <linux/err.h>
  27. #include <linux/io.h>
  28. #include <linux/clk.h>
  29. #include <linux/cpufreq.h>
  30. #include "clock.h"
  31. #include "fuse.h"
  32. #include "tegra30_clocks.h"
  33. #include "tegra_cpu_car.h"
  34. #define DEFINE_CLK_TEGRA(_name, _rate, _ops, _flags, \
  35. _parent_names, _parents, _parent) \
  36. static struct clk tegra_##_name = { \
  37. .hw = &tegra_##_name##_hw.hw, \
  38. .name = #_name, \
  39. .rate = _rate, \
  40. .ops = _ops, \
  41. .flags = _flags, \
  42. .parent_names = _parent_names, \
  43. .parents = _parents, \
  44. .num_parents = ARRAY_SIZE(_parent_names), \
  45. .parent = _parent, \
  46. };
  47. static struct clk tegra_clk_32k;
  48. static struct clk_tegra tegra_clk_32k_hw = {
  49. .hw = {
  50. .clk = &tegra_clk_32k,
  51. },
  52. .fixed_rate = 32768,
  53. };
  54. static struct clk tegra_clk_32k = {
  55. .name = "clk_32k",
  56. .hw = &tegra_clk_32k_hw.hw,
  57. .ops = &tegra30_clk_32k_ops,
  58. .flags = CLK_IS_ROOT,
  59. };
  60. static struct clk tegra_clk_m;
  61. static struct clk_tegra tegra_clk_m_hw = {
  62. .hw = {
  63. .clk = &tegra_clk_m,
  64. },
  65. .flags = ENABLE_ON_INIT,
  66. .reg = 0x1fc,
  67. .reg_shift = 28,
  68. .max_rate = 48000000,
  69. };
  70. static struct clk tegra_clk_m = {
  71. .name = "clk_m",
  72. .hw = &tegra_clk_m_hw.hw,
  73. .ops = &tegra30_clk_m_ops,
  74. .flags = CLK_IS_ROOT | CLK_IGNORE_UNUSED,
  75. };
  76. static const char *clk_m_div_parent_names[] = {
  77. "clk_m",
  78. };
  79. static struct clk *clk_m_div_parents[] = {
  80. &tegra_clk_m,
  81. };
  82. static struct clk tegra_clk_m_div2;
  83. static struct clk_tegra tegra_clk_m_div2_hw = {
  84. .hw = {
  85. .clk = &tegra_clk_m_div2,
  86. },
  87. .mul = 1,
  88. .div = 2,
  89. .max_rate = 24000000,
  90. };
  91. DEFINE_CLK_TEGRA(clk_m_div2, 0, &tegra_clk_m_div_ops, 0,
  92. clk_m_div_parent_names, clk_m_div_parents, &tegra_clk_m);
  93. static struct clk tegra_clk_m_div4;
  94. static struct clk_tegra tegra_clk_m_div4_hw = {
  95. .hw = {
  96. .clk = &tegra_clk_m_div4,
  97. },
  98. .mul = 1,
  99. .div = 4,
  100. .max_rate = 12000000,
  101. };
  102. DEFINE_CLK_TEGRA(clk_m_div4, 0, &tegra_clk_m_div_ops, 0,
  103. clk_m_div_parent_names, clk_m_div_parents, &tegra_clk_m);
  104. static struct clk tegra_pll_ref;
  105. static struct clk_tegra tegra_pll_ref_hw = {
  106. .hw = {
  107. .clk = &tegra_pll_ref,
  108. },
  109. .flags = ENABLE_ON_INIT,
  110. .max_rate = 26000000,
  111. };
  112. DEFINE_CLK_TEGRA(pll_ref, 0, &tegra_pll_ref_ops, 0, clk_m_div_parent_names,
  113. clk_m_div_parents, &tegra_clk_m);
  114. #define DEFINE_PLL(_name, _flags, _reg, _max_rate, _input_min, \
  115. _input_max, _cf_min, _cf_max, _vco_min, \
  116. _vco_max, _freq_table, _lock_delay, _ops, \
  117. _fixed_rate, _clk_cfg_ex, _parent) \
  118. static struct clk tegra_##_name; \
  119. static const char *_name##_parent_names[] = { \
  120. #_parent, \
  121. }; \
  122. static struct clk *_name##_parents[] = { \
  123. &tegra_##_parent, \
  124. }; \
  125. static struct clk_tegra tegra_##_name##_hw = { \
  126. .hw = { \
  127. .clk = &tegra_##_name, \
  128. }, \
  129. .flags = _flags, \
  130. .reg = _reg, \
  131. .max_rate = _max_rate, \
  132. .u.pll = { \
  133. .input_min = _input_min, \
  134. .input_max = _input_max, \
  135. .cf_min = _cf_min, \
  136. .cf_max = _cf_max, \
  137. .vco_min = _vco_min, \
  138. .vco_max = _vco_max, \
  139. .freq_table = _freq_table, \
  140. .lock_delay = _lock_delay, \
  141. .fixed_rate = _fixed_rate, \
  142. }, \
  143. .clk_cfg_ex = _clk_cfg_ex, \
  144. }; \
  145. DEFINE_CLK_TEGRA(_name, 0, &_ops, CLK_IGNORE_UNUSED, \
  146. _name##_parent_names, _name##_parents, \
  147. &tegra_##_parent);
  148. #define DEFINE_PLL_OUT(_name, _flags, _reg, _reg_shift, \
  149. _max_rate, _ops, _parent, _clk_flags) \
  150. static const char *_name##_parent_names[] = { \
  151. #_parent, \
  152. }; \
  153. static struct clk *_name##_parents[] = { \
  154. &tegra_##_parent, \
  155. }; \
  156. static struct clk tegra_##_name; \
  157. static struct clk_tegra tegra_##_name##_hw = { \
  158. .hw = { \
  159. .clk = &tegra_##_name, \
  160. }, \
  161. .flags = _flags, \
  162. .reg = _reg, \
  163. .max_rate = _max_rate, \
  164. .reg_shift = _reg_shift, \
  165. }; \
  166. DEFINE_CLK_TEGRA(_name, 0, &tegra30_pll_div_ops, \
  167. _clk_flags, _name##_parent_names, \
  168. _name##_parents, &tegra_##_parent);
  169. static struct clk_pll_freq_table tegra_pll_c_freq_table[] = {
  170. { 12000000, 1040000000, 520, 6, 1, 8},
  171. { 13000000, 1040000000, 480, 6, 1, 8},
  172. { 16800000, 1040000000, 495, 8, 1, 8}, /* actual: 1039.5 MHz */
  173. { 19200000, 1040000000, 325, 6, 1, 6},
  174. { 26000000, 1040000000, 520, 13, 1, 8},
  175. { 12000000, 832000000, 416, 6, 1, 8},
  176. { 13000000, 832000000, 832, 13, 1, 8},
  177. { 16800000, 832000000, 396, 8, 1, 8}, /* actual: 831.6 MHz */
  178. { 19200000, 832000000, 260, 6, 1, 8},
  179. { 26000000, 832000000, 416, 13, 1, 8},
  180. { 12000000, 624000000, 624, 12, 1, 8},
  181. { 13000000, 624000000, 624, 13, 1, 8},
  182. { 16800000, 600000000, 520, 14, 1, 8},
  183. { 19200000, 624000000, 520, 16, 1, 8},
  184. { 26000000, 624000000, 624, 26, 1, 8},
  185. { 12000000, 600000000, 600, 12, 1, 8},
  186. { 13000000, 600000000, 600, 13, 1, 8},
  187. { 16800000, 600000000, 500, 14, 1, 8},
  188. { 19200000, 600000000, 375, 12, 1, 6},
  189. { 26000000, 600000000, 600, 26, 1, 8},
  190. { 12000000, 520000000, 520, 12, 1, 8},
  191. { 13000000, 520000000, 520, 13, 1, 8},
  192. { 16800000, 520000000, 495, 16, 1, 8}, /* actual: 519.75 MHz */
  193. { 19200000, 520000000, 325, 12, 1, 6},
  194. { 26000000, 520000000, 520, 26, 1, 8},
  195. { 12000000, 416000000, 416, 12, 1, 8},
  196. { 13000000, 416000000, 416, 13, 1, 8},
  197. { 16800000, 416000000, 396, 16, 1, 8}, /* actual: 415.8 MHz */
  198. { 19200000, 416000000, 260, 12, 1, 6},
  199. { 26000000, 416000000, 416, 26, 1, 8},
  200. { 0, 0, 0, 0, 0, 0 },
  201. };
  202. DEFINE_PLL(pll_c, PLL_HAS_CPCON, 0x80, 1400000000, 2000000, 31000000, 1000000,
  203. 6000000, 20000000, 1400000000, tegra_pll_c_freq_table, 300,
  204. tegra30_pll_ops, 0, NULL, pll_ref);
  205. DEFINE_PLL_OUT(pll_c_out1, DIV_U71, 0x84, 0, 700000000,
  206. tegra30_pll_div_ops, pll_c, CLK_IGNORE_UNUSED);
  207. static struct clk_pll_freq_table tegra_pll_m_freq_table[] = {
  208. { 12000000, 666000000, 666, 12, 1, 8},
  209. { 13000000, 666000000, 666, 13, 1, 8},
  210. { 16800000, 666000000, 555, 14, 1, 8},
  211. { 19200000, 666000000, 555, 16, 1, 8},
  212. { 26000000, 666000000, 666, 26, 1, 8},
  213. { 12000000, 600000000, 600, 12, 1, 8},
  214. { 13000000, 600000000, 600, 13, 1, 8},
  215. { 16800000, 600000000, 500, 14, 1, 8},
  216. { 19200000, 600000000, 375, 12, 1, 6},
  217. { 26000000, 600000000, 600, 26, 1, 8},
  218. { 0, 0, 0, 0, 0, 0 },
  219. };
  220. DEFINE_PLL(pll_m, PLL_HAS_CPCON | PLLM, 0x90, 800000000, 2000000, 31000000,
  221. 1000000, 6000000, 20000000, 1200000000, tegra_pll_m_freq_table,
  222. 300, tegra30_pll_ops, 0, NULL, pll_ref);
  223. DEFINE_PLL_OUT(pll_m_out1, DIV_U71, 0x94, 0, 600000000,
  224. tegra30_pll_div_ops, pll_m, CLK_IGNORE_UNUSED);
  225. static struct clk_pll_freq_table tegra_pll_p_freq_table[] = {
  226. { 12000000, 216000000, 432, 12, 2, 8},
  227. { 13000000, 216000000, 432, 13, 2, 8},
  228. { 16800000, 216000000, 360, 14, 2, 8},
  229. { 19200000, 216000000, 360, 16, 2, 8},
  230. { 26000000, 216000000, 432, 26, 2, 8},
  231. { 0, 0, 0, 0, 0, 0 },
  232. };
  233. DEFINE_PLL(pll_p, ENABLE_ON_INIT | PLL_FIXED | PLL_HAS_CPCON, 0xa0, 432000000,
  234. 2000000, 31000000, 1000000, 6000000, 20000000, 1400000000,
  235. tegra_pll_p_freq_table, 300, tegra30_pll_ops, 408000000, NULL,
  236. pll_ref);
  237. DEFINE_PLL_OUT(pll_p_out1, ENABLE_ON_INIT | DIV_U71 | DIV_U71_FIXED, 0xa4,
  238. 0, 432000000, tegra30_pll_div_ops, pll_p, CLK_IGNORE_UNUSED);
  239. DEFINE_PLL_OUT(pll_p_out2, ENABLE_ON_INIT | DIV_U71 | DIV_U71_FIXED, 0xa4,
  240. 16, 432000000, tegra30_pll_div_ops, pll_p, CLK_IGNORE_UNUSED);
  241. DEFINE_PLL_OUT(pll_p_out3, ENABLE_ON_INIT | DIV_U71 | DIV_U71_FIXED, 0xa8,
  242. 0, 432000000, tegra30_pll_div_ops, pll_p, CLK_IGNORE_UNUSED);
  243. DEFINE_PLL_OUT(pll_p_out4, ENABLE_ON_INIT | DIV_U71 | DIV_U71_FIXED, 0xa8,
  244. 16, 432000000, tegra30_pll_div_ops, pll_p, CLK_IGNORE_UNUSED);
  245. static struct clk_pll_freq_table tegra_pll_a_freq_table[] = {
  246. { 9600000, 564480000, 294, 5, 1, 4},
  247. { 9600000, 552960000, 288, 5, 1, 4},
  248. { 9600000, 24000000, 5, 2, 1, 1},
  249. { 28800000, 56448000, 49, 25, 1, 1},
  250. { 28800000, 73728000, 64, 25, 1, 1},
  251. { 28800000, 24000000, 5, 6, 1, 1},
  252. { 0, 0, 0, 0, 0, 0 },
  253. };
  254. DEFINE_PLL(pll_a, PLL_HAS_CPCON, 0xb0, 700000000, 2000000, 31000000, 1000000,
  255. 6000000, 20000000, 1400000000, tegra_pll_a_freq_table,
  256. 300, tegra30_pll_ops, 0, NULL, pll_p_out1);
  257. DEFINE_PLL_OUT(pll_a_out0, DIV_U71, 0xb4, 0, 100000000, tegra30_pll_div_ops,
  258. pll_a, CLK_IGNORE_UNUSED);
  259. static struct clk_pll_freq_table tegra_pll_d_freq_table[] = {
  260. { 12000000, 216000000, 216, 12, 1, 4},
  261. { 13000000, 216000000, 216, 13, 1, 4},
  262. { 16800000, 216000000, 180, 14, 1, 4},
  263. { 19200000, 216000000, 180, 16, 1, 4},
  264. { 26000000, 216000000, 216, 26, 1, 4},
  265. { 12000000, 594000000, 594, 12, 1, 8},
  266. { 13000000, 594000000, 594, 13, 1, 8},
  267. { 16800000, 594000000, 495, 14, 1, 8},
  268. { 19200000, 594000000, 495, 16, 1, 8},
  269. { 26000000, 594000000, 594, 26, 1, 8},
  270. { 12000000, 1000000000, 1000, 12, 1, 12},
  271. { 13000000, 1000000000, 1000, 13, 1, 12},
  272. { 19200000, 1000000000, 625, 12, 1, 8},
  273. { 26000000, 1000000000, 1000, 26, 1, 12},
  274. { 0, 0, 0, 0, 0, 0 },
  275. };
  276. DEFINE_PLL(pll_d, PLL_HAS_CPCON | PLLD, 0xd0, 1000000000, 2000000, 40000000,
  277. 1000000, 6000000, 40000000, 1000000000, tegra_pll_d_freq_table,
  278. 1000, tegra30_pll_ops, 0, tegra30_plld_clk_cfg_ex, pll_ref);
  279. DEFINE_PLL_OUT(pll_d_out0, DIV_2 | PLLD, 0, 0, 500000000, tegra30_pll_div_ops,
  280. pll_d, CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED);
  281. DEFINE_PLL(pll_d2, PLL_HAS_CPCON | PLL_ALT_MISC_REG | PLLD, 0x4b8, 1000000000,
  282. 2000000, 40000000, 1000000, 6000000, 40000000, 1000000000,
  283. tegra_pll_d_freq_table, 1000, tegra30_pll_ops, 0, NULL,
  284. pll_ref);
  285. DEFINE_PLL_OUT(pll_d2_out0, DIV_2 | PLLD, 0, 0, 500000000, tegra30_pll_div_ops,
  286. pll_d2, CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED);
  287. static struct clk_pll_freq_table tegra_pll_u_freq_table[] = {
  288. { 12000000, 480000000, 960, 12, 2, 12},
  289. { 13000000, 480000000, 960, 13, 2, 12},
  290. { 16800000, 480000000, 400, 7, 2, 5},
  291. { 19200000, 480000000, 200, 4, 2, 3},
  292. { 26000000, 480000000, 960, 26, 2, 12},
  293. { 0, 0, 0, 0, 0, 0 },
  294. };
  295. DEFINE_PLL(pll_u, PLL_HAS_CPCON | PLLU, 0xc0, 480000000, 2000000, 40000000,
  296. 1000000, 6000000, 48000000, 960000000, tegra_pll_u_freq_table,
  297. 1000, tegra30_pll_ops, 0, NULL, pll_ref);
  298. static struct clk_pll_freq_table tegra_pll_x_freq_table[] = {
  299. /* 1.7 GHz */
  300. { 12000000, 1700000000, 850, 6, 1, 8},
  301. { 13000000, 1700000000, 915, 7, 1, 8}, /* actual: 1699.2 MHz */
  302. { 16800000, 1700000000, 708, 7, 1, 8}, /* actual: 1699.2 MHz */
  303. { 19200000, 1700000000, 885, 10, 1, 8}, /* actual: 1699.2 MHz */
  304. { 26000000, 1700000000, 850, 13, 1, 8},
  305. /* 1.6 GHz */
  306. { 12000000, 1600000000, 800, 6, 1, 8},
  307. { 13000000, 1600000000, 738, 6, 1, 8}, /* actual: 1599.0 MHz */
  308. { 16800000, 1600000000, 857, 9, 1, 8}, /* actual: 1599.7 MHz */
  309. { 19200000, 1600000000, 500, 6, 1, 8},
  310. { 26000000, 1600000000, 800, 13, 1, 8},
  311. /* 1.5 GHz */
  312. { 12000000, 1500000000, 750, 6, 1, 8},
  313. { 13000000, 1500000000, 923, 8, 1, 8}, /* actual: 1499.8 MHz */
  314. { 16800000, 1500000000, 625, 7, 1, 8},
  315. { 19200000, 1500000000, 625, 8, 1, 8},
  316. { 26000000, 1500000000, 750, 13, 1, 8},
  317. /* 1.4 GHz */
  318. { 12000000, 1400000000, 700, 6, 1, 8},
  319. { 13000000, 1400000000, 969, 9, 1, 8}, /* actual: 1399.7 MHz */
  320. { 16800000, 1400000000, 1000, 12, 1, 8},
  321. { 19200000, 1400000000, 875, 12, 1, 8},
  322. { 26000000, 1400000000, 700, 13, 1, 8},
  323. /* 1.3 GHz */
  324. { 12000000, 1300000000, 975, 9, 1, 8},
  325. { 13000000, 1300000000, 1000, 10, 1, 8},
  326. { 16800000, 1300000000, 928, 12, 1, 8}, /* actual: 1299.2 MHz */
  327. { 19200000, 1300000000, 812, 12, 1, 8}, /* actual: 1299.2 MHz */
  328. { 26000000, 1300000000, 650, 13, 1, 8},
  329. /* 1.2 GHz */
  330. { 12000000, 1200000000, 1000, 10, 1, 8},
  331. { 13000000, 1200000000, 923, 10, 1, 8}, /* actual: 1199.9 MHz */
  332. { 16800000, 1200000000, 1000, 14, 1, 8},
  333. { 19200000, 1200000000, 1000, 16, 1, 8},
  334. { 26000000, 1200000000, 600, 13, 1, 8},
  335. /* 1.1 GHz */
  336. { 12000000, 1100000000, 825, 9, 1, 8},
  337. { 13000000, 1100000000, 846, 10, 1, 8}, /* actual: 1099.8 MHz */
  338. { 16800000, 1100000000, 982, 15, 1, 8}, /* actual: 1099.8 MHz */
  339. { 19200000, 1100000000, 859, 15, 1, 8}, /* actual: 1099.5 MHz */
  340. { 26000000, 1100000000, 550, 13, 1, 8},
  341. /* 1 GHz */
  342. { 12000000, 1000000000, 1000, 12, 1, 8},
  343. { 13000000, 1000000000, 1000, 13, 1, 8},
  344. { 16800000, 1000000000, 833, 14, 1, 8}, /* actual: 999.6 MHz */
  345. { 19200000, 1000000000, 625, 12, 1, 8},
  346. { 26000000, 1000000000, 1000, 26, 1, 8},
  347. { 0, 0, 0, 0, 0, 0 },
  348. };
  349. DEFINE_PLL(pll_x, PLL_HAS_CPCON | PLL_ALT_MISC_REG | PLLX, 0xe0, 1700000000,
  350. 2000000, 31000000, 1000000, 6000000, 20000000, 1700000000,
  351. tegra_pll_x_freq_table, 300, tegra30_pll_ops, 0, NULL, pll_ref);
  352. DEFINE_PLL_OUT(pll_x_out0, DIV_2 | PLLX, 0, 0, 850000000, tegra30_pll_div_ops,
  353. pll_x, CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED);
  354. static struct clk_pll_freq_table tegra_pll_e_freq_table[] = {
  355. /* PLLE special case: use cpcon field to store cml divider value */
  356. { 12000000, 100000000, 150, 1, 18, 11},
  357. { 216000000, 100000000, 200, 18, 24, 13},
  358. { 0, 0, 0, 0, 0, 0 },
  359. };
  360. DEFINE_PLL(pll_e, PLL_ALT_MISC_REG, 0xe8, 100000000, 2000000, 216000000,
  361. 12000000, 12000000, 1200000000, 2400000000U,
  362. tegra_pll_e_freq_table, 300, tegra30_plle_ops, 100000000, NULL,
  363. pll_ref);
  364. static const char *mux_plle[] = {
  365. "pll_e",
  366. };
  367. static struct clk *mux_plle_p[] = {
  368. &tegra_pll_e,
  369. };
  370. static struct clk tegra_cml0;
  371. static struct clk_tegra tegra_cml0_hw = {
  372. .hw = {
  373. .clk = &tegra_cml0,
  374. },
  375. .reg = 0x48c,
  376. .fixed_rate = 100000000,
  377. .u.periph = {
  378. .clk_num = 0,
  379. },
  380. };
  381. DEFINE_CLK_TEGRA(cml0, 0, &tegra_cml_clk_ops, 0, mux_plle,
  382. mux_plle_p, &tegra_pll_e);
  383. static struct clk tegra_cml1;
  384. static struct clk_tegra tegra_cml1_hw = {
  385. .hw = {
  386. .clk = &tegra_cml1,
  387. },
  388. .reg = 0x48c,
  389. .fixed_rate = 100000000,
  390. .u.periph = {
  391. .clk_num = 1,
  392. },
  393. };
  394. DEFINE_CLK_TEGRA(cml1, 0, &tegra_cml_clk_ops, 0, mux_plle,
  395. mux_plle_p, &tegra_pll_e);
  396. static struct clk tegra_pciex;
  397. static struct clk_tegra tegra_pciex_hw = {
  398. .hw = {
  399. .clk = &tegra_pciex,
  400. },
  401. .reg = 0x48c,
  402. .fixed_rate = 100000000,
  403. .reset = tegra30_periph_clk_reset,
  404. .u.periph = {
  405. .clk_num = 74,
  406. },
  407. };
  408. DEFINE_CLK_TEGRA(pciex, 0, &tegra_pciex_clk_ops, 0, mux_plle,
  409. mux_plle_p, &tegra_pll_e);
  410. #define SYNC_SOURCE(_name) \
  411. static struct clk tegra_##_name##_sync; \
  412. static struct clk_tegra tegra_##_name##_sync_hw = { \
  413. .hw = { \
  414. .clk = &tegra_##_name##_sync, \
  415. }, \
  416. .max_rate = 24000000, \
  417. .fixed_rate = 24000000, \
  418. }; \
  419. static struct clk tegra_##_name##_sync = { \
  420. .name = #_name "_sync", \
  421. .hw = &tegra_##_name##_sync_hw.hw, \
  422. .ops = &tegra_sync_source_ops, \
  423. .flags = CLK_IS_ROOT, \
  424. };
  425. SYNC_SOURCE(spdif_in);
  426. SYNC_SOURCE(i2s0);
  427. SYNC_SOURCE(i2s1);
  428. SYNC_SOURCE(i2s2);
  429. SYNC_SOURCE(i2s3);
  430. SYNC_SOURCE(i2s4);
  431. SYNC_SOURCE(vimclk);
  432. static struct clk *tegra_sync_source_list[] = {
  433. &tegra_spdif_in_sync,
  434. &tegra_i2s0_sync,
  435. &tegra_i2s1_sync,
  436. &tegra_i2s2_sync,
  437. &tegra_i2s3_sync,
  438. &tegra_i2s4_sync,
  439. &tegra_vimclk_sync,
  440. };
  441. static const char *mux_audio_sync_clk[] = {
  442. "spdif_in_sync",
  443. "i2s0_sync",
  444. "i2s1_sync",
  445. "i2s2_sync",
  446. "i2s3_sync",
  447. "i2s4_sync",
  448. "vimclk_sync",
  449. };
  450. #define AUDIO_SYNC_CLK(_name, _index) \
  451. static struct clk tegra_##_name; \
  452. static struct clk_tegra tegra_##_name##_hw = { \
  453. .hw = { \
  454. .clk = &tegra_##_name, \
  455. }, \
  456. .max_rate = 24000000, \
  457. .reg = 0x4A0 + (_index) * 4, \
  458. }; \
  459. static struct clk tegra_##_name = { \
  460. .name = #_name, \
  461. .ops = &tegra30_audio_sync_clk_ops, \
  462. .hw = &tegra_##_name##_hw.hw, \
  463. .parent_names = mux_audio_sync_clk, \
  464. .parents = tegra_sync_source_list, \
  465. .num_parents = ARRAY_SIZE(mux_audio_sync_clk), \
  466. };
  467. AUDIO_SYNC_CLK(audio0, 0);
  468. AUDIO_SYNC_CLK(audio1, 1);
  469. AUDIO_SYNC_CLK(audio2, 2);
  470. AUDIO_SYNC_CLK(audio3, 3);
  471. AUDIO_SYNC_CLK(audio4, 4);
  472. AUDIO_SYNC_CLK(audio5, 5);
  473. static struct clk *tegra_clk_audio_list[] = {
  474. &tegra_audio0,
  475. &tegra_audio1,
  476. &tegra_audio2,
  477. &tegra_audio3,
  478. &tegra_audio4,
  479. &tegra_audio5, /* SPDIF */
  480. };
  481. #define AUDIO_SYNC_2X_CLK(_name, _index) \
  482. static const char *_name##_parent_names[] = { \
  483. "tegra_" #_name, \
  484. }; \
  485. static struct clk *_name##_parents[] = { \
  486. &tegra_##_name, \
  487. }; \
  488. static struct clk tegra_##_name##_2x; \
  489. static struct clk_tegra tegra_##_name##_2x_hw = { \
  490. .hw = { \
  491. .clk = &tegra_##_name##_2x, \
  492. }, \
  493. .flags = PERIPH_NO_RESET, \
  494. .max_rate = 48000000, \
  495. .reg = 0x49C, \
  496. .reg_shift = 24 + (_index), \
  497. .u.periph = { \
  498. .clk_num = 113 + (_index), \
  499. }, \
  500. }; \
  501. static struct clk tegra_##_name##_2x = { \
  502. .name = #_name "_2x", \
  503. .ops = &tegra30_clk_double_ops, \
  504. .hw = &tegra_##_name##_2x_hw.hw, \
  505. .parent_names = _name##_parent_names, \
  506. .parents = _name##_parents, \
  507. .parent = &tegra_##_name, \
  508. .num_parents = 1, \
  509. };
  510. AUDIO_SYNC_2X_CLK(audio0, 0);
  511. AUDIO_SYNC_2X_CLK(audio1, 1);
  512. AUDIO_SYNC_2X_CLK(audio2, 2);
  513. AUDIO_SYNC_2X_CLK(audio3, 3);
  514. AUDIO_SYNC_2X_CLK(audio4, 4);
  515. AUDIO_SYNC_2X_CLK(audio5, 5); /* SPDIF */
  516. static struct clk *tegra_clk_audio_2x_list[] = {
  517. &tegra_audio0_2x,
  518. &tegra_audio1_2x,
  519. &tegra_audio2_2x,
  520. &tegra_audio3_2x,
  521. &tegra_audio4_2x,
  522. &tegra_audio5_2x, /* SPDIF */
  523. };
  524. #define MUX_I2S_SPDIF(_id) \
  525. static const char *mux_pllaout0_##_id##_2x_pllp_clkm[] = { \
  526. "pll_a_out0", \
  527. #_id "_2x", \
  528. "pll_p", \
  529. "clk_m", \
  530. }; \
  531. static struct clk *mux_pllaout0_##_id##_2x_pllp_clkm_p[] = { \
  532. &tegra_pll_a_out0, \
  533. &tegra_##_id##_2x, \
  534. &tegra_pll_p, \
  535. &tegra_clk_m, \
  536. };
  537. MUX_I2S_SPDIF(audio0);
  538. MUX_I2S_SPDIF(audio1);
  539. MUX_I2S_SPDIF(audio2);
  540. MUX_I2S_SPDIF(audio3);
  541. MUX_I2S_SPDIF(audio4);
  542. MUX_I2S_SPDIF(audio5); /* SPDIF */
  543. static struct clk tegra_extern1;
  544. static struct clk tegra_extern2;
  545. static struct clk tegra_extern3;
  546. /* External clock outputs (through PMC) */
  547. #define MUX_EXTERN_OUT(_id) \
  548. static const char *mux_clkm_clkm2_clkm4_extern##_id[] = { \
  549. "clk_m", \
  550. "clk_m_div2", \
  551. "clk_m_div4", \
  552. "extern" #_id, \
  553. }; \
  554. static struct clk *mux_clkm_clkm2_clkm4_extern##_id##_p[] = { \
  555. &tegra_clk_m, \
  556. &tegra_clk_m_div2, \
  557. &tegra_clk_m_div4, \
  558. &tegra_extern##_id, \
  559. };
  560. MUX_EXTERN_OUT(1);
  561. MUX_EXTERN_OUT(2);
  562. MUX_EXTERN_OUT(3);
  563. #define CLK_OUT_CLK(_name, _index) \
  564. static struct clk tegra_##_name; \
  565. static struct clk_tegra tegra_##_name##_hw = { \
  566. .hw = { \
  567. .clk = &tegra_##_name, \
  568. }, \
  569. .lookup = { \
  570. .dev_id = #_name, \
  571. .con_id = "extern" #_index, \
  572. }, \
  573. .flags = MUX_CLK_OUT, \
  574. .fixed_rate = 216000000, \
  575. .reg = 0x1a8, \
  576. .u.periph = { \
  577. .clk_num = (_index - 1) * 8 + 2, \
  578. }, \
  579. }; \
  580. static struct clk tegra_##_name = { \
  581. .name = #_name, \
  582. .ops = &tegra_clk_out_ops, \
  583. .hw = &tegra_##_name##_hw.hw, \
  584. .parent_names = mux_clkm_clkm2_clkm4_extern##_index, \
  585. .parents = mux_clkm_clkm2_clkm4_extern##_index##_p, \
  586. .num_parents = ARRAY_SIZE(mux_clkm_clkm2_clkm4_extern##_index),\
  587. };
  588. CLK_OUT_CLK(clk_out_1, 1);
  589. CLK_OUT_CLK(clk_out_2, 2);
  590. CLK_OUT_CLK(clk_out_3, 3);
  591. static struct clk *tegra_clk_out_list[] = {
  592. &tegra_clk_out_1,
  593. &tegra_clk_out_2,
  594. &tegra_clk_out_3,
  595. };
  596. static const char *mux_sclk[] = {
  597. "clk_m",
  598. "pll_c_out1",
  599. "pll_p_out4",
  600. "pll_p_out3",
  601. "pll_p_out2",
  602. "dummy",
  603. "clk_32k",
  604. "pll_m_out1",
  605. };
  606. static struct clk *mux_sclk_p[] = {
  607. &tegra_clk_m,
  608. &tegra_pll_c_out1,
  609. &tegra_pll_p_out4,
  610. &tegra_pll_p_out3,
  611. &tegra_pll_p_out2,
  612. NULL,
  613. &tegra_clk_32k,
  614. &tegra_pll_m_out1,
  615. };
  616. static struct clk tegra_clk_sclk;
  617. static struct clk_tegra tegra_clk_sclk_hw = {
  618. .hw = {
  619. .clk = &tegra_clk_sclk,
  620. },
  621. .reg = 0x28,
  622. .max_rate = 334000000,
  623. .min_rate = 40000000,
  624. };
  625. static struct clk tegra_clk_sclk = {
  626. .name = "sclk",
  627. .ops = &tegra30_super_ops,
  628. .hw = &tegra_clk_sclk_hw.hw,
  629. .parent_names = mux_sclk,
  630. .parents = mux_sclk_p,
  631. .num_parents = ARRAY_SIZE(mux_sclk),
  632. };
  633. static const char *tegra_hclk_parent_names[] = {
  634. "tegra_sclk",
  635. };
  636. static struct clk *tegra_hclk_parents[] = {
  637. &tegra_clk_sclk,
  638. };
  639. static struct clk tegra_hclk;
  640. static struct clk_tegra tegra_hclk_hw = {
  641. .hw = {
  642. .clk = &tegra_hclk,
  643. },
  644. .flags = DIV_BUS,
  645. .reg = 0x30,
  646. .reg_shift = 4,
  647. .max_rate = 378000000,
  648. .min_rate = 12000000,
  649. };
  650. DEFINE_CLK_TEGRA(hclk, 0, &tegra30_bus_ops, 0, tegra_hclk_parent_names,
  651. tegra_hclk_parents, &tegra_clk_sclk);
  652. static const char *tegra_pclk_parent_names[] = {
  653. "tegra_hclk",
  654. };
  655. static struct clk *tegra_pclk_parents[] = {
  656. &tegra_hclk,
  657. };
  658. static struct clk tegra_pclk;
  659. static struct clk_tegra tegra_pclk_hw = {
  660. .hw = {
  661. .clk = &tegra_pclk,
  662. },
  663. .flags = DIV_BUS,
  664. .reg = 0x30,
  665. .reg_shift = 0,
  666. .max_rate = 167000000,
  667. .min_rate = 12000000,
  668. };
  669. DEFINE_CLK_TEGRA(pclk, 0, &tegra30_bus_ops, 0, tegra_pclk_parent_names,
  670. tegra_pclk_parents, &tegra_hclk);
  671. static const char *mux_blink[] = {
  672. "clk_32k",
  673. };
  674. static struct clk *mux_blink_p[] = {
  675. &tegra_clk_32k,
  676. };
  677. static struct clk tegra_clk_blink;
  678. static struct clk_tegra tegra_clk_blink_hw = {
  679. .hw = {
  680. .clk = &tegra_clk_blink,
  681. },
  682. .reg = 0x40,
  683. .max_rate = 32768,
  684. };
  685. static struct clk tegra_clk_blink = {
  686. .name = "blink",
  687. .ops = &tegra30_blink_clk_ops,
  688. .hw = &tegra_clk_blink_hw.hw,
  689. .parent = &tegra_clk_32k,
  690. .parent_names = mux_blink,
  691. .parents = mux_blink_p,
  692. .num_parents = ARRAY_SIZE(mux_blink),
  693. };
  694. static const char *mux_pllm_pllc_pllp_plla[] = {
  695. "pll_m",
  696. "pll_c",
  697. "pll_p",
  698. "pll_a_out0",
  699. };
  700. static const char *mux_pllp_pllc_pllm_clkm[] = {
  701. "pll_p",
  702. "pll_c",
  703. "pll_m",
  704. "clk_m",
  705. };
  706. static const char *mux_pllp_clkm[] = {
  707. "pll_p",
  708. "dummy",
  709. "dummy",
  710. "clk_m",
  711. };
  712. static const char *mux_pllp_plld_pllc_clkm[] = {
  713. "pll_p",
  714. "pll_d_out0",
  715. "pll_c",
  716. "clk_m",
  717. };
  718. static const char *mux_pllp_pllm_plld_plla_pllc_plld2_clkm[] = {
  719. "pll_p",
  720. "pll_m",
  721. "pll_d_out0",
  722. "pll_a_out0",
  723. "pll_c",
  724. "pll_d2_out0",
  725. "clk_m",
  726. };
  727. static const char *mux_plla_pllc_pllp_clkm[] = {
  728. "pll_a_out0",
  729. "dummy",
  730. "pll_p",
  731. "clk_m"
  732. };
  733. static const char *mux_pllp_pllc_clk32_clkm[] = {
  734. "pll_p",
  735. "pll_c",
  736. "clk_32k",
  737. "clk_m",
  738. };
  739. static const char *mux_pllp_pllc_clkm_clk32[] = {
  740. "pll_p",
  741. "pll_c",
  742. "clk_m",
  743. "clk_32k",
  744. };
  745. static const char *mux_pllp_pllc_pllm[] = {
  746. "pll_p",
  747. "pll_c",
  748. "pll_m",
  749. };
  750. static const char *mux_clk_m[] = {
  751. "clk_m",
  752. };
  753. static const char *mux_pllp_out3[] = {
  754. "pll_p_out3",
  755. };
  756. static const char *mux_plld_out0[] = {
  757. "pll_d_out0",
  758. };
  759. static const char *mux_plld_out0_plld2_out0[] = {
  760. "pll_d_out0",
  761. "pll_d2_out0",
  762. };
  763. static const char *mux_clk_32k[] = {
  764. "clk_32k",
  765. };
  766. static const char *mux_plla_clk32_pllp_clkm_plle[] = {
  767. "pll_a_out0",
  768. "clk_32k",
  769. "pll_p",
  770. "clk_m",
  771. "pll_e",
  772. };
  773. static const char *mux_cclk_g[] = {
  774. "clk_m",
  775. "pll_c",
  776. "clk_32k",
  777. "pll_m",
  778. "pll_p",
  779. "pll_p_out4",
  780. "pll_p_out3",
  781. "dummy",
  782. "pll_x",
  783. };
  784. static struct clk *mux_pllm_pllc_pllp_plla_p[] = {
  785. &tegra_pll_m,
  786. &tegra_pll_c,
  787. &tegra_pll_p,
  788. &tegra_pll_a_out0,
  789. };
  790. static struct clk *mux_pllp_pllc_pllm_clkm_p[] = {
  791. &tegra_pll_p,
  792. &tegra_pll_c,
  793. &tegra_pll_m,
  794. &tegra_clk_m,
  795. };
  796. static struct clk *mux_pllp_clkm_p[] = {
  797. &tegra_pll_p,
  798. NULL,
  799. NULL,
  800. &tegra_clk_m,
  801. };
  802. static struct clk *mux_pllp_plld_pllc_clkm_p[] = {
  803. &tegra_pll_p,
  804. &tegra_pll_d_out0,
  805. &tegra_pll_c,
  806. &tegra_clk_m,
  807. };
  808. static struct clk *mux_pllp_pllm_plld_plla_pllc_plld2_clkm_p[] = {
  809. &tegra_pll_p,
  810. &tegra_pll_m,
  811. &tegra_pll_d_out0,
  812. &tegra_pll_a_out0,
  813. &tegra_pll_c,
  814. &tegra_pll_d2_out0,
  815. &tegra_clk_m,
  816. };
  817. static struct clk *mux_plla_pllc_pllp_clkm_p[] = {
  818. &tegra_pll_a_out0,
  819. NULL,
  820. &tegra_pll_p,
  821. &tegra_clk_m,
  822. };
  823. static struct clk *mux_pllp_pllc_clk32_clkm_p[] = {
  824. &tegra_pll_p,
  825. &tegra_pll_c,
  826. &tegra_clk_32k,
  827. &tegra_clk_m,
  828. };
  829. static struct clk *mux_pllp_pllc_clkm_clk32_p[] = {
  830. &tegra_pll_p,
  831. &tegra_pll_c,
  832. &tegra_clk_m,
  833. &tegra_clk_32k,
  834. };
  835. static struct clk *mux_pllp_pllc_pllm_p[] = {
  836. &tegra_pll_p,
  837. &tegra_pll_c,
  838. &tegra_pll_m,
  839. };
  840. static struct clk *mux_clk_m_p[] = {
  841. &tegra_clk_m,
  842. };
  843. static struct clk *mux_pllp_out3_p[] = {
  844. &tegra_pll_p_out3,
  845. };
  846. static struct clk *mux_plld_out0_p[] = {
  847. &tegra_pll_d_out0,
  848. };
  849. static struct clk *mux_plld_out0_plld2_out0_p[] = {
  850. &tegra_pll_d_out0,
  851. &tegra_pll_d2_out0,
  852. };
  853. static struct clk *mux_clk_32k_p[] = {
  854. &tegra_clk_32k,
  855. };
  856. static struct clk *mux_plla_clk32_pllp_clkm_plle_p[] = {
  857. &tegra_pll_a_out0,
  858. &tegra_clk_32k,
  859. &tegra_pll_p,
  860. &tegra_clk_m,
  861. &tegra_pll_e,
  862. };
  863. static struct clk *mux_cclk_g_p[] = {
  864. &tegra_clk_m,
  865. &tegra_pll_c,
  866. &tegra_clk_32k,
  867. &tegra_pll_m,
  868. &tegra_pll_p,
  869. &tegra_pll_p_out4,
  870. &tegra_pll_p_out3,
  871. NULL,
  872. &tegra_pll_x,
  873. };
  874. static struct clk tegra_clk_cclk_g;
  875. static struct clk_tegra tegra_clk_cclk_g_hw = {
  876. .hw = {
  877. .clk = &tegra_clk_cclk_g,
  878. },
  879. .flags = DIV_U71 | DIV_U71_INT,
  880. .reg = 0x368,
  881. .max_rate = 1700000000,
  882. };
  883. static struct clk tegra_clk_cclk_g = {
  884. .name = "cclk_g",
  885. .ops = &tegra30_super_ops,
  886. .hw = &tegra_clk_cclk_g_hw.hw,
  887. .parent_names = mux_cclk_g,
  888. .parents = mux_cclk_g_p,
  889. .num_parents = ARRAY_SIZE(mux_cclk_g),
  890. };
  891. static const char *mux_twd[] = {
  892. "cclk_g",
  893. };
  894. static struct clk *mux_twd_p[] = {
  895. &tegra_clk_cclk_g,
  896. };
  897. static struct clk tegra30_clk_twd;
  898. static struct clk_tegra tegra30_clk_twd_hw = {
  899. .hw = {
  900. .clk = &tegra30_clk_twd,
  901. },
  902. .max_rate = 1400000000,
  903. .mul = 1,
  904. .div = 2,
  905. };
  906. static struct clk tegra30_clk_twd = {
  907. .name = "twd",
  908. .ops = &tegra30_twd_ops,
  909. .hw = &tegra30_clk_twd_hw.hw,
  910. .parent = &tegra_clk_cclk_g,
  911. .parent_names = mux_twd,
  912. .parents = mux_twd_p,
  913. .num_parents = ARRAY_SIZE(mux_twd),
  914. };
  915. #define PERIPH_CLK(_name, _dev, _con, _clk_num, _reg, \
  916. _max, _inputs, _flags) \
  917. static struct clk tegra_##_name; \
  918. static struct clk_tegra tegra_##_name##_hw = { \
  919. .hw = { \
  920. .clk = &tegra_##_name, \
  921. }, \
  922. .lookup = { \
  923. .dev_id = _dev, \
  924. .con_id = _con, \
  925. }, \
  926. .reg = _reg, \
  927. .flags = _flags, \
  928. .max_rate = _max, \
  929. .u.periph = { \
  930. .clk_num = _clk_num, \
  931. }, \
  932. .reset = &tegra30_periph_clk_reset, \
  933. }; \
  934. static struct clk tegra_##_name = { \
  935. .name = #_name, \
  936. .ops = &tegra30_periph_clk_ops, \
  937. .hw = &tegra_##_name##_hw.hw, \
  938. .parent_names = _inputs, \
  939. .parents = _inputs##_p, \
  940. .num_parents = ARRAY_SIZE(_inputs), \
  941. };
  942. PERIPH_CLK(apbdma, "tegra-apbdma", NULL, 34, 0, 26000000, mux_clk_m, 0);
  943. PERIPH_CLK(rtc, "rtc-tegra", NULL, 4, 0, 32768, mux_clk_32k, PERIPH_NO_RESET | PERIPH_ON_APB);
  944. PERIPH_CLK(kbc, "tegra-kbc", NULL, 36, 0, 32768, mux_clk_32k, PERIPH_NO_RESET | PERIPH_ON_APB);
  945. PERIPH_CLK(timer, "timer", NULL, 5, 0, 26000000, mux_clk_m, 0);
  946. PERIPH_CLK(kfuse, "kfuse-tegra", NULL, 40, 0, 26000000, mux_clk_m, 0);
  947. PERIPH_CLK(fuse, "fuse-tegra", "fuse", 39, 0, 26000000, mux_clk_m, PERIPH_ON_APB);
  948. PERIPH_CLK(fuse_burn, "fuse-tegra", "fuse_burn", 39, 0, 26000000, mux_clk_m, PERIPH_ON_APB);
  949. PERIPH_CLK(apbif, "tegra30-ahub", "apbif", 107, 0, 26000000, mux_clk_m, 0);
  950. PERIPH_CLK(i2s0, "tegra30-i2s.0", NULL, 30, 0x1d8, 26000000, mux_pllaout0_audio0_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  951. PERIPH_CLK(i2s1, "tegra30-i2s.1", NULL, 11, 0x100, 26000000, mux_pllaout0_audio1_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  952. PERIPH_CLK(i2s2, "tegra30-i2s.2", NULL, 18, 0x104, 26000000, mux_pllaout0_audio2_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  953. PERIPH_CLK(i2s3, "tegra30-i2s.3", NULL, 101, 0x3bc, 26000000, mux_pllaout0_audio3_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  954. PERIPH_CLK(i2s4, "tegra30-i2s.4", NULL, 102, 0x3c0, 26000000, mux_pllaout0_audio4_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  955. PERIPH_CLK(spdif_out, "tegra30-spdif", "spdif_out", 10, 0x108, 100000000, mux_pllaout0_audio5_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  956. PERIPH_CLK(spdif_in, "tegra30-spdif", "spdif_in", 10, 0x10c, 100000000, mux_pllp_pllc_pllm, MUX | DIV_U71 | PERIPH_ON_APB);
  957. PERIPH_CLK(pwm, "tegra-pwm", NULL, 17, 0x110, 432000000, mux_pllp_pllc_clk32_clkm, MUX | MUX_PWM | DIV_U71 | PERIPH_ON_APB);
  958. PERIPH_CLK(d_audio, "tegra30-ahub", "d_audio", 106, 0x3d0, 48000000, mux_plla_pllc_pllp_clkm, MUX | DIV_U71);
  959. PERIPH_CLK(dam0, "tegra30-dam.0", NULL, 108, 0x3d8, 48000000, mux_plla_pllc_pllp_clkm, MUX | DIV_U71);
  960. PERIPH_CLK(dam1, "tegra30-dam.1", NULL, 109, 0x3dc, 48000000, mux_plla_pllc_pllp_clkm, MUX | DIV_U71);
  961. PERIPH_CLK(dam2, "tegra30-dam.2", NULL, 110, 0x3e0, 48000000, mux_plla_pllc_pllp_clkm, MUX | DIV_U71);
  962. PERIPH_CLK(hda, "tegra30-hda", "hda", 125, 0x428, 108000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71);
  963. PERIPH_CLK(hda2codec_2x, "tegra30-hda", "hda2codec", 111, 0x3e4, 48000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71);
  964. PERIPH_CLK(hda2hdmi, "tegra30-hda", "hda2hdmi", 128, 0, 48000000, mux_clk_m, 0);
  965. PERIPH_CLK(sbc1, "spi_tegra.0", NULL, 41, 0x134, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  966. PERIPH_CLK(sbc2, "spi_tegra.1", NULL, 44, 0x118, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  967. PERIPH_CLK(sbc3, "spi_tegra.2", NULL, 46, 0x11c, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  968. PERIPH_CLK(sbc4, "spi_tegra.3", NULL, 68, 0x1b4, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  969. PERIPH_CLK(sbc5, "spi_tegra.4", NULL, 104, 0x3c8, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  970. PERIPH_CLK(sbc6, "spi_tegra.5", NULL, 105, 0x3cc, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  971. PERIPH_CLK(sata_oob, "tegra_sata_oob", NULL, 123, 0x420, 216000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71);
  972. PERIPH_CLK(sata, "tegra_sata", NULL, 124, 0x424, 216000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71);
  973. PERIPH_CLK(sata_cold, "tegra_sata_cold", NULL, 129, 0, 48000000, mux_clk_m, 0);
  974. PERIPH_CLK(ndflash, "tegra_nand", NULL, 13, 0x160, 240000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71);
  975. PERIPH_CLK(ndspeed, "tegra_nand_speed", NULL, 80, 0x3f8, 240000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71);
  976. PERIPH_CLK(vfir, "vfir", NULL, 7, 0x168, 72000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  977. PERIPH_CLK(sdmmc1, "sdhci-tegra.0", NULL, 14, 0x150, 208000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* scales with voltage */
  978. PERIPH_CLK(sdmmc2, "sdhci-tegra.1", NULL, 9, 0x154, 104000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* scales with voltage */
  979. PERIPH_CLK(sdmmc3, "sdhci-tegra.2", NULL, 69, 0x1bc, 208000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* scales with voltage */
  980. PERIPH_CLK(sdmmc4, "sdhci-tegra.3", NULL, 15, 0x164, 104000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* scales with voltage */
  981. PERIPH_CLK(vcp, "tegra-avp", "vcp", 29, 0, 250000000, mux_clk_m, 0);
  982. PERIPH_CLK(bsea, "tegra-avp", "bsea", 62, 0, 250000000, mux_clk_m, 0);
  983. PERIPH_CLK(bsev, "tegra-aes", "bsev", 63, 0, 250000000, mux_clk_m, 0);
  984. PERIPH_CLK(vde, "vde", NULL, 61, 0x1c8, 520000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_INT);
  985. PERIPH_CLK(csite, "csite", NULL, 73, 0x1d4, 144000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* max rate ??? */
  986. PERIPH_CLK(la, "la", NULL, 76, 0x1f8, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71);
  987. PERIPH_CLK(owr, "tegra_w1", NULL, 71, 0x1cc, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  988. PERIPH_CLK(nor, "nor", NULL, 42, 0x1d0, 127000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* requires min voltage */
  989. PERIPH_CLK(mipi, "mipi", NULL, 50, 0x174, 60000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB); /* scales with voltage */
  990. PERIPH_CLK(i2c1, "tegra-i2c.0", "div-clk", 12, 0x124, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB);
  991. PERIPH_CLK(i2c2, "tegra-i2c.1", "div-clk", 54, 0x198, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB);
  992. PERIPH_CLK(i2c3, "tegra-i2c.2", "div-clk", 67, 0x1b8, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB);
  993. PERIPH_CLK(i2c4, "tegra-i2c.3", "div-clk", 103, 0x3c4, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB);
  994. PERIPH_CLK(i2c5, "tegra-i2c.4", "div-clk", 47, 0x128, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB);
  995. PERIPH_CLK(uarta, "tegra-uart.0", NULL, 6, 0x178, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB);
  996. PERIPH_CLK(uartb, "tegra-uart.1", NULL, 7, 0x17c, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB);
  997. PERIPH_CLK(uartc, "tegra-uart.2", NULL, 55, 0x1a0, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB);
  998. PERIPH_CLK(uartd, "tegra-uart.3", NULL, 65, 0x1c0, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB);
  999. PERIPH_CLK(uarte, "tegra-uart.4", NULL, 66, 0x1c4, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB);
  1000. PERIPH_CLK(vi, "tegra_camera", "vi", 20, 0x148, 425000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT);
  1001. PERIPH_CLK(3d, "3d", NULL, 24, 0x158, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT | DIV_U71_IDLE | PERIPH_MANUAL_RESET);
  1002. PERIPH_CLK(3d2, "3d2", NULL, 98, 0x3b0, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT | DIV_U71_IDLE | PERIPH_MANUAL_RESET);
  1003. PERIPH_CLK(2d, "2d", NULL, 21, 0x15c, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT | DIV_U71_IDLE);
  1004. PERIPH_CLK(vi_sensor, "tegra_camera", "vi_sensor", 20, 0x1a8, 150000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | PERIPH_NO_RESET);
  1005. PERIPH_CLK(epp, "epp", NULL, 19, 0x16c, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT);
  1006. PERIPH_CLK(mpe, "mpe", NULL, 60, 0x170, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT);
  1007. PERIPH_CLK(host1x, "host1x", NULL, 28, 0x180, 260000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT);
  1008. PERIPH_CLK(cve, "cve", NULL, 49, 0x140, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71); /* requires min voltage */
  1009. PERIPH_CLK(tvo, "tvo", NULL, 49, 0x188, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71); /* requires min voltage */
  1010. PERIPH_CLK(dtv, "dtv", NULL, 79, 0x1dc, 250000000, mux_clk_m, 0);
  1011. PERIPH_CLK(hdmi, "hdmi", NULL, 51, 0x18c, 148500000, mux_pllp_pllm_plld_plla_pllc_plld2_clkm, MUX | MUX8 | DIV_U71);
  1012. PERIPH_CLK(tvdac, "tvdac", NULL, 53, 0x194, 220000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71); /* requires min voltage */
  1013. PERIPH_CLK(disp1, "tegradc.0", NULL, 27, 0x138, 600000000, mux_pllp_pllm_plld_plla_pllc_plld2_clkm, MUX | MUX8);
  1014. PERIPH_CLK(disp2, "tegradc.1", NULL, 26, 0x13c, 600000000, mux_pllp_pllm_plld_plla_pllc_plld2_clkm, MUX | MUX8);
  1015. PERIPH_CLK(usbd, "fsl-tegra-udc", NULL, 22, 0, 480000000, mux_clk_m, 0); /* requires min voltage */
  1016. PERIPH_CLK(usb2, "tegra-ehci.1", NULL, 58, 0, 480000000, mux_clk_m, 0); /* requires min voltage */
  1017. PERIPH_CLK(usb3, "tegra-ehci.2", NULL, 59, 0, 480000000, mux_clk_m, 0); /* requires min voltage */
  1018. PERIPH_CLK(dsia, "tegradc.0", "dsia", 48, 0, 500000000, mux_plld_out0, 0);
  1019. PERIPH_CLK(csi, "tegra_camera", "csi", 52, 0, 102000000, mux_pllp_out3, 0);
  1020. PERIPH_CLK(isp, "tegra_camera", "isp", 23, 0, 150000000, mux_clk_m, 0); /* same frequency as VI */
  1021. PERIPH_CLK(csus, "tegra_camera", "csus", 92, 0, 150000000, mux_clk_m, PERIPH_NO_RESET);
  1022. PERIPH_CLK(tsensor, "tegra-tsensor", NULL, 100, 0x3b8, 216000000, mux_pllp_pllc_clkm_clk32, MUX | DIV_U71);
  1023. PERIPH_CLK(actmon, "actmon", NULL, 119, 0x3e8, 216000000, mux_pllp_pllc_clk32_clkm, MUX | DIV_U71);
  1024. PERIPH_CLK(extern1, "extern1", NULL, 120, 0x3ec, 216000000, mux_plla_clk32_pllp_clkm_plle, MUX | MUX8 | DIV_U71);
  1025. PERIPH_CLK(extern2, "extern2", NULL, 121, 0x3f0, 216000000, mux_plla_clk32_pllp_clkm_plle, MUX | MUX8 | DIV_U71);
  1026. PERIPH_CLK(extern3, "extern3", NULL, 122, 0x3f4, 216000000, mux_plla_clk32_pllp_clkm_plle, MUX | MUX8 | DIV_U71);
  1027. PERIPH_CLK(i2cslow, "i2cslow", NULL, 81, 0x3fc, 26000000, mux_pllp_pllc_clk32_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
  1028. PERIPH_CLK(pcie, "tegra-pcie", "pcie", 70, 0, 250000000, mux_clk_m, 0);
  1029. PERIPH_CLK(afi, "tegra-pcie", "afi", 72, 0, 250000000, mux_clk_m, 0);
  1030. PERIPH_CLK(se, "se", NULL, 127, 0x42c, 520000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_INT);
  1031. static struct clk tegra_dsib;
  1032. static struct clk_tegra tegra_dsib_hw = {
  1033. .hw = {
  1034. .clk = &tegra_dsib,
  1035. },
  1036. .lookup = {
  1037. .dev_id = "tegradc.1",
  1038. .con_id = "dsib",
  1039. },
  1040. .reg = 0xd0,
  1041. .flags = MUX | PLLD,
  1042. .max_rate = 500000000,
  1043. .u.periph = {
  1044. .clk_num = 82,
  1045. },
  1046. .reset = &tegra30_periph_clk_reset,
  1047. };
  1048. static struct clk tegra_dsib = {
  1049. .name = "dsib",
  1050. .ops = &tegra30_dsib_clk_ops,
  1051. .hw = &tegra_dsib_hw.hw,
  1052. .parent_names = mux_plld_out0_plld2_out0,
  1053. .parents = mux_plld_out0_plld2_out0_p,
  1054. .num_parents = ARRAY_SIZE(mux_plld_out0_plld2_out0),
  1055. };
  1056. struct clk *tegra_list_clks[] = {
  1057. &tegra_apbdma,
  1058. &tegra_rtc,
  1059. &tegra_kbc,
  1060. &tegra_timer,
  1061. &tegra_kfuse,
  1062. &tegra_fuse,
  1063. &tegra_fuse_burn,
  1064. &tegra_apbif,
  1065. &tegra_i2s0,
  1066. &tegra_i2s1,
  1067. &tegra_i2s2,
  1068. &tegra_i2s3,
  1069. &tegra_i2s4,
  1070. &tegra_spdif_out,
  1071. &tegra_spdif_in,
  1072. &tegra_pwm,
  1073. &tegra_d_audio,
  1074. &tegra_dam0,
  1075. &tegra_dam1,
  1076. &tegra_dam2,
  1077. &tegra_hda,
  1078. &tegra_hda2codec_2x,
  1079. &tegra_hda2hdmi,
  1080. &tegra_sbc1,
  1081. &tegra_sbc2,
  1082. &tegra_sbc3,
  1083. &tegra_sbc4,
  1084. &tegra_sbc5,
  1085. &tegra_sbc6,
  1086. &tegra_sata_oob,
  1087. &tegra_sata,
  1088. &tegra_sata_cold,
  1089. &tegra_ndflash,
  1090. &tegra_ndspeed,
  1091. &tegra_vfir,
  1092. &tegra_sdmmc1,
  1093. &tegra_sdmmc2,
  1094. &tegra_sdmmc3,
  1095. &tegra_sdmmc4,
  1096. &tegra_vcp,
  1097. &tegra_bsea,
  1098. &tegra_bsev,
  1099. &tegra_vde,
  1100. &tegra_csite,
  1101. &tegra_la,
  1102. &tegra_owr,
  1103. &tegra_nor,
  1104. &tegra_mipi,
  1105. &tegra_i2c1,
  1106. &tegra_i2c2,
  1107. &tegra_i2c3,
  1108. &tegra_i2c4,
  1109. &tegra_i2c5,
  1110. &tegra_uarta,
  1111. &tegra_uartb,
  1112. &tegra_uartc,
  1113. &tegra_uartd,
  1114. &tegra_uarte,
  1115. &tegra_vi,
  1116. &tegra_3d,
  1117. &tegra_3d2,
  1118. &tegra_2d,
  1119. &tegra_vi_sensor,
  1120. &tegra_epp,
  1121. &tegra_mpe,
  1122. &tegra_host1x,
  1123. &tegra_cve,
  1124. &tegra_tvo,
  1125. &tegra_dtv,
  1126. &tegra_hdmi,
  1127. &tegra_tvdac,
  1128. &tegra_disp1,
  1129. &tegra_disp2,
  1130. &tegra_usbd,
  1131. &tegra_usb2,
  1132. &tegra_usb3,
  1133. &tegra_dsia,
  1134. &tegra_dsib,
  1135. &tegra_csi,
  1136. &tegra_isp,
  1137. &tegra_csus,
  1138. &tegra_tsensor,
  1139. &tegra_actmon,
  1140. &tegra_extern1,
  1141. &tegra_extern2,
  1142. &tegra_extern3,
  1143. &tegra_i2cslow,
  1144. &tegra_pcie,
  1145. &tegra_afi,
  1146. &tegra_se,
  1147. };
  1148. #define CLK_DUPLICATE(_name, _dev, _con) \
  1149. { \
  1150. .name = _name, \
  1151. .lookup = { \
  1152. .dev_id = _dev, \
  1153. .con_id = _con, \
  1154. }, \
  1155. }
  1156. /* Some clocks may be used by different drivers depending on the board
  1157. * configuration. List those here to register them twice in the clock lookup
  1158. * table under two names.
  1159. */
  1160. struct clk_duplicate tegra_clk_duplicates[] = {
  1161. CLK_DUPLICATE("uarta", "serial8250.0", NULL),
  1162. CLK_DUPLICATE("uartb", "serial8250.1", NULL),
  1163. CLK_DUPLICATE("uartc", "serial8250.2", NULL),
  1164. CLK_DUPLICATE("uartd", "serial8250.3", NULL),
  1165. CLK_DUPLICATE("uarte", "serial8250.4", NULL),
  1166. CLK_DUPLICATE("usbd", "utmip-pad", NULL),
  1167. CLK_DUPLICATE("usbd", "tegra-ehci.0", NULL),
  1168. CLK_DUPLICATE("usbd", "tegra-otg", NULL),
  1169. CLK_DUPLICATE("dsib", "tegradc.0", "dsib"),
  1170. CLK_DUPLICATE("dsia", "tegradc.1", "dsia"),
  1171. CLK_DUPLICATE("bsev", "tegra-avp", "bsev"),
  1172. CLK_DUPLICATE("bsev", "nvavp", "bsev"),
  1173. CLK_DUPLICATE("vde", "tegra-aes", "vde"),
  1174. CLK_DUPLICATE("bsea", "tegra-aes", "bsea"),
  1175. CLK_DUPLICATE("bsea", "nvavp", "bsea"),
  1176. CLK_DUPLICATE("cml1", "tegra_sata_cml", NULL),
  1177. CLK_DUPLICATE("cml0", "tegra_pcie", "cml"),
  1178. CLK_DUPLICATE("pciex", "tegra_pcie", "pciex"),
  1179. CLK_DUPLICATE("i2c1", "tegra-i2c-slave.0", NULL),
  1180. CLK_DUPLICATE("i2c2", "tegra-i2c-slave.1", NULL),
  1181. CLK_DUPLICATE("i2c3", "tegra-i2c-slave.2", NULL),
  1182. CLK_DUPLICATE("i2c4", "tegra-i2c-slave.3", NULL),
  1183. CLK_DUPLICATE("i2c5", "tegra-i2c-slave.4", NULL),
  1184. CLK_DUPLICATE("sbc1", "spi_slave_tegra.0", NULL),
  1185. CLK_DUPLICATE("sbc2", "spi_slave_tegra.1", NULL),
  1186. CLK_DUPLICATE("sbc3", "spi_slave_tegra.2", NULL),
  1187. CLK_DUPLICATE("sbc4", "spi_slave_tegra.3", NULL),
  1188. CLK_DUPLICATE("sbc5", "spi_slave_tegra.4", NULL),
  1189. CLK_DUPLICATE("sbc6", "spi_slave_tegra.5", NULL),
  1190. CLK_DUPLICATE("twd", "smp_twd", NULL),
  1191. CLK_DUPLICATE("vcp", "nvavp", "vcp"),
  1192. CLK_DUPLICATE("i2s0", NULL, "i2s0"),
  1193. CLK_DUPLICATE("i2s1", NULL, "i2s1"),
  1194. CLK_DUPLICATE("i2s2", NULL, "i2s2"),
  1195. CLK_DUPLICATE("i2s3", NULL, "i2s3"),
  1196. CLK_DUPLICATE("i2s4", NULL, "i2s4"),
  1197. CLK_DUPLICATE("dam0", NULL, "dam0"),
  1198. CLK_DUPLICATE("dam1", NULL, "dam1"),
  1199. CLK_DUPLICATE("dam2", NULL, "dam2"),
  1200. CLK_DUPLICATE("spdif_in", NULL, "spdif_in"),
  1201. CLK_DUPLICATE("pll_p_out3", "tegra-i2c.0", "fast-clk"),
  1202. CLK_DUPLICATE("pll_p_out3", "tegra-i2c.1", "fast-clk"),
  1203. CLK_DUPLICATE("pll_p_out3", "tegra-i2c.2", "fast-clk"),
  1204. CLK_DUPLICATE("pll_p_out3", "tegra-i2c.3", "fast-clk"),
  1205. CLK_DUPLICATE("pll_p_out3", "tegra-i2c.4", "fast-clk"),
  1206. CLK_DUPLICATE("pll_p", "tegradc.0", "parent"),
  1207. CLK_DUPLICATE("pll_p", "tegradc.1", "parent"),
  1208. CLK_DUPLICATE("pll_d2_out0", "hdmi", "parent"),
  1209. };
  1210. struct clk *tegra_ptr_clks[] = {
  1211. &tegra_clk_32k,
  1212. &tegra_clk_m,
  1213. &tegra_clk_m_div2,
  1214. &tegra_clk_m_div4,
  1215. &tegra_pll_ref,
  1216. &tegra_pll_m,
  1217. &tegra_pll_m_out1,
  1218. &tegra_pll_c,
  1219. &tegra_pll_c_out1,
  1220. &tegra_pll_p,
  1221. &tegra_pll_p_out1,
  1222. &tegra_pll_p_out2,
  1223. &tegra_pll_p_out3,
  1224. &tegra_pll_p_out4,
  1225. &tegra_pll_a,
  1226. &tegra_pll_a_out0,
  1227. &tegra_pll_d,
  1228. &tegra_pll_d_out0,
  1229. &tegra_pll_d2,
  1230. &tegra_pll_d2_out0,
  1231. &tegra_pll_u,
  1232. &tegra_pll_x,
  1233. &tegra_pll_x_out0,
  1234. &tegra_pll_e,
  1235. &tegra_clk_cclk_g,
  1236. &tegra_cml0,
  1237. &tegra_cml1,
  1238. &tegra_pciex,
  1239. &tegra_clk_sclk,
  1240. &tegra_hclk,
  1241. &tegra_pclk,
  1242. &tegra_clk_blink,
  1243. &tegra30_clk_twd,
  1244. };
  1245. static void tegra30_init_one_clock(struct clk *c)
  1246. {
  1247. struct clk_tegra *clk = to_clk_tegra(c->hw);
  1248. __clk_init(NULL, c);
  1249. INIT_LIST_HEAD(&clk->shared_bus_list);
  1250. if (!clk->lookup.dev_id && !clk->lookup.con_id)
  1251. clk->lookup.con_id = c->name;
  1252. clk->lookup.clk = c;
  1253. clkdev_add(&clk->lookup);
  1254. tegra_clk_add(c);
  1255. }
  1256. void __init tegra30_init_clocks(void)
  1257. {
  1258. int i;
  1259. struct clk *c;
  1260. for (i = 0; i < ARRAY_SIZE(tegra_ptr_clks); i++)
  1261. tegra30_init_one_clock(tegra_ptr_clks[i]);
  1262. for (i = 0; i < ARRAY_SIZE(tegra_list_clks); i++)
  1263. tegra30_init_one_clock(tegra_list_clks[i]);
  1264. for (i = 0; i < ARRAY_SIZE(tegra_clk_duplicates); i++) {
  1265. c = tegra_get_clock_by_name(tegra_clk_duplicates[i].name);
  1266. if (!c) {
  1267. pr_err("%s: Unknown duplicate clock %s\n", __func__,
  1268. tegra_clk_duplicates[i].name);
  1269. continue;
  1270. }
  1271. tegra_clk_duplicates[i].lookup.clk = c;
  1272. clkdev_add(&tegra_clk_duplicates[i].lookup);
  1273. }
  1274. for (i = 0; i < ARRAY_SIZE(tegra_sync_source_list); i++)
  1275. tegra30_init_one_clock(tegra_sync_source_list[i]);
  1276. for (i = 0; i < ARRAY_SIZE(tegra_clk_audio_list); i++)
  1277. tegra30_init_one_clock(tegra_clk_audio_list[i]);
  1278. for (i = 0; i < ARRAY_SIZE(tegra_clk_audio_2x_list); i++)
  1279. tegra30_init_one_clock(tegra_clk_audio_2x_list[i]);
  1280. for (i = 0; i < ARRAY_SIZE(tegra_clk_out_list); i++)
  1281. tegra30_init_one_clock(tegra_clk_out_list[i]);
  1282. tegra30_cpu_car_ops_init();
  1283. }