clk-tegra124.c 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567
  1. /*
  2. * Copyright (c) 2012-2014 NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include <linux/io.h>
  17. #include <linux/clk.h>
  18. #include <linux/clk-provider.h>
  19. #include <linux/clkdev.h>
  20. #include <linux/of.h>
  21. #include <linux/of_address.h>
  22. #include <linux/delay.h>
  23. #include <linux/export.h>
  24. #include <linux/clk/tegra.h>
  25. #include <dt-bindings/clock/tegra124-car.h>
  26. #include "clk.h"
  27. #include "clk-id.h"
  28. /*
  29. * TEGRA124_CAR_BANK_COUNT: the number of peripheral clock register
  30. * banks present in the Tegra124/132 CAR IP block. The banks are
  31. * identified by single letters, e.g.: L, H, U, V, W, X. See
  32. * periph_regs[] in drivers/clk/tegra/clk.c
  33. */
  34. #define TEGRA124_CAR_BANK_COUNT 6
  35. #define CLK_SOURCE_CSITE 0x1d4
  36. #define CLK_SOURCE_EMC 0x19c
  37. #define PLLC_BASE 0x80
  38. #define PLLC_OUT 0x84
  39. #define PLLC_MISC2 0x88
  40. #define PLLC_MISC 0x8c
  41. #define PLLC2_BASE 0x4e8
  42. #define PLLC2_MISC 0x4ec
  43. #define PLLC3_BASE 0x4fc
  44. #define PLLC3_MISC 0x500
  45. #define PLLM_BASE 0x90
  46. #define PLLM_OUT 0x94
  47. #define PLLM_MISC 0x9c
  48. #define PLLP_BASE 0xa0
  49. #define PLLP_MISC 0xac
  50. #define PLLA_BASE 0xb0
  51. #define PLLA_MISC 0xbc
  52. #define PLLD_BASE 0xd0
  53. #define PLLD_MISC 0xdc
  54. #define PLLU_BASE 0xc0
  55. #define PLLU_MISC 0xcc
  56. #define PLLX_BASE 0xe0
  57. #define PLLX_MISC 0xe4
  58. #define PLLX_MISC2 0x514
  59. #define PLLX_MISC3 0x518
  60. #define PLLE_BASE 0xe8
  61. #define PLLE_MISC 0xec
  62. #define PLLD2_BASE 0x4b8
  63. #define PLLD2_MISC 0x4bc
  64. #define PLLE_AUX 0x48c
  65. #define PLLRE_BASE 0x4c4
  66. #define PLLRE_MISC 0x4c8
  67. #define PLLDP_BASE 0x590
  68. #define PLLDP_MISC 0x594
  69. #define PLLC4_BASE 0x5a4
  70. #define PLLC4_MISC 0x5a8
  71. #define PLLC_IDDQ_BIT 26
  72. #define PLLRE_IDDQ_BIT 16
  73. #define PLLSS_IDDQ_BIT 19
  74. #define PLL_BASE_LOCK BIT(27)
  75. #define PLLE_MISC_LOCK BIT(11)
  76. #define PLLRE_MISC_LOCK BIT(24)
  77. #define PLL_MISC_LOCK_ENABLE 18
  78. #define PLLC_MISC_LOCK_ENABLE 24
  79. #define PLLDU_MISC_LOCK_ENABLE 22
  80. #define PLLE_MISC_LOCK_ENABLE 9
  81. #define PLLRE_MISC_LOCK_ENABLE 30
  82. #define PLLSS_MISC_LOCK_ENABLE 30
  83. #define PLLXC_SW_MAX_P 6
  84. #define PMC_PLLM_WB0_OVERRIDE 0x1dc
  85. #define PMC_PLLM_WB0_OVERRIDE_2 0x2b0
  86. #define UTMIP_PLL_CFG2 0x488
  87. #define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6)
  88. #define UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(x) (((x) & 0x3f) << 18)
  89. #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN BIT(0)
  90. #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN BIT(2)
  91. #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN BIT(4)
  92. #define UTMIP_PLL_CFG1 0x484
  93. #define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 6)
  94. #define UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(x) (((x) & 0xfff) << 0)
  95. #define UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP BIT(17)
  96. #define UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN BIT(16)
  97. #define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP BIT(15)
  98. #define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN BIT(14)
  99. #define UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN BIT(12)
  100. #define UTMIPLL_HW_PWRDN_CFG0 0x52c
  101. #define UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE BIT(25)
  102. #define UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE BIT(24)
  103. #define UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET BIT(6)
  104. #define UTMIPLL_HW_PWRDN_CFG0_SEQ_RESET_INPUT_VALUE BIT(5)
  105. #define UTMIPLL_HW_PWRDN_CFG0_SEQ_IN_SWCTL BIT(4)
  106. #define UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL BIT(2)
  107. #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE BIT(1)
  108. #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL BIT(0)
  109. /* Tegra CPU clock and reset control regs */
  110. #define CLK_RST_CONTROLLER_CPU_CMPLX_STATUS 0x470
  111. #ifdef CONFIG_PM_SLEEP
  112. static struct cpu_clk_suspend_context {
  113. u32 clk_csite_src;
  114. } tegra124_cpu_clk_sctx;
  115. #endif
  116. static void __iomem *clk_base;
  117. static void __iomem *pmc_base;
  118. static unsigned long osc_freq;
  119. static unsigned long pll_ref_freq;
  120. static DEFINE_SPINLOCK(pll_d_lock);
  121. static DEFINE_SPINLOCK(pll_e_lock);
  122. static DEFINE_SPINLOCK(pll_re_lock);
  123. static DEFINE_SPINLOCK(pll_u_lock);
  124. static DEFINE_SPINLOCK(emc_lock);
  125. /* possible OSC frequencies in Hz */
  126. static unsigned long tegra124_input_freq[] = {
  127. [0] = 13000000,
  128. [1] = 16800000,
  129. [4] = 19200000,
  130. [5] = 38400000,
  131. [8] = 12000000,
  132. [9] = 48000000,
  133. [12] = 260000000,
  134. };
  135. static const char *mux_pllmcp_clkm[] = {
  136. "pll_m", "pll_c", "pll_p", "clk_m", "pll_m_ud", "pll_c2", "pll_c3",
  137. };
  138. #define mux_pllmcp_clkm_idx NULL
  139. static struct div_nmp pllxc_nmp = {
  140. .divm_shift = 0,
  141. .divm_width = 8,
  142. .divn_shift = 8,
  143. .divn_width = 8,
  144. .divp_shift = 20,
  145. .divp_width = 4,
  146. };
  147. static struct pdiv_map pllxc_p[] = {
  148. { .pdiv = 1, .hw_val = 0 },
  149. { .pdiv = 2, .hw_val = 1 },
  150. { .pdiv = 3, .hw_val = 2 },
  151. { .pdiv = 4, .hw_val = 3 },
  152. { .pdiv = 5, .hw_val = 4 },
  153. { .pdiv = 6, .hw_val = 5 },
  154. { .pdiv = 8, .hw_val = 6 },
  155. { .pdiv = 10, .hw_val = 7 },
  156. { .pdiv = 12, .hw_val = 8 },
  157. { .pdiv = 16, .hw_val = 9 },
  158. { .pdiv = 12, .hw_val = 10 },
  159. { .pdiv = 16, .hw_val = 11 },
  160. { .pdiv = 20, .hw_val = 12 },
  161. { .pdiv = 24, .hw_val = 13 },
  162. { .pdiv = 32, .hw_val = 14 },
  163. { .pdiv = 0, .hw_val = 0 },
  164. };
  165. static struct tegra_clk_pll_freq_table pll_x_freq_table[] = {
  166. /* 1 GHz */
  167. {12000000, 1000000000, 83, 0, 1}, /* actual: 996.0 MHz */
  168. {13000000, 1000000000, 76, 0, 1}, /* actual: 988.0 MHz */
  169. {16800000, 1000000000, 59, 0, 1}, /* actual: 991.2 MHz */
  170. {19200000, 1000000000, 52, 0, 1}, /* actual: 998.4 MHz */
  171. {26000000, 1000000000, 76, 1, 1}, /* actual: 988.0 MHz */
  172. {0, 0, 0, 0, 0, 0},
  173. };
  174. static struct tegra_clk_pll_params pll_x_params = {
  175. .input_min = 12000000,
  176. .input_max = 800000000,
  177. .cf_min = 12000000,
  178. .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */
  179. .vco_min = 700000000,
  180. .vco_max = 3000000000UL,
  181. .base_reg = PLLX_BASE,
  182. .misc_reg = PLLX_MISC,
  183. .lock_mask = PLL_BASE_LOCK,
  184. .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
  185. .lock_delay = 300,
  186. .iddq_reg = PLLX_MISC3,
  187. .iddq_bit_idx = 3,
  188. .max_p = 6,
  189. .dyn_ramp_reg = PLLX_MISC2,
  190. .stepa_shift = 16,
  191. .stepb_shift = 24,
  192. .pdiv_tohw = pllxc_p,
  193. .div_nmp = &pllxc_nmp,
  194. .freq_table = pll_x_freq_table,
  195. .flags = TEGRA_PLL_USE_LOCK,
  196. };
  197. static struct tegra_clk_pll_freq_table pll_c_freq_table[] = {
  198. { 12000000, 624000000, 104, 1, 2},
  199. { 12000000, 600000000, 100, 1, 2},
  200. { 13000000, 600000000, 92, 1, 2}, /* actual: 598.0 MHz */
  201. { 16800000, 600000000, 71, 1, 2}, /* actual: 596.4 MHz */
  202. { 19200000, 600000000, 62, 1, 2}, /* actual: 595.2 MHz */
  203. { 26000000, 600000000, 92, 2, 2}, /* actual: 598.0 MHz */
  204. { 0, 0, 0, 0, 0, 0 },
  205. };
  206. static struct tegra_clk_pll_params pll_c_params = {
  207. .input_min = 12000000,
  208. .input_max = 800000000,
  209. .cf_min = 12000000,
  210. .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */
  211. .vco_min = 600000000,
  212. .vco_max = 1400000000,
  213. .base_reg = PLLC_BASE,
  214. .misc_reg = PLLC_MISC,
  215. .lock_mask = PLL_BASE_LOCK,
  216. .lock_enable_bit_idx = PLLC_MISC_LOCK_ENABLE,
  217. .lock_delay = 300,
  218. .iddq_reg = PLLC_MISC,
  219. .iddq_bit_idx = PLLC_IDDQ_BIT,
  220. .max_p = PLLXC_SW_MAX_P,
  221. .dyn_ramp_reg = PLLC_MISC2,
  222. .stepa_shift = 17,
  223. .stepb_shift = 9,
  224. .pdiv_tohw = pllxc_p,
  225. .div_nmp = &pllxc_nmp,
  226. .freq_table = pll_c_freq_table,
  227. .flags = TEGRA_PLL_USE_LOCK,
  228. };
  229. static struct div_nmp pllcx_nmp = {
  230. .divm_shift = 0,
  231. .divm_width = 2,
  232. .divn_shift = 8,
  233. .divn_width = 8,
  234. .divp_shift = 20,
  235. .divp_width = 3,
  236. };
  237. static struct pdiv_map pllc_p[] = {
  238. { .pdiv = 1, .hw_val = 0 },
  239. { .pdiv = 2, .hw_val = 1 },
  240. { .pdiv = 3, .hw_val = 2 },
  241. { .pdiv = 4, .hw_val = 3 },
  242. { .pdiv = 6, .hw_val = 4 },
  243. { .pdiv = 8, .hw_val = 5 },
  244. { .pdiv = 12, .hw_val = 6 },
  245. { .pdiv = 16, .hw_val = 7 },
  246. { .pdiv = 0, .hw_val = 0 },
  247. };
  248. static struct tegra_clk_pll_freq_table pll_cx_freq_table[] = {
  249. {12000000, 600000000, 100, 1, 2},
  250. {13000000, 600000000, 92, 1, 2}, /* actual: 598.0 MHz */
  251. {16800000, 600000000, 71, 1, 2}, /* actual: 596.4 MHz */
  252. {19200000, 600000000, 62, 1, 2}, /* actual: 595.2 MHz */
  253. {26000000, 600000000, 92, 2, 2}, /* actual: 598.0 MHz */
  254. {0, 0, 0, 0, 0, 0},
  255. };
  256. static struct tegra_clk_pll_params pll_c2_params = {
  257. .input_min = 12000000,
  258. .input_max = 48000000,
  259. .cf_min = 12000000,
  260. .cf_max = 19200000,
  261. .vco_min = 600000000,
  262. .vco_max = 1200000000,
  263. .base_reg = PLLC2_BASE,
  264. .misc_reg = PLLC2_MISC,
  265. .lock_mask = PLL_BASE_LOCK,
  266. .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
  267. .lock_delay = 300,
  268. .pdiv_tohw = pllc_p,
  269. .div_nmp = &pllcx_nmp,
  270. .max_p = 7,
  271. .ext_misc_reg[0] = 0x4f0,
  272. .ext_misc_reg[1] = 0x4f4,
  273. .ext_misc_reg[2] = 0x4f8,
  274. .freq_table = pll_cx_freq_table,
  275. .flags = TEGRA_PLL_USE_LOCK,
  276. };
  277. static struct tegra_clk_pll_params pll_c3_params = {
  278. .input_min = 12000000,
  279. .input_max = 48000000,
  280. .cf_min = 12000000,
  281. .cf_max = 19200000,
  282. .vco_min = 600000000,
  283. .vco_max = 1200000000,
  284. .base_reg = PLLC3_BASE,
  285. .misc_reg = PLLC3_MISC,
  286. .lock_mask = PLL_BASE_LOCK,
  287. .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
  288. .lock_delay = 300,
  289. .pdiv_tohw = pllc_p,
  290. .div_nmp = &pllcx_nmp,
  291. .max_p = 7,
  292. .ext_misc_reg[0] = 0x504,
  293. .ext_misc_reg[1] = 0x508,
  294. .ext_misc_reg[2] = 0x50c,
  295. .freq_table = pll_cx_freq_table,
  296. .flags = TEGRA_PLL_USE_LOCK,
  297. };
  298. static struct div_nmp pllss_nmp = {
  299. .divm_shift = 0,
  300. .divm_width = 8,
  301. .divn_shift = 8,
  302. .divn_width = 8,
  303. .divp_shift = 20,
  304. .divp_width = 4,
  305. };
  306. static struct pdiv_map pll12g_ssd_esd_p[] = {
  307. { .pdiv = 1, .hw_val = 0 },
  308. { .pdiv = 2, .hw_val = 1 },
  309. { .pdiv = 3, .hw_val = 2 },
  310. { .pdiv = 4, .hw_val = 3 },
  311. { .pdiv = 5, .hw_val = 4 },
  312. { .pdiv = 6, .hw_val = 5 },
  313. { .pdiv = 8, .hw_val = 6 },
  314. { .pdiv = 10, .hw_val = 7 },
  315. { .pdiv = 12, .hw_val = 8 },
  316. { .pdiv = 16, .hw_val = 9 },
  317. { .pdiv = 12, .hw_val = 10 },
  318. { .pdiv = 16, .hw_val = 11 },
  319. { .pdiv = 20, .hw_val = 12 },
  320. { .pdiv = 24, .hw_val = 13 },
  321. { .pdiv = 32, .hw_val = 14 },
  322. { .pdiv = 0, .hw_val = 0 },
  323. };
  324. static struct tegra_clk_pll_freq_table pll_c4_freq_table[] = {
  325. { 12000000, 600000000, 100, 1, 1},
  326. { 13000000, 600000000, 92, 1, 1}, /* actual: 598.0 MHz */
  327. { 16800000, 600000000, 71, 1, 1}, /* actual: 596.4 MHz */
  328. { 19200000, 600000000, 62, 1, 1}, /* actual: 595.2 MHz */
  329. { 26000000, 600000000, 92, 2, 1}, /* actual: 598.0 MHz */
  330. { 0, 0, 0, 0, 0, 0 },
  331. };
  332. static struct tegra_clk_pll_params pll_c4_params = {
  333. .input_min = 12000000,
  334. .input_max = 1000000000,
  335. .cf_min = 12000000,
  336. .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */
  337. .vco_min = 600000000,
  338. .vco_max = 1200000000,
  339. .base_reg = PLLC4_BASE,
  340. .misc_reg = PLLC4_MISC,
  341. .lock_mask = PLL_BASE_LOCK,
  342. .lock_enable_bit_idx = PLLSS_MISC_LOCK_ENABLE,
  343. .lock_delay = 300,
  344. .iddq_reg = PLLC4_BASE,
  345. .iddq_bit_idx = PLLSS_IDDQ_BIT,
  346. .pdiv_tohw = pll12g_ssd_esd_p,
  347. .div_nmp = &pllss_nmp,
  348. .ext_misc_reg[0] = 0x5ac,
  349. .ext_misc_reg[1] = 0x5b0,
  350. .ext_misc_reg[2] = 0x5b4,
  351. .freq_table = pll_c4_freq_table,
  352. };
  353. static struct pdiv_map pllm_p[] = {
  354. { .pdiv = 1, .hw_val = 0 },
  355. { .pdiv = 2, .hw_val = 1 },
  356. { .pdiv = 0, .hw_val = 0 },
  357. };
  358. static struct tegra_clk_pll_freq_table pll_m_freq_table[] = {
  359. {12000000, 800000000, 66, 1, 1}, /* actual: 792.0 MHz */
  360. {13000000, 800000000, 61, 1, 1}, /* actual: 793.0 MHz */
  361. {16800000, 800000000, 47, 1, 1}, /* actual: 789.6 MHz */
  362. {19200000, 800000000, 41, 1, 1}, /* actual: 787.2 MHz */
  363. {26000000, 800000000, 61, 2, 1}, /* actual: 793.0 MHz */
  364. {0, 0, 0, 0, 0, 0},
  365. };
  366. static struct div_nmp pllm_nmp = {
  367. .divm_shift = 0,
  368. .divm_width = 8,
  369. .override_divm_shift = 0,
  370. .divn_shift = 8,
  371. .divn_width = 8,
  372. .override_divn_shift = 8,
  373. .divp_shift = 20,
  374. .divp_width = 1,
  375. .override_divp_shift = 27,
  376. };
  377. static struct tegra_clk_pll_params pll_m_params = {
  378. .input_min = 12000000,
  379. .input_max = 500000000,
  380. .cf_min = 12000000,
  381. .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */
  382. .vco_min = 400000000,
  383. .vco_max = 1066000000,
  384. .base_reg = PLLM_BASE,
  385. .misc_reg = PLLM_MISC,
  386. .lock_mask = PLL_BASE_LOCK,
  387. .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
  388. .lock_delay = 300,
  389. .max_p = 2,
  390. .pdiv_tohw = pllm_p,
  391. .div_nmp = &pllm_nmp,
  392. .pmc_divnm_reg = PMC_PLLM_WB0_OVERRIDE,
  393. .pmc_divp_reg = PMC_PLLM_WB0_OVERRIDE_2,
  394. .freq_table = pll_m_freq_table,
  395. .flags = TEGRA_PLL_USE_LOCK,
  396. };
  397. static struct tegra_clk_pll_freq_table pll_e_freq_table[] = {
  398. /* PLLE special case: use cpcon field to store cml divider value */
  399. {336000000, 100000000, 100, 21, 16, 11},
  400. {312000000, 100000000, 200, 26, 24, 13},
  401. {13000000, 100000000, 200, 1, 26, 13},
  402. {12000000, 100000000, 200, 1, 24, 13},
  403. {0, 0, 0, 0, 0, 0},
  404. };
  405. static struct div_nmp plle_nmp = {
  406. .divm_shift = 0,
  407. .divm_width = 8,
  408. .divn_shift = 8,
  409. .divn_width = 8,
  410. .divp_shift = 24,
  411. .divp_width = 4,
  412. };
  413. static struct tegra_clk_pll_params pll_e_params = {
  414. .input_min = 12000000,
  415. .input_max = 1000000000,
  416. .cf_min = 12000000,
  417. .cf_max = 75000000,
  418. .vco_min = 1600000000,
  419. .vco_max = 2400000000U,
  420. .base_reg = PLLE_BASE,
  421. .misc_reg = PLLE_MISC,
  422. .aux_reg = PLLE_AUX,
  423. .lock_mask = PLLE_MISC_LOCK,
  424. .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE,
  425. .lock_delay = 300,
  426. .div_nmp = &plle_nmp,
  427. .freq_table = pll_e_freq_table,
  428. .flags = TEGRA_PLL_FIXED,
  429. .fixed_rate = 100000000,
  430. };
  431. static const struct clk_div_table pll_re_div_table[] = {
  432. { .val = 0, .div = 1 },
  433. { .val = 1, .div = 2 },
  434. { .val = 2, .div = 3 },
  435. { .val = 3, .div = 4 },
  436. { .val = 4, .div = 5 },
  437. { .val = 5, .div = 6 },
  438. { .val = 0, .div = 0 },
  439. };
  440. static struct div_nmp pllre_nmp = {
  441. .divm_shift = 0,
  442. .divm_width = 8,
  443. .divn_shift = 8,
  444. .divn_width = 8,
  445. .divp_shift = 16,
  446. .divp_width = 4,
  447. };
  448. static struct tegra_clk_pll_params pll_re_vco_params = {
  449. .input_min = 12000000,
  450. .input_max = 1000000000,
  451. .cf_min = 12000000,
  452. .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */
  453. .vco_min = 300000000,
  454. .vco_max = 600000000,
  455. .base_reg = PLLRE_BASE,
  456. .misc_reg = PLLRE_MISC,
  457. .lock_mask = PLLRE_MISC_LOCK,
  458. .lock_enable_bit_idx = PLLRE_MISC_LOCK_ENABLE,
  459. .lock_delay = 300,
  460. .iddq_reg = PLLRE_MISC,
  461. .iddq_bit_idx = PLLRE_IDDQ_BIT,
  462. .div_nmp = &pllre_nmp,
  463. .flags = TEGRA_PLL_USE_LOCK,
  464. };
  465. static struct div_nmp pllp_nmp = {
  466. .divm_shift = 0,
  467. .divm_width = 5,
  468. .divn_shift = 8,
  469. .divn_width = 10,
  470. .divp_shift = 20,
  471. .divp_width = 3,
  472. };
  473. static struct tegra_clk_pll_freq_table pll_p_freq_table[] = {
  474. {12000000, 408000000, 408, 12, 0, 8},
  475. {13000000, 408000000, 408, 13, 0, 8},
  476. {16800000, 408000000, 340, 14, 0, 8},
  477. {19200000, 408000000, 340, 16, 0, 8},
  478. {26000000, 408000000, 408, 26, 0, 8},
  479. {0, 0, 0, 0, 0, 0},
  480. };
  481. static struct tegra_clk_pll_params pll_p_params = {
  482. .input_min = 2000000,
  483. .input_max = 31000000,
  484. .cf_min = 1000000,
  485. .cf_max = 6000000,
  486. .vco_min = 200000000,
  487. .vco_max = 700000000,
  488. .base_reg = PLLP_BASE,
  489. .misc_reg = PLLP_MISC,
  490. .lock_mask = PLL_BASE_LOCK,
  491. .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
  492. .lock_delay = 300,
  493. .div_nmp = &pllp_nmp,
  494. .freq_table = pll_p_freq_table,
  495. .fixed_rate = 408000000,
  496. .flags = TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK,
  497. };
  498. static struct tegra_clk_pll_freq_table pll_a_freq_table[] = {
  499. {9600000, 282240000, 147, 5, 0, 4},
  500. {9600000, 368640000, 192, 5, 0, 4},
  501. {9600000, 240000000, 200, 8, 0, 8},
  502. {28800000, 282240000, 245, 25, 0, 8},
  503. {28800000, 368640000, 320, 25, 0, 8},
  504. {28800000, 240000000, 200, 24, 0, 8},
  505. {0, 0, 0, 0, 0, 0},
  506. };
  507. static struct tegra_clk_pll_params pll_a_params = {
  508. .input_min = 2000000,
  509. .input_max = 31000000,
  510. .cf_min = 1000000,
  511. .cf_max = 6000000,
  512. .vco_min = 200000000,
  513. .vco_max = 700000000,
  514. .base_reg = PLLA_BASE,
  515. .misc_reg = PLLA_MISC,
  516. .lock_mask = PLL_BASE_LOCK,
  517. .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
  518. .lock_delay = 300,
  519. .div_nmp = &pllp_nmp,
  520. .freq_table = pll_a_freq_table,
  521. .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK,
  522. };
  523. static struct div_nmp plld_nmp = {
  524. .divm_shift = 0,
  525. .divm_width = 5,
  526. .divn_shift = 8,
  527. .divn_width = 11,
  528. .divp_shift = 20,
  529. .divp_width = 3,
  530. };
  531. static struct tegra_clk_pll_freq_table pll_d_freq_table[] = {
  532. {12000000, 216000000, 864, 12, 4, 12},
  533. {13000000, 216000000, 864, 13, 4, 12},
  534. {16800000, 216000000, 720, 14, 4, 12},
  535. {19200000, 216000000, 720, 16, 4, 12},
  536. {26000000, 216000000, 864, 26, 4, 12},
  537. {12000000, 594000000, 594, 12, 1, 12},
  538. {13000000, 594000000, 594, 13, 1, 12},
  539. {16800000, 594000000, 495, 14, 1, 12},
  540. {19200000, 594000000, 495, 16, 1, 12},
  541. {26000000, 594000000, 594, 26, 1, 12},
  542. {12000000, 1000000000, 1000, 12, 1, 12},
  543. {13000000, 1000000000, 1000, 13, 1, 12},
  544. {19200000, 1000000000, 625, 12, 1, 12},
  545. {26000000, 1000000000, 1000, 26, 1, 12},
  546. {0, 0, 0, 0, 0, 0},
  547. };
  548. static struct tegra_clk_pll_params pll_d_params = {
  549. .input_min = 2000000,
  550. .input_max = 40000000,
  551. .cf_min = 1000000,
  552. .cf_max = 6000000,
  553. .vco_min = 500000000,
  554. .vco_max = 1000000000,
  555. .base_reg = PLLD_BASE,
  556. .misc_reg = PLLD_MISC,
  557. .lock_mask = PLL_BASE_LOCK,
  558. .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE,
  559. .lock_delay = 1000,
  560. .div_nmp = &plld_nmp,
  561. .freq_table = pll_d_freq_table,
  562. .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
  563. TEGRA_PLL_USE_LOCK,
  564. };
  565. static struct tegra_clk_pll_freq_table tegra124_pll_d2_freq_table[] = {
  566. { 12000000, 594000000, 99, 1, 2},
  567. { 13000000, 594000000, 91, 1, 2}, /* actual: 591.5 MHz */
  568. { 16800000, 594000000, 71, 1, 2}, /* actual: 596.4 MHz */
  569. { 19200000, 594000000, 62, 1, 2}, /* actual: 595.2 MHz */
  570. { 26000000, 594000000, 91, 2, 2}, /* actual: 591.5 MHz */
  571. { 0, 0, 0, 0, 0, 0 },
  572. };
  573. static struct tegra_clk_pll_params tegra124_pll_d2_params = {
  574. .input_min = 12000000,
  575. .input_max = 1000000000,
  576. .cf_min = 12000000,
  577. .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */
  578. .vco_min = 600000000,
  579. .vco_max = 1200000000,
  580. .base_reg = PLLD2_BASE,
  581. .misc_reg = PLLD2_MISC,
  582. .lock_mask = PLL_BASE_LOCK,
  583. .lock_enable_bit_idx = PLLSS_MISC_LOCK_ENABLE,
  584. .lock_delay = 300,
  585. .iddq_reg = PLLD2_BASE,
  586. .iddq_bit_idx = PLLSS_IDDQ_BIT,
  587. .pdiv_tohw = pll12g_ssd_esd_p,
  588. .div_nmp = &pllss_nmp,
  589. .ext_misc_reg[0] = 0x570,
  590. .ext_misc_reg[1] = 0x574,
  591. .ext_misc_reg[2] = 0x578,
  592. .max_p = 15,
  593. .freq_table = tegra124_pll_d2_freq_table,
  594. };
  595. static struct tegra_clk_pll_freq_table pll_dp_freq_table[] = {
  596. { 12000000, 600000000, 100, 1, 1},
  597. { 13000000, 600000000, 92, 1, 1}, /* actual: 598.0 MHz */
  598. { 16800000, 600000000, 71, 1, 1}, /* actual: 596.4 MHz */
  599. { 19200000, 600000000, 62, 1, 1}, /* actual: 595.2 MHz */
  600. { 26000000, 600000000, 92, 2, 1}, /* actual: 598.0 MHz */
  601. { 0, 0, 0, 0, 0, 0 },
  602. };
  603. static struct tegra_clk_pll_params pll_dp_params = {
  604. .input_min = 12000000,
  605. .input_max = 1000000000,
  606. .cf_min = 12000000,
  607. .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */
  608. .vco_min = 600000000,
  609. .vco_max = 1200000000,
  610. .base_reg = PLLDP_BASE,
  611. .misc_reg = PLLDP_MISC,
  612. .lock_mask = PLL_BASE_LOCK,
  613. .lock_enable_bit_idx = PLLSS_MISC_LOCK_ENABLE,
  614. .lock_delay = 300,
  615. .iddq_reg = PLLDP_BASE,
  616. .iddq_bit_idx = PLLSS_IDDQ_BIT,
  617. .pdiv_tohw = pll12g_ssd_esd_p,
  618. .div_nmp = &pllss_nmp,
  619. .ext_misc_reg[0] = 0x598,
  620. .ext_misc_reg[1] = 0x59c,
  621. .ext_misc_reg[2] = 0x5a0,
  622. .max_p = 5,
  623. .freq_table = pll_dp_freq_table,
  624. };
  625. static struct pdiv_map pllu_p[] = {
  626. { .pdiv = 1, .hw_val = 1 },
  627. { .pdiv = 2, .hw_val = 0 },
  628. { .pdiv = 0, .hw_val = 0 },
  629. };
  630. static struct div_nmp pllu_nmp = {
  631. .divm_shift = 0,
  632. .divm_width = 5,
  633. .divn_shift = 8,
  634. .divn_width = 10,
  635. .divp_shift = 20,
  636. .divp_width = 1,
  637. };
  638. static struct tegra_clk_pll_freq_table pll_u_freq_table[] = {
  639. {12000000, 480000000, 960, 12, 2, 12},
  640. {13000000, 480000000, 960, 13, 2, 12},
  641. {16800000, 480000000, 400, 7, 2, 5},
  642. {19200000, 480000000, 200, 4, 2, 3},
  643. {26000000, 480000000, 960, 26, 2, 12},
  644. {0, 0, 0, 0, 0, 0},
  645. };
  646. static struct tegra_clk_pll_params pll_u_params = {
  647. .input_min = 2000000,
  648. .input_max = 40000000,
  649. .cf_min = 1000000,
  650. .cf_max = 6000000,
  651. .vco_min = 480000000,
  652. .vco_max = 960000000,
  653. .base_reg = PLLU_BASE,
  654. .misc_reg = PLLU_MISC,
  655. .lock_mask = PLL_BASE_LOCK,
  656. .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE,
  657. .lock_delay = 1000,
  658. .pdiv_tohw = pllu_p,
  659. .div_nmp = &pllu_nmp,
  660. .freq_table = pll_u_freq_table,
  661. .flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
  662. TEGRA_PLL_USE_LOCK,
  663. };
  664. struct utmi_clk_param {
  665. /* Oscillator Frequency in KHz */
  666. u32 osc_frequency;
  667. /* UTMIP PLL Enable Delay Count */
  668. u8 enable_delay_count;
  669. /* UTMIP PLL Stable count */
  670. u8 stable_count;
  671. /* UTMIP PLL Active delay count */
  672. u8 active_delay_count;
  673. /* UTMIP PLL Xtal frequency count */
  674. u8 xtal_freq_count;
  675. };
  676. static const struct utmi_clk_param utmi_parameters[] = {
  677. {.osc_frequency = 13000000, .enable_delay_count = 0x02,
  678. .stable_count = 0x33, .active_delay_count = 0x05,
  679. .xtal_freq_count = 0x7F},
  680. {.osc_frequency = 19200000, .enable_delay_count = 0x03,
  681. .stable_count = 0x4B, .active_delay_count = 0x06,
  682. .xtal_freq_count = 0xBB},
  683. {.osc_frequency = 12000000, .enable_delay_count = 0x02,
  684. .stable_count = 0x2F, .active_delay_count = 0x04,
  685. .xtal_freq_count = 0x76},
  686. {.osc_frequency = 26000000, .enable_delay_count = 0x04,
  687. .stable_count = 0x66, .active_delay_count = 0x09,
  688. .xtal_freq_count = 0xFE},
  689. {.osc_frequency = 16800000, .enable_delay_count = 0x03,
  690. .stable_count = 0x41, .active_delay_count = 0x0A,
  691. .xtal_freq_count = 0xA4},
  692. };
  693. static struct tegra_clk tegra124_clks[tegra_clk_max] __initdata = {
  694. [tegra_clk_ispb] = { .dt_id = TEGRA124_CLK_ISPB, .present = true },
  695. [tegra_clk_rtc] = { .dt_id = TEGRA124_CLK_RTC, .present = true },
  696. [tegra_clk_timer] = { .dt_id = TEGRA124_CLK_TIMER, .present = true },
  697. [tegra_clk_uarta] = { .dt_id = TEGRA124_CLK_UARTA, .present = true },
  698. [tegra_clk_sdmmc2_8] = { .dt_id = TEGRA124_CLK_SDMMC2, .present = true },
  699. [tegra_clk_i2s1] = { .dt_id = TEGRA124_CLK_I2S1, .present = true },
  700. [tegra_clk_i2c1] = { .dt_id = TEGRA124_CLK_I2C1, .present = true },
  701. [tegra_clk_sdmmc1_8] = { .dt_id = TEGRA124_CLK_SDMMC1, .present = true },
  702. [tegra_clk_sdmmc4_8] = { .dt_id = TEGRA124_CLK_SDMMC4, .present = true },
  703. [tegra_clk_pwm] = { .dt_id = TEGRA124_CLK_PWM, .present = true },
  704. [tegra_clk_i2s2] = { .dt_id = TEGRA124_CLK_I2S2, .present = true },
  705. [tegra_clk_usbd] = { .dt_id = TEGRA124_CLK_USBD, .present = true },
  706. [tegra_clk_isp_8] = { .dt_id = TEGRA124_CLK_ISP, .present = true },
  707. [tegra_clk_disp2] = { .dt_id = TEGRA124_CLK_DISP2, .present = true },
  708. [tegra_clk_disp1] = { .dt_id = TEGRA124_CLK_DISP1, .present = true },
  709. [tegra_clk_host1x_8] = { .dt_id = TEGRA124_CLK_HOST1X, .present = true },
  710. [tegra_clk_vcp] = { .dt_id = TEGRA124_CLK_VCP, .present = true },
  711. [tegra_clk_i2s0] = { .dt_id = TEGRA124_CLK_I2S0, .present = true },
  712. [tegra_clk_apbdma] = { .dt_id = TEGRA124_CLK_APBDMA, .present = true },
  713. [tegra_clk_kbc] = { .dt_id = TEGRA124_CLK_KBC, .present = true },
  714. [tegra_clk_kfuse] = { .dt_id = TEGRA124_CLK_KFUSE, .present = true },
  715. [tegra_clk_sbc1] = { .dt_id = TEGRA124_CLK_SBC1, .present = true },
  716. [tegra_clk_nor] = { .dt_id = TEGRA124_CLK_NOR, .present = true },
  717. [tegra_clk_sbc2] = { .dt_id = TEGRA124_CLK_SBC2, .present = true },
  718. [tegra_clk_sbc3] = { .dt_id = TEGRA124_CLK_SBC3, .present = true },
  719. [tegra_clk_i2c5] = { .dt_id = TEGRA124_CLK_I2C5, .present = true },
  720. [tegra_clk_mipi] = { .dt_id = TEGRA124_CLK_MIPI, .present = true },
  721. [tegra_clk_hdmi] = { .dt_id = TEGRA124_CLK_HDMI, .present = true },
  722. [tegra_clk_csi] = { .dt_id = TEGRA124_CLK_CSI, .present = true },
  723. [tegra_clk_i2c2] = { .dt_id = TEGRA124_CLK_I2C2, .present = true },
  724. [tegra_clk_uartc] = { .dt_id = TEGRA124_CLK_UARTC, .present = true },
  725. [tegra_clk_mipi_cal] = { .dt_id = TEGRA124_CLK_MIPI_CAL, .present = true },
  726. [tegra_clk_emc] = { .dt_id = TEGRA124_CLK_EMC, .present = true },
  727. [tegra_clk_usb2] = { .dt_id = TEGRA124_CLK_USB2, .present = true },
  728. [tegra_clk_usb3] = { .dt_id = TEGRA124_CLK_USB3, .present = true },
  729. [tegra_clk_vde_8] = { .dt_id = TEGRA124_CLK_VDE, .present = true },
  730. [tegra_clk_bsea] = { .dt_id = TEGRA124_CLK_BSEA, .present = true },
  731. [tegra_clk_bsev] = { .dt_id = TEGRA124_CLK_BSEV, .present = true },
  732. [tegra_clk_uartd] = { .dt_id = TEGRA124_CLK_UARTD, .present = true },
  733. [tegra_clk_i2c3] = { .dt_id = TEGRA124_CLK_I2C3, .present = true },
  734. [tegra_clk_sbc4] = { .dt_id = TEGRA124_CLK_SBC4, .present = true },
  735. [tegra_clk_sdmmc3_8] = { .dt_id = TEGRA124_CLK_SDMMC3, .present = true },
  736. [tegra_clk_pcie] = { .dt_id = TEGRA124_CLK_PCIE, .present = true },
  737. [tegra_clk_owr] = { .dt_id = TEGRA124_CLK_OWR, .present = true },
  738. [tegra_clk_afi] = { .dt_id = TEGRA124_CLK_AFI, .present = true },
  739. [tegra_clk_csite] = { .dt_id = TEGRA124_CLK_CSITE, .present = true },
  740. [tegra_clk_la] = { .dt_id = TEGRA124_CLK_LA, .present = true },
  741. [tegra_clk_trace] = { .dt_id = TEGRA124_CLK_TRACE, .present = true },
  742. [tegra_clk_soc_therm] = { .dt_id = TEGRA124_CLK_SOC_THERM, .present = true },
  743. [tegra_clk_dtv] = { .dt_id = TEGRA124_CLK_DTV, .present = true },
  744. [tegra_clk_i2cslow] = { .dt_id = TEGRA124_CLK_I2CSLOW, .present = true },
  745. [tegra_clk_tsec] = { .dt_id = TEGRA124_CLK_TSEC, .present = true },
  746. [tegra_clk_xusb_host] = { .dt_id = TEGRA124_CLK_XUSB_HOST, .present = true },
  747. [tegra_clk_msenc] = { .dt_id = TEGRA124_CLK_MSENC, .present = true },
  748. [tegra_clk_csus] = { .dt_id = TEGRA124_CLK_CSUS, .present = true },
  749. [tegra_clk_mselect] = { .dt_id = TEGRA124_CLK_MSELECT, .present = true },
  750. [tegra_clk_tsensor] = { .dt_id = TEGRA124_CLK_TSENSOR, .present = true },
  751. [tegra_clk_i2s3] = { .dt_id = TEGRA124_CLK_I2S3, .present = true },
  752. [tegra_clk_i2s4] = { .dt_id = TEGRA124_CLK_I2S4, .present = true },
  753. [tegra_clk_i2c4] = { .dt_id = TEGRA124_CLK_I2C4, .present = true },
  754. [tegra_clk_sbc5] = { .dt_id = TEGRA124_CLK_SBC5, .present = true },
  755. [tegra_clk_sbc6] = { .dt_id = TEGRA124_CLK_SBC6, .present = true },
  756. [tegra_clk_d_audio] = { .dt_id = TEGRA124_CLK_D_AUDIO, .present = true },
  757. [tegra_clk_apbif] = { .dt_id = TEGRA124_CLK_APBIF, .present = true },
  758. [tegra_clk_dam0] = { .dt_id = TEGRA124_CLK_DAM0, .present = true },
  759. [tegra_clk_dam1] = { .dt_id = TEGRA124_CLK_DAM1, .present = true },
  760. [tegra_clk_dam2] = { .dt_id = TEGRA124_CLK_DAM2, .present = true },
  761. [tegra_clk_hda2codec_2x] = { .dt_id = TEGRA124_CLK_HDA2CODEC_2X, .present = true },
  762. [tegra_clk_audio0_2x] = { .dt_id = TEGRA124_CLK_AUDIO0_2X, .present = true },
  763. [tegra_clk_audio1_2x] = { .dt_id = TEGRA124_CLK_AUDIO1_2X, .present = true },
  764. [tegra_clk_audio2_2x] = { .dt_id = TEGRA124_CLK_AUDIO2_2X, .present = true },
  765. [tegra_clk_audio3_2x] = { .dt_id = TEGRA124_CLK_AUDIO3_2X, .present = true },
  766. [tegra_clk_audio4_2x] = { .dt_id = TEGRA124_CLK_AUDIO4_2X, .present = true },
  767. [tegra_clk_spdif_2x] = { .dt_id = TEGRA124_CLK_SPDIF_2X, .present = true },
  768. [tegra_clk_actmon] = { .dt_id = TEGRA124_CLK_ACTMON, .present = true },
  769. [tegra_clk_extern1] = { .dt_id = TEGRA124_CLK_EXTERN1, .present = true },
  770. [tegra_clk_extern2] = { .dt_id = TEGRA124_CLK_EXTERN2, .present = true },
  771. [tegra_clk_extern3] = { .dt_id = TEGRA124_CLK_EXTERN3, .present = true },
  772. [tegra_clk_sata_oob] = { .dt_id = TEGRA124_CLK_SATA_OOB, .present = true },
  773. [tegra_clk_sata] = { .dt_id = TEGRA124_CLK_SATA, .present = true },
  774. [tegra_clk_hda] = { .dt_id = TEGRA124_CLK_HDA, .present = true },
  775. [tegra_clk_se] = { .dt_id = TEGRA124_CLK_SE, .present = true },
  776. [tegra_clk_hda2hdmi] = { .dt_id = TEGRA124_CLK_HDA2HDMI, .present = true },
  777. [tegra_clk_sata_cold] = { .dt_id = TEGRA124_CLK_SATA_COLD, .present = true },
  778. [tegra_clk_cilab] = { .dt_id = TEGRA124_CLK_CILAB, .present = true },
  779. [tegra_clk_cilcd] = { .dt_id = TEGRA124_CLK_CILCD, .present = true },
  780. [tegra_clk_cile] = { .dt_id = TEGRA124_CLK_CILE, .present = true },
  781. [tegra_clk_dsialp] = { .dt_id = TEGRA124_CLK_DSIALP, .present = true },
  782. [tegra_clk_dsiblp] = { .dt_id = TEGRA124_CLK_DSIBLP, .present = true },
  783. [tegra_clk_entropy] = { .dt_id = TEGRA124_CLK_ENTROPY, .present = true },
  784. [tegra_clk_dds] = { .dt_id = TEGRA124_CLK_DDS, .present = true },
  785. [tegra_clk_dp2] = { .dt_id = TEGRA124_CLK_DP2, .present = true },
  786. [tegra_clk_amx] = { .dt_id = TEGRA124_CLK_AMX, .present = true },
  787. [tegra_clk_adx] = { .dt_id = TEGRA124_CLK_ADX, .present = true },
  788. [tegra_clk_xusb_ss] = { .dt_id = TEGRA124_CLK_XUSB_SS, .present = true },
  789. [tegra_clk_i2c6] = { .dt_id = TEGRA124_CLK_I2C6, .present = true },
  790. [tegra_clk_vim2_clk] = { .dt_id = TEGRA124_CLK_VIM2_CLK, .present = true },
  791. [tegra_clk_hdmi_audio] = { .dt_id = TEGRA124_CLK_HDMI_AUDIO, .present = true },
  792. [tegra_clk_clk72Mhz] = { .dt_id = TEGRA124_CLK_CLK72MHZ, .present = true },
  793. [tegra_clk_vic03] = { .dt_id = TEGRA124_CLK_VIC03, .present = true },
  794. [tegra_clk_adx1] = { .dt_id = TEGRA124_CLK_ADX1, .present = true },
  795. [tegra_clk_dpaux] = { .dt_id = TEGRA124_CLK_DPAUX, .present = true },
  796. [tegra_clk_sor0] = { .dt_id = TEGRA124_CLK_SOR0, .present = true },
  797. [tegra_clk_sor0_lvds] = { .dt_id = TEGRA124_CLK_SOR0_LVDS, .present = true },
  798. [tegra_clk_gpu] = { .dt_id = TEGRA124_CLK_GPU, .present = true },
  799. [tegra_clk_amx1] = { .dt_id = TEGRA124_CLK_AMX1, .present = true },
  800. [tegra_clk_uartb] = { .dt_id = TEGRA124_CLK_UARTB, .present = true },
  801. [tegra_clk_vfir] = { .dt_id = TEGRA124_CLK_VFIR, .present = true },
  802. [tegra_clk_spdif_in] = { .dt_id = TEGRA124_CLK_SPDIF_IN, .present = true },
  803. [tegra_clk_spdif_out] = { .dt_id = TEGRA124_CLK_SPDIF_OUT, .present = true },
  804. [tegra_clk_vi_9] = { .dt_id = TEGRA124_CLK_VI, .present = true },
  805. [tegra_clk_vi_sensor_8] = { .dt_id = TEGRA124_CLK_VI_SENSOR, .present = true },
  806. [tegra_clk_fuse] = { .dt_id = TEGRA124_CLK_FUSE, .present = true },
  807. [tegra_clk_fuse_burn] = { .dt_id = TEGRA124_CLK_FUSE_BURN, .present = true },
  808. [tegra_clk_clk_32k] = { .dt_id = TEGRA124_CLK_CLK_32K, .present = true },
  809. [tegra_clk_clk_m] = { .dt_id = TEGRA124_CLK_CLK_M, .present = true },
  810. [tegra_clk_clk_m_div2] = { .dt_id = TEGRA124_CLK_CLK_M_DIV2, .present = true },
  811. [tegra_clk_clk_m_div4] = { .dt_id = TEGRA124_CLK_CLK_M_DIV4, .present = true },
  812. [tegra_clk_pll_ref] = { .dt_id = TEGRA124_CLK_PLL_REF, .present = true },
  813. [tegra_clk_pll_c] = { .dt_id = TEGRA124_CLK_PLL_C, .present = true },
  814. [tegra_clk_pll_c_out1] = { .dt_id = TEGRA124_CLK_PLL_C_OUT1, .present = true },
  815. [tegra_clk_pll_c2] = { .dt_id = TEGRA124_CLK_PLL_C2, .present = true },
  816. [tegra_clk_pll_c3] = { .dt_id = TEGRA124_CLK_PLL_C3, .present = true },
  817. [tegra_clk_pll_m] = { .dt_id = TEGRA124_CLK_PLL_M, .present = true },
  818. [tegra_clk_pll_m_out1] = { .dt_id = TEGRA124_CLK_PLL_M_OUT1, .present = true },
  819. [tegra_clk_pll_p] = { .dt_id = TEGRA124_CLK_PLL_P, .present = true },
  820. [tegra_clk_pll_p_out1] = { .dt_id = TEGRA124_CLK_PLL_P_OUT1, .present = true },
  821. [tegra_clk_pll_p_out2] = { .dt_id = TEGRA124_CLK_PLL_P_OUT2, .present = true },
  822. [tegra_clk_pll_p_out3] = { .dt_id = TEGRA124_CLK_PLL_P_OUT3, .present = true },
  823. [tegra_clk_pll_p_out4] = { .dt_id = TEGRA124_CLK_PLL_P_OUT4, .present = true },
  824. [tegra_clk_pll_a] = { .dt_id = TEGRA124_CLK_PLL_A, .present = true },
  825. [tegra_clk_pll_a_out0] = { .dt_id = TEGRA124_CLK_PLL_A_OUT0, .present = true },
  826. [tegra_clk_pll_d] = { .dt_id = TEGRA124_CLK_PLL_D, .present = true },
  827. [tegra_clk_pll_d_out0] = { .dt_id = TEGRA124_CLK_PLL_D_OUT0, .present = true },
  828. [tegra_clk_pll_d2] = { .dt_id = TEGRA124_CLK_PLL_D2, .present = true },
  829. [tegra_clk_pll_d2_out0] = { .dt_id = TEGRA124_CLK_PLL_D2_OUT0, .present = true },
  830. [tegra_clk_pll_u] = { .dt_id = TEGRA124_CLK_PLL_U, .present = true },
  831. [tegra_clk_pll_u_480m] = { .dt_id = TEGRA124_CLK_PLL_U_480M, .present = true },
  832. [tegra_clk_pll_u_60m] = { .dt_id = TEGRA124_CLK_PLL_U_60M, .present = true },
  833. [tegra_clk_pll_u_48m] = { .dt_id = TEGRA124_CLK_PLL_U_48M, .present = true },
  834. [tegra_clk_pll_u_12m] = { .dt_id = TEGRA124_CLK_PLL_U_12M, .present = true },
  835. [tegra_clk_pll_x] = { .dt_id = TEGRA124_CLK_PLL_X, .present = true },
  836. [tegra_clk_pll_x_out0] = { .dt_id = TEGRA124_CLK_PLL_X_OUT0, .present = true },
  837. [tegra_clk_pll_re_vco] = { .dt_id = TEGRA124_CLK_PLL_RE_VCO, .present = true },
  838. [tegra_clk_pll_re_out] = { .dt_id = TEGRA124_CLK_PLL_RE_OUT, .present = true },
  839. [tegra_clk_spdif_in_sync] = { .dt_id = TEGRA124_CLK_SPDIF_IN_SYNC, .present = true },
  840. [tegra_clk_i2s0_sync] = { .dt_id = TEGRA124_CLK_I2S0_SYNC, .present = true },
  841. [tegra_clk_i2s1_sync] = { .dt_id = TEGRA124_CLK_I2S1_SYNC, .present = true },
  842. [tegra_clk_i2s2_sync] = { .dt_id = TEGRA124_CLK_I2S2_SYNC, .present = true },
  843. [tegra_clk_i2s3_sync] = { .dt_id = TEGRA124_CLK_I2S3_SYNC, .present = true },
  844. [tegra_clk_i2s4_sync] = { .dt_id = TEGRA124_CLK_I2S4_SYNC, .present = true },
  845. [tegra_clk_vimclk_sync] = { .dt_id = TEGRA124_CLK_VIMCLK_SYNC, .present = true },
  846. [tegra_clk_audio0] = { .dt_id = TEGRA124_CLK_AUDIO0, .present = true },
  847. [tegra_clk_audio1] = { .dt_id = TEGRA124_CLK_AUDIO1, .present = true },
  848. [tegra_clk_audio2] = { .dt_id = TEGRA124_CLK_AUDIO2, .present = true },
  849. [tegra_clk_audio3] = { .dt_id = TEGRA124_CLK_AUDIO3, .present = true },
  850. [tegra_clk_audio4] = { .dt_id = TEGRA124_CLK_AUDIO4, .present = true },
  851. [tegra_clk_spdif] = { .dt_id = TEGRA124_CLK_SPDIF, .present = true },
  852. [tegra_clk_clk_out_1] = { .dt_id = TEGRA124_CLK_CLK_OUT_1, .present = true },
  853. [tegra_clk_clk_out_2] = { .dt_id = TEGRA124_CLK_CLK_OUT_2, .present = true },
  854. [tegra_clk_clk_out_3] = { .dt_id = TEGRA124_CLK_CLK_OUT_3, .present = true },
  855. [tegra_clk_blink] = { .dt_id = TEGRA124_CLK_BLINK, .present = true },
  856. [tegra_clk_xusb_host_src] = { .dt_id = TEGRA124_CLK_XUSB_HOST_SRC, .present = true },
  857. [tegra_clk_xusb_falcon_src] = { .dt_id = TEGRA124_CLK_XUSB_FALCON_SRC, .present = true },
  858. [tegra_clk_xusb_fs_src] = { .dt_id = TEGRA124_CLK_XUSB_FS_SRC, .present = true },
  859. [tegra_clk_xusb_ss_src] = { .dt_id = TEGRA124_CLK_XUSB_SS_SRC, .present = true },
  860. [tegra_clk_xusb_ss_div2] = { .dt_id = TEGRA124_CLK_XUSB_SS_DIV2, .present = true },
  861. [tegra_clk_xusb_dev_src] = { .dt_id = TEGRA124_CLK_XUSB_DEV_SRC, .present = true },
  862. [tegra_clk_xusb_dev] = { .dt_id = TEGRA124_CLK_XUSB_DEV, .present = true },
  863. [tegra_clk_xusb_hs_src] = { .dt_id = TEGRA124_CLK_XUSB_HS_SRC, .present = true },
  864. [tegra_clk_sclk] = { .dt_id = TEGRA124_CLK_SCLK, .present = true },
  865. [tegra_clk_hclk] = { .dt_id = TEGRA124_CLK_HCLK, .present = true },
  866. [tegra_clk_pclk] = { .dt_id = TEGRA124_CLK_PCLK, .present = true },
  867. [tegra_clk_cclk_g] = { .dt_id = TEGRA124_CLK_CCLK_G, .present = true },
  868. [tegra_clk_cclk_lp] = { .dt_id = TEGRA124_CLK_CCLK_LP, .present = true },
  869. [tegra_clk_dfll_ref] = { .dt_id = TEGRA124_CLK_DFLL_REF, .present = true },
  870. [tegra_clk_dfll_soc] = { .dt_id = TEGRA124_CLK_DFLL_SOC, .present = true },
  871. [tegra_clk_vi_sensor2] = { .dt_id = TEGRA124_CLK_VI_SENSOR2, .present = true },
  872. [tegra_clk_pll_p_out5] = { .dt_id = TEGRA124_CLK_PLL_P_OUT5, .present = true },
  873. [tegra_clk_pll_c4] = { .dt_id = TEGRA124_CLK_PLL_C4, .present = true },
  874. [tegra_clk_pll_dp] = { .dt_id = TEGRA124_CLK_PLL_DP, .present = true },
  875. [tegra_clk_audio0_mux] = { .dt_id = TEGRA124_CLK_AUDIO0_MUX, .present = true },
  876. [tegra_clk_audio1_mux] = { .dt_id = TEGRA124_CLK_AUDIO1_MUX, .present = true },
  877. [tegra_clk_audio2_mux] = { .dt_id = TEGRA124_CLK_AUDIO2_MUX, .present = true },
  878. [tegra_clk_audio3_mux] = { .dt_id = TEGRA124_CLK_AUDIO3_MUX, .present = true },
  879. [tegra_clk_audio4_mux] = { .dt_id = TEGRA124_CLK_AUDIO4_MUX, .present = true },
  880. [tegra_clk_spdif_mux] = { .dt_id = TEGRA124_CLK_SPDIF_MUX, .present = true },
  881. [tegra_clk_clk_out_1_mux] = { .dt_id = TEGRA124_CLK_CLK_OUT_1_MUX, .present = true },
  882. [tegra_clk_clk_out_2_mux] = { .dt_id = TEGRA124_CLK_CLK_OUT_2_MUX, .present = true },
  883. [tegra_clk_clk_out_3_mux] = { .dt_id = TEGRA124_CLK_CLK_OUT_3_MUX, .present = true },
  884. };
  885. static struct tegra_devclk devclks[] __initdata = {
  886. { .con_id = "clk_m", .dt_id = TEGRA124_CLK_CLK_M },
  887. { .con_id = "pll_ref", .dt_id = TEGRA124_CLK_PLL_REF },
  888. { .con_id = "clk_32k", .dt_id = TEGRA124_CLK_CLK_32K },
  889. { .con_id = "clk_m_div2", .dt_id = TEGRA124_CLK_CLK_M_DIV2 },
  890. { .con_id = "clk_m_div4", .dt_id = TEGRA124_CLK_CLK_M_DIV4 },
  891. { .con_id = "pll_c", .dt_id = TEGRA124_CLK_PLL_C },
  892. { .con_id = "pll_c_out1", .dt_id = TEGRA124_CLK_PLL_C_OUT1 },
  893. { .con_id = "pll_c2", .dt_id = TEGRA124_CLK_PLL_C2 },
  894. { .con_id = "pll_c3", .dt_id = TEGRA124_CLK_PLL_C3 },
  895. { .con_id = "pll_p", .dt_id = TEGRA124_CLK_PLL_P },
  896. { .con_id = "pll_p_out1", .dt_id = TEGRA124_CLK_PLL_P_OUT1 },
  897. { .con_id = "pll_p_out2", .dt_id = TEGRA124_CLK_PLL_P_OUT2 },
  898. { .con_id = "pll_p_out3", .dt_id = TEGRA124_CLK_PLL_P_OUT3 },
  899. { .con_id = "pll_p_out4", .dt_id = TEGRA124_CLK_PLL_P_OUT4 },
  900. { .con_id = "pll_m", .dt_id = TEGRA124_CLK_PLL_M },
  901. { .con_id = "pll_m_out1", .dt_id = TEGRA124_CLK_PLL_M_OUT1 },
  902. { .con_id = "pll_x", .dt_id = TEGRA124_CLK_PLL_X },
  903. { .con_id = "pll_x_out0", .dt_id = TEGRA124_CLK_PLL_X_OUT0 },
  904. { .con_id = "pll_u", .dt_id = TEGRA124_CLK_PLL_U },
  905. { .con_id = "pll_u_480M", .dt_id = TEGRA124_CLK_PLL_U_480M },
  906. { .con_id = "pll_u_60M", .dt_id = TEGRA124_CLK_PLL_U_60M },
  907. { .con_id = "pll_u_48M", .dt_id = TEGRA124_CLK_PLL_U_48M },
  908. { .con_id = "pll_u_12M", .dt_id = TEGRA124_CLK_PLL_U_12M },
  909. { .con_id = "pll_d", .dt_id = TEGRA124_CLK_PLL_D },
  910. { .con_id = "pll_d_out0", .dt_id = TEGRA124_CLK_PLL_D_OUT0 },
  911. { .con_id = "pll_d2", .dt_id = TEGRA124_CLK_PLL_D2 },
  912. { .con_id = "pll_d2_out0", .dt_id = TEGRA124_CLK_PLL_D2_OUT0 },
  913. { .con_id = "pll_a", .dt_id = TEGRA124_CLK_PLL_A },
  914. { .con_id = "pll_a_out0", .dt_id = TEGRA124_CLK_PLL_A_OUT0 },
  915. { .con_id = "pll_re_vco", .dt_id = TEGRA124_CLK_PLL_RE_VCO },
  916. { .con_id = "pll_re_out", .dt_id = TEGRA124_CLK_PLL_RE_OUT },
  917. { .con_id = "spdif_in_sync", .dt_id = TEGRA124_CLK_SPDIF_IN_SYNC },
  918. { .con_id = "i2s0_sync", .dt_id = TEGRA124_CLK_I2S0_SYNC },
  919. { .con_id = "i2s1_sync", .dt_id = TEGRA124_CLK_I2S1_SYNC },
  920. { .con_id = "i2s2_sync", .dt_id = TEGRA124_CLK_I2S2_SYNC },
  921. { .con_id = "i2s3_sync", .dt_id = TEGRA124_CLK_I2S3_SYNC },
  922. { .con_id = "i2s4_sync", .dt_id = TEGRA124_CLK_I2S4_SYNC },
  923. { .con_id = "vimclk_sync", .dt_id = TEGRA124_CLK_VIMCLK_SYNC },
  924. { .con_id = "audio0", .dt_id = TEGRA124_CLK_AUDIO0 },
  925. { .con_id = "audio1", .dt_id = TEGRA124_CLK_AUDIO1 },
  926. { .con_id = "audio2", .dt_id = TEGRA124_CLK_AUDIO2 },
  927. { .con_id = "audio3", .dt_id = TEGRA124_CLK_AUDIO3 },
  928. { .con_id = "audio4", .dt_id = TEGRA124_CLK_AUDIO4 },
  929. { .con_id = "spdif", .dt_id = TEGRA124_CLK_SPDIF },
  930. { .con_id = "audio0_2x", .dt_id = TEGRA124_CLK_AUDIO0_2X },
  931. { .con_id = "audio1_2x", .dt_id = TEGRA124_CLK_AUDIO1_2X },
  932. { .con_id = "audio2_2x", .dt_id = TEGRA124_CLK_AUDIO2_2X },
  933. { .con_id = "audio3_2x", .dt_id = TEGRA124_CLK_AUDIO3_2X },
  934. { .con_id = "audio4_2x", .dt_id = TEGRA124_CLK_AUDIO4_2X },
  935. { .con_id = "spdif_2x", .dt_id = TEGRA124_CLK_SPDIF_2X },
  936. { .con_id = "extern1", .dev_id = "clk_out_1", .dt_id = TEGRA124_CLK_EXTERN1 },
  937. { .con_id = "extern2", .dev_id = "clk_out_2", .dt_id = TEGRA124_CLK_EXTERN2 },
  938. { .con_id = "extern3", .dev_id = "clk_out_3", .dt_id = TEGRA124_CLK_EXTERN3 },
  939. { .con_id = "blink", .dt_id = TEGRA124_CLK_BLINK },
  940. { .con_id = "cclk_g", .dt_id = TEGRA124_CLK_CCLK_G },
  941. { .con_id = "cclk_lp", .dt_id = TEGRA124_CLK_CCLK_LP },
  942. { .con_id = "sclk", .dt_id = TEGRA124_CLK_SCLK },
  943. { .con_id = "hclk", .dt_id = TEGRA124_CLK_HCLK },
  944. { .con_id = "pclk", .dt_id = TEGRA124_CLK_PCLK },
  945. { .con_id = "fuse", .dt_id = TEGRA124_CLK_FUSE },
  946. { .dev_id = "rtc-tegra", .dt_id = TEGRA124_CLK_RTC },
  947. { .dev_id = "timer", .dt_id = TEGRA124_CLK_TIMER },
  948. { .con_id = "hda", .dt_id = TEGRA124_CLK_HDA },
  949. { .con_id = "hda2codec_2x", .dt_id = TEGRA124_CLK_HDA2CODEC_2X },
  950. { .con_id = "hda2hdmi", .dt_id = TEGRA124_CLK_HDA2HDMI },
  951. };
  952. static struct clk **clks;
  953. static void tegra124_utmi_param_configure(void __iomem *clk_base)
  954. {
  955. u32 reg;
  956. int i;
  957. for (i = 0; i < ARRAY_SIZE(utmi_parameters); i++) {
  958. if (osc_freq == utmi_parameters[i].osc_frequency)
  959. break;
  960. }
  961. if (i >= ARRAY_SIZE(utmi_parameters)) {
  962. pr_err("%s: Unexpected oscillator freq %lu\n", __func__,
  963. osc_freq);
  964. return;
  965. }
  966. reg = readl_relaxed(clk_base + UTMIP_PLL_CFG2);
  967. /* Program UTMIP PLL stable and active counts */
  968. /* [FIXME] arclk_rst.h says WRONG! This should be 1ms -> 0x50 Check! */
  969. reg &= ~UTMIP_PLL_CFG2_STABLE_COUNT(~0);
  970. reg |= UTMIP_PLL_CFG2_STABLE_COUNT(utmi_parameters[i].stable_count);
  971. reg &= ~UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(~0);
  972. reg |= UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(utmi_parameters[i].
  973. active_delay_count);
  974. /* Remove power downs from UTMIP PLL control bits */
  975. reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN;
  976. reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN;
  977. reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN;
  978. writel_relaxed(reg, clk_base + UTMIP_PLL_CFG2);
  979. /* Program UTMIP PLL delay and oscillator frequency counts */
  980. reg = readl_relaxed(clk_base + UTMIP_PLL_CFG1);
  981. reg &= ~UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(~0);
  982. reg |= UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(utmi_parameters[i].
  983. enable_delay_count);
  984. reg &= ~UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(~0);
  985. reg |= UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(utmi_parameters[i].
  986. xtal_freq_count);
  987. /* Remove power downs from UTMIP PLL control bits */
  988. reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN;
  989. reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN;
  990. reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP;
  991. reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN;
  992. writel_relaxed(reg, clk_base + UTMIP_PLL_CFG1);
  993. /* Setup HW control of UTMIPLL */
  994. reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0);
  995. reg |= UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET;
  996. reg &= ~UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL;
  997. reg |= UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE;
  998. writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0);
  999. reg = readl_relaxed(clk_base + UTMIP_PLL_CFG1);
  1000. reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP;
  1001. reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN;
  1002. writel_relaxed(reg, clk_base + UTMIP_PLL_CFG1);
  1003. udelay(1);
  1004. /* Setup SW override of UTMIPLL assuming USB2.0
  1005. ports are assigned to USB2 */
  1006. reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0);
  1007. reg |= UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL;
  1008. reg &= ~UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE;
  1009. writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0);
  1010. udelay(1);
  1011. /* Enable HW control UTMIPLL */
  1012. reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0);
  1013. reg |= UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE;
  1014. writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0);
  1015. }
  1016. static __init void tegra124_periph_clk_init(void __iomem *clk_base,
  1017. void __iomem *pmc_base)
  1018. {
  1019. struct clk *clk;
  1020. /* xusb_ss_div2 */
  1021. clk = clk_register_fixed_factor(NULL, "xusb_ss_div2", "xusb_ss_src", 0,
  1022. 1, 2);
  1023. clks[TEGRA124_CLK_XUSB_SS_DIV2] = clk;
  1024. clk = clk_register_gate(NULL, "pll_d_dsi_out", "pll_d_out0", 0,
  1025. clk_base + PLLD_MISC, 30, 0, &pll_d_lock);
  1026. clks[TEGRA124_CLK_PLL_D_DSI_OUT] = clk;
  1027. clk = tegra_clk_register_periph_gate("dsia", "pll_d_dsi_out", 0,
  1028. clk_base, 0, 48,
  1029. periph_clk_enb_refcnt);
  1030. clks[TEGRA124_CLK_DSIA] = clk;
  1031. clk = tegra_clk_register_periph_gate("dsib", "pll_d_dsi_out", 0,
  1032. clk_base, 0, 82,
  1033. periph_clk_enb_refcnt);
  1034. clks[TEGRA124_CLK_DSIB] = clk;
  1035. /* emc mux */
  1036. clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm,
  1037. ARRAY_SIZE(mux_pllmcp_clkm), 0,
  1038. clk_base + CLK_SOURCE_EMC,
  1039. 29, 3, 0, &emc_lock);
  1040. clk = tegra_clk_register_mc("mc", "emc_mux", clk_base + CLK_SOURCE_EMC,
  1041. &emc_lock);
  1042. clks[TEGRA124_CLK_MC] = clk;
  1043. /* cml0 */
  1044. clk = clk_register_gate(NULL, "cml0", "pll_e", 0, clk_base + PLLE_AUX,
  1045. 0, 0, &pll_e_lock);
  1046. clk_register_clkdev(clk, "cml0", NULL);
  1047. clks[TEGRA124_CLK_CML0] = clk;
  1048. /* cml1 */
  1049. clk = clk_register_gate(NULL, "cml1", "pll_e", 0, clk_base + PLLE_AUX,
  1050. 1, 0, &pll_e_lock);
  1051. clk_register_clkdev(clk, "cml1", NULL);
  1052. clks[TEGRA124_CLK_CML1] = clk;
  1053. tegra_periph_clk_init(clk_base, pmc_base, tegra124_clks, &pll_p_params);
  1054. }
  1055. static void __init tegra124_pll_init(void __iomem *clk_base,
  1056. void __iomem *pmc)
  1057. {
  1058. u32 val;
  1059. struct clk *clk;
  1060. /* PLLC */
  1061. clk = tegra_clk_register_pllxc("pll_c", "pll_ref", clk_base,
  1062. pmc, 0, &pll_c_params, NULL);
  1063. clk_register_clkdev(clk, "pll_c", NULL);
  1064. clks[TEGRA124_CLK_PLL_C] = clk;
  1065. /* PLLC_OUT1 */
  1066. clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c",
  1067. clk_base + PLLC_OUT, 0, TEGRA_DIVIDER_ROUND_UP,
  1068. 8, 8, 1, NULL);
  1069. clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div",
  1070. clk_base + PLLC_OUT, 1, 0,
  1071. CLK_SET_RATE_PARENT, 0, NULL);
  1072. clk_register_clkdev(clk, "pll_c_out1", NULL);
  1073. clks[TEGRA124_CLK_PLL_C_OUT1] = clk;
  1074. /* PLLC_UD */
  1075. clk = clk_register_fixed_factor(NULL, "pll_c_ud", "pll_c",
  1076. CLK_SET_RATE_PARENT, 1, 1);
  1077. clk_register_clkdev(clk, "pll_c_ud", NULL);
  1078. clks[TEGRA124_CLK_PLL_C_UD] = clk;
  1079. /* PLLC2 */
  1080. clk = tegra_clk_register_pllc("pll_c2", "pll_ref", clk_base, pmc, 0,
  1081. &pll_c2_params, NULL);
  1082. clk_register_clkdev(clk, "pll_c2", NULL);
  1083. clks[TEGRA124_CLK_PLL_C2] = clk;
  1084. /* PLLC3 */
  1085. clk = tegra_clk_register_pllc("pll_c3", "pll_ref", clk_base, pmc, 0,
  1086. &pll_c3_params, NULL);
  1087. clk_register_clkdev(clk, "pll_c3", NULL);
  1088. clks[TEGRA124_CLK_PLL_C3] = clk;
  1089. /* PLLM */
  1090. clk = tegra_clk_register_pllm("pll_m", "pll_ref", clk_base, pmc,
  1091. CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE,
  1092. &pll_m_params, NULL);
  1093. clk_register_clkdev(clk, "pll_m", NULL);
  1094. clks[TEGRA124_CLK_PLL_M] = clk;
  1095. /* PLLM_OUT1 */
  1096. clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m",
  1097. clk_base + PLLM_OUT, 0, TEGRA_DIVIDER_ROUND_UP,
  1098. 8, 8, 1, NULL);
  1099. clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div",
  1100. clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED |
  1101. CLK_SET_RATE_PARENT, 0, NULL);
  1102. clk_register_clkdev(clk, "pll_m_out1", NULL);
  1103. clks[TEGRA124_CLK_PLL_M_OUT1] = clk;
  1104. /* PLLM_UD */
  1105. clk = clk_register_fixed_factor(NULL, "pll_m_ud", "pll_m",
  1106. CLK_SET_RATE_PARENT, 1, 1);
  1107. clk_register_clkdev(clk, "pll_m_ud", NULL);
  1108. clks[TEGRA124_CLK_PLL_M_UD] = clk;
  1109. /* PLLU */
  1110. val = readl(clk_base + pll_u_params.base_reg);
  1111. val &= ~BIT(24); /* disable PLLU_OVERRIDE */
  1112. writel(val, clk_base + pll_u_params.base_reg);
  1113. clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc, 0,
  1114. &pll_u_params, &pll_u_lock);
  1115. clk_register_clkdev(clk, "pll_u", NULL);
  1116. clks[TEGRA124_CLK_PLL_U] = clk;
  1117. tegra124_utmi_param_configure(clk_base);
  1118. /* PLLU_480M */
  1119. clk = clk_register_gate(NULL, "pll_u_480M", "pll_u",
  1120. CLK_SET_RATE_PARENT, clk_base + PLLU_BASE,
  1121. 22, 0, &pll_u_lock);
  1122. clk_register_clkdev(clk, "pll_u_480M", NULL);
  1123. clks[TEGRA124_CLK_PLL_U_480M] = clk;
  1124. /* PLLU_60M */
  1125. clk = clk_register_fixed_factor(NULL, "pll_u_60M", "pll_u",
  1126. CLK_SET_RATE_PARENT, 1, 8);
  1127. clk_register_clkdev(clk, "pll_u_60M", NULL);
  1128. clks[TEGRA124_CLK_PLL_U_60M] = clk;
  1129. /* PLLU_48M */
  1130. clk = clk_register_fixed_factor(NULL, "pll_u_48M", "pll_u",
  1131. CLK_SET_RATE_PARENT, 1, 10);
  1132. clk_register_clkdev(clk, "pll_u_48M", NULL);
  1133. clks[TEGRA124_CLK_PLL_U_48M] = clk;
  1134. /* PLLU_12M */
  1135. clk = clk_register_fixed_factor(NULL, "pll_u_12M", "pll_u",
  1136. CLK_SET_RATE_PARENT, 1, 40);
  1137. clk_register_clkdev(clk, "pll_u_12M", NULL);
  1138. clks[TEGRA124_CLK_PLL_U_12M] = clk;
  1139. /* PLLD */
  1140. clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc, 0,
  1141. &pll_d_params, &pll_d_lock);
  1142. clk_register_clkdev(clk, "pll_d", NULL);
  1143. clks[TEGRA124_CLK_PLL_D] = clk;
  1144. /* PLLD_OUT0 */
  1145. clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d",
  1146. CLK_SET_RATE_PARENT, 1, 2);
  1147. clk_register_clkdev(clk, "pll_d_out0", NULL);
  1148. clks[TEGRA124_CLK_PLL_D_OUT0] = clk;
  1149. /* PLLRE */
  1150. clk = tegra_clk_register_pllre("pll_re_vco", "pll_ref", clk_base, pmc,
  1151. 0, &pll_re_vco_params, &pll_re_lock, pll_ref_freq);
  1152. clk_register_clkdev(clk, "pll_re_vco", NULL);
  1153. clks[TEGRA124_CLK_PLL_RE_VCO] = clk;
  1154. clk = clk_register_divider_table(NULL, "pll_re_out", "pll_re_vco", 0,
  1155. clk_base + PLLRE_BASE, 16, 4, 0,
  1156. pll_re_div_table, &pll_re_lock);
  1157. clk_register_clkdev(clk, "pll_re_out", NULL);
  1158. clks[TEGRA124_CLK_PLL_RE_OUT] = clk;
  1159. /* PLLE */
  1160. clk = tegra_clk_register_plle_tegra114("pll_e", "pll_ref",
  1161. clk_base, 0, &pll_e_params, NULL);
  1162. clk_register_clkdev(clk, "pll_e", NULL);
  1163. clks[TEGRA124_CLK_PLL_E] = clk;
  1164. /* PLLC4 */
  1165. clk = tegra_clk_register_pllss("pll_c4", "pll_ref", clk_base, 0,
  1166. &pll_c4_params, NULL);
  1167. clk_register_clkdev(clk, "pll_c4", NULL);
  1168. clks[TEGRA124_CLK_PLL_C4] = clk;
  1169. /* PLLDP */
  1170. clk = tegra_clk_register_pllss("pll_dp", "pll_ref", clk_base, 0,
  1171. &pll_dp_params, NULL);
  1172. clk_register_clkdev(clk, "pll_dp", NULL);
  1173. clks[TEGRA124_CLK_PLL_DP] = clk;
  1174. /* PLLD2 */
  1175. clk = tegra_clk_register_pllss("pll_d2", "pll_ref", clk_base, 0,
  1176. &tegra124_pll_d2_params, NULL);
  1177. clk_register_clkdev(clk, "pll_d2", NULL);
  1178. clks[TEGRA124_CLK_PLL_D2] = clk;
  1179. /* PLLD2_OUT0 */
  1180. clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2",
  1181. CLK_SET_RATE_PARENT, 1, 1);
  1182. clk_register_clkdev(clk, "pll_d2_out0", NULL);
  1183. clks[TEGRA124_CLK_PLL_D2_OUT0] = clk;
  1184. }
  1185. /* Tegra124 CPU clock and reset control functions */
  1186. static void tegra124_wait_cpu_in_reset(u32 cpu)
  1187. {
  1188. unsigned int reg;
  1189. do {
  1190. reg = readl(clk_base + CLK_RST_CONTROLLER_CPU_CMPLX_STATUS);
  1191. cpu_relax();
  1192. } while (!(reg & (1 << cpu))); /* check CPU been reset or not */
  1193. }
  1194. static void tegra124_disable_cpu_clock(u32 cpu)
  1195. {
  1196. /* flow controller would take care in the power sequence. */
  1197. }
  1198. #ifdef CONFIG_PM_SLEEP
  1199. static void tegra124_cpu_clock_suspend(void)
  1200. {
  1201. /* switch coresite to clk_m, save off original source */
  1202. tegra124_cpu_clk_sctx.clk_csite_src =
  1203. readl(clk_base + CLK_SOURCE_CSITE);
  1204. writel(3 << 30, clk_base + CLK_SOURCE_CSITE);
  1205. }
  1206. static void tegra124_cpu_clock_resume(void)
  1207. {
  1208. writel(tegra124_cpu_clk_sctx.clk_csite_src,
  1209. clk_base + CLK_SOURCE_CSITE);
  1210. }
  1211. #endif
  1212. static struct tegra_cpu_car_ops tegra124_cpu_car_ops = {
  1213. .wait_for_reset = tegra124_wait_cpu_in_reset,
  1214. .disable_clock = tegra124_disable_cpu_clock,
  1215. #ifdef CONFIG_PM_SLEEP
  1216. .suspend = tegra124_cpu_clock_suspend,
  1217. .resume = tegra124_cpu_clock_resume,
  1218. #endif
  1219. };
  1220. static const struct of_device_id pmc_match[] __initconst = {
  1221. { .compatible = "nvidia,tegra124-pmc" },
  1222. {},
  1223. };
  1224. static struct tegra_clk_init_table common_init_table[] __initdata = {
  1225. {TEGRA124_CLK_UARTA, TEGRA124_CLK_PLL_P, 408000000, 0},
  1226. {TEGRA124_CLK_UARTB, TEGRA124_CLK_PLL_P, 408000000, 0},
  1227. {TEGRA124_CLK_UARTC, TEGRA124_CLK_PLL_P, 408000000, 0},
  1228. {TEGRA124_CLK_UARTD, TEGRA124_CLK_PLL_P, 408000000, 0},
  1229. {TEGRA124_CLK_PLL_A, TEGRA124_CLK_CLK_MAX, 564480000, 1},
  1230. {TEGRA124_CLK_PLL_A_OUT0, TEGRA124_CLK_CLK_MAX, 11289600, 1},
  1231. {TEGRA124_CLK_EXTERN1, TEGRA124_CLK_PLL_A_OUT0, 0, 1},
  1232. {TEGRA124_CLK_CLK_OUT_1_MUX, TEGRA124_CLK_EXTERN1, 0, 1},
  1233. {TEGRA124_CLK_CLK_OUT_1, TEGRA124_CLK_CLK_MAX, 0, 1},
  1234. {TEGRA124_CLK_I2S0, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0},
  1235. {TEGRA124_CLK_I2S1, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0},
  1236. {TEGRA124_CLK_I2S2, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0},
  1237. {TEGRA124_CLK_I2S3, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0},
  1238. {TEGRA124_CLK_I2S4, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0},
  1239. {TEGRA124_CLK_VDE, TEGRA124_CLK_PLL_P, 0, 0},
  1240. {TEGRA124_CLK_HOST1X, TEGRA124_CLK_PLL_P, 136000000, 1},
  1241. {TEGRA124_CLK_DSIALP, TEGRA124_CLK_PLL_P, 68000000, 0},
  1242. {TEGRA124_CLK_DSIBLP, TEGRA124_CLK_PLL_P, 68000000, 0},
  1243. {TEGRA124_CLK_SCLK, TEGRA124_CLK_PLL_P_OUT2, 102000000, 1},
  1244. {TEGRA124_CLK_DFLL_SOC, TEGRA124_CLK_PLL_P, 51000000, 1},
  1245. {TEGRA124_CLK_DFLL_REF, TEGRA124_CLK_PLL_P, 51000000, 1},
  1246. {TEGRA124_CLK_PLL_C, TEGRA124_CLK_CLK_MAX, 768000000, 0},
  1247. {TEGRA124_CLK_PLL_C_OUT1, TEGRA124_CLK_CLK_MAX, 100000000, 0},
  1248. {TEGRA124_CLK_SBC4, TEGRA124_CLK_PLL_P, 12000000, 1},
  1249. {TEGRA124_CLK_TSEC, TEGRA124_CLK_PLL_C3, 0, 0},
  1250. {TEGRA124_CLK_MSENC, TEGRA124_CLK_PLL_C3, 0, 0},
  1251. {TEGRA124_CLK_PLL_RE_VCO, TEGRA124_CLK_CLK_MAX, 672000000, 0},
  1252. {TEGRA124_CLK_XUSB_SS_SRC, TEGRA124_CLK_PLL_U_480M, 120000000, 0},
  1253. {TEGRA124_CLK_XUSB_FS_SRC, TEGRA124_CLK_PLL_U_48M, 48000000, 0},
  1254. {TEGRA124_CLK_XUSB_HS_SRC, TEGRA124_CLK_PLL_U_60M, 60000000, 0},
  1255. {TEGRA124_CLK_XUSB_FALCON_SRC, TEGRA124_CLK_PLL_RE_OUT, 224000000, 0},
  1256. {TEGRA124_CLK_XUSB_HOST_SRC, TEGRA124_CLK_PLL_RE_OUT, 112000000, 0},
  1257. {TEGRA124_CLK_SATA, TEGRA124_CLK_PLL_P, 104000000, 0},
  1258. {TEGRA124_CLK_SATA_OOB, TEGRA124_CLK_PLL_P, 204000000, 0},
  1259. {TEGRA124_CLK_EMC, TEGRA124_CLK_CLK_MAX, 0, 1},
  1260. {TEGRA124_CLK_MSELECT, TEGRA124_CLK_CLK_MAX, 0, 1},
  1261. {TEGRA124_CLK_CSITE, TEGRA124_CLK_CLK_MAX, 0, 1},
  1262. {TEGRA124_CLK_TSENSOR, TEGRA124_CLK_CLK_M, 400000, 0},
  1263. /* This MUST be the last entry. */
  1264. {TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0},
  1265. };
  1266. static struct tegra_clk_init_table tegra124_init_table[] __initdata = {
  1267. {TEGRA124_CLK_SOC_THERM, TEGRA124_CLK_PLL_P, 51000000, 0},
  1268. {TEGRA124_CLK_CCLK_G, TEGRA124_CLK_CLK_MAX, 0, 1},
  1269. {TEGRA124_CLK_HDA, TEGRA124_CLK_PLL_P, 102000000, 0},
  1270. {TEGRA124_CLK_HDA2CODEC_2X, TEGRA124_CLK_PLL_P, 48000000, 0},
  1271. /* This MUST be the last entry. */
  1272. {TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0},
  1273. };
  1274. /* Tegra132 requires the SOC_THERM clock to remain active */
  1275. static struct tegra_clk_init_table tegra132_init_table[] __initdata = {
  1276. {TEGRA124_CLK_SOC_THERM, TEGRA124_CLK_PLL_P, 51000000, 1},
  1277. /* This MUST be the last entry. */
  1278. {TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0},
  1279. };
  1280. /**
  1281. * tegra124_clock_apply_init_table - initialize clocks on Tegra124 SoCs
  1282. *
  1283. * Program an initial clock rate and enable or disable clocks needed
  1284. * by the rest of the kernel, for Tegra124 SoCs. It is intended to be
  1285. * called by assigning a pointer to it to tegra_clk_apply_init_table -
  1286. * this will be called as an arch_initcall. No return value.
  1287. */
  1288. static void __init tegra124_clock_apply_init_table(void)
  1289. {
  1290. tegra_init_from_table(common_init_table, clks, TEGRA124_CLK_CLK_MAX);
  1291. tegra_init_from_table(tegra124_init_table, clks, TEGRA124_CLK_CLK_MAX);
  1292. }
  1293. /**
  1294. * tegra132_clock_apply_init_table - initialize clocks on Tegra132 SoCs
  1295. *
  1296. * Program an initial clock rate and enable or disable clocks needed
  1297. * by the rest of the kernel, for Tegra132 SoCs. It is intended to be
  1298. * called by assigning a pointer to it to tegra_clk_apply_init_table -
  1299. * this will be called as an arch_initcall. No return value.
  1300. */
  1301. static void __init tegra132_clock_apply_init_table(void)
  1302. {
  1303. tegra_init_from_table(common_init_table, clks, TEGRA124_CLK_CLK_MAX);
  1304. tegra_init_from_table(tegra132_init_table, clks, TEGRA124_CLK_CLK_MAX);
  1305. }
  1306. /**
  1307. * tegra124_132_clock_init_pre - clock initialization preamble for T124/T132
  1308. * @np: struct device_node * of the DT node for the SoC CAR IP block
  1309. *
  1310. * Register most of the clocks controlled by the CAR IP block, along
  1311. * with a few clocks controlled by the PMC IP block. Everything in
  1312. * this function should be common to Tegra124 and Tegra132. XXX The
  1313. * PMC clock initialization should probably be moved to PMC-specific
  1314. * driver code. No return value.
  1315. */
  1316. static void __init tegra124_132_clock_init_pre(struct device_node *np)
  1317. {
  1318. struct device_node *node;
  1319. u32 plld_base;
  1320. clk_base = of_iomap(np, 0);
  1321. if (!clk_base) {
  1322. pr_err("ioremap tegra124/tegra132 CAR failed\n");
  1323. return;
  1324. }
  1325. node = of_find_matching_node(NULL, pmc_match);
  1326. if (!node) {
  1327. pr_err("Failed to find pmc node\n");
  1328. WARN_ON(1);
  1329. return;
  1330. }
  1331. pmc_base = of_iomap(node, 0);
  1332. if (!pmc_base) {
  1333. pr_err("Can't map pmc registers\n");
  1334. WARN_ON(1);
  1335. return;
  1336. }
  1337. clks = tegra_clk_init(clk_base, TEGRA124_CLK_CLK_MAX,
  1338. TEGRA124_CAR_BANK_COUNT);
  1339. if (!clks)
  1340. return;
  1341. if (tegra_osc_clk_init(clk_base, tegra124_clks, tegra124_input_freq,
  1342. ARRAY_SIZE(tegra124_input_freq), 1, &osc_freq,
  1343. &pll_ref_freq) < 0)
  1344. return;
  1345. tegra_fixed_clk_init(tegra124_clks);
  1346. tegra124_pll_init(clk_base, pmc_base);
  1347. tegra124_periph_clk_init(clk_base, pmc_base);
  1348. tegra_audio_clk_init(clk_base, pmc_base, tegra124_clks, &pll_a_params);
  1349. tegra_pmc_clk_init(pmc_base, tegra124_clks);
  1350. /* For Tegra124 & Tegra132, PLLD is the only source for DSIA & DSIB */
  1351. plld_base = clk_readl(clk_base + PLLD_BASE);
  1352. plld_base &= ~BIT(25);
  1353. clk_writel(plld_base, clk_base + PLLD_BASE);
  1354. }
  1355. /**
  1356. * tegra124_132_clock_init_post - clock initialization postamble for T124/T132
  1357. * @np: struct device_node * of the DT node for the SoC CAR IP block
  1358. *
  1359. * Register most of the along with a few clocks controlled by the PMC
  1360. * IP block. Everything in this function should be common to Tegra124
  1361. * and Tegra132. This function must be called after
  1362. * tegra124_132_clock_init_pre(), otherwise clk_base and pmc_base will
  1363. * not be set. No return value.
  1364. */
  1365. static void __init tegra124_132_clock_init_post(struct device_node *np)
  1366. {
  1367. tegra_super_clk_gen4_init(clk_base, pmc_base, tegra124_clks,
  1368. &pll_x_params);
  1369. tegra_add_of_provider(np);
  1370. tegra_register_devclks(devclks, ARRAY_SIZE(devclks));
  1371. tegra_cpu_car_ops = &tegra124_cpu_car_ops;
  1372. }
  1373. /**
  1374. * tegra124_clock_init - Tegra124-specific clock initialization
  1375. * @np: struct device_node * of the DT node for the SoC CAR IP block
  1376. *
  1377. * Register most SoC clocks for the Tegra124 system-on-chip. Most of
  1378. * this code is shared between the Tegra124 and Tegra132 SoCs,
  1379. * although some of the initial clock settings and CPU clocks differ.
  1380. * Intended to be called by the OF init code when a DT node with the
  1381. * "nvidia,tegra124-car" string is encountered, and declared with
  1382. * CLK_OF_DECLARE. No return value.
  1383. */
  1384. static void __init tegra124_clock_init(struct device_node *np)
  1385. {
  1386. tegra124_132_clock_init_pre(np);
  1387. tegra_clk_apply_init_table = tegra124_clock_apply_init_table;
  1388. tegra124_132_clock_init_post(np);
  1389. }
  1390. /**
  1391. * tegra132_clock_init - Tegra132-specific clock initialization
  1392. * @np: struct device_node * of the DT node for the SoC CAR IP block
  1393. *
  1394. * Register most SoC clocks for the Tegra132 system-on-chip. Most of
  1395. * this code is shared between the Tegra124 and Tegra132 SoCs,
  1396. * although some of the initial clock settings and CPU clocks differ.
  1397. * Intended to be called by the OF init code when a DT node with the
  1398. * "nvidia,tegra132-car" string is encountered, and declared with
  1399. * CLK_OF_DECLARE. No return value.
  1400. */
  1401. static void __init tegra132_clock_init(struct device_node *np)
  1402. {
  1403. tegra124_132_clock_init_pre(np);
  1404. /*
  1405. * On Tegra132, these clocks are controlled by the
  1406. * CLUSTER_clocks IP block, located in the CPU complex
  1407. */
  1408. tegra124_clks[tegra_clk_cclk_g].present = false;
  1409. tegra124_clks[tegra_clk_cclk_lp].present = false;
  1410. tegra124_clks[tegra_clk_pll_x].present = false;
  1411. tegra124_clks[tegra_clk_pll_x_out0].present = false;
  1412. tegra_clk_apply_init_table = tegra132_clock_apply_init_table;
  1413. tegra124_132_clock_init_post(np);
  1414. }
  1415. CLK_OF_DECLARE(tegra124, "nvidia,tegra124-car", tegra124_clock_init);
  1416. CLK_OF_DECLARE(tegra132, "nvidia,tegra132-car", tegra132_clock_init);