clk-mt2712.c 37 KB

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