clk-tegra-periph.c 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081
  1. /*
  2. * Copyright (c) 2012, 2013, 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-provider.h>
  18. #include <linux/clkdev.h>
  19. #include <linux/of.h>
  20. #include <linux/of_address.h>
  21. #include <linux/delay.h>
  22. #include <linux/export.h>
  23. #include <linux/clk/tegra.h>
  24. #include "clk.h"
  25. #include "clk-id.h"
  26. #define CLK_SOURCE_I2S0 0x1d8
  27. #define CLK_SOURCE_I2S1 0x100
  28. #define CLK_SOURCE_I2S2 0x104
  29. #define CLK_SOURCE_NDFLASH 0x160
  30. #define CLK_SOURCE_I2S3 0x3bc
  31. #define CLK_SOURCE_I2S4 0x3c0
  32. #define CLK_SOURCE_SPDIF_OUT 0x108
  33. #define CLK_SOURCE_SPDIF_IN 0x10c
  34. #define CLK_SOURCE_PWM 0x110
  35. #define CLK_SOURCE_ADX 0x638
  36. #define CLK_SOURCE_ADX1 0x670
  37. #define CLK_SOURCE_AMX 0x63c
  38. #define CLK_SOURCE_AMX1 0x674
  39. #define CLK_SOURCE_HDA 0x428
  40. #define CLK_SOURCE_HDA2CODEC_2X 0x3e4
  41. #define CLK_SOURCE_SBC1 0x134
  42. #define CLK_SOURCE_SBC2 0x118
  43. #define CLK_SOURCE_SBC3 0x11c
  44. #define CLK_SOURCE_SBC4 0x1b4
  45. #define CLK_SOURCE_SBC5 0x3c8
  46. #define CLK_SOURCE_SBC6 0x3cc
  47. #define CLK_SOURCE_SATA_OOB 0x420
  48. #define CLK_SOURCE_SATA 0x424
  49. #define CLK_SOURCE_NDSPEED 0x3f8
  50. #define CLK_SOURCE_VFIR 0x168
  51. #define CLK_SOURCE_SDMMC1 0x150
  52. #define CLK_SOURCE_SDMMC2 0x154
  53. #define CLK_SOURCE_SDMMC3 0x1bc
  54. #define CLK_SOURCE_SDMMC4 0x164
  55. #define CLK_SOURCE_CVE 0x140
  56. #define CLK_SOURCE_TVO 0x188
  57. #define CLK_SOURCE_TVDAC 0x194
  58. #define CLK_SOURCE_VDE 0x1c8
  59. #define CLK_SOURCE_CSITE 0x1d4
  60. #define CLK_SOURCE_LA 0x1f8
  61. #define CLK_SOURCE_TRACE 0x634
  62. #define CLK_SOURCE_OWR 0x1cc
  63. #define CLK_SOURCE_NOR 0x1d0
  64. #define CLK_SOURCE_MIPI 0x174
  65. #define CLK_SOURCE_I2C1 0x124
  66. #define CLK_SOURCE_I2C2 0x198
  67. #define CLK_SOURCE_I2C3 0x1b8
  68. #define CLK_SOURCE_I2C4 0x3c4
  69. #define CLK_SOURCE_I2C5 0x128
  70. #define CLK_SOURCE_I2C6 0x65c
  71. #define CLK_SOURCE_UARTA 0x178
  72. #define CLK_SOURCE_UARTB 0x17c
  73. #define CLK_SOURCE_UARTC 0x1a0
  74. #define CLK_SOURCE_UARTD 0x1c0
  75. #define CLK_SOURCE_UARTE 0x1c4
  76. #define CLK_SOURCE_3D 0x158
  77. #define CLK_SOURCE_2D 0x15c
  78. #define CLK_SOURCE_MPE 0x170
  79. #define CLK_SOURCE_UARTE 0x1c4
  80. #define CLK_SOURCE_VI_SENSOR 0x1a8
  81. #define CLK_SOURCE_VI 0x148
  82. #define CLK_SOURCE_EPP 0x16c
  83. #define CLK_SOURCE_MSENC 0x1f0
  84. #define CLK_SOURCE_TSEC 0x1f4
  85. #define CLK_SOURCE_HOST1X 0x180
  86. #define CLK_SOURCE_HDMI 0x18c
  87. #define CLK_SOURCE_DISP1 0x138
  88. #define CLK_SOURCE_DISP2 0x13c
  89. #define CLK_SOURCE_CILAB 0x614
  90. #define CLK_SOURCE_CILCD 0x618
  91. #define CLK_SOURCE_CILE 0x61c
  92. #define CLK_SOURCE_DSIALP 0x620
  93. #define CLK_SOURCE_DSIBLP 0x624
  94. #define CLK_SOURCE_TSENSOR 0x3b8
  95. #define CLK_SOURCE_D_AUDIO 0x3d0
  96. #define CLK_SOURCE_DAM0 0x3d8
  97. #define CLK_SOURCE_DAM1 0x3dc
  98. #define CLK_SOURCE_DAM2 0x3e0
  99. #define CLK_SOURCE_ACTMON 0x3e8
  100. #define CLK_SOURCE_EXTERN1 0x3ec
  101. #define CLK_SOURCE_EXTERN2 0x3f0
  102. #define CLK_SOURCE_EXTERN3 0x3f4
  103. #define CLK_SOURCE_I2CSLOW 0x3fc
  104. #define CLK_SOURCE_SE 0x42c
  105. #define CLK_SOURCE_MSELECT 0x3b4
  106. #define CLK_SOURCE_DFLL_REF 0x62c
  107. #define CLK_SOURCE_DFLL_SOC 0x630
  108. #define CLK_SOURCE_SOC_THERM 0x644
  109. #define CLK_SOURCE_XUSB_HOST_SRC 0x600
  110. #define CLK_SOURCE_XUSB_FALCON_SRC 0x604
  111. #define CLK_SOURCE_XUSB_FS_SRC 0x608
  112. #define CLK_SOURCE_XUSB_SS_SRC 0x610
  113. #define CLK_SOURCE_XUSB_DEV_SRC 0x60c
  114. #define CLK_SOURCE_ISP 0x144
  115. #define CLK_SOURCE_SOR0 0x414
  116. #define CLK_SOURCE_DPAUX 0x418
  117. #define CLK_SOURCE_SATA_OOB 0x420
  118. #define CLK_SOURCE_SATA 0x424
  119. #define CLK_SOURCE_ENTROPY 0x628
  120. #define CLK_SOURCE_VI_SENSOR2 0x658
  121. #define CLK_SOURCE_HDMI_AUDIO 0x668
  122. #define CLK_SOURCE_VIC03 0x678
  123. #define CLK_SOURCE_CLK72MHZ 0x66c
  124. #define CLK_SOURCE_DBGAPB 0x718
  125. #define CLK_SOURCE_NVENC 0x6a0
  126. #define CLK_SOURCE_NVDEC 0x698
  127. #define CLK_SOURCE_NVJPG 0x69c
  128. #define CLK_SOURCE_APE 0x6c0
  129. #define CLK_SOURCE_SOR1 0x410
  130. #define CLK_SOURCE_SDMMC_LEGACY 0x694
  131. #define CLK_SOURCE_QSPI 0x6c4
  132. #define CLK_SOURCE_VI_I2C 0x6c8
  133. #define CLK_SOURCE_MIPIBIF 0x660
  134. #define CLK_SOURCE_UARTAPE 0x710
  135. #define CLK_SOURCE_TSECB 0x6d8
  136. #define CLK_SOURCE_MAUD 0x6d4
  137. #define CLK_SOURCE_USB2_HSIC_TRK 0x6cc
  138. #define CLK_SOURCE_DMIC1 0x64c
  139. #define CLK_SOURCE_DMIC2 0x650
  140. #define CLK_SOURCE_DMIC3 0x6bc
  141. #define MASK(x) (BIT(x) - 1)
  142. #define MUX(_name, _parents, _offset, \
  143. _clk_num, _gate_flags, _clk_id) \
  144. TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
  145. 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP, \
  146. _clk_num, _gate_flags, _clk_id, _parents##_idx, 0,\
  147. NULL)
  148. #define MUX_FLAGS(_name, _parents, _offset,\
  149. _clk_num, _gate_flags, _clk_id, flags)\
  150. TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
  151. 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP,\
  152. _clk_num, _gate_flags, _clk_id, _parents##_idx, flags,\
  153. NULL)
  154. #define MUX8(_name, _parents, _offset, \
  155. _clk_num, _gate_flags, _clk_id) \
  156. TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
  157. 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP,\
  158. _clk_num, _gate_flags, _clk_id, _parents##_idx, 0,\
  159. NULL)
  160. #define MUX8_NOGATE_LOCK(_name, _parents, _offset, _clk_id, _lock) \
  161. TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset, \
  162. 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP,\
  163. 0, TEGRA_PERIPH_NO_GATE, _clk_id,\
  164. _parents##_idx, 0, _lock)
  165. #define MUX8_NOGATE(_name, _parents, _offset, _clk_id) \
  166. TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset, \
  167. 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP,\
  168. 0, TEGRA_PERIPH_NO_GATE, _clk_id,\
  169. _parents##_idx, 0, NULL)
  170. #define INT(_name, _parents, _offset, \
  171. _clk_num, _gate_flags, _clk_id) \
  172. TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
  173. 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT| \
  174. TEGRA_DIVIDER_ROUND_UP, _clk_num, _gate_flags,\
  175. _clk_id, _parents##_idx, 0, NULL)
  176. #define INT_FLAGS(_name, _parents, _offset,\
  177. _clk_num, _gate_flags, _clk_id, flags)\
  178. TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
  179. 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT| \
  180. TEGRA_DIVIDER_ROUND_UP, _clk_num, _gate_flags,\
  181. _clk_id, _parents##_idx, flags, NULL)
  182. #define INT8(_name, _parents, _offset,\
  183. _clk_num, _gate_flags, _clk_id) \
  184. TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
  185. 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT| \
  186. TEGRA_DIVIDER_ROUND_UP, _clk_num, _gate_flags,\
  187. _clk_id, _parents##_idx, 0, NULL)
  188. #define UART(_name, _parents, _offset,\
  189. _clk_num, _clk_id) \
  190. TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
  191. 30, MASK(2), 0, 0, 16, 1, TEGRA_DIVIDER_UART| \
  192. TEGRA_DIVIDER_ROUND_UP, _clk_num, 0, _clk_id,\
  193. _parents##_idx, 0, NULL)
  194. #define UART8(_name, _parents, _offset,\
  195. _clk_num, _clk_id) \
  196. TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
  197. 29, MASK(3), 0, 0, 16, 1, TEGRA_DIVIDER_UART| \
  198. TEGRA_DIVIDER_ROUND_UP, _clk_num, 0, _clk_id,\
  199. _parents##_idx, 0, NULL)
  200. #define I2C(_name, _parents, _offset,\
  201. _clk_num, _clk_id) \
  202. TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
  203. 30, MASK(2), 0, 0, 16, 0, TEGRA_DIVIDER_ROUND_UP,\
  204. _clk_num, TEGRA_PERIPH_ON_APB, _clk_id, \
  205. _parents##_idx, 0, NULL)
  206. #define XUSB(_name, _parents, _offset, \
  207. _clk_num, _gate_flags, _clk_id) \
  208. TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset, \
  209. 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT| \
  210. TEGRA_DIVIDER_ROUND_UP, _clk_num, _gate_flags,\
  211. _clk_id, _parents##_idx, 0, NULL)
  212. #define AUDIO(_name, _offset, _clk_num,\
  213. _gate_flags, _clk_id) \
  214. TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, mux_d_audio_clk, \
  215. _offset, 16, 0xE01F, 0, 0, 8, 1, \
  216. TEGRA_DIVIDER_ROUND_UP, _clk_num, _gate_flags, \
  217. _clk_id, mux_d_audio_clk_idx, 0, NULL)
  218. #define NODIV(_name, _parents, _offset, \
  219. _mux_shift, _mux_mask, _clk_num, \
  220. _gate_flags, _clk_id, _lock) \
  221. TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
  222. _mux_shift, _mux_mask, 0, 0, 0, 0, 0,\
  223. _clk_num, (_gate_flags) | TEGRA_PERIPH_NO_DIV,\
  224. _clk_id, _parents##_idx, 0, _lock)
  225. #define GATE(_name, _parent_name, \
  226. _clk_num, _gate_flags, _clk_id, _flags) \
  227. { \
  228. .name = _name, \
  229. .clk_id = _clk_id, \
  230. .p.parent_name = _parent_name, \
  231. .periph = TEGRA_CLK_PERIPH(0, 0, 0, 0, 0, 0, 0, \
  232. _clk_num, _gate_flags, NULL, NULL), \
  233. .flags = _flags \
  234. }
  235. #define DIV8(_name, _parent_name, _offset, _clk_id, _flags) \
  236. { \
  237. .name = _name, \
  238. .clk_id = _clk_id, \
  239. .p.parent_name = _parent_name, \
  240. .periph = TEGRA_CLK_PERIPH(0, 0, 0, 0, 8, 1, \
  241. TEGRA_DIVIDER_ROUND_UP, 0, 0, \
  242. NULL, NULL), \
  243. .offset = _offset, \
  244. .flags = _flags, \
  245. }
  246. #define PLLP_BASE 0xa0
  247. #define PLLP_MISC 0xac
  248. #define PLLP_MISC1 0x680
  249. #define PLLP_OUTA 0xa4
  250. #define PLLP_OUTB 0xa8
  251. #define PLLP_OUTC 0x67c
  252. #define PLL_BASE_LOCK BIT(27)
  253. #define PLL_MISC_LOCK_ENABLE 18
  254. static DEFINE_SPINLOCK(PLLP_OUTA_lock);
  255. static DEFINE_SPINLOCK(PLLP_OUTB_lock);
  256. static DEFINE_SPINLOCK(PLLP_OUTC_lock);
  257. static DEFINE_SPINLOCK(sor0_lock);
  258. static DEFINE_SPINLOCK(sor1_lock);
  259. #define MUX_I2S_SPDIF(_id) \
  260. static const char *mux_pllaout0_##_id##_2x_pllp_clkm[] = { "pll_a_out0", \
  261. #_id, "pll_p",\
  262. "clk_m"};
  263. MUX_I2S_SPDIF(audio0)
  264. MUX_I2S_SPDIF(audio1)
  265. MUX_I2S_SPDIF(audio2)
  266. MUX_I2S_SPDIF(audio3)
  267. MUX_I2S_SPDIF(audio4)
  268. MUX_I2S_SPDIF(audio)
  269. #define mux_pllaout0_audio0_2x_pllp_clkm_idx NULL
  270. #define mux_pllaout0_audio1_2x_pllp_clkm_idx NULL
  271. #define mux_pllaout0_audio2_2x_pllp_clkm_idx NULL
  272. #define mux_pllaout0_audio3_2x_pllp_clkm_idx NULL
  273. #define mux_pllaout0_audio4_2x_pllp_clkm_idx NULL
  274. #define mux_pllaout0_audio_2x_pllp_clkm_idx NULL
  275. static const char *mux_pllp_pllc_pllm_clkm[] = {
  276. "pll_p", "pll_c", "pll_m", "clk_m"
  277. };
  278. #define mux_pllp_pllc_pllm_clkm_idx NULL
  279. static const char *mux_pllp_pllc_pllm[] = { "pll_p", "pll_c", "pll_m" };
  280. #define mux_pllp_pllc_pllm_idx NULL
  281. static const char *mux_pllp_pllc_clk32_clkm[] = {
  282. "pll_p", "pll_c", "clk_32k", "clk_m"
  283. };
  284. #define mux_pllp_pllc_clk32_clkm_idx NULL
  285. static const char *mux_plla_pllc_pllp_clkm[] = {
  286. "pll_a_out0", "pll_c", "pll_p", "clk_m"
  287. };
  288. #define mux_plla_pllc_pllp_clkm_idx mux_pllp_pllc_pllm_clkm_idx
  289. static const char *mux_pllp_pllc2_c_c3_pllm_clkm[] = {
  290. "pll_p", "pll_c2", "pll_c", "pll_c3", "pll_m", "clk_m"
  291. };
  292. static u32 mux_pllp_pllc2_c_c3_pllm_clkm_idx[] = {
  293. [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6,
  294. };
  295. static const char *mux_pllp_clkm[] = {
  296. "pll_p", "clk_m"
  297. };
  298. static u32 mux_pllp_clkm_idx[] = {
  299. [0] = 0, [1] = 3,
  300. };
  301. static const char *mux_pllp_clkm_2[] = {
  302. "pll_p", "clk_m"
  303. };
  304. static u32 mux_pllp_clkm_2_idx[] = {
  305. [0] = 2, [1] = 6,
  306. };
  307. static const char *mux_pllc2_c_c3_pllp_plla1_clkm[] = {
  308. "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a1", "clk_m"
  309. };
  310. static u32 mux_pllc2_c_c3_pllp_plla1_clkm_idx[] = {
  311. [0] = 1, [1] = 2, [2] = 3, [3] = 4, [4] = 6, [5] = 7,
  312. };
  313. static const char *
  314. mux_pllc4_out1_pllc_pllc4_out2_pllp_clkm_plla_pllc4_out0[] = {
  315. "pll_c4_out1", "pll_c", "pll_c4_out2", "pll_p", "clk_m",
  316. "pll_a_out0", "pll_c4_out0"
  317. };
  318. static u32 mux_pllc4_out1_pllc_pllc4_out2_pllp_clkm_plla_pllc4_out0_idx[] = {
  319. [0] = 0, [1] = 2, [2] = 3, [3] = 4, [4] = 5, [5] = 6, [6] = 7,
  320. };
  321. static const char *mux_pllc_pllp_plla[] = {
  322. "pll_c", "pll_p", "pll_a_out0"
  323. };
  324. static u32 mux_pllc_pllp_plla_idx[] = {
  325. [0] = 1, [1] = 2, [2] = 3,
  326. };
  327. static const char *mux_clkm_pllc_pllp_plla[] = {
  328. "clk_m", "pll_c", "pll_p", "pll_a_out0"
  329. };
  330. #define mux_clkm_pllc_pllp_plla_idx NULL
  331. static const char *mux_pllc_pllp_plla1_pllc2_c3_clkm[] = {
  332. "pll_c", "pll_p", "pll_a1", "pll_c2", "pll_c3", "clk_m"
  333. };
  334. static u32 mux_pllc_pllp_plla1_pllc2_c3_clkm_idx[] = {
  335. [0] = 1, [1] = 2, [2] = 3, [3] = 4, [4] = 5, [5] = 6,
  336. };
  337. static const char *mux_pllc2_c_c3_pllp_clkm_plla1_pllc4[] = {
  338. "pll_c2", "pll_c", "pll_c3", "pll_p", "clk_m", "pll_a1", "pll_c4_out0",
  339. };
  340. static u32 mux_pllc2_c_c3_pllp_clkm_plla1_pllc4_idx[] = {
  341. [0] = 1, [1] = 2, [2] = 3, [3] = 4, [4] = 5, [5] = 6, [6] = 7,
  342. };
  343. static const char *mux_pllc_pllp_plla1_pllc2_c3_clkm_pllc4[] = {
  344. "pll_c", "pll_p", "pll_a1", "pll_c2", "pll_c3", "clk_m", "pll_c4_out0",
  345. };
  346. #define mux_pllc_pllp_plla1_pllc2_c3_clkm_pllc4_idx \
  347. mux_pllc2_c_c3_pllp_clkm_plla1_pllc4_idx
  348. static const char *
  349. mux_plla_pllc4_out0_pllc_pllc4_out1_pllp_pllc4_out2_clkm[] = {
  350. "pll_a_out0", "pll_c4_out0", "pll_c", "pll_c4_out1", "pll_p",
  351. "pll_c4_out2", "clk_m"
  352. };
  353. #define mux_plla_pllc4_out0_pllc_pllc4_out1_pllp_pllc4_out2_clkm_idx NULL
  354. static const char *mux_pllm_pllc2_c_c3_pllp_plla[] = {
  355. "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0"
  356. };
  357. #define mux_pllm_pllc2_c_c3_pllp_plla_idx mux_pllp_pllc2_c_c3_pllm_clkm_idx
  358. static const char *mux_pllp_pllm_plld_plla_pllc_plld2_clkm[] = {
  359. "pll_p", "pll_m", "pll_d_out0", "pll_a_out0", "pll_c",
  360. "pll_d2_out0", "clk_m"
  361. };
  362. #define mux_pllp_pllm_plld_plla_pllc_plld2_clkm_idx NULL
  363. static const char *mux_pllm_pllc_pllp_plla[] = {
  364. "pll_m", "pll_c", "pll_p", "pll_a_out0"
  365. };
  366. #define mux_pllm_pllc_pllp_plla_idx mux_pllp_pllc_pllm_clkm_idx
  367. static const char *mux_pllp_pllc_clkm[] = {
  368. "pll_p", "pll_c", "clk_m"
  369. };
  370. static u32 mux_pllp_pllc_clkm_idx[] = {
  371. [0] = 0, [1] = 1, [2] = 3,
  372. };
  373. static const char *mux_pllp_pllc_clkm_1[] = {
  374. "pll_p", "pll_c", "clk_m"
  375. };
  376. static u32 mux_pllp_pllc_clkm_1_idx[] = {
  377. [0] = 0, [1] = 2, [2] = 5,
  378. };
  379. static const char *mux_pllp_pllc_plla_clkm[] = {
  380. "pll_p", "pll_c", "pll_a_out0", "clk_m"
  381. };
  382. static u32 mux_pllp_pllc_plla_clkm_idx[] = {
  383. [0] = 0, [1] = 2, [2] = 4, [3] = 6,
  384. };
  385. static const char *mux_pllp_pllc_pllc4_out0_pllc4_out1_clkm_pllc4_out2[] = {
  386. "pll_p", "pll_c", "pll_c4_out0", "pll_c4_out1", "clk_m", "pll_c4_out2"
  387. };
  388. static u32 mux_pllp_pllc_pllc4_out0_pllc4_out1_clkm_pllc4_out2_idx[] = {
  389. [0] = 0, [1] = 2, [2] = 3, [3] = 5, [4] = 6, [5] = 7,
  390. };
  391. static const char *
  392. mux_pllp_pllc_pllc_out1_pllc4_out2_pllc4_out1_clkm_pllc4_out0[] = {
  393. "pll_p", "pll_c_out1", "pll_c", "pll_c4_out2", "pll_c4_out1",
  394. "clk_m", "pll_c4_out0"
  395. };
  396. static u32
  397. mux_pllp_pllc_pllc_out1_pllc4_out2_pllc4_out1_clkm_pllc4_out0_idx[] = {
  398. [0] = 0, [1] = 1, [2] = 2, [3] = 4, [4] = 5, [5] = 6, [6] = 7,
  399. };
  400. static const char *mux_pllp_pllc4_out2_pllc4_out1_clkm_pllc4_out0[] = {
  401. "pll_p", "pll_c4_out2", "pll_c4_out1", "clk_m", "pll_c4_out0"
  402. };
  403. static u32 mux_pllp_pllc4_out2_pllc4_out1_clkm_pllc4_out0_idx[] = {
  404. [0] = 0, [1] = 3, [2] = 4, [3] = 6, [4] = 7,
  405. };
  406. static const char *mux_pllp_clkm_pllc4_out2_out1_out0_lj[] = {
  407. "pll_p",
  408. "pll_c4_out2", "pll_c4_out0", /* LJ input */
  409. "pll_c4_out2", "pll_c4_out1",
  410. "pll_c4_out1", /* LJ input */
  411. "clk_m", "pll_c4_out0"
  412. };
  413. #define mux_pllp_clkm_pllc4_out2_out1_out0_lj_idx NULL
  414. static const char *mux_pllp_pllc2_c_c3_clkm[] = {
  415. "pll_p", "pll_c2", "pll_c", "pll_c3", "clk_m"
  416. };
  417. static u32 mux_pllp_pllc2_c_c3_clkm_idx[] = {
  418. [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 6,
  419. };
  420. static const char *mux_pllp_clkm_clk32_plle[] = {
  421. "pll_p", "clk_m", "clk_32k", "pll_e"
  422. };
  423. static u32 mux_pllp_clkm_clk32_plle_idx[] = {
  424. [0] = 0, [1] = 2, [2] = 4, [3] = 6,
  425. };
  426. static const char *mux_pllp_pllp_out3_clkm_clk32k_plla[] = {
  427. "pll_p", "pll_p_out3", "clk_m", "clk_32k", "pll_a_out0"
  428. };
  429. #define mux_pllp_pllp_out3_clkm_clk32k_plla_idx NULL
  430. static const char *mux_pllp_out3_clkm_pllp_pllc4[] = {
  431. "pll_p_out3", "clk_m", "pll_p", "pll_c4_out0", "pll_c4_out1",
  432. "pll_c4_out2"
  433. };
  434. static u32 mux_pllp_out3_clkm_pllp_pllc4_idx[] = {
  435. [0] = 0, [1] = 3, [2] = 4, [3] = 5, [4] = 6, [5] = 7,
  436. };
  437. static const char *mux_clkm_pllp_pllre[] = {
  438. "clk_m", "pll_p_out_xusb", "pll_re_out"
  439. };
  440. static u32 mux_clkm_pllp_pllre_idx[] = {
  441. [0] = 0, [1] = 1, [2] = 5,
  442. };
  443. static const char *mux_pllp_pllc_clkm_clk32[] = {
  444. "pll_p", "pll_c", "clk_m", "clk_32k"
  445. };
  446. #define mux_pllp_pllc_clkm_clk32_idx NULL
  447. static const char *mux_plla_clk32_pllp_clkm_plle[] = {
  448. "pll_a_out0", "clk_32k", "pll_p", "clk_m", "pll_e_out0"
  449. };
  450. #define mux_plla_clk32_pllp_clkm_plle_idx NULL
  451. static const char *mux_clkm_pllp_pllc_pllre[] = {
  452. "clk_m", "pll_p", "pll_c", "pll_re_out"
  453. };
  454. static u32 mux_clkm_pllp_pllc_pllre_idx[] = {
  455. [0] = 0, [1] = 1, [2] = 3, [3] = 5,
  456. };
  457. static const char *mux_clkm_48M_pllp_480M[] = {
  458. "clk_m", "pll_u_48M", "pll_p", "pll_u_480M"
  459. };
  460. static u32 mux_clkm_48M_pllp_480M_idx[] = {
  461. [0] = 0, [1] = 2, [2] = 4, [3] = 6,
  462. };
  463. static const char *mux_clkm_pllre_clk32_480M[] = {
  464. "clk_m", "pll_re_out", "clk_32k", "pll_u_480M"
  465. };
  466. #define mux_clkm_pllre_clk32_480M_idx NULL
  467. static const char *mux_clkm_pllre_clk32_480M_pllc_ref[] = {
  468. "clk_m", "pll_re_out", "clk_32k", "pll_u_480M", "pll_c", "pll_ref"
  469. };
  470. static u32 mux_clkm_pllre_clk32_480M_pllc_ref_idx[] = {
  471. [0] = 0, [1] = 1, [2] = 3, [3] = 3, [4] = 4, [5] = 7,
  472. };
  473. static const char *mux_pllp_out3_pllp_pllc_clkm[] = {
  474. "pll_p_out3", "pll_p", "pll_c", "clk_m"
  475. };
  476. static u32 mux_pllp_out3_pllp_pllc_clkm_idx[] = {
  477. [0] = 0, [1] = 1, [2] = 2, [3] = 6,
  478. };
  479. static const char *mux_ss_div2_60M[] = {
  480. "xusb_ss_div2", "pll_u_60M"
  481. };
  482. #define mux_ss_div2_60M_idx NULL
  483. static const char *mux_ss_div2_60M_ss[] = {
  484. "xusb_ss_div2", "pll_u_60M", "xusb_ss_src"
  485. };
  486. #define mux_ss_div2_60M_ss_idx NULL
  487. static const char *mux_ss_clkm[] = {
  488. "xusb_ss_src", "clk_m"
  489. };
  490. #define mux_ss_clkm_idx NULL
  491. static const char *mux_d_audio_clk[] = {
  492. "pll_a_out0", "pll_p", "clk_m", "spdif_in_sync", "i2s0_sync",
  493. "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync",
  494. };
  495. static u32 mux_d_audio_clk_idx[] = {
  496. [0] = 0, [1] = 0x8000, [2] = 0xc000, [3] = 0xE000, [4] = 0xE001,
  497. [5] = 0xE002, [6] = 0xE003, [7] = 0xE004, [8] = 0xE005, [9] = 0xE007,
  498. };
  499. static const char *mux_pllp_plld_pllc_clkm[] = {
  500. "pll_p", "pll_d_out0", "pll_c", "clk_m"
  501. };
  502. #define mux_pllp_plld_pllc_clkm_idx NULL
  503. static const char *mux_pllm_pllc_pllp_plla_clkm_pllc4[] = {
  504. "pll_m", "pll_c", "pll_p", "pll_a_out0", "clk_m", "pll_c4",
  505. };
  506. static u32 mux_pllm_pllc_pllp_plla_clkm_pllc4_idx[] = {
  507. [0] = 0, [1] = 1, [2] = 3, [3] = 3, [4] = 6, [5] = 7,
  508. };
  509. static const char *mux_pllp_clkm1[] = {
  510. "pll_p", "clk_m",
  511. };
  512. #define mux_pllp_clkm1_idx NULL
  513. static const char *mux_pllp3_pllc_clkm[] = {
  514. "pll_p_out3", "pll_c", "pll_c2", "clk_m",
  515. };
  516. #define mux_pllp3_pllc_clkm_idx NULL
  517. static const char *mux_pllm_pllc_pllp_plla_pllc2_c3_clkm[] = {
  518. "pll_m", "pll_c", "pll_p", "pll_a", "pll_c2", "pll_c3", "clk_m"
  519. };
  520. #define mux_pllm_pllc_pllp_plla_pllc2_c3_clkm_idx NULL
  521. static const char *mux_pllm_pllc2_c_c3_pllp_plla_pllc4[] = {
  522. "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0", "pll_c4",
  523. };
  524. static u32 mux_pllm_pllc2_c_c3_pllp_plla_pllc4_idx[] = {
  525. [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6, [6] = 7,
  526. };
  527. /* SOR1 mux'es */
  528. static const char *mux_pllp_plld_plld2_clkm[] = {
  529. "pll_p", "pll_d_out0", "pll_d2_out0", "clk_m"
  530. };
  531. static u32 mux_pllp_plld_plld2_clkm_idx[] = {
  532. [0] = 0, [1] = 2, [2] = 5, [3] = 6
  533. };
  534. static const char *mux_sor_safe_sor1_brick_sor1_src[] = {
  535. /*
  536. * Bit 0 of the mux selects sor1_brick, irrespective of bit 1, so the
  537. * sor1_brick parent appears twice in the list below. This is merely
  538. * to support clk_get_parent() if firmware happened to set these bits
  539. * to 0b11. While not an invalid setting, code should always set the
  540. * bits to 0b01 to select sor1_brick.
  541. */
  542. "sor_safe", "sor1_brick", "sor1_src", "sor1_brick"
  543. };
  544. #define mux_sor_safe_sor1_brick_sor1_src_idx NULL
  545. static const char *mux_pllp_pllre_clkm[] = {
  546. "pll_p", "pll_re_out1", "clk_m"
  547. };
  548. static u32 mux_pllp_pllre_clkm_idx[] = {
  549. [0] = 0, [1] = 2, [2] = 3,
  550. };
  551. static const char *mux_clkm_plldp_sor0lvds[] = {
  552. "clk_m", "pll_dp", "sor0_lvds",
  553. };
  554. #define mux_clkm_plldp_sor0lvds_idx NULL
  555. static const char * const mux_dmic1[] = {
  556. "pll_a_out0", "dmic1_sync_clk", "pll_p", "clk_m"
  557. };
  558. #define mux_dmic1_idx NULL
  559. static const char * const mux_dmic2[] = {
  560. "pll_a_out0", "dmic2_sync_clk", "pll_p", "clk_m"
  561. };
  562. #define mux_dmic2_idx NULL
  563. static const char * const mux_dmic3[] = {
  564. "pll_a_out0", "dmic3_sync_clk", "pll_p", "clk_m"
  565. };
  566. #define mux_dmic3_idx NULL
  567. static struct tegra_periph_init_data periph_clks[] = {
  568. AUDIO("d_audio", CLK_SOURCE_D_AUDIO, 106, TEGRA_PERIPH_ON_APB, tegra_clk_d_audio),
  569. AUDIO("dam0", CLK_SOURCE_DAM0, 108, TEGRA_PERIPH_ON_APB, tegra_clk_dam0),
  570. AUDIO("dam1", CLK_SOURCE_DAM1, 109, TEGRA_PERIPH_ON_APB, tegra_clk_dam1),
  571. AUDIO("dam2", CLK_SOURCE_DAM2, 110, TEGRA_PERIPH_ON_APB, tegra_clk_dam2),
  572. I2C("i2c1", mux_pllp_clkm, CLK_SOURCE_I2C1, 12, tegra_clk_i2c1),
  573. I2C("i2c2", mux_pllp_clkm, CLK_SOURCE_I2C2, 54, tegra_clk_i2c2),
  574. I2C("i2c3", mux_pllp_clkm, CLK_SOURCE_I2C3, 67, tegra_clk_i2c3),
  575. I2C("i2c4", mux_pllp_clkm, CLK_SOURCE_I2C4, 103, tegra_clk_i2c4),
  576. I2C("i2c5", mux_pllp_clkm, CLK_SOURCE_I2C5, 47, tegra_clk_i2c5),
  577. I2C("i2c6", mux_pllp_clkm, CLK_SOURCE_I2C6, 166, tegra_clk_i2c6),
  578. INT("vde", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VDE, 61, 0, tegra_clk_vde),
  579. INT("vi", mux_pllm_pllc_pllp_plla, CLK_SOURCE_VI, 20, 0, tegra_clk_vi),
  580. INT("epp", mux_pllm_pllc_pllp_plla, CLK_SOURCE_EPP, 19, 0, tegra_clk_epp),
  581. INT("host1x", mux_pllm_pllc_pllp_plla, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x),
  582. INT("mpe", mux_pllm_pllc_pllp_plla, CLK_SOURCE_MPE, 60, 0, tegra_clk_mpe),
  583. INT("2d", mux_pllm_pllc_pllp_plla, CLK_SOURCE_2D, 21, 0, tegra_clk_gr2d),
  584. INT("3d", mux_pllm_pllc_pllp_plla, CLK_SOURCE_3D, 24, 0, tegra_clk_gr3d),
  585. INT8("vde", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_VDE, 61, 0, tegra_clk_vde_8),
  586. INT8("vi", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI, 20, 0, tegra_clk_vi_8),
  587. INT8("vi", mux_pllm_pllc2_c_c3_pllp_plla_pllc4, CLK_SOURCE_VI, 20, 0, tegra_clk_vi_9),
  588. INT8("vi", mux_pllc2_c_c3_pllp_clkm_plla1_pllc4, CLK_SOURCE_VI, 20, 0, tegra_clk_vi_10),
  589. INT8("epp", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_EPP, 19, 0, tegra_clk_epp_8),
  590. INT8("msenc", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_MSENC, 91, TEGRA_PERIPH_WAR_1005168, tegra_clk_msenc),
  591. INT8("tsec", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_TSEC, 83, 0, tegra_clk_tsec),
  592. INT("tsec", mux_pllp_pllc_clkm, CLK_SOURCE_TSEC, 83, 0, tegra_clk_tsec_8),
  593. INT8("host1x", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x_8),
  594. INT8("host1x", mux_pllc4_out1_pllc_pllc4_out2_pllp_clkm_plla_pllc4_out0, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x_9),
  595. INT8("se", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se),
  596. INT8("se", mux_pllp_pllc2_c_c3_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se),
  597. INT8("2d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_2D, 21, 0, tegra_clk_gr2d_8),
  598. INT8("3d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_3D, 24, 0, tegra_clk_gr3d_8),
  599. INT8("vic03", mux_pllm_pllc_pllp_plla_pllc2_c3_clkm, CLK_SOURCE_VIC03, 178, 0, tegra_clk_vic03),
  600. INT8("vic03", mux_pllc_pllp_plla1_pllc2_c3_clkm, CLK_SOURCE_VIC03, 178, 0, tegra_clk_vic03_8),
  601. INT_FLAGS("mselect", mux_pllp_clkm, CLK_SOURCE_MSELECT, 99, 0, tegra_clk_mselect, CLK_IGNORE_UNUSED),
  602. MUX("i2s0", mux_pllaout0_audio0_2x_pllp_clkm, CLK_SOURCE_I2S0, 30, TEGRA_PERIPH_ON_APB, tegra_clk_i2s0),
  603. MUX("i2s1", mux_pllaout0_audio1_2x_pllp_clkm, CLK_SOURCE_I2S1, 11, TEGRA_PERIPH_ON_APB, tegra_clk_i2s1),
  604. MUX("i2s2", mux_pllaout0_audio2_2x_pllp_clkm, CLK_SOURCE_I2S2, 18, TEGRA_PERIPH_ON_APB, tegra_clk_i2s2),
  605. MUX("i2s3", mux_pllaout0_audio3_2x_pllp_clkm, CLK_SOURCE_I2S3, 101, TEGRA_PERIPH_ON_APB, tegra_clk_i2s3),
  606. MUX("i2s4", mux_pllaout0_audio4_2x_pllp_clkm, CLK_SOURCE_I2S4, 102, TEGRA_PERIPH_ON_APB, tegra_clk_i2s4),
  607. MUX("spdif_out", mux_pllaout0_audio_2x_pllp_clkm, CLK_SOURCE_SPDIF_OUT, 10, TEGRA_PERIPH_ON_APB, tegra_clk_spdif_out),
  608. MUX("spdif_in", mux_pllp_pllc_pllm, CLK_SOURCE_SPDIF_IN, 10, TEGRA_PERIPH_ON_APB, tegra_clk_spdif_in),
  609. MUX8("spdif_in", mux_pllp_pllc_clkm_1, CLK_SOURCE_SPDIF_IN, 10, TEGRA_PERIPH_ON_APB, tegra_clk_spdif_in_8),
  610. MUX("pwm", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_PWM, 17, TEGRA_PERIPH_ON_APB, tegra_clk_pwm),
  611. MUX("adx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX, 154, TEGRA_PERIPH_ON_APB, tegra_clk_adx),
  612. MUX("amx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX, 153, TEGRA_PERIPH_ON_APB, tegra_clk_amx),
  613. MUX("hda", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA, 125, TEGRA_PERIPH_ON_APB, tegra_clk_hda),
  614. MUX("hda", mux_pllp_pllc_clkm, CLK_SOURCE_HDA, 125, TEGRA_PERIPH_ON_APB, tegra_clk_hda_8),
  615. MUX("hda2codec_2x", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA2CODEC_2X, 111, TEGRA_PERIPH_ON_APB, tegra_clk_hda2codec_2x),
  616. MUX8("hda2codec_2x", mux_pllp_pllc_plla_clkm, CLK_SOURCE_HDA2CODEC_2X, 111, TEGRA_PERIPH_ON_APB, tegra_clk_hda2codec_2x_8),
  617. MUX("vfir", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VFIR, 7, TEGRA_PERIPH_ON_APB, tegra_clk_vfir),
  618. MUX("sdmmc1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC1, 14, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc1),
  619. MUX("sdmmc2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC2, 9, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc2),
  620. MUX("sdmmc3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC3, 69, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc3),
  621. MUX("sdmmc4", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC4, 15, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc4),
  622. MUX8("sdmmc1", mux_pllp_pllc4_out2_pllc4_out1_clkm_pllc4_out0, CLK_SOURCE_SDMMC1, 14, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc1_9),
  623. MUX8("sdmmc2", mux_pllp_clkm_pllc4_out2_out1_out0_lj, CLK_SOURCE_SDMMC2, 9, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc2_9),
  624. MUX8("sdmmc3", mux_pllp_pllc4_out2_pllc4_out1_clkm_pllc4_out0, CLK_SOURCE_SDMMC3, 69, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc3_9),
  625. MUX8("sdmmc4", mux_pllp_clkm_pllc4_out2_out1_out0_lj, CLK_SOURCE_SDMMC4, 15, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc4_9),
  626. MUX("la", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_LA, 76, TEGRA_PERIPH_ON_APB, tegra_clk_la),
  627. MUX("trace", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_TRACE, 77, TEGRA_PERIPH_ON_APB, tegra_clk_trace),
  628. MUX("owr", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_OWR, 71, TEGRA_PERIPH_ON_APB, tegra_clk_owr),
  629. MUX("owr", mux_pllp_pllc_clkm, CLK_SOURCE_OWR, 71, TEGRA_PERIPH_ON_APB, tegra_clk_owr_8),
  630. MUX("nor", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NOR, 42, 0, tegra_clk_nor),
  631. MUX("mipi", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_MIPI, 50, TEGRA_PERIPH_ON_APB, tegra_clk_mipi),
  632. MUX("vi_sensor", mux_pllm_pllc_pllp_plla, CLK_SOURCE_VI_SENSOR, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor),
  633. MUX("vi_sensor", mux_pllc_pllp_plla, CLK_SOURCE_VI_SENSOR, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor_9),
  634. MUX("cilab", mux_pllp_pllc_clkm, CLK_SOURCE_CILAB, 144, 0, tegra_clk_cilab),
  635. MUX("cilcd", mux_pllp_pllc_clkm, CLK_SOURCE_CILCD, 145, 0, tegra_clk_cilcd),
  636. MUX("cile", mux_pllp_pllc_clkm, CLK_SOURCE_CILE, 146, 0, tegra_clk_cile),
  637. MUX("dsialp", mux_pllp_pllc_clkm, CLK_SOURCE_DSIALP, 147, 0, tegra_clk_dsialp),
  638. MUX("dsiblp", mux_pllp_pllc_clkm, CLK_SOURCE_DSIBLP, 148, 0, tegra_clk_dsiblp),
  639. MUX("tsensor", mux_pllp_pllc_clkm_clk32, CLK_SOURCE_TSENSOR, 100, TEGRA_PERIPH_ON_APB, tegra_clk_tsensor),
  640. MUX("actmon", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_ACTMON, 119, 0, tegra_clk_actmon),
  641. MUX("dfll_ref", mux_pllp_clkm, CLK_SOURCE_DFLL_REF, 155, TEGRA_PERIPH_ON_APB, tegra_clk_dfll_ref),
  642. MUX("dfll_soc", mux_pllp_clkm, CLK_SOURCE_DFLL_SOC, 155, TEGRA_PERIPH_ON_APB, tegra_clk_dfll_soc),
  643. MUX("i2cslow", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_I2CSLOW, 81, TEGRA_PERIPH_ON_APB, tegra_clk_i2cslow),
  644. MUX("sbc1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC1, 41, TEGRA_PERIPH_ON_APB, tegra_clk_sbc1),
  645. MUX("sbc2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC2, 44, TEGRA_PERIPH_ON_APB, tegra_clk_sbc2),
  646. MUX("sbc3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, tegra_clk_sbc3),
  647. MUX("sbc4", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC4, 68, TEGRA_PERIPH_ON_APB, tegra_clk_sbc4),
  648. MUX("sbc5", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC5, 104, TEGRA_PERIPH_ON_APB, tegra_clk_sbc5),
  649. MUX("sbc6", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC6, 105, TEGRA_PERIPH_ON_APB, tegra_clk_sbc6),
  650. MUX("cve", mux_pllp_plld_pllc_clkm, CLK_SOURCE_CVE, 49, 0, tegra_clk_cve),
  651. MUX("tvo", mux_pllp_plld_pllc_clkm, CLK_SOURCE_TVO, 49, 0, tegra_clk_tvo),
  652. MUX("tvdac", mux_pllp_plld_pllc_clkm, CLK_SOURCE_TVDAC, 53, 0, tegra_clk_tvdac),
  653. MUX("ndflash", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NDFLASH, 13, TEGRA_PERIPH_ON_APB, tegra_clk_ndflash),
  654. MUX("ndspeed", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NDSPEED, 80, TEGRA_PERIPH_ON_APB, tegra_clk_ndspeed),
  655. MUX("sata_oob", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SATA_OOB, 123, TEGRA_PERIPH_ON_APB, tegra_clk_sata_oob),
  656. MUX("sata_oob", mux_pllp_pllc_clkm, CLK_SOURCE_SATA_OOB, 123, TEGRA_PERIPH_ON_APB, tegra_clk_sata_oob_8),
  657. MUX("sata", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SATA, 124, TEGRA_PERIPH_ON_APB, tegra_clk_sata),
  658. MUX("sata", mux_pllp_pllc_clkm, CLK_SOURCE_SATA, 124, TEGRA_PERIPH_ON_APB, tegra_clk_sata_8),
  659. MUX("adx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX1, 180, TEGRA_PERIPH_ON_APB, tegra_clk_adx1),
  660. MUX("amx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX1, 185, TEGRA_PERIPH_ON_APB, tegra_clk_amx1),
  661. MUX("vi_sensor2", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR2, 165, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor2),
  662. MUX("vi_sensor2", mux_pllc_pllp_plla, CLK_SOURCE_VI_SENSOR2, 165, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor2_8),
  663. MUX8("sdmmc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC1, 14, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc1_8),
  664. MUX8("sdmmc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC2, 9, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc2_8),
  665. MUX8("sdmmc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC3, 69, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc3_8),
  666. MUX8("sdmmc4", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC4, 15, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc4_8),
  667. MUX8("sbc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC1, 41, TEGRA_PERIPH_ON_APB, tegra_clk_sbc1_8),
  668. MUX8("sbc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC2, 44, TEGRA_PERIPH_ON_APB, tegra_clk_sbc2_8),
  669. MUX8("sbc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, tegra_clk_sbc3_8),
  670. MUX8("sbc4", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC4, 68, TEGRA_PERIPH_ON_APB, tegra_clk_sbc4_8),
  671. MUX8("sbc5", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC5, 104, TEGRA_PERIPH_ON_APB, tegra_clk_sbc5_8),
  672. MUX8("sbc6", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC6, 105, TEGRA_PERIPH_ON_APB, tegra_clk_sbc6_8),
  673. MUX("sbc1", mux_pllp_pllc_clkm, CLK_SOURCE_SBC1, 41, TEGRA_PERIPH_ON_APB, tegra_clk_sbc1_9),
  674. MUX("sbc2", mux_pllp_pllc_clkm, CLK_SOURCE_SBC2, 44, TEGRA_PERIPH_ON_APB, tegra_clk_sbc2_9),
  675. MUX("sbc3", mux_pllp_pllc_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, tegra_clk_sbc3_9),
  676. MUX("sbc4", mux_pllp_pllc_clkm, CLK_SOURCE_SBC4, 68, TEGRA_PERIPH_ON_APB, tegra_clk_sbc4_9),
  677. MUX8("ndflash", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDFLASH, 13, TEGRA_PERIPH_ON_APB, tegra_clk_ndflash_8),
  678. MUX8("ndspeed", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDSPEED, 80, TEGRA_PERIPH_ON_APB, tegra_clk_ndspeed_8),
  679. MUX8("hdmi", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_HDMI, 51, 0, tegra_clk_hdmi),
  680. MUX8("extern1", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN1, 120, 0, tegra_clk_extern1),
  681. MUX8("extern2", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN2, 121, 0, tegra_clk_extern2),
  682. MUX8("extern3", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN3, 122, 0, tegra_clk_extern3),
  683. MUX8("soc_therm", mux_pllm_pllc_pllp_plla, CLK_SOURCE_SOC_THERM, 78, TEGRA_PERIPH_ON_APB, tegra_clk_soc_therm),
  684. MUX8("soc_therm", mux_clkm_pllc_pllp_plla, CLK_SOURCE_SOC_THERM, 78, TEGRA_PERIPH_ON_APB, tegra_clk_soc_therm_8),
  685. MUX8("vi_sensor", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR, 164, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor_8),
  686. MUX8("isp", mux_pllm_pllc_pllp_plla_clkm_pllc4, CLK_SOURCE_ISP, 23, TEGRA_PERIPH_ON_APB, tegra_clk_isp_8),
  687. MUX8_NOGATE("isp", mux_pllc_pllp_plla1_pllc2_c3_clkm_pllc4, CLK_SOURCE_ISP, tegra_clk_isp_9),
  688. MUX8("entropy", mux_pllp_clkm1, CLK_SOURCE_ENTROPY, 149, 0, tegra_clk_entropy),
  689. MUX8("entropy", mux_pllp_clkm_clk32_plle, CLK_SOURCE_ENTROPY, 149, 0, tegra_clk_entropy_8),
  690. MUX8("hdmi_audio", mux_pllp3_pllc_clkm, CLK_SOURCE_HDMI_AUDIO, 176, TEGRA_PERIPH_NO_RESET, tegra_clk_hdmi_audio),
  691. MUX8("clk72mhz", mux_pllp3_pllc_clkm, CLK_SOURCE_CLK72MHZ, 177, TEGRA_PERIPH_NO_RESET, tegra_clk_clk72Mhz),
  692. MUX8("clk72mhz", mux_pllp_out3_pllp_pllc_clkm, CLK_SOURCE_CLK72MHZ, 177, TEGRA_PERIPH_NO_RESET, tegra_clk_clk72Mhz_8),
  693. MUX8_NOGATE_LOCK("sor0_lvds", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_SOR0, tegra_clk_sor0_lvds, &sor0_lock),
  694. MUX_FLAGS("csite", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_CSITE, 73, TEGRA_PERIPH_ON_APB, tegra_clk_csite, CLK_IGNORE_UNUSED),
  695. MUX_FLAGS("csite", mux_pllp_pllre_clkm, CLK_SOURCE_CSITE, 73, TEGRA_PERIPH_ON_APB, tegra_clk_csite_8, CLK_IGNORE_UNUSED),
  696. NODIV("disp1", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP1, 29, 7, 27, 0, tegra_clk_disp1, NULL),
  697. NODIV("disp1", mux_pllp_plld_plld2_clkm, CLK_SOURCE_DISP1, 29, 7, 27, 0, tegra_clk_disp1_8, NULL),
  698. NODIV("disp2", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP2, 29, 7, 26, 0, tegra_clk_disp2, NULL),
  699. NODIV("disp2", mux_pllp_plld_plld2_clkm, CLK_SOURCE_DISP2, 29, 7, 26, 0, tegra_clk_disp2_8, NULL),
  700. NODIV("sor0", mux_clkm_plldp_sor0lvds, CLK_SOURCE_SOR0, 14, 3, 182, 0, tegra_clk_sor0, &sor0_lock),
  701. UART("uarta", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTA, 6, tegra_clk_uarta),
  702. UART("uartb", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, tegra_clk_uartb),
  703. UART("uartc", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, tegra_clk_uartc),
  704. UART("uartd", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, tegra_clk_uartd),
  705. UART("uarte", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTE, 66, tegra_clk_uarte),
  706. UART8("uarta", mux_pllp_pllc_pllc4_out0_pllc4_out1_clkm_pllc4_out2, CLK_SOURCE_UARTA, 6, tegra_clk_uarta_8),
  707. UART8("uartb", mux_pllp_pllc_pllc4_out0_pllc4_out1_clkm_pllc4_out2, CLK_SOURCE_UARTB, 7, tegra_clk_uartb_8),
  708. UART8("uartc", mux_pllp_pllc_pllc4_out0_pllc4_out1_clkm_pllc4_out2, CLK_SOURCE_UARTC, 55, tegra_clk_uartc_8),
  709. UART8("uartd", mux_pllp_pllc_pllc4_out0_pllc4_out1_clkm_pllc4_out2, CLK_SOURCE_UARTD, 65, tegra_clk_uartd_8),
  710. XUSB("xusb_host_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_host_src),
  711. XUSB("xusb_host_src", mux_clkm_pllp_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_host_src_8),
  712. XUSB("xusb_falcon_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_falcon_src),
  713. XUSB("xusb_falcon_src", mux_clkm_pllp_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_falcon_src_8),
  714. XUSB("xusb_fs_src", mux_clkm_48M_pllp_480M, CLK_SOURCE_XUSB_FS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_fs_src),
  715. XUSB("xusb_ss_src", mux_clkm_pllre_clk32_480M_pllc_ref, CLK_SOURCE_XUSB_SS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_ss_src),
  716. XUSB("xusb_ss_src", mux_clkm_pllre_clk32_480M, CLK_SOURCE_XUSB_SS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_ss_src_8),
  717. NODIV("xusb_hs_src", mux_ss_div2_60M, CLK_SOURCE_XUSB_SS_SRC, 25, MASK(1), 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_hs_src, NULL),
  718. NODIV("xusb_hs_src", mux_ss_div2_60M_ss, CLK_SOURCE_XUSB_SS_SRC, 25, MASK(2), 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_hs_src_4, NULL),
  719. NODIV("xusb_ssp_src", mux_ss_clkm, CLK_SOURCE_XUSB_SS_SRC, 24, MASK(1), 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_ssp_src, NULL),
  720. XUSB("xusb_dev_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_DEV_SRC, 95, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_dev_src),
  721. XUSB("xusb_dev_src", mux_clkm_pllp_pllre, CLK_SOURCE_XUSB_DEV_SRC, 95, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_dev_src_8),
  722. MUX8("dbgapb", mux_pllp_clkm_2, CLK_SOURCE_DBGAPB, 185, TEGRA_PERIPH_NO_RESET, tegra_clk_dbgapb),
  723. MUX8("nvenc", mux_pllc2_c_c3_pllp_plla1_clkm, CLK_SOURCE_NVENC, 219, 0, tegra_clk_nvenc),
  724. MUX8("nvdec", mux_pllc2_c_c3_pllp_plla1_clkm, CLK_SOURCE_NVDEC, 194, 0, tegra_clk_nvdec),
  725. MUX8("nvjpg", mux_pllc2_c_c3_pllp_plla1_clkm, CLK_SOURCE_NVJPG, 195, 0, tegra_clk_nvjpg),
  726. MUX8("ape", mux_plla_pllc4_out0_pllc_pllc4_out1_pllp_pllc4_out2_clkm, CLK_SOURCE_APE, 198, TEGRA_PERIPH_ON_APB, tegra_clk_ape),
  727. MUX8_NOGATE_LOCK("sor1_src", mux_pllp_plld_plld2_clkm, CLK_SOURCE_SOR1, tegra_clk_sor1_src, &sor1_lock),
  728. NODIV("sor1", mux_sor_safe_sor1_brick_sor1_src, CLK_SOURCE_SOR1, 14, MASK(2), 183, 0, tegra_clk_sor1, &sor1_lock),
  729. MUX8("sdmmc_legacy", mux_pllp_out3_clkm_pllp_pllc4, CLK_SOURCE_SDMMC_LEGACY, 193, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_sdmmc_legacy),
  730. MUX8("qspi", mux_pllp_pllc_pllc_out1_pllc4_out2_pllc4_out1_clkm_pllc4_out0, CLK_SOURCE_QSPI, 211, TEGRA_PERIPH_ON_APB, tegra_clk_qspi),
  731. I2C("vii2c", mux_pllp_pllc_clkm, CLK_SOURCE_VI_I2C, 208, tegra_clk_vi_i2c),
  732. MUX("mipibif", mux_pllp_clkm, CLK_SOURCE_MIPIBIF, 173, TEGRA_PERIPH_ON_APB, tegra_clk_mipibif),
  733. MUX("uartape", mux_pllp_pllc_clkm, CLK_SOURCE_UARTAPE, 212, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_uartape),
  734. MUX8("tsecb", mux_pllp_pllc2_c_c3_clkm, CLK_SOURCE_TSECB, 206, 0, tegra_clk_tsecb),
  735. MUX8("maud", mux_pllp_pllp_out3_clkm_clk32k_plla, CLK_SOURCE_MAUD, 202, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_maud),
  736. MUX8("dmic1", mux_dmic1, CLK_SOURCE_DMIC1, 161, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_dmic1),
  737. MUX8("dmic2", mux_dmic2, CLK_SOURCE_DMIC2, 162, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_dmic2),
  738. MUX8("dmic3", mux_dmic3, CLK_SOURCE_DMIC3, 197, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_dmic3),
  739. };
  740. static struct tegra_periph_init_data gate_clks[] = {
  741. GATE("rtc", "clk_32k", 4, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_rtc, 0),
  742. GATE("timer", "clk_m", 5, 0, tegra_clk_timer, CLK_IS_CRITICAL),
  743. GATE("isp", "clk_m", 23, 0, tegra_clk_isp, 0),
  744. GATE("vcp", "clk_m", 29, 0, tegra_clk_vcp, 0),
  745. GATE("apbdma", "clk_m", 34, 0, tegra_clk_apbdma, 0),
  746. GATE("kbc", "clk_32k", 36, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_kbc, 0),
  747. GATE("fuse", "clk_m", 39, TEGRA_PERIPH_ON_APB, tegra_clk_fuse, 0),
  748. GATE("fuse_burn", "clk_m", 39, TEGRA_PERIPH_ON_APB, tegra_clk_fuse_burn, 0),
  749. GATE("kfuse", "clk_m", 40, TEGRA_PERIPH_ON_APB, tegra_clk_kfuse, 0),
  750. GATE("apbif", "clk_m", 107, TEGRA_PERIPH_ON_APB, tegra_clk_apbif, 0),
  751. GATE("hda2hdmi", "clk_m", 128, TEGRA_PERIPH_ON_APB, tegra_clk_hda2hdmi, 0),
  752. GATE("bsea", "clk_m", 62, 0, tegra_clk_bsea, 0),
  753. GATE("bsev", "clk_m", 63, 0, tegra_clk_bsev, 0),
  754. GATE("mipi-cal", "clk72mhz", 56, 0, tegra_clk_mipi_cal, 0),
  755. GATE("usbd", "clk_m", 22, 0, tegra_clk_usbd, 0),
  756. GATE("usb2", "clk_m", 58, 0, tegra_clk_usb2, 0),
  757. GATE("usb3", "clk_m", 59, 0, tegra_clk_usb3, 0),
  758. GATE("csi", "pll_p_out3", 52, 0, tegra_clk_csi, 0),
  759. GATE("afi", "mselect", 72, 0, tegra_clk_afi, 0),
  760. GATE("csus", "clk_m", 92, TEGRA_PERIPH_NO_RESET, tegra_clk_csus, 0),
  761. GATE("dds", "clk_m", 150, TEGRA_PERIPH_ON_APB, tegra_clk_dds, 0),
  762. GATE("dp2", "clk_m", 152, TEGRA_PERIPH_ON_APB, tegra_clk_dp2, 0),
  763. GATE("dtv", "clk_m", 79, TEGRA_PERIPH_ON_APB, tegra_clk_dtv, 0),
  764. GATE("xusb_host", "xusb_host_src", 89, 0, tegra_clk_xusb_host, 0),
  765. GATE("xusb_ss", "xusb_ss_src", 156, 0, tegra_clk_xusb_ss, 0),
  766. GATE("xusb_dev", "xusb_dev_src", 95, 0, tegra_clk_xusb_dev, 0),
  767. GATE("emc", "emc_mux", 57, 0, tegra_clk_emc, CLK_IGNORE_UNUSED),
  768. GATE("sata_cold", "clk_m", 129, TEGRA_PERIPH_ON_APB, tegra_clk_sata_cold, 0),
  769. GATE("ispa", "isp", 23, 0, tegra_clk_ispa, 0),
  770. GATE("ispb", "isp", 3, 0, tegra_clk_ispb, 0),
  771. GATE("vim2_clk", "clk_m", 11, 0, tegra_clk_vim2_clk, 0),
  772. GATE("pcie", "clk_m", 70, 0, tegra_clk_pcie, 0),
  773. GATE("gpu", "pll_ref", 184, 0, tegra_clk_gpu, 0),
  774. GATE("pllg_ref", "pll_ref", 189, 0, tegra_clk_pll_g_ref, 0),
  775. GATE("hsic_trk", "usb2_hsic_trk", 209, TEGRA_PERIPH_NO_RESET, tegra_clk_hsic_trk, 0),
  776. GATE("usb2_trk", "usb2_hsic_trk", 210, TEGRA_PERIPH_NO_RESET, tegra_clk_usb2_trk, 0),
  777. GATE("xusb_gate", "osc", 143, 0, tegra_clk_xusb_gate, 0),
  778. GATE("pll_p_out_cpu", "pll_p", 223, 0, tegra_clk_pll_p_out_cpu, 0),
  779. GATE("pll_p_out_adsp", "pll_p", 187, 0, tegra_clk_pll_p_out_adsp, 0),
  780. GATE("apb2ape", "clk_m", 107, 0, tegra_clk_apb2ape, 0),
  781. GATE("cec", "pclk", 136, 0, tegra_clk_cec, 0),
  782. GATE("iqc1", "clk_m", 221, 0, tegra_clk_iqc1, 0),
  783. GATE("iqc2", "clk_m", 220, 0, tegra_clk_iqc1, 0),
  784. GATE("pll_a_out_adsp", "pll_a", 188, 0, tegra_clk_pll_a_out_adsp, 0),
  785. GATE("pll_a_out0_out_adsp", "pll_a", 188, 0, tegra_clk_pll_a_out0_out_adsp, 0),
  786. GATE("adsp", "aclk", 199, 0, tegra_clk_adsp, 0),
  787. GATE("adsp_neon", "aclk", 218, 0, tegra_clk_adsp_neon, 0),
  788. };
  789. static struct tegra_periph_init_data div_clks[] = {
  790. DIV8("usb2_hsic_trk", "osc", CLK_SOURCE_USB2_HSIC_TRK, tegra_clk_usb2_hsic_trk, 0),
  791. };
  792. struct pll_out_data {
  793. char *div_name;
  794. char *pll_out_name;
  795. u32 offset;
  796. int clk_id;
  797. u8 div_shift;
  798. u8 div_flags;
  799. u8 rst_shift;
  800. spinlock_t *lock;
  801. };
  802. #define PLL_OUT(_num, _offset, _div_shift, _div_flags, _rst_shift, _id) \
  803. {\
  804. .div_name = "pll_p_out" #_num "_div",\
  805. .pll_out_name = "pll_p_out" #_num,\
  806. .offset = _offset,\
  807. .div_shift = _div_shift,\
  808. .div_flags = _div_flags | TEGRA_DIVIDER_FIXED |\
  809. TEGRA_DIVIDER_ROUND_UP,\
  810. .rst_shift = _rst_shift,\
  811. .clk_id = tegra_clk_ ## _id,\
  812. .lock = &_offset ##_lock,\
  813. }
  814. static struct pll_out_data pllp_out_clks[] = {
  815. PLL_OUT(1, PLLP_OUTA, 8, 0, 0, pll_p_out1),
  816. PLL_OUT(2, PLLP_OUTA, 24, 0, 16, pll_p_out2),
  817. PLL_OUT(2, PLLP_OUTA, 24, TEGRA_DIVIDER_INT, 16, pll_p_out2_int),
  818. PLL_OUT(3, PLLP_OUTB, 8, 0, 0, pll_p_out3),
  819. PLL_OUT(4, PLLP_OUTB, 24, 0, 16, pll_p_out4),
  820. PLL_OUT(5, PLLP_OUTC, 24, 0, 16, pll_p_out5),
  821. };
  822. static void __init periph_clk_init(void __iomem *clk_base,
  823. struct tegra_clk *tegra_clks)
  824. {
  825. int i;
  826. struct clk *clk;
  827. struct clk **dt_clk;
  828. for (i = 0; i < ARRAY_SIZE(periph_clks); i++) {
  829. const struct tegra_clk_periph_regs *bank;
  830. struct tegra_periph_init_data *data;
  831. data = periph_clks + i;
  832. dt_clk = tegra_lookup_dt_id(data->clk_id, tegra_clks);
  833. if (!dt_clk)
  834. continue;
  835. bank = get_reg_bank(data->periph.gate.clk_num);
  836. if (!bank)
  837. continue;
  838. data->periph.gate.regs = bank;
  839. clk = tegra_clk_register_periph(data->name,
  840. data->p.parent_names, data->num_parents,
  841. &data->periph, clk_base, data->offset,
  842. data->flags);
  843. *dt_clk = clk;
  844. }
  845. }
  846. static void __init gate_clk_init(void __iomem *clk_base,
  847. struct tegra_clk *tegra_clks)
  848. {
  849. int i;
  850. struct clk *clk;
  851. struct clk **dt_clk;
  852. for (i = 0; i < ARRAY_SIZE(gate_clks); i++) {
  853. struct tegra_periph_init_data *data;
  854. data = gate_clks + i;
  855. dt_clk = tegra_lookup_dt_id(data->clk_id, tegra_clks);
  856. if (!dt_clk)
  857. continue;
  858. clk = tegra_clk_register_periph_gate(data->name,
  859. data->p.parent_name, data->periph.gate.flags,
  860. clk_base, data->flags,
  861. data->periph.gate.clk_num,
  862. periph_clk_enb_refcnt);
  863. *dt_clk = clk;
  864. }
  865. }
  866. static void __init div_clk_init(void __iomem *clk_base,
  867. struct tegra_clk *tegra_clks)
  868. {
  869. int i;
  870. struct clk *clk;
  871. struct clk **dt_clk;
  872. for (i = 0; i < ARRAY_SIZE(div_clks); i++) {
  873. struct tegra_periph_init_data *data;
  874. data = div_clks + i;
  875. dt_clk = tegra_lookup_dt_id(data->clk_id, tegra_clks);
  876. if (!dt_clk)
  877. continue;
  878. clk = tegra_clk_register_divider(data->name,
  879. data->p.parent_name, clk_base + data->offset,
  880. data->flags, data->periph.divider.flags,
  881. data->periph.divider.shift,
  882. data->periph.divider.width,
  883. data->periph.divider.frac_width,
  884. data->periph.divider.lock);
  885. *dt_clk = clk;
  886. }
  887. }
  888. static void __init init_pllp(void __iomem *clk_base, void __iomem *pmc_base,
  889. struct tegra_clk *tegra_clks,
  890. struct tegra_clk_pll_params *pll_params)
  891. {
  892. struct clk *clk;
  893. struct clk **dt_clk;
  894. int i;
  895. dt_clk = tegra_lookup_dt_id(tegra_clk_pll_p, tegra_clks);
  896. if (dt_clk) {
  897. /* PLLP */
  898. clk = tegra_clk_register_pll("pll_p", "pll_ref", clk_base,
  899. pmc_base, 0, pll_params, NULL);
  900. clk_register_clkdev(clk, "pll_p", NULL);
  901. *dt_clk = clk;
  902. }
  903. for (i = 0; i < ARRAY_SIZE(pllp_out_clks); i++) {
  904. struct pll_out_data *data;
  905. data = pllp_out_clks + i;
  906. dt_clk = tegra_lookup_dt_id(data->clk_id, tegra_clks);
  907. if (!dt_clk)
  908. continue;
  909. clk = tegra_clk_register_divider(data->div_name, "pll_p",
  910. clk_base + data->offset, 0, data->div_flags,
  911. data->div_shift, 8, 1, data->lock);
  912. clk = tegra_clk_register_pll_out(data->pll_out_name,
  913. data->div_name, clk_base + data->offset,
  914. data->rst_shift + 1, data->rst_shift,
  915. CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0,
  916. data->lock);
  917. *dt_clk = clk;
  918. }
  919. dt_clk = tegra_lookup_dt_id(tegra_clk_pll_p_out_cpu,
  920. tegra_clks);
  921. if (dt_clk) {
  922. /*
  923. * Tegra210 has control on enabling/disabling PLLP branches to
  924. * CPU, register a gate clock "pll_p_out_cpu" for this gating
  925. * function and parent "pll_p_out4" to it, so when we are
  926. * re-parenting CPU off from "pll_p_out4" the PLLP branching to
  927. * CPU can be disabled automatically.
  928. */
  929. clk = tegra_clk_register_divider("pll_p_out4_div",
  930. "pll_p_out_cpu", clk_base + PLLP_OUTB, 0, 0, 24,
  931. 8, 1, &PLLP_OUTB_lock);
  932. dt_clk = tegra_lookup_dt_id(tegra_clk_pll_p_out4_cpu, tegra_clks);
  933. if (dt_clk) {
  934. clk = tegra_clk_register_pll_out("pll_p_out4",
  935. "pll_p_out4_div", clk_base + PLLP_OUTB,
  936. 17, 16, CLK_IGNORE_UNUSED |
  937. CLK_SET_RATE_PARENT, 0,
  938. &PLLP_OUTB_lock);
  939. *dt_clk = clk;
  940. }
  941. }
  942. dt_clk = tegra_lookup_dt_id(tegra_clk_pll_p_out_hsio, tegra_clks);
  943. if (dt_clk) {
  944. /* PLLP_OUT_HSIO */
  945. clk = clk_register_gate(NULL, "pll_p_out_hsio", "pll_p",
  946. CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
  947. clk_base + PLLP_MISC1, 29, 0, NULL);
  948. *dt_clk = clk;
  949. }
  950. dt_clk = tegra_lookup_dt_id(tegra_clk_pll_p_out_xusb, tegra_clks);
  951. if (dt_clk) {
  952. /* PLLP_OUT_XUSB */
  953. clk = clk_register_gate(NULL, "pll_p_out_xusb",
  954. "pll_p_out_hsio", CLK_SET_RATE_PARENT |
  955. CLK_IGNORE_UNUSED, clk_base + PLLP_MISC1, 28, 0,
  956. NULL);
  957. clk_register_clkdev(clk, "pll_p_out_xusb", NULL);
  958. *dt_clk = clk;
  959. }
  960. }
  961. void __init tegra_periph_clk_init(void __iomem *clk_base,
  962. void __iomem *pmc_base, struct tegra_clk *tegra_clks,
  963. struct tegra_clk_pll_params *pll_params)
  964. {
  965. init_pllp(clk_base, pmc_base, tegra_clks, pll_params);
  966. periph_clk_init(clk_base, tegra_clks);
  967. gate_clk_init(clk_base, tegra_clks);
  968. div_clk_init(clk_base, tegra_clks);
  969. }