clk-mt2712.c 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2017 MediaTek Inc.
  4. * Author: Weiyi Lu <[email protected]>
  5. */
  6. #include <linux/clk.h>
  7. #include <linux/delay.h>
  8. #include <linux/mfd/syscon.h>
  9. #include <linux/of.h>
  10. #include <linux/of_address.h>
  11. #include <linux/of_device.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/slab.h>
  14. #include "clk-gate.h"
  15. #include "clk-pll.h"
  16. #include "clk-mtk.h"
  17. #include <dt-bindings/clock/mt2712-clk.h>
  18. static DEFINE_SPINLOCK(mt2712_clk_lock);
  19. static const struct mtk_fixed_clk top_fixed_clks[] = {
  20. FIXED_CLK(CLK_TOP_VPLL3_DPIX, "vpll3_dpix", NULL, 200000000),
  21. FIXED_CLK(CLK_TOP_VPLL_DPIX, "vpll_dpix", NULL, 200000000),
  22. FIXED_CLK(CLK_TOP_LTEPLL_FS26M, "ltepll_fs26m", NULL, 26000000),
  23. FIXED_CLK(CLK_TOP_DMPLL, "dmpll_ck", NULL, 350000000),
  24. FIXED_CLK(CLK_TOP_DSI0_LNTC, "dsi0_lntc", NULL, 143000000),
  25. FIXED_CLK(CLK_TOP_DSI1_LNTC, "dsi1_lntc", NULL, 143000000),
  26. FIXED_CLK(CLK_TOP_LVDSTX3_CLKDIG_CTS, "lvdstx3", NULL, 140000000),
  27. FIXED_CLK(CLK_TOP_LVDSTX_CLKDIG_CTS, "lvdstx", NULL, 140000000),
  28. FIXED_CLK(CLK_TOP_CLKRTC_EXT, "clkrtc_ext", NULL, 32768),
  29. FIXED_CLK(CLK_TOP_CLKRTC_INT, "clkrtc_int", NULL, 32747),
  30. FIXED_CLK(CLK_TOP_CSI0, "csi0", NULL, 26000000),
  31. FIXED_CLK(CLK_TOP_CVBSPLL, "cvbspll", NULL, 108000000),
  32. };
  33. static const struct mtk_fixed_factor top_early_divs[] = {
  34. FACTOR(CLK_TOP_SYS_26M, "sys_26m", "clk26m", 1,
  35. 1),
  36. FACTOR(CLK_TOP_CLK26M_D2, "clk26m_d2", "sys_26m", 1,
  37. 2),
  38. };
  39. static const struct mtk_fixed_factor top_divs[] = {
  40. FACTOR(CLK_TOP_ARMCA35PLL, "armca35pll_ck", "armca35pll", 1,
  41. 1),
  42. FACTOR(CLK_TOP_ARMCA35PLL_600M, "armca35pll_600m", "armca35pll_ck", 1,
  43. 2),
  44. FACTOR(CLK_TOP_ARMCA35PLL_400M, "armca35pll_400m", "armca35pll_ck", 1,
  45. 3),
  46. FACTOR(CLK_TOP_ARMCA72PLL, "armca72pll_ck", "armca72pll", 1,
  47. 1),
  48. FACTOR(CLK_TOP_SYSPLL, "syspll_ck", "mainpll", 1,
  49. 1),
  50. FACTOR(CLK_TOP_SYSPLL_D2, "syspll_d2", "syspll_ck", 1,
  51. 2),
  52. FACTOR(CLK_TOP_SYSPLL1_D2, "syspll1_d2", "syspll_d2", 1,
  53. 2),
  54. FACTOR(CLK_TOP_SYSPLL1_D4, "syspll1_d4", "syspll_d2", 1,
  55. 4),
  56. FACTOR(CLK_TOP_SYSPLL1_D8, "syspll1_d8", "syspll_d2", 1,
  57. 8),
  58. FACTOR(CLK_TOP_SYSPLL1_D16, "syspll1_d16", "syspll_d2", 1,
  59. 16),
  60. FACTOR(CLK_TOP_SYSPLL_D3, "syspll_d3", "syspll_ck", 1,
  61. 3),
  62. FACTOR(CLK_TOP_SYSPLL2_D2, "syspll2_d2", "syspll_d3", 1,
  63. 2),
  64. FACTOR(CLK_TOP_SYSPLL2_D4, "syspll2_d4", "syspll_d3", 1,
  65. 4),
  66. FACTOR(CLK_TOP_SYSPLL_D5, "syspll_d5", "syspll_ck", 1,
  67. 5),
  68. FACTOR(CLK_TOP_SYSPLL3_D2, "syspll3_d2", "syspll_d5", 1,
  69. 2),
  70. FACTOR(CLK_TOP_SYSPLL3_D4, "syspll3_d4", "syspll_d5", 1,
  71. 4),
  72. FACTOR(CLK_TOP_SYSPLL_D7, "syspll_d7", "syspll_ck", 1,
  73. 7),
  74. FACTOR(CLK_TOP_SYSPLL4_D2, "syspll4_d2", "syspll_d7", 1,
  75. 2),
  76. FACTOR(CLK_TOP_SYSPLL4_D4, "syspll4_d4", "syspll_d7", 1,
  77. 4),
  78. FACTOR(CLK_TOP_UNIVPLL, "univpll_ck", "univpll", 1,
  79. 1),
  80. FACTOR(CLK_TOP_UNIVPLL_D7, "univpll_d7", "univpll_ck", 1,
  81. 7),
  82. FACTOR(CLK_TOP_UNIVPLL_D26, "univpll_d26", "univpll_ck", 1,
  83. 26),
  84. FACTOR(CLK_TOP_UNIVPLL_D52, "univpll_d52", "univpll_ck", 1,
  85. 52),
  86. FACTOR(CLK_TOP_UNIVPLL_D104, "univpll_d104", "univpll_ck", 1,
  87. 104),
  88. FACTOR(CLK_TOP_UNIVPLL_D208, "univpll_d208", "univpll_ck", 1,
  89. 208),
  90. FACTOR(CLK_TOP_UNIVPLL_D2, "univpll_d2", "univpll_ck", 1,
  91. 2),
  92. FACTOR(CLK_TOP_UNIVPLL1_D2, "univpll1_d2", "univpll_d2", 1,
  93. 2),
  94. FACTOR(CLK_TOP_UNIVPLL1_D4, "univpll1_d4", "univpll_d2", 1,
  95. 4),
  96. FACTOR(CLK_TOP_UNIVPLL1_D8, "univpll1_d8", "univpll_d2", 1,
  97. 8),
  98. FACTOR(CLK_TOP_UNIVPLL_D3, "univpll_d3", "univpll_ck", 1,
  99. 3),
  100. FACTOR(CLK_TOP_UNIVPLL2_D2, "univpll2_d2", "univpll_d3", 1,
  101. 2),
  102. FACTOR(CLK_TOP_UNIVPLL2_D4, "univpll2_d4", "univpll_d3", 1,
  103. 4),
  104. FACTOR(CLK_TOP_UNIVPLL2_D8, "univpll2_d8", "univpll_d3", 1,
  105. 8),
  106. FACTOR(CLK_TOP_UNIVPLL_D5, "univpll_d5", "univpll_ck", 1,
  107. 5),
  108. FACTOR(CLK_TOP_UNIVPLL3_D2, "univpll3_d2", "univpll_d5", 1,
  109. 2),
  110. FACTOR(CLK_TOP_UNIVPLL3_D4, "univpll3_d4", "univpll_d5", 1,
  111. 4),
  112. FACTOR(CLK_TOP_UNIVPLL3_D8, "univpll3_d8", "univpll_d5", 1,
  113. 8),
  114. FACTOR(CLK_TOP_F_MP0_PLL1, "f_mp0_pll1_ck", "univpll_d2", 1,
  115. 1),
  116. FACTOR(CLK_TOP_F_MP0_PLL2, "f_mp0_pll2_ck", "univpll1_d2", 1,
  117. 1),
  118. FACTOR(CLK_TOP_F_BIG_PLL1, "f_big_pll1_ck", "univpll_d2", 1,
  119. 1),
  120. FACTOR(CLK_TOP_F_BIG_PLL2, "f_big_pll2_ck", "univpll1_d2", 1,
  121. 1),
  122. FACTOR(CLK_TOP_F_BUS_PLL1, "f_bus_pll1_ck", "univpll_d2", 1,
  123. 1),
  124. FACTOR(CLK_TOP_F_BUS_PLL2, "f_bus_pll2_ck", "univpll1_d2", 1,
  125. 1),
  126. FACTOR(CLK_TOP_APLL1, "apll1_ck", "apll1", 1,
  127. 1),
  128. FACTOR(CLK_TOP_APLL1_D2, "apll1_d2", "apll1_ck", 1,
  129. 2),
  130. FACTOR(CLK_TOP_APLL1_D4, "apll1_d4", "apll1_ck", 1,
  131. 4),
  132. FACTOR(CLK_TOP_APLL1_D8, "apll1_d8", "apll1_ck", 1,
  133. 8),
  134. FACTOR(CLK_TOP_APLL1_D16, "apll1_d16", "apll1_ck", 1,
  135. 16),
  136. FACTOR(CLK_TOP_APLL2, "apll2_ck", "apll2", 1,
  137. 1),
  138. FACTOR(CLK_TOP_APLL2_D2, "apll2_d2", "apll2_ck", 1,
  139. 2),
  140. FACTOR(CLK_TOP_APLL2_D4, "apll2_d4", "apll2_ck", 1,
  141. 4),
  142. FACTOR(CLK_TOP_APLL2_D8, "apll2_d8", "apll2_ck", 1,
  143. 8),
  144. FACTOR(CLK_TOP_APLL2_D16, "apll2_d16", "apll2_ck", 1,
  145. 16),
  146. FACTOR(CLK_TOP_LVDSPLL, "lvdspll_ck", "lvdspll", 1,
  147. 1),
  148. FACTOR(CLK_TOP_LVDSPLL_D2, "lvdspll_d2", "lvdspll_ck", 1,
  149. 2),
  150. FACTOR(CLK_TOP_LVDSPLL_D4, "lvdspll_d4", "lvdspll_ck", 1,
  151. 4),
  152. FACTOR(CLK_TOP_LVDSPLL_D8, "lvdspll_d8", "lvdspll_ck", 1,
  153. 8),
  154. FACTOR(CLK_TOP_LVDSPLL2, "lvdspll2_ck", "lvdspll2", 1,
  155. 1),
  156. FACTOR(CLK_TOP_LVDSPLL2_D2, "lvdspll2_d2", "lvdspll2_ck", 1,
  157. 2),
  158. FACTOR(CLK_TOP_LVDSPLL2_D4, "lvdspll2_d4", "lvdspll2_ck", 1,
  159. 4),
  160. FACTOR(CLK_TOP_LVDSPLL2_D8, "lvdspll2_d8", "lvdspll2_ck", 1,
  161. 8),
  162. FACTOR(CLK_TOP_ETHERPLL_125M, "etherpll_125m", "etherpll", 1,
  163. 1),
  164. FACTOR(CLK_TOP_ETHERPLL_50M, "etherpll_50m", "etherpll", 1,
  165. 1),
  166. FACTOR(CLK_TOP_CVBS, "cvbs", "cvbspll", 1,
  167. 1),
  168. FACTOR(CLK_TOP_CVBS_D2, "cvbs_d2", "cvbs", 1,
  169. 2),
  170. FACTOR(CLK_TOP_MMPLL, "mmpll_ck", "mmpll", 1,
  171. 1),
  172. FACTOR(CLK_TOP_MMPLL_D2, "mmpll_d2", "mmpll_ck", 1,
  173. 2),
  174. FACTOR(CLK_TOP_VENCPLL, "vencpll_ck", "vencpll", 1,
  175. 1),
  176. FACTOR(CLK_TOP_VENCPLL_D2, "vencpll_d2", "vencpll_ck", 1,
  177. 2),
  178. FACTOR(CLK_TOP_VCODECPLL, "vcodecpll_ck", "vcodecpll", 1,
  179. 1),
  180. FACTOR(CLK_TOP_VCODECPLL_D2, "vcodecpll_d2", "vcodecpll_ck", 1,
  181. 2),
  182. FACTOR(CLK_TOP_TVDPLL, "tvdpll_ck", "tvdpll", 1,
  183. 1),
  184. FACTOR(CLK_TOP_TVDPLL_D2, "tvdpll_d2", "tvdpll_ck", 1,
  185. 2),
  186. FACTOR(CLK_TOP_TVDPLL_D4, "tvdpll_d4", "tvdpll_ck", 1,
  187. 4),
  188. FACTOR(CLK_TOP_TVDPLL_D8, "tvdpll_d8", "tvdpll_ck", 1,
  189. 8),
  190. FACTOR(CLK_TOP_TVDPLL_429M, "tvdpll_429m", "tvdpll", 1,
  191. 1),
  192. FACTOR(CLK_TOP_TVDPLL_429M_D2, "tvdpll_429m_d2", "tvdpll_429m", 1,
  193. 2),
  194. FACTOR(CLK_TOP_TVDPLL_429M_D4, "tvdpll_429m_d4", "tvdpll_429m", 1,
  195. 4),
  196. FACTOR(CLK_TOP_MSDCPLL, "msdcpll_ck", "msdcpll", 1,
  197. 1),
  198. FACTOR(CLK_TOP_MSDCPLL_D2, "msdcpll_d2", "msdcpll_ck", 1,
  199. 2),
  200. FACTOR(CLK_TOP_MSDCPLL_D4, "msdcpll_d4", "msdcpll_ck", 1,
  201. 4),
  202. FACTOR(CLK_TOP_MSDCPLL2, "msdcpll2_ck", "msdcpll2", 1,
  203. 1),
  204. FACTOR(CLK_TOP_MSDCPLL2_D2, "msdcpll2_d2", "msdcpll2_ck", 1,
  205. 2),
  206. FACTOR(CLK_TOP_MSDCPLL2_D4, "msdcpll2_d4", "msdcpll2_ck", 1,
  207. 4),
  208. FACTOR(CLK_TOP_D2A_ULCLK_6P5M, "d2a_ulclk_6p5m", "clk26m", 1,
  209. 4),
  210. FACTOR(CLK_TOP_APLL1_D3, "apll1_d3", "apll1_ck", 1,
  211. 3),
  212. FACTOR(CLK_TOP_APLL2_D3, "apll2_d3", "apll2_ck", 1,
  213. 3),
  214. };
  215. static const char * const axi_parents[] = {
  216. "clk26m",
  217. "syspll1_d2",
  218. "syspll_d5",
  219. "syspll1_d4",
  220. "univpll_d5",
  221. "univpll2_d2",
  222. "msdcpll2_ck"
  223. };
  224. static const char * const mem_parents[] = {
  225. "clk26m",
  226. "dmpll_ck"
  227. };
  228. static const char * const mm_parents[] = {
  229. "clk26m",
  230. "vencpll_ck",
  231. "syspll_d3",
  232. "syspll1_d2",
  233. "syspll_d5",
  234. "syspll1_d4",
  235. "univpll1_d2",
  236. "univpll2_d2"
  237. };
  238. static const char * const pwm_parents[] = {
  239. "clk26m",
  240. "univpll2_d4",
  241. "univpll3_d2",
  242. "univpll1_d4"
  243. };
  244. static const char * const vdec_parents[] = {
  245. "clk26m",
  246. "vcodecpll_ck",
  247. "tvdpll_429m",
  248. "univpll_d3",
  249. "vencpll_ck",
  250. "syspll_d3",
  251. "univpll1_d2",
  252. "mmpll_d2",
  253. "syspll3_d2",
  254. "tvdpll_ck"
  255. };
  256. static const char * const venc_parents[] = {
  257. "clk26m",
  258. "univpll1_d2",
  259. "mmpll_d2",
  260. "tvdpll_d2",
  261. "syspll1_d2",
  262. "univpll_d5",
  263. "vcodecpll_d2",
  264. "univpll2_d2",
  265. "syspll3_d2"
  266. };
  267. static const char * const mfg_parents[] = {
  268. "clk26m",
  269. "mmpll_ck",
  270. "univpll_d3",
  271. "clk26m",
  272. "clk26m",
  273. "clk26m",
  274. "clk26m",
  275. "clk26m",
  276. "clk26m",
  277. "syspll_d3",
  278. "syspll1_d2",
  279. "syspll_d5",
  280. "univpll_d3",
  281. "univpll1_d2",
  282. "univpll_d5",
  283. "univpll2_d2"
  284. };
  285. static const char * const camtg_parents[] = {
  286. "clk26m",
  287. "univpll_d52",
  288. "univpll_d208",
  289. "univpll_d104",
  290. "clk26m_d2",
  291. "univpll_d26",
  292. "univpll2_d8",
  293. "syspll3_d4",
  294. "syspll3_d2",
  295. "univpll1_d4",
  296. "univpll2_d2"
  297. };
  298. static const char * const uart_parents[] = {
  299. "clk26m",
  300. "univpll2_d8"
  301. };
  302. static const char * const spi_parents[] = {
  303. "clk26m",
  304. "univpll2_d4",
  305. "univpll1_d4",
  306. "univpll2_d2",
  307. "univpll3_d2",
  308. "univpll1_d8"
  309. };
  310. static const char * const usb20_parents[] = {
  311. "clk26m",
  312. "univpll1_d8",
  313. "univpll3_d4"
  314. };
  315. static const char * const usb30_parents[] = {
  316. "clk26m",
  317. "univpll3_d2",
  318. "univpll3_d4",
  319. "univpll2_d4"
  320. };
  321. static const char * const msdc50_0_h_parents[] = {
  322. "clk26m",
  323. "syspll1_d2",
  324. "syspll2_d2",
  325. "syspll4_d2",
  326. "univpll_d5",
  327. "univpll1_d4"
  328. };
  329. static const char * const msdc50_0_parents[] = {
  330. "clk26m",
  331. "msdcpll_ck",
  332. "msdcpll_d2",
  333. "univpll1_d4",
  334. "syspll2_d2",
  335. "msdcpll_d4",
  336. "vencpll_d2",
  337. "univpll1_d2",
  338. "msdcpll2_ck",
  339. "msdcpll2_d2",
  340. "msdcpll2_d4"
  341. };
  342. static const char * const msdc30_1_parents[] = {
  343. "clk26m",
  344. "univpll2_d2",
  345. "msdcpll_d2",
  346. "univpll1_d4",
  347. "syspll2_d2",
  348. "univpll_d7",
  349. "vencpll_d2"
  350. };
  351. static const char * const msdc30_3_parents[] = {
  352. "clk26m",
  353. "msdcpll2_ck",
  354. "msdcpll2_d2",
  355. "univpll2_d2",
  356. "msdcpll2_d4",
  357. "univpll1_d4",
  358. "syspll2_d2",
  359. "syspll_d7",
  360. "univpll_d7",
  361. "vencpll_d2",
  362. "msdcpll_ck",
  363. "msdcpll_d2",
  364. "msdcpll_d4"
  365. };
  366. static const char * const audio_parents[] = {
  367. "clk26m",
  368. "syspll3_d4",
  369. "syspll4_d4",
  370. "syspll1_d16"
  371. };
  372. static const char * const aud_intbus_parents[] = {
  373. "clk26m",
  374. "syspll1_d4",
  375. "syspll4_d2",
  376. "univpll3_d2",
  377. "univpll2_d8",
  378. "syspll3_d2",
  379. "syspll3_d4"
  380. };
  381. static const char * const pmicspi_parents[] = {
  382. "clk26m",
  383. "syspll1_d8",
  384. "syspll3_d4",
  385. "syspll1_d16",
  386. "univpll3_d4",
  387. "univpll_d26",
  388. "syspll3_d4"
  389. };
  390. static const char * const dpilvds1_parents[] = {
  391. "clk26m",
  392. "lvdspll2_ck",
  393. "lvdspll2_d2",
  394. "lvdspll2_d4",
  395. "lvdspll2_d8",
  396. "clkfpc"
  397. };
  398. static const char * const atb_parents[] = {
  399. "clk26m",
  400. "syspll1_d2",
  401. "univpll_d5",
  402. "syspll_d5"
  403. };
  404. static const char * const nr_parents[] = {
  405. "clk26m",
  406. "univpll1_d4",
  407. "syspll2_d2",
  408. "syspll1_d4",
  409. "univpll1_d8",
  410. "univpll3_d2",
  411. "univpll2_d2",
  412. "syspll_d5"
  413. };
  414. static const char * const nfi2x_parents[] = {
  415. "clk26m",
  416. "syspll4_d4",
  417. "univpll3_d4",
  418. "univpll1_d8",
  419. "syspll2_d4",
  420. "univpll3_d2",
  421. "syspll_d7",
  422. "syspll2_d2",
  423. "univpll2_d2",
  424. "syspll_d5",
  425. "syspll1_d2"
  426. };
  427. static const char * const irda_parents[] = {
  428. "clk26m",
  429. "univpll2_d4",
  430. "syspll2_d4",
  431. "univpll2_d8"
  432. };
  433. static const char * const cci400_parents[] = {
  434. "clk26m",
  435. "vencpll_ck",
  436. "armca35pll_600m",
  437. "armca35pll_400m",
  438. "univpll_d2",
  439. "syspll_d2",
  440. "msdcpll_ck",
  441. "univpll_d3"
  442. };
  443. static const char * const aud_1_parents[] = {
  444. "clk26m",
  445. "apll1_ck",
  446. "univpll2_d4",
  447. "univpll2_d8"
  448. };
  449. static const char * const aud_2_parents[] = {
  450. "clk26m",
  451. "apll2_ck",
  452. "univpll2_d4",
  453. "univpll2_d8"
  454. };
  455. static const char * const mem_mfg_parents[] = {
  456. "clk26m",
  457. "mmpll_ck",
  458. "univpll_d3"
  459. };
  460. static const char * const axi_mfg_parents[] = {
  461. "clk26m",
  462. "axi_sel",
  463. "univpll_d5"
  464. };
  465. static const char * const scam_parents[] = {
  466. "clk26m",
  467. "syspll3_d2",
  468. "univpll2_d4",
  469. "syspll2_d4"
  470. };
  471. static const char * const nfiecc_parents[] = {
  472. "clk26m",
  473. "nfi2x_sel",
  474. "syspll_d7",
  475. "syspll2_d2",
  476. "univpll2_d2",
  477. "univpll_d5",
  478. "syspll1_d2"
  479. };
  480. static const char * const pe2_mac_p0_parents[] = {
  481. "clk26m",
  482. "syspll1_d8",
  483. "syspll4_d2",
  484. "syspll2_d4",
  485. "univpll2_d4",
  486. "syspll3_d2"
  487. };
  488. static const char * const dpilvds_parents[] = {
  489. "clk26m",
  490. "lvdspll_ck",
  491. "lvdspll_d2",
  492. "lvdspll_d4",
  493. "lvdspll_d8",
  494. "clkfpc"
  495. };
  496. static const char * const hdcp_parents[] = {
  497. "clk26m",
  498. "syspll4_d2",
  499. "syspll3_d4",
  500. "univpll2_d4"
  501. };
  502. static const char * const hdcp_24m_parents[] = {
  503. "clk26m",
  504. "univpll_d26",
  505. "univpll_d52",
  506. "univpll2_d8"
  507. };
  508. static const char * const rtc_parents[] = {
  509. "clkrtc_int",
  510. "clkrtc_ext",
  511. "clk26m",
  512. "univpll3_d8"
  513. };
  514. static const char * const spinor_parents[] = {
  515. "clk26m",
  516. "clk26m_d2",
  517. "syspll4_d4",
  518. "univpll2_d8",
  519. "univpll3_d4",
  520. "syspll4_d2",
  521. "syspll2_d4",
  522. "univpll2_d4",
  523. "etherpll_125m",
  524. "syspll1_d4"
  525. };
  526. static const char * const apll_parents[] = {
  527. "clk26m",
  528. "apll1_ck",
  529. "apll1_d2",
  530. "apll1_d4",
  531. "apll1_d8",
  532. "apll1_d16",
  533. "apll2_ck",
  534. "apll2_d2",
  535. "apll2_d4",
  536. "apll2_d8",
  537. "apll2_d16",
  538. "clk26m",
  539. "clk26m"
  540. };
  541. static const char * const a1sys_hp_parents[] = {
  542. "clk26m",
  543. "apll1_ck",
  544. "apll1_d2",
  545. "apll1_d4",
  546. "apll1_d8",
  547. "apll1_d3"
  548. };
  549. static const char * const a2sys_hp_parents[] = {
  550. "clk26m",
  551. "apll2_ck",
  552. "apll2_d2",
  553. "apll2_d4",
  554. "apll2_d8",
  555. "apll2_d3"
  556. };
  557. static const char * const asm_l_parents[] = {
  558. "clk26m",
  559. "univpll2_d4",
  560. "univpll2_d2",
  561. "syspll_d5"
  562. };
  563. static const char * const i2so1_parents[] = {
  564. "clk26m",
  565. "apll1_ck",
  566. "apll2_ck"
  567. };
  568. static const char * const ether_125m_parents[] = {
  569. "clk26m",
  570. "etherpll_125m",
  571. "univpll3_d2"
  572. };
  573. static const char * const ether_50m_parents[] = {
  574. "clk26m",
  575. "etherpll_50m",
  576. "apll1_d3",
  577. "univpll3_d4"
  578. };
  579. static const char * const jpgdec_parents[] = {
  580. "clk26m",
  581. "univpll_d3",
  582. "tvdpll_429m",
  583. "vencpll_ck",
  584. "syspll_d3",
  585. "vcodecpll_ck",
  586. "univpll1_d2",
  587. "armca35pll_400m",
  588. "tvdpll_429m_d2",
  589. "tvdpll_429m_d4"
  590. };
  591. static const char * const spislv_parents[] = {
  592. "clk26m",
  593. "univpll2_d4",
  594. "univpll1_d4",
  595. "univpll2_d2",
  596. "univpll3_d2",
  597. "univpll1_d8",
  598. "univpll1_d2",
  599. "univpll_d5"
  600. };
  601. static const char * const ether_parents[] = {
  602. "clk26m",
  603. "etherpll_50m",
  604. "univpll_d26"
  605. };
  606. static const char * const di_parents[] = {
  607. "clk26m",
  608. "tvdpll_d2",
  609. "tvdpll_d4",
  610. "tvdpll_d8",
  611. "vencpll_ck",
  612. "vencpll_d2",
  613. "cvbs",
  614. "cvbs_d2"
  615. };
  616. static const char * const tvd_parents[] = {
  617. "clk26m",
  618. "cvbs_d2",
  619. "univpll2_d8"
  620. };
  621. static const char * const i2c_parents[] = {
  622. "clk26m",
  623. "univpll_d26",
  624. "univpll2_d4",
  625. "univpll3_d2",
  626. "univpll1_d4"
  627. };
  628. static const char * const msdc0p_aes_parents[] = {
  629. "clk26m",
  630. "syspll_d2",
  631. "univpll_d3",
  632. "vcodecpll_ck"
  633. };
  634. static const char * const cmsys_parents[] = {
  635. "clk26m",
  636. "univpll_d3",
  637. "syspll_d3",
  638. "syspll1_d2",
  639. "syspll2_d2"
  640. };
  641. static const char * const gcpu_parents[] = {
  642. "clk26m",
  643. "syspll_d3",
  644. "syspll1_d2",
  645. "univpll1_d2",
  646. "univpll_d5",
  647. "univpll3_d2",
  648. "univpll_d3"
  649. };
  650. static const char * const aud_apll1_parents[] = {
  651. "apll1",
  652. "clkaud_ext_i_1"
  653. };
  654. static const char * const aud_apll2_parents[] = {
  655. "apll2",
  656. "clkaud_ext_i_2"
  657. };
  658. static const char * const apll1_ref_parents[] = {
  659. "clkaud_ext_i_2",
  660. "clkaud_ext_i_1",
  661. "clki2si0_mck_i",
  662. "clki2si1_mck_i",
  663. "clki2si2_mck_i",
  664. "clktdmin_mclk_i",
  665. "clki2si2_mck_i",
  666. "clktdmin_mclk_i"
  667. };
  668. static const char * const audull_vtx_parents[] = {
  669. "d2a_ulclk_6p5m",
  670. "clkaud_ext_i_0"
  671. };
  672. static struct mtk_composite top_muxes[] = {
  673. /* CLK_CFG_0 */
  674. MUX_GATE_FLAGS(CLK_TOP_AXI_SEL, "axi_sel", axi_parents, 0x040, 0, 3,
  675. 7, CLK_IS_CRITICAL),
  676. MUX_GATE_FLAGS(CLK_TOP_MEM_SEL, "mem_sel", mem_parents, 0x040, 8, 1,
  677. 15, CLK_IS_CRITICAL),
  678. MUX_GATE(CLK_TOP_MM_SEL, "mm_sel",
  679. mm_parents, 0x040, 24, 3, 31),
  680. /* CLK_CFG_1 */
  681. MUX_GATE(CLK_TOP_PWM_SEL, "pwm_sel",
  682. pwm_parents, 0x050, 0, 2, 7),
  683. MUX_GATE(CLK_TOP_VDEC_SEL, "vdec_sel",
  684. vdec_parents, 0x050, 8, 4, 15),
  685. MUX_GATE(CLK_TOP_VENC_SEL, "venc_sel",
  686. venc_parents, 0x050, 16, 4, 23),
  687. MUX_GATE(CLK_TOP_MFG_SEL, "mfg_sel",
  688. mfg_parents, 0x050, 24, 4, 31),
  689. /* CLK_CFG_2 */
  690. MUX_GATE(CLK_TOP_CAMTG_SEL, "camtg_sel",
  691. camtg_parents, 0x060, 0, 4, 7),
  692. MUX_GATE(CLK_TOP_UART_SEL, "uart_sel",
  693. uart_parents, 0x060, 8, 1, 15),
  694. MUX_GATE(CLK_TOP_SPI_SEL, "spi_sel",
  695. spi_parents, 0x060, 16, 3, 23),
  696. MUX_GATE(CLK_TOP_USB20_SEL, "usb20_sel",
  697. usb20_parents, 0x060, 24, 2, 31),
  698. /* CLK_CFG_3 */
  699. MUX_GATE(CLK_TOP_USB30_SEL, "usb30_sel",
  700. usb30_parents, 0x070, 0, 2, 7),
  701. MUX_GATE(CLK_TOP_MSDC50_0_HCLK_SEL, "msdc50_0_h_sel",
  702. msdc50_0_h_parents, 0x070, 8, 3, 15),
  703. MUX_GATE(CLK_TOP_MSDC50_0_SEL, "msdc50_0_sel",
  704. msdc50_0_parents, 0x070, 16, 4, 23),
  705. MUX_GATE(CLK_TOP_MSDC30_1_SEL, "msdc30_1_sel",
  706. msdc30_1_parents, 0x070, 24, 3, 31),
  707. /* CLK_CFG_4 */
  708. MUX_GATE(CLK_TOP_MSDC30_2_SEL, "msdc30_2_sel",
  709. msdc30_1_parents, 0x080, 0, 3, 7),
  710. MUX_GATE(CLK_TOP_MSDC30_3_SEL, "msdc30_3_sel",
  711. msdc30_3_parents, 0x080, 8, 4, 15),
  712. MUX_GATE(CLK_TOP_AUDIO_SEL, "audio_sel",
  713. audio_parents, 0x080, 16, 2, 23),
  714. MUX_GATE(CLK_TOP_AUD_INTBUS_SEL, "aud_intbus_sel",
  715. aud_intbus_parents, 0x080, 24, 3, 31),
  716. /* CLK_CFG_5 */
  717. MUX_GATE(CLK_TOP_PMICSPI_SEL, "pmicspi_sel",
  718. pmicspi_parents, 0x090, 0, 3, 7),
  719. MUX_GATE(CLK_TOP_DPILVDS1_SEL, "dpilvds1_sel",
  720. dpilvds1_parents, 0x090, 8, 3, 15),
  721. MUX_GATE(CLK_TOP_ATB_SEL, "atb_sel",
  722. atb_parents, 0x090, 16, 2, 23),
  723. MUX_GATE(CLK_TOP_NR_SEL, "nr_sel",
  724. nr_parents, 0x090, 24, 3, 31),
  725. /* CLK_CFG_6 */
  726. MUX_GATE(CLK_TOP_NFI2X_SEL, "nfi2x_sel",
  727. nfi2x_parents, 0x0a0, 0, 4, 7),
  728. MUX_GATE(CLK_TOP_IRDA_SEL, "irda_sel",
  729. irda_parents, 0x0a0, 8, 2, 15),
  730. MUX_GATE(CLK_TOP_CCI400_SEL, "cci400_sel",
  731. cci400_parents, 0x0a0, 16, 3, 23),
  732. MUX_GATE(CLK_TOP_AUD_1_SEL, "aud_1_sel",
  733. aud_1_parents, 0x0a0, 24, 2, 31),
  734. /* CLK_CFG_7 */
  735. MUX_GATE(CLK_TOP_AUD_2_SEL, "aud_2_sel",
  736. aud_2_parents, 0x0b0, 0, 2, 7),
  737. MUX_GATE(CLK_TOP_MEM_MFG_IN_AS_SEL, "mem_mfg_sel",
  738. mem_mfg_parents, 0x0b0, 8, 2, 15),
  739. MUX_GATE(CLK_TOP_AXI_MFG_IN_AS_SEL, "axi_mfg_sel",
  740. axi_mfg_parents, 0x0b0, 16, 2, 23),
  741. MUX_GATE(CLK_TOP_SCAM_SEL, "scam_sel",
  742. scam_parents, 0x0b0, 24, 2, 31),
  743. /* CLK_CFG_8 */
  744. MUX_GATE(CLK_TOP_NFIECC_SEL, "nfiecc_sel",
  745. nfiecc_parents, 0x0c0, 0, 3, 7),
  746. MUX_GATE(CLK_TOP_PE2_MAC_P0_SEL, "pe2_mac_p0_sel",
  747. pe2_mac_p0_parents, 0x0c0, 8, 3, 15),
  748. MUX_GATE(CLK_TOP_PE2_MAC_P1_SEL, "pe2_mac_p1_sel",
  749. pe2_mac_p0_parents, 0x0c0, 16, 3, 23),
  750. MUX_GATE(CLK_TOP_DPILVDS_SEL, "dpilvds_sel",
  751. dpilvds_parents, 0x0c0, 24, 3, 31),
  752. /* CLK_CFG_9 */
  753. MUX_GATE(CLK_TOP_MSDC50_3_HCLK_SEL, "msdc50_3_h_sel",
  754. msdc50_0_h_parents, 0x0d0, 0, 3, 7),
  755. MUX_GATE(CLK_TOP_HDCP_SEL, "hdcp_sel",
  756. hdcp_parents, 0x0d0, 8, 2, 15),
  757. MUX_GATE(CLK_TOP_HDCP_24M_SEL, "hdcp_24m_sel",
  758. hdcp_24m_parents, 0x0d0, 16, 2, 23),
  759. MUX_GATE_FLAGS(CLK_TOP_RTC_SEL, "rtc_sel", rtc_parents, 0x0d0, 24, 2,
  760. 31, CLK_IS_CRITICAL),
  761. /* CLK_CFG_10 */
  762. MUX_GATE(CLK_TOP_SPINOR_SEL, "spinor_sel",
  763. spinor_parents, 0x500, 0, 4, 7),
  764. MUX_GATE(CLK_TOP_APLL_SEL, "apll_sel",
  765. apll_parents, 0x500, 8, 4, 15),
  766. MUX_GATE(CLK_TOP_APLL2_SEL, "apll2_sel",
  767. apll_parents, 0x500, 16, 4, 23),
  768. MUX_GATE(CLK_TOP_A1SYS_HP_SEL, "a1sys_hp_sel",
  769. a1sys_hp_parents, 0x500, 24, 3, 31),
  770. /* CLK_CFG_11 */
  771. MUX_GATE(CLK_TOP_A2SYS_HP_SEL, "a2sys_hp_sel",
  772. a2sys_hp_parents, 0x510, 0, 3, 7),
  773. MUX_GATE(CLK_TOP_ASM_L_SEL, "asm_l_sel",
  774. asm_l_parents, 0x510, 8, 2, 15),
  775. MUX_GATE(CLK_TOP_ASM_M_SEL, "asm_m_sel",
  776. asm_l_parents, 0x510, 16, 2, 23),
  777. MUX_GATE(CLK_TOP_ASM_H_SEL, "asm_h_sel",
  778. asm_l_parents, 0x510, 24, 2, 31),
  779. /* CLK_CFG_12 */
  780. MUX_GATE(CLK_TOP_I2SO1_SEL, "i2so1_sel",
  781. i2so1_parents, 0x520, 0, 2, 7),
  782. MUX_GATE(CLK_TOP_I2SO2_SEL, "i2so2_sel",
  783. i2so1_parents, 0x520, 8, 2, 15),
  784. MUX_GATE(CLK_TOP_I2SO3_SEL, "i2so3_sel",
  785. i2so1_parents, 0x520, 16, 2, 23),
  786. MUX_GATE(CLK_TOP_TDMO0_SEL, "tdmo0_sel",
  787. i2so1_parents, 0x520, 24, 2, 31),
  788. /* CLK_CFG_13 */
  789. MUX_GATE(CLK_TOP_TDMO1_SEL, "tdmo1_sel",
  790. i2so1_parents, 0x530, 0, 2, 7),
  791. MUX_GATE(CLK_TOP_I2SI1_SEL, "i2si1_sel",
  792. i2so1_parents, 0x530, 8, 2, 15),
  793. MUX_GATE(CLK_TOP_I2SI2_SEL, "i2si2_sel",
  794. i2so1_parents, 0x530, 16, 2, 23),
  795. MUX_GATE(CLK_TOP_I2SI3_SEL, "i2si3_sel",
  796. i2so1_parents, 0x530, 24, 2, 31),
  797. /* CLK_CFG_14 */
  798. MUX_GATE(CLK_TOP_ETHER_125M_SEL, "ether_125m_sel",
  799. ether_125m_parents, 0x540, 0, 2, 7),
  800. MUX_GATE(CLK_TOP_ETHER_50M_SEL, "ether_50m_sel",
  801. ether_50m_parents, 0x540, 8, 2, 15),
  802. MUX_GATE(CLK_TOP_JPGDEC_SEL, "jpgdec_sel",
  803. jpgdec_parents, 0x540, 16, 4, 23),
  804. MUX_GATE(CLK_TOP_SPISLV_SEL, "spislv_sel",
  805. spislv_parents, 0x540, 24, 3, 31),
  806. /* CLK_CFG_15 */
  807. MUX_GATE(CLK_TOP_ETHER_50M_RMII_SEL, "ether_sel",
  808. ether_parents, 0x550, 0, 2, 7),
  809. MUX_GATE(CLK_TOP_CAM2TG_SEL, "cam2tg_sel",
  810. camtg_parents, 0x550, 8, 4, 15),
  811. MUX_GATE(CLK_TOP_DI_SEL, "di_sel",
  812. di_parents, 0x550, 16, 3, 23),
  813. MUX_GATE(CLK_TOP_TVD_SEL, "tvd_sel",
  814. tvd_parents, 0x550, 24, 2, 31),
  815. /* CLK_CFG_16 */
  816. MUX_GATE(CLK_TOP_I2C_SEL, "i2c_sel",
  817. i2c_parents, 0x560, 0, 3, 7),
  818. MUX_GATE(CLK_TOP_PWM_INFRA_SEL, "pwm_infra_sel",
  819. pwm_parents, 0x560, 8, 2, 15),
  820. MUX_GATE(CLK_TOP_MSDC0P_AES_SEL, "msdc0p_aes_sel",
  821. msdc0p_aes_parents, 0x560, 16, 2, 23),
  822. MUX_GATE(CLK_TOP_CMSYS_SEL, "cmsys_sel",
  823. cmsys_parents, 0x560, 24, 3, 31),
  824. /* CLK_CFG_17 */
  825. MUX_GATE(CLK_TOP_GCPU_SEL, "gcpu_sel",
  826. gcpu_parents, 0x570, 0, 3, 7),
  827. /* CLK_AUDDIV_4 */
  828. MUX(CLK_TOP_AUD_APLL1_SEL, "aud_apll1_sel",
  829. aud_apll1_parents, 0x134, 0, 1),
  830. MUX(CLK_TOP_AUD_APLL2_SEL, "aud_apll2_sel",
  831. aud_apll2_parents, 0x134, 1, 1),
  832. MUX(CLK_TOP_DA_AUDULL_VTX_6P5M_SEL, "audull_vtx_sel",
  833. audull_vtx_parents, 0x134, 31, 1),
  834. MUX(CLK_TOP_APLL1_REF_SEL, "apll1_ref_sel",
  835. apll1_ref_parents, 0x134, 4, 3),
  836. MUX(CLK_TOP_APLL2_REF_SEL, "apll2_ref_sel",
  837. apll1_ref_parents, 0x134, 7, 3),
  838. };
  839. static const char * const mcu_mp0_parents[] = {
  840. "clk26m",
  841. "armca35pll_ck",
  842. "f_mp0_pll1_ck",
  843. "f_mp0_pll2_ck"
  844. };
  845. static const char * const mcu_mp2_parents[] = {
  846. "clk26m",
  847. "armca72pll_ck",
  848. "f_big_pll1_ck",
  849. "f_big_pll2_ck"
  850. };
  851. static const char * const mcu_bus_parents[] = {
  852. "clk26m",
  853. "cci400_sel",
  854. "f_bus_pll1_ck",
  855. "f_bus_pll2_ck"
  856. };
  857. static struct mtk_composite mcu_muxes[] = {
  858. /* mp0_pll_divider_cfg */
  859. MUX_GATE_FLAGS(CLK_MCU_MP0_SEL, "mcu_mp0_sel", mcu_mp0_parents, 0x7A0,
  860. 9, 2, -1, CLK_IS_CRITICAL),
  861. /* mp2_pll_divider_cfg */
  862. MUX_GATE_FLAGS(CLK_MCU_MP2_SEL, "mcu_mp2_sel", mcu_mp2_parents, 0x7A8,
  863. 9, 2, -1, CLK_IS_CRITICAL),
  864. /* bus_pll_divider_cfg */
  865. MUX_GATE_FLAGS(CLK_MCU_BUS_SEL, "mcu_bus_sel", mcu_bus_parents, 0x7C0,
  866. 9, 2, -1, CLK_IS_CRITICAL),
  867. };
  868. static const struct mtk_clk_divider top_adj_divs[] = {
  869. DIV_ADJ(CLK_TOP_APLL_DIV0, "apll_div0", "i2so1_sel", 0x124, 0, 8),
  870. DIV_ADJ(CLK_TOP_APLL_DIV1, "apll_div1", "i2so2_sel", 0x124, 8, 8),
  871. DIV_ADJ(CLK_TOP_APLL_DIV2, "apll_div2", "i2so3_sel", 0x124, 16, 8),
  872. DIV_ADJ(CLK_TOP_APLL_DIV3, "apll_div3", "tdmo0_sel", 0x124, 24, 8),
  873. DIV_ADJ(CLK_TOP_APLL_DIV4, "apll_div4", "tdmo1_sel", 0x128, 0, 8),
  874. DIV_ADJ(CLK_TOP_APLL_DIV5, "apll_div5", "i2si1_sel", 0x128, 8, 8),
  875. DIV_ADJ(CLK_TOP_APLL_DIV6, "apll_div6", "i2si2_sel", 0x128, 16, 8),
  876. DIV_ADJ(CLK_TOP_APLL_DIV7, "apll_div7", "i2si3_sel", 0x128, 24, 8),
  877. };
  878. static const struct mtk_gate_regs top0_cg_regs = {
  879. .set_ofs = 0x120,
  880. .clr_ofs = 0x120,
  881. .sta_ofs = 0x120,
  882. };
  883. static const struct mtk_gate_regs top1_cg_regs = {
  884. .set_ofs = 0x424,
  885. .clr_ofs = 0x424,
  886. .sta_ofs = 0x424,
  887. };
  888. #define GATE_TOP0(_id, _name, _parent, _shift) \
  889. GATE_MTK(_id, _name, _parent, &top0_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
  890. #define GATE_TOP1(_id, _name, _parent, _shift) \
  891. GATE_MTK(_id, _name, _parent, &top1_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
  892. static const struct mtk_gate top_clks[] = {
  893. /* TOP0 */
  894. GATE_TOP0(CLK_TOP_APLL_DIV_PDN0, "apll_div_pdn0", "i2so1_sel", 0),
  895. GATE_TOP0(CLK_TOP_APLL_DIV_PDN1, "apll_div_pdn1", "i2so2_sel", 1),
  896. GATE_TOP0(CLK_TOP_APLL_DIV_PDN2, "apll_div_pdn2", "i2so3_sel", 2),
  897. GATE_TOP0(CLK_TOP_APLL_DIV_PDN3, "apll_div_pdn3", "tdmo0_sel", 3),
  898. GATE_TOP0(CLK_TOP_APLL_DIV_PDN4, "apll_div_pdn4", "tdmo1_sel", 4),
  899. GATE_TOP0(CLK_TOP_APLL_DIV_PDN5, "apll_div_pdn5", "i2si1_sel", 5),
  900. GATE_TOP0(CLK_TOP_APLL_DIV_PDN6, "apll_div_pdn6", "i2si2_sel", 6),
  901. GATE_TOP0(CLK_TOP_APLL_DIV_PDN7, "apll_div_pdn7", "i2si3_sel", 7),
  902. /* TOP1 */
  903. GATE_TOP1(CLK_TOP_NFI2X_EN, "nfi2x_en", "nfi2x_sel", 0),
  904. GATE_TOP1(CLK_TOP_NFIECC_EN, "nfiecc_en", "nfiecc_sel", 1),
  905. GATE_TOP1(CLK_TOP_NFI1X_CK_EN, "nfi1x_ck_en", "nfi2x_sel", 2),
  906. };
  907. static const struct mtk_gate_regs infra_cg_regs = {
  908. .set_ofs = 0x40,
  909. .clr_ofs = 0x44,
  910. .sta_ofs = 0x48,
  911. };
  912. #define GATE_INFRA(_id, _name, _parent, _shift) \
  913. GATE_MTK(_id, _name, _parent, &infra_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
  914. static const struct mtk_gate infra_clks[] = {
  915. GATE_INFRA(CLK_INFRA_DBGCLK, "infra_dbgclk", "axi_sel", 0),
  916. GATE_INFRA(CLK_INFRA_GCE, "infra_gce", "axi_sel", 6),
  917. GATE_INFRA(CLK_INFRA_M4U, "infra_m4u", "mem_sel", 8),
  918. GATE_INFRA(CLK_INFRA_KP, "infra_kp", "axi_sel", 16),
  919. GATE_INFRA(CLK_INFRA_AO_SPI0, "infra_ao_spi0", "spi_sel", 24),
  920. GATE_INFRA(CLK_INFRA_AO_SPI1, "infra_ao_spi1", "spislv_sel", 25),
  921. GATE_INFRA(CLK_INFRA_AO_UART5, "infra_ao_uart5", "axi_sel", 26),
  922. };
  923. static const struct mtk_gate_regs peri0_cg_regs = {
  924. .set_ofs = 0x8,
  925. .clr_ofs = 0x10,
  926. .sta_ofs = 0x18,
  927. };
  928. static const struct mtk_gate_regs peri1_cg_regs = {
  929. .set_ofs = 0xc,
  930. .clr_ofs = 0x14,
  931. .sta_ofs = 0x1c,
  932. };
  933. static const struct mtk_gate_regs peri2_cg_regs = {
  934. .set_ofs = 0x42c,
  935. .clr_ofs = 0x42c,
  936. .sta_ofs = 0x42c,
  937. };
  938. #define GATE_PERI0(_id, _name, _parent, _shift) \
  939. GATE_MTK(_id, _name, _parent, &peri0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
  940. #define GATE_PERI1(_id, _name, _parent, _shift) \
  941. GATE_MTK(_id, _name, _parent, &peri1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
  942. #define GATE_PERI2(_id, _name, _parent, _shift) \
  943. GATE_MTK(_id, _name, _parent, &peri2_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
  944. static const struct mtk_gate peri_clks[] = {
  945. /* PERI0 */
  946. GATE_PERI0(CLK_PERI_NFI, "per_nfi",
  947. "axi_sel", 0),
  948. GATE_PERI0(CLK_PERI_THERM, "per_therm",
  949. "axi_sel", 1),
  950. GATE_PERI0(CLK_PERI_PWM0, "per_pwm0",
  951. "pwm_sel", 2),
  952. GATE_PERI0(CLK_PERI_PWM1, "per_pwm1",
  953. "pwm_sel", 3),
  954. GATE_PERI0(CLK_PERI_PWM2, "per_pwm2",
  955. "pwm_sel", 4),
  956. GATE_PERI0(CLK_PERI_PWM3, "per_pwm3",
  957. "pwm_sel", 5),
  958. GATE_PERI0(CLK_PERI_PWM4, "per_pwm4",
  959. "pwm_sel", 6),
  960. GATE_PERI0(CLK_PERI_PWM5, "per_pwm5",
  961. "pwm_sel", 7),
  962. GATE_PERI0(CLK_PERI_PWM6, "per_pwm6",
  963. "pwm_sel", 8),
  964. GATE_PERI0(CLK_PERI_PWM7, "per_pwm7",
  965. "pwm_sel", 9),
  966. GATE_PERI0(CLK_PERI_PWM, "per_pwm",
  967. "pwm_sel", 10),
  968. GATE_PERI0(CLK_PERI_AP_DMA, "per_ap_dma",
  969. "axi_sel", 13),
  970. GATE_PERI0(CLK_PERI_MSDC30_0, "per_msdc30_0",
  971. "msdc50_0_sel", 14),
  972. GATE_PERI0(CLK_PERI_MSDC30_1, "per_msdc30_1",
  973. "msdc30_1_sel", 15),
  974. GATE_PERI0(CLK_PERI_MSDC30_2, "per_msdc30_2",
  975. "msdc30_2_sel", 16),
  976. GATE_PERI0(CLK_PERI_MSDC30_3, "per_msdc30_3",
  977. "msdc30_3_sel", 17),
  978. GATE_PERI0(CLK_PERI_UART0, "per_uart0",
  979. "uart_sel", 20),
  980. GATE_PERI0(CLK_PERI_UART1, "per_uart1",
  981. "uart_sel", 21),
  982. GATE_PERI0(CLK_PERI_UART2, "per_uart2",
  983. "uart_sel", 22),
  984. GATE_PERI0(CLK_PERI_UART3, "per_uart3",
  985. "uart_sel", 23),
  986. GATE_PERI0(CLK_PERI_I2C0, "per_i2c0",
  987. "axi_sel", 24),
  988. GATE_PERI0(CLK_PERI_I2C1, "per_i2c1",
  989. "axi_sel", 25),
  990. GATE_PERI0(CLK_PERI_I2C2, "per_i2c2",
  991. "axi_sel", 26),
  992. GATE_PERI0(CLK_PERI_I2C3, "per_i2c3",
  993. "axi_sel", 27),
  994. GATE_PERI0(CLK_PERI_I2C4, "per_i2c4",
  995. "axi_sel", 28),
  996. GATE_PERI0(CLK_PERI_AUXADC, "per_auxadc",
  997. "ltepll_fs26m", 29),
  998. GATE_PERI0(CLK_PERI_SPI0, "per_spi0",
  999. "spi_sel", 30),
  1000. /* PERI1 */
  1001. GATE_PERI1(CLK_PERI_SPI, "per_spi",
  1002. "spinor_sel", 1),
  1003. GATE_PERI1(CLK_PERI_I2C5, "per_i2c5",
  1004. "axi_sel", 3),
  1005. GATE_PERI1(CLK_PERI_SPI2, "per_spi2",
  1006. "spi_sel", 5),
  1007. GATE_PERI1(CLK_PERI_SPI3, "per_spi3",
  1008. "spi_sel", 6),
  1009. GATE_PERI1(CLK_PERI_SPI5, "per_spi5",
  1010. "spi_sel", 8),
  1011. GATE_PERI1(CLK_PERI_UART4, "per_uart4",
  1012. "uart_sel", 9),
  1013. GATE_PERI1(CLK_PERI_SFLASH, "per_sflash",
  1014. "uart_sel", 11),
  1015. GATE_PERI1(CLK_PERI_GMAC, "per_gmac",
  1016. "uart_sel", 12),
  1017. GATE_PERI1(CLK_PERI_PCIE0, "per_pcie0",
  1018. "uart_sel", 14),
  1019. GATE_PERI1(CLK_PERI_PCIE1, "per_pcie1",
  1020. "uart_sel", 15),
  1021. GATE_PERI1(CLK_PERI_GMAC_PCLK, "per_gmac_pclk",
  1022. "uart_sel", 16),
  1023. /* PERI2 */
  1024. GATE_PERI2(CLK_PERI_MSDC50_0_EN, "per_msdc50_0_en",
  1025. "msdc50_0_sel", 0),
  1026. GATE_PERI2(CLK_PERI_MSDC30_1_EN, "per_msdc30_1_en",
  1027. "msdc30_1_sel", 1),
  1028. GATE_PERI2(CLK_PERI_MSDC30_2_EN, "per_msdc30_2_en",
  1029. "msdc30_2_sel", 2),
  1030. GATE_PERI2(CLK_PERI_MSDC30_3_EN, "per_msdc30_3_en",
  1031. "msdc30_3_sel", 3),
  1032. GATE_PERI2(CLK_PERI_MSDC50_0_HCLK_EN, "per_msdc50_0_h",
  1033. "msdc50_0_h_sel", 4),
  1034. GATE_PERI2(CLK_PERI_MSDC50_3_HCLK_EN, "per_msdc50_3_h",
  1035. "msdc50_3_h_sel", 5),
  1036. GATE_PERI2(CLK_PERI_MSDC30_0_QTR_EN, "per_msdc30_0_q",
  1037. "axi_sel", 6),
  1038. GATE_PERI2(CLK_PERI_MSDC30_3_QTR_EN, "per_msdc30_3_q",
  1039. "mem_sel", 7),
  1040. };
  1041. #define MT2712_PLL_FMAX (3000UL * MHZ)
  1042. #define CON0_MT2712_RST_BAR BIT(24)
  1043. #define PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
  1044. _pd_reg, _pd_shift, _tuner_reg, _tuner_en_reg, \
  1045. _tuner_en_bit, _pcw_reg, _pcw_shift, \
  1046. _div_table) { \
  1047. .id = _id, \
  1048. .name = _name, \
  1049. .reg = _reg, \
  1050. .pwr_reg = _pwr_reg, \
  1051. .en_mask = _en_mask, \
  1052. .flags = _flags, \
  1053. .rst_bar_mask = CON0_MT2712_RST_BAR, \
  1054. .fmax = MT2712_PLL_FMAX, \
  1055. .pcwbits = _pcwbits, \
  1056. .pd_reg = _pd_reg, \
  1057. .pd_shift = _pd_shift, \
  1058. .tuner_reg = _tuner_reg, \
  1059. .tuner_en_reg = _tuner_en_reg, \
  1060. .tuner_en_bit = _tuner_en_bit, \
  1061. .pcw_reg = _pcw_reg, \
  1062. .pcw_shift = _pcw_shift, \
  1063. .div_table = _div_table, \
  1064. }
  1065. #define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
  1066. _pd_reg, _pd_shift, _tuner_reg, _tuner_en_reg, \
  1067. _tuner_en_bit, _pcw_reg, _pcw_shift) \
  1068. PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, \
  1069. _pcwbits, _pd_reg, _pd_shift, _tuner_reg, \
  1070. _tuner_en_reg, _tuner_en_bit, _pcw_reg, \
  1071. _pcw_shift, NULL)
  1072. static const struct mtk_pll_div_table armca35pll_div_table[] = {
  1073. { .div = 0, .freq = MT2712_PLL_FMAX },
  1074. { .div = 1, .freq = 1202500000 },
  1075. { .div = 2, .freq = 500500000 },
  1076. { .div = 3, .freq = 315250000 },
  1077. { .div = 4, .freq = 157625000 },
  1078. { } /* sentinel */
  1079. };
  1080. static const struct mtk_pll_div_table armca72pll_div_table[] = {
  1081. { .div = 0, .freq = MT2712_PLL_FMAX },
  1082. { .div = 1, .freq = 994500000 },
  1083. { .div = 2, .freq = 520000000 },
  1084. { .div = 3, .freq = 315250000 },
  1085. { .div = 4, .freq = 157625000 },
  1086. { } /* sentinel */
  1087. };
  1088. static const struct mtk_pll_div_table mmpll_div_table[] = {
  1089. { .div = 0, .freq = MT2712_PLL_FMAX },
  1090. { .div = 1, .freq = 1001000000 },
  1091. { .div = 2, .freq = 601250000 },
  1092. { .div = 3, .freq = 250250000 },
  1093. { .div = 4, .freq = 125125000 },
  1094. { } /* sentinel */
  1095. };
  1096. static const struct mtk_pll_data plls[] = {
  1097. PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x0230, 0x023C, 0xf0000100,
  1098. HAVE_RST_BAR, 31, 0x0230, 4, 0, 0, 0, 0x0234, 0),
  1099. PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x0240, 0x024C, 0xfe000100,
  1100. HAVE_RST_BAR, 31, 0x0240, 4, 0, 0, 0, 0x0244, 0),
  1101. PLL(CLK_APMIXED_VCODECPLL, "vcodecpll", 0x0320, 0x032C, 0xc0000100,
  1102. 0, 31, 0x0320, 4, 0, 0, 0, 0x0324, 0),
  1103. PLL(CLK_APMIXED_VENCPLL, "vencpll", 0x0280, 0x028C, 0x00000100,
  1104. 0, 31, 0x0280, 4, 0, 0, 0, 0x0284, 0),
  1105. PLL(CLK_APMIXED_APLL1, "apll1", 0x0330, 0x0340, 0x00000100,
  1106. 0, 31, 0x0330, 4, 0x0338, 0x0014, 0, 0x0334, 0),
  1107. PLL(CLK_APMIXED_APLL2, "apll2", 0x0350, 0x0360, 0x00000100,
  1108. 0, 31, 0x0350, 4, 0x0358, 0x0014, 1, 0x0354, 0),
  1109. PLL(CLK_APMIXED_LVDSPLL, "lvdspll", 0x0370, 0x037c, 0x00000100,
  1110. 0, 31, 0x0370, 4, 0, 0, 0, 0x0374, 0),
  1111. PLL(CLK_APMIXED_LVDSPLL2, "lvdspll2", 0x0390, 0x039C, 0x00000100,
  1112. 0, 31, 0x0390, 4, 0, 0, 0, 0x0394, 0),
  1113. PLL(CLK_APMIXED_MSDCPLL, "msdcpll", 0x0270, 0x027C, 0x00000100,
  1114. 0, 31, 0x0270, 4, 0, 0, 0, 0x0274, 0),
  1115. PLL(CLK_APMIXED_MSDCPLL2, "msdcpll2", 0x0410, 0x041C, 0x00000100,
  1116. 0, 31, 0x0410, 4, 0, 0, 0, 0x0414, 0),
  1117. PLL(CLK_APMIXED_TVDPLL, "tvdpll", 0x0290, 0x029C, 0xc0000100,
  1118. 0, 31, 0x0290, 4, 0, 0, 0, 0x0294, 0),
  1119. PLL_B(CLK_APMIXED_MMPLL, "mmpll", 0x0250, 0x0260, 0x00000100,
  1120. 0, 31, 0x0250, 4, 0, 0, 0, 0x0254, 0,
  1121. mmpll_div_table),
  1122. PLL_B(CLK_APMIXED_ARMCA35PLL, "armca35pll", 0x0100, 0x0110, 0xf0000100,
  1123. HAVE_RST_BAR, 31, 0x0100, 4, 0, 0, 0, 0x0104, 0,
  1124. armca35pll_div_table),
  1125. PLL_B(CLK_APMIXED_ARMCA72PLL, "armca72pll", 0x0210, 0x0220, 0x00000100,
  1126. 0, 31, 0x0210, 4, 0, 0, 0, 0x0214, 0,
  1127. armca72pll_div_table),
  1128. PLL(CLK_APMIXED_ETHERPLL, "etherpll", 0x0300, 0x030C, 0xc0000100,
  1129. 0, 31, 0x0300, 4, 0, 0, 0, 0x0304, 0),
  1130. };
  1131. static u16 infrasys_rst_ofs[] = { 0x30, 0x34, };
  1132. static u16 pericfg_rst_ofs[] = { 0x0, 0x4, };
  1133. static const struct mtk_clk_rst_desc clk_rst_desc[] = {
  1134. /* infra */
  1135. {
  1136. .version = MTK_RST_SIMPLE,
  1137. .rst_bank_ofs = infrasys_rst_ofs,
  1138. .rst_bank_nr = ARRAY_SIZE(infrasys_rst_ofs),
  1139. },
  1140. /* peri */
  1141. {
  1142. .version = MTK_RST_SIMPLE,
  1143. .rst_bank_ofs = pericfg_rst_ofs,
  1144. .rst_bank_nr = ARRAY_SIZE(pericfg_rst_ofs),
  1145. },
  1146. };
  1147. static int clk_mt2712_apmixed_probe(struct platform_device *pdev)
  1148. {
  1149. struct clk_hw_onecell_data *clk_data;
  1150. int r;
  1151. struct device_node *node = pdev->dev.of_node;
  1152. clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
  1153. if (!clk_data)
  1154. return -ENOMEM;
  1155. r = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
  1156. if (r)
  1157. goto free_clk_data;
  1158. r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
  1159. if (r) {
  1160. dev_err(&pdev->dev, "Cannot register clock provider: %d\n", r);
  1161. goto unregister_plls;
  1162. }
  1163. return 0;
  1164. unregister_plls:
  1165. mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
  1166. free_clk_data:
  1167. mtk_free_clk_data(clk_data);
  1168. return r;
  1169. }
  1170. static struct clk_hw_onecell_data *top_clk_data;
  1171. static void clk_mt2712_top_init_early(struct device_node *node)
  1172. {
  1173. int r, i;
  1174. if (!top_clk_data) {
  1175. top_clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
  1176. for (i = 0; i < CLK_TOP_NR_CLK; i++)
  1177. top_clk_data->hws[i] = ERR_PTR(-EPROBE_DEFER);
  1178. }
  1179. mtk_clk_register_factors(top_early_divs, ARRAY_SIZE(top_early_divs),
  1180. top_clk_data);
  1181. r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, top_clk_data);
  1182. if (r)
  1183. pr_err("%s(): could not register clock provider: %d\n",
  1184. __func__, r);
  1185. }
  1186. CLK_OF_DECLARE_DRIVER(mt2712_topckgen, "mediatek,mt2712-topckgen",
  1187. clk_mt2712_top_init_early);
  1188. static int clk_mt2712_top_probe(struct platform_device *pdev)
  1189. {
  1190. int r, i;
  1191. struct device_node *node = pdev->dev.of_node;
  1192. void __iomem *base;
  1193. base = devm_platform_ioremap_resource(pdev, 0);
  1194. if (IS_ERR(base)) {
  1195. pr_err("%s(): ioremap failed\n", __func__);
  1196. return PTR_ERR(base);
  1197. }
  1198. if (!top_clk_data) {
  1199. top_clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
  1200. } else {
  1201. for (i = 0; i < CLK_TOP_NR_CLK; i++) {
  1202. if (top_clk_data->hws[i] == ERR_PTR(-EPROBE_DEFER))
  1203. top_clk_data->hws[i] = ERR_PTR(-ENOENT);
  1204. }
  1205. }
  1206. mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks),
  1207. top_clk_data);
  1208. mtk_clk_register_factors(top_early_divs, ARRAY_SIZE(top_early_divs),
  1209. top_clk_data);
  1210. mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data);
  1211. mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base,
  1212. &mt2712_clk_lock, top_clk_data);
  1213. mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs), base,
  1214. &mt2712_clk_lock, top_clk_data);
  1215. mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks),
  1216. top_clk_data);
  1217. r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, top_clk_data);
  1218. if (r != 0)
  1219. pr_err("%s(): could not register clock provider: %d\n",
  1220. __func__, r);
  1221. return r;
  1222. }
  1223. static int clk_mt2712_infra_probe(struct platform_device *pdev)
  1224. {
  1225. struct clk_hw_onecell_data *clk_data;
  1226. int r;
  1227. struct device_node *node = pdev->dev.of_node;
  1228. clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
  1229. mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
  1230. clk_data);
  1231. r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
  1232. if (r != 0)
  1233. pr_err("%s(): could not register clock provider: %d\n",
  1234. __func__, r);
  1235. mtk_register_reset_controller_with_dev(&pdev->dev, &clk_rst_desc[0]);
  1236. return r;
  1237. }
  1238. static int clk_mt2712_peri_probe(struct platform_device *pdev)
  1239. {
  1240. struct clk_hw_onecell_data *clk_data;
  1241. int r;
  1242. struct device_node *node = pdev->dev.of_node;
  1243. clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK);
  1244. mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks),
  1245. clk_data);
  1246. r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
  1247. if (r != 0)
  1248. pr_err("%s(): could not register clock provider: %d\n",
  1249. __func__, r);
  1250. mtk_register_reset_controller_with_dev(&pdev->dev, &clk_rst_desc[1]);
  1251. return r;
  1252. }
  1253. static int clk_mt2712_mcu_probe(struct platform_device *pdev)
  1254. {
  1255. struct clk_hw_onecell_data *clk_data;
  1256. int r;
  1257. struct device_node *node = pdev->dev.of_node;
  1258. void __iomem *base;
  1259. base = devm_platform_ioremap_resource(pdev, 0);
  1260. if (IS_ERR(base)) {
  1261. pr_err("%s(): ioremap failed\n", __func__);
  1262. return PTR_ERR(base);
  1263. }
  1264. clk_data = mtk_alloc_clk_data(CLK_MCU_NR_CLK);
  1265. mtk_clk_register_composites(mcu_muxes, ARRAY_SIZE(mcu_muxes), base,
  1266. &mt2712_clk_lock, clk_data);
  1267. r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
  1268. if (r != 0)
  1269. pr_err("%s(): could not register clock provider: %d\n",
  1270. __func__, r);
  1271. return r;
  1272. }
  1273. static const struct of_device_id of_match_clk_mt2712[] = {
  1274. {
  1275. .compatible = "mediatek,mt2712-apmixedsys",
  1276. .data = clk_mt2712_apmixed_probe,
  1277. }, {
  1278. .compatible = "mediatek,mt2712-topckgen",
  1279. .data = clk_mt2712_top_probe,
  1280. }, {
  1281. .compatible = "mediatek,mt2712-infracfg",
  1282. .data = clk_mt2712_infra_probe,
  1283. }, {
  1284. .compatible = "mediatek,mt2712-pericfg",
  1285. .data = clk_mt2712_peri_probe,
  1286. }, {
  1287. .compatible = "mediatek,mt2712-mcucfg",
  1288. .data = clk_mt2712_mcu_probe,
  1289. }, {
  1290. /* sentinel */
  1291. }
  1292. };
  1293. static int clk_mt2712_probe(struct platform_device *pdev)
  1294. {
  1295. int (*clk_probe)(struct platform_device *);
  1296. int r;
  1297. clk_probe = of_device_get_match_data(&pdev->dev);
  1298. if (!clk_probe)
  1299. return -EINVAL;
  1300. r = clk_probe(pdev);
  1301. if (r != 0)
  1302. dev_err(&pdev->dev,
  1303. "could not register clock provider: %s: %d\n",
  1304. pdev->name, r);
  1305. return r;
  1306. }
  1307. static struct platform_driver clk_mt2712_drv = {
  1308. .probe = clk_mt2712_probe,
  1309. .driver = {
  1310. .name = "clk-mt2712",
  1311. .of_match_table = of_match_clk_mt2712,
  1312. },
  1313. };
  1314. static int __init clk_mt2712_init(void)
  1315. {
  1316. return platform_driver_register(&clk_mt2712_drv);
  1317. }
  1318. arch_initcall(clk_mt2712_init);