dispcc-sm8450.c 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022, Linaro Ltd.
  5. */
  6. #include <linux/clk-provider.h>
  7. #include <linux/err.h>
  8. #include <linux/kernel.h>
  9. #include <linux/mod_devicetable.h>
  10. #include <linux/module.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/regmap.h>
  13. #include <linux/pm_runtime.h>
  14. #include <dt-bindings/clock/qcom,sm8450-dispcc.h>
  15. #include "common.h"
  16. #include "clk-alpha-pll.h"
  17. #include "clk-branch.h"
  18. #include "clk-pll.h"
  19. #include "clk-rcg.h"
  20. #include "clk-regmap.h"
  21. #include "clk-regmap-divider.h"
  22. #include "clk-regmap-mux.h"
  23. #include "reset.h"
  24. #include "gdsc.h"
  25. /* Need to match the order of clocks in DT binding */
  26. enum {
  27. DT_BI_TCXO,
  28. DT_BI_TCXO_AO,
  29. DT_AHB_CLK,
  30. DT_SLEEP_CLK,
  31. DT_DSI0_PHY_PLL_OUT_BYTECLK,
  32. DT_DSI0_PHY_PLL_OUT_DSICLK,
  33. DT_DSI1_PHY_PLL_OUT_BYTECLK,
  34. DT_DSI1_PHY_PLL_OUT_DSICLK,
  35. DT_DP0_PHY_PLL_LINK_CLK,
  36. DT_DP0_PHY_PLL_VCO_DIV_CLK,
  37. DT_DP1_PHY_PLL_LINK_CLK,
  38. DT_DP1_PHY_PLL_VCO_DIV_CLK,
  39. DT_DP2_PHY_PLL_LINK_CLK,
  40. DT_DP2_PHY_PLL_VCO_DIV_CLK,
  41. DT_DP3_PHY_PLL_LINK_CLK,
  42. DT_DP3_PHY_PLL_VCO_DIV_CLK,
  43. };
  44. #define DISP_CC_MISC_CMD 0xF000
  45. enum {
  46. P_BI_TCXO,
  47. P_DISP_CC_PLL0_OUT_MAIN,
  48. P_DISP_CC_PLL1_OUT_EVEN,
  49. P_DISP_CC_PLL1_OUT_MAIN,
  50. P_DP0_PHY_PLL_LINK_CLK,
  51. P_DP0_PHY_PLL_VCO_DIV_CLK,
  52. P_DP1_PHY_PLL_LINK_CLK,
  53. P_DP1_PHY_PLL_VCO_DIV_CLK,
  54. P_DP2_PHY_PLL_LINK_CLK,
  55. P_DP2_PHY_PLL_VCO_DIV_CLK,
  56. P_DP3_PHY_PLL_LINK_CLK,
  57. P_DP3_PHY_PLL_VCO_DIV_CLK,
  58. P_DSI0_PHY_PLL_OUT_BYTECLK,
  59. P_DSI0_PHY_PLL_OUT_DSICLK,
  60. P_DSI1_PHY_PLL_OUT_BYTECLK,
  61. P_DSI1_PHY_PLL_OUT_DSICLK,
  62. P_SLEEP_CLK,
  63. };
  64. static const struct pll_vco lucid_evo_vco[] = {
  65. { 249600000, 2000000000, 0 },
  66. };
  67. static const struct alpha_pll_config disp_cc_pll0_config = {
  68. .l = 0xD,
  69. .alpha = 0x6492,
  70. .config_ctl_val = 0x20485699,
  71. .config_ctl_hi_val = 0x00182261,
  72. .config_ctl_hi1_val = 0x32AA299C,
  73. .user_ctl_val = 0x00000000,
  74. .user_ctl_hi_val = 0x00000805,
  75. };
  76. static const struct alpha_pll_config sm8475_disp_cc_pll0_config = {
  77. .l = 0xd,
  78. .alpha = 0x6492,
  79. .config_ctl_val = 0x20485699,
  80. .config_ctl_hi_val = 0x00182261,
  81. .config_ctl_hi1_val = 0x82aa299c,
  82. .test_ctl_val = 0x00000000,
  83. .test_ctl_hi_val = 0x00000003,
  84. .test_ctl_hi1_val = 0x00009000,
  85. .test_ctl_hi2_val = 0x00000034,
  86. .user_ctl_val = 0x00000000,
  87. .user_ctl_hi_val = 0x00000005,
  88. };
  89. static struct clk_init_data sm8475_disp_cc_pll0_init = {
  90. .name = "disp_cc_pll0",
  91. .parent_data = &(const struct clk_parent_data) {
  92. .index = DT_BI_TCXO,
  93. },
  94. .num_parents = 1,
  95. .ops = &clk_alpha_pll_reset_lucid_ole_ops,
  96. };
  97. static struct clk_alpha_pll disp_cc_pll0 = {
  98. .offset = 0x0,
  99. .vco_table = lucid_evo_vco,
  100. .num_vco = ARRAY_SIZE(lucid_evo_vco),
  101. .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_EVO],
  102. .clkr = {
  103. .hw.init = &(struct clk_init_data) {
  104. .name = "disp_cc_pll0",
  105. .parent_data = &(const struct clk_parent_data) {
  106. .index = DT_BI_TCXO,
  107. },
  108. .num_parents = 1,
  109. .ops = &clk_alpha_pll_reset_lucid_evo_ops,
  110. },
  111. },
  112. };
  113. static const struct alpha_pll_config disp_cc_pll1_config = {
  114. .l = 0x1F,
  115. .alpha = 0x4000,
  116. .config_ctl_val = 0x20485699,
  117. .config_ctl_hi_val = 0x00182261,
  118. .config_ctl_hi1_val = 0x32AA299C,
  119. .user_ctl_val = 0x00000000,
  120. .user_ctl_hi_val = 0x00000805,
  121. };
  122. static const struct alpha_pll_config sm8475_disp_cc_pll1_config = {
  123. .l = 0x1f,
  124. .alpha = 0x4000,
  125. .config_ctl_val = 0x20485699,
  126. .config_ctl_hi_val = 0x00182261,
  127. .config_ctl_hi1_val = 0x82aa299c,
  128. .test_ctl_val = 0x00000000,
  129. .test_ctl_hi_val = 0x00000003,
  130. .test_ctl_hi1_val = 0x00009000,
  131. .test_ctl_hi2_val = 0x00000034,
  132. .user_ctl_val = 0x00000000,
  133. .user_ctl_hi_val = 0x00000005,
  134. };
  135. static struct clk_init_data sm8475_disp_cc_pll1_init = {
  136. .name = "disp_cc_pll1",
  137. .parent_data = &(const struct clk_parent_data) {
  138. .index = DT_BI_TCXO,
  139. },
  140. .num_parents = 1,
  141. .ops = &clk_alpha_pll_reset_lucid_ole_ops,
  142. };
  143. static struct clk_alpha_pll disp_cc_pll1 = {
  144. .offset = 0x1000,
  145. .vco_table = lucid_evo_vco,
  146. .num_vco = ARRAY_SIZE(lucid_evo_vco),
  147. .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_EVO],
  148. .clkr = {
  149. .hw.init = &(struct clk_init_data) {
  150. .name = "disp_cc_pll1",
  151. .parent_data = &(const struct clk_parent_data) {
  152. .index = DT_BI_TCXO,
  153. },
  154. .num_parents = 1,
  155. .ops = &clk_alpha_pll_reset_lucid_evo_ops,
  156. },
  157. },
  158. };
  159. static const struct parent_map disp_cc_parent_map_0[] = {
  160. { P_BI_TCXO, 0 },
  161. { P_DP0_PHY_PLL_LINK_CLK, 1 },
  162. { P_DP0_PHY_PLL_VCO_DIV_CLK, 2 },
  163. { P_DP3_PHY_PLL_VCO_DIV_CLK, 3 },
  164. { P_DP1_PHY_PLL_VCO_DIV_CLK, 4 },
  165. { P_DP2_PHY_PLL_VCO_DIV_CLK, 6 },
  166. };
  167. static const struct clk_parent_data disp_cc_parent_data_0[] = {
  168. { .index = DT_BI_TCXO },
  169. { .index = DT_DP0_PHY_PLL_LINK_CLK },
  170. { .index = DT_DP0_PHY_PLL_VCO_DIV_CLK },
  171. { .index = DT_DP3_PHY_PLL_VCO_DIV_CLK },
  172. { .index = DT_DP1_PHY_PLL_VCO_DIV_CLK },
  173. { .index = DT_DP2_PHY_PLL_VCO_DIV_CLK },
  174. };
  175. static const struct parent_map disp_cc_parent_map_1[] = {
  176. { P_BI_TCXO, 0 },
  177. };
  178. static const struct clk_parent_data disp_cc_parent_data_1[] = {
  179. { .index = DT_BI_TCXO },
  180. };
  181. static const struct clk_parent_data disp_cc_parent_data_1_ao[] = {
  182. { .index = DT_BI_TCXO_AO },
  183. };
  184. static const struct parent_map disp_cc_parent_map_2[] = {
  185. { P_BI_TCXO, 0 },
  186. { P_DSI0_PHY_PLL_OUT_DSICLK, 1 },
  187. { P_DSI0_PHY_PLL_OUT_BYTECLK, 2 },
  188. { P_DSI1_PHY_PLL_OUT_DSICLK, 3 },
  189. { P_DSI1_PHY_PLL_OUT_BYTECLK, 4 },
  190. };
  191. static const struct clk_parent_data disp_cc_parent_data_2[] = {
  192. { .index = DT_BI_TCXO },
  193. { .index = DT_DSI0_PHY_PLL_OUT_DSICLK },
  194. { .index = DT_DSI0_PHY_PLL_OUT_BYTECLK },
  195. { .index = DT_DSI1_PHY_PLL_OUT_DSICLK },
  196. { .index = DT_DSI1_PHY_PLL_OUT_BYTECLK },
  197. };
  198. static const struct parent_map disp_cc_parent_map_3[] = {
  199. { P_BI_TCXO, 0 },
  200. { P_DP0_PHY_PLL_LINK_CLK, 1 },
  201. { P_DP1_PHY_PLL_LINK_CLK, 2 },
  202. { P_DP2_PHY_PLL_LINK_CLK, 3 },
  203. { P_DP3_PHY_PLL_LINK_CLK, 4 },
  204. };
  205. static const struct clk_parent_data disp_cc_parent_data_3[] = {
  206. { .index = DT_BI_TCXO },
  207. { .index = DT_DP0_PHY_PLL_LINK_CLK },
  208. { .index = DT_DP1_PHY_PLL_LINK_CLK },
  209. { .index = DT_DP2_PHY_PLL_LINK_CLK },
  210. { .index = DT_DP3_PHY_PLL_LINK_CLK },
  211. };
  212. static const struct parent_map disp_cc_parent_map_4[] = {
  213. { P_BI_TCXO, 0 },
  214. { P_DSI0_PHY_PLL_OUT_BYTECLK, 2 },
  215. { P_DSI1_PHY_PLL_OUT_BYTECLK, 4 },
  216. };
  217. static const struct clk_parent_data disp_cc_parent_data_4[] = {
  218. { .index = DT_BI_TCXO },
  219. { .index = DT_DSI0_PHY_PLL_OUT_BYTECLK },
  220. { .index = DT_DSI1_PHY_PLL_OUT_BYTECLK },
  221. };
  222. static const struct parent_map disp_cc_parent_map_5[] = {
  223. { P_BI_TCXO, 0 },
  224. { P_DISP_CC_PLL0_OUT_MAIN, 1 },
  225. { P_DISP_CC_PLL1_OUT_MAIN, 4 },
  226. { P_DISP_CC_PLL1_OUT_EVEN, 6 },
  227. };
  228. static const struct clk_parent_data disp_cc_parent_data_5[] = {
  229. { .index = DT_BI_TCXO },
  230. { .hw = &disp_cc_pll0.clkr.hw },
  231. { .hw = &disp_cc_pll1.clkr.hw },
  232. { .hw = &disp_cc_pll1.clkr.hw },
  233. };
  234. static const struct parent_map disp_cc_parent_map_6[] = {
  235. { P_BI_TCXO, 0 },
  236. { P_DISP_CC_PLL1_OUT_MAIN, 4 },
  237. { P_DISP_CC_PLL1_OUT_EVEN, 6 },
  238. };
  239. static const struct clk_parent_data disp_cc_parent_data_6[] = {
  240. { .index = DT_BI_TCXO },
  241. { .hw = &disp_cc_pll1.clkr.hw },
  242. { .hw = &disp_cc_pll1.clkr.hw },
  243. };
  244. static const struct parent_map disp_cc_parent_map_7[] = {
  245. { P_SLEEP_CLK, 0 },
  246. };
  247. static const struct clk_parent_data disp_cc_parent_data_7[] = {
  248. { .index = DT_SLEEP_CLK },
  249. };
  250. static const struct freq_tbl ftbl_disp_cc_mdss_ahb_clk_src[] = {
  251. F(19200000, P_BI_TCXO, 1, 0, 0),
  252. F(37500000, P_DISP_CC_PLL1_OUT_MAIN, 16, 0, 0),
  253. F(75000000, P_DISP_CC_PLL1_OUT_MAIN, 8, 0, 0),
  254. { }
  255. };
  256. static struct clk_rcg2 disp_cc_mdss_ahb_clk_src = {
  257. .cmd_rcgr = 0x8324,
  258. .mnd_width = 0,
  259. .hid_width = 5,
  260. .parent_map = disp_cc_parent_map_6,
  261. .freq_tbl = ftbl_disp_cc_mdss_ahb_clk_src,
  262. .clkr.hw.init = &(struct clk_init_data) {
  263. .name = "disp_cc_mdss_ahb_clk_src",
  264. .parent_data = disp_cc_parent_data_6,
  265. .num_parents = ARRAY_SIZE(disp_cc_parent_data_6),
  266. .flags = CLK_SET_RATE_PARENT,
  267. .ops = &clk_rcg2_shared_ops,
  268. },
  269. };
  270. static const struct freq_tbl ftbl_disp_cc_mdss_byte0_clk_src[] = {
  271. F(19200000, P_BI_TCXO, 1, 0, 0),
  272. { }
  273. };
  274. static struct clk_rcg2 disp_cc_mdss_byte0_clk_src = {
  275. .cmd_rcgr = 0x8134,
  276. .mnd_width = 0,
  277. .hid_width = 5,
  278. .parent_map = disp_cc_parent_map_2,
  279. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  280. .clkr.hw.init = &(struct clk_init_data) {
  281. .name = "disp_cc_mdss_byte0_clk_src",
  282. .parent_data = disp_cc_parent_data_2,
  283. .num_parents = ARRAY_SIZE(disp_cc_parent_data_2),
  284. .flags = CLK_SET_RATE_PARENT,
  285. .ops = &clk_byte2_ops,
  286. },
  287. };
  288. static struct clk_rcg2 disp_cc_mdss_byte1_clk_src = {
  289. .cmd_rcgr = 0x8150,
  290. .mnd_width = 0,
  291. .hid_width = 5,
  292. .parent_map = disp_cc_parent_map_2,
  293. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  294. .clkr.hw.init = &(struct clk_init_data) {
  295. .name = "disp_cc_mdss_byte1_clk_src",
  296. .parent_data = disp_cc_parent_data_2,
  297. .num_parents = ARRAY_SIZE(disp_cc_parent_data_2),
  298. .flags = CLK_SET_RATE_PARENT,
  299. .ops = &clk_byte2_ops,
  300. },
  301. };
  302. static struct clk_rcg2 disp_cc_mdss_dptx0_aux_clk_src = {
  303. .cmd_rcgr = 0x81ec,
  304. .mnd_width = 0,
  305. .hid_width = 5,
  306. .parent_map = disp_cc_parent_map_1,
  307. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  308. .clkr.hw.init = &(struct clk_init_data) {
  309. .name = "disp_cc_mdss_dptx0_aux_clk_src",
  310. .parent_data = disp_cc_parent_data_1,
  311. .num_parents = ARRAY_SIZE(disp_cc_parent_data_1),
  312. .flags = CLK_SET_RATE_PARENT,
  313. .ops = &clk_rcg2_ops,
  314. },
  315. };
  316. static struct clk_rcg2 disp_cc_mdss_dptx0_link_clk_src = {
  317. .cmd_rcgr = 0x819c,
  318. .mnd_width = 0,
  319. .hid_width = 5,
  320. .parent_map = disp_cc_parent_map_3,
  321. .clkr.hw.init = &(struct clk_init_data) {
  322. .name = "disp_cc_mdss_dptx0_link_clk_src",
  323. .parent_data = disp_cc_parent_data_3,
  324. .num_parents = ARRAY_SIZE(disp_cc_parent_data_3),
  325. .flags = CLK_SET_RATE_PARENT,
  326. .ops = &clk_byte2_ops,
  327. },
  328. };
  329. static struct clk_rcg2 disp_cc_mdss_dptx0_pixel0_clk_src = {
  330. .cmd_rcgr = 0x81bc,
  331. .mnd_width = 16,
  332. .hid_width = 5,
  333. .parent_map = disp_cc_parent_map_0,
  334. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  335. .clkr.hw.init = &(struct clk_init_data) {
  336. .name = "disp_cc_mdss_dptx0_pixel0_clk_src",
  337. .parent_data = disp_cc_parent_data_0,
  338. .num_parents = ARRAY_SIZE(disp_cc_parent_data_0),
  339. .flags = CLK_SET_RATE_PARENT,
  340. .ops = &clk_dp_ops,
  341. },
  342. };
  343. static struct clk_rcg2 disp_cc_mdss_dptx0_pixel1_clk_src = {
  344. .cmd_rcgr = 0x81d4,
  345. .mnd_width = 16,
  346. .hid_width = 5,
  347. .parent_map = disp_cc_parent_map_0,
  348. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  349. .clkr.hw.init = &(struct clk_init_data) {
  350. .name = "disp_cc_mdss_dptx0_pixel1_clk_src",
  351. .parent_data = disp_cc_parent_data_0,
  352. .num_parents = ARRAY_SIZE(disp_cc_parent_data_0),
  353. .flags = CLK_SET_RATE_PARENT,
  354. .ops = &clk_dp_ops,
  355. },
  356. };
  357. static struct clk_rcg2 disp_cc_mdss_dptx1_aux_clk_src = {
  358. .cmd_rcgr = 0x8254,
  359. .mnd_width = 0,
  360. .hid_width = 5,
  361. .parent_map = disp_cc_parent_map_1,
  362. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  363. .clkr.hw.init = &(struct clk_init_data) {
  364. .name = "disp_cc_mdss_dptx1_aux_clk_src",
  365. .parent_data = disp_cc_parent_data_1,
  366. .num_parents = ARRAY_SIZE(disp_cc_parent_data_1),
  367. .flags = CLK_SET_RATE_PARENT,
  368. .ops = &clk_dp_ops,
  369. },
  370. };
  371. static struct clk_rcg2 disp_cc_mdss_dptx1_link_clk_src = {
  372. .cmd_rcgr = 0x8234,
  373. .mnd_width = 0,
  374. .hid_width = 5,
  375. .parent_map = disp_cc_parent_map_3,
  376. .clkr.hw.init = &(struct clk_init_data) {
  377. .name = "disp_cc_mdss_dptx1_link_clk_src",
  378. .parent_data = disp_cc_parent_data_3,
  379. .num_parents = ARRAY_SIZE(disp_cc_parent_data_3),
  380. .flags = CLK_SET_RATE_PARENT,
  381. .ops = &clk_byte2_ops,
  382. },
  383. };
  384. static struct clk_rcg2 disp_cc_mdss_dptx1_pixel0_clk_src = {
  385. .cmd_rcgr = 0x8204,
  386. .mnd_width = 16,
  387. .hid_width = 5,
  388. .parent_map = disp_cc_parent_map_0,
  389. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  390. .clkr.hw.init = &(struct clk_init_data) {
  391. .name = "disp_cc_mdss_dptx1_pixel0_clk_src",
  392. .parent_data = disp_cc_parent_data_0,
  393. .num_parents = ARRAY_SIZE(disp_cc_parent_data_0),
  394. .flags = CLK_SET_RATE_PARENT,
  395. .ops = &clk_dp_ops,
  396. },
  397. };
  398. static struct clk_rcg2 disp_cc_mdss_dptx1_pixel1_clk_src = {
  399. .cmd_rcgr = 0x821c,
  400. .mnd_width = 16,
  401. .hid_width = 5,
  402. .parent_map = disp_cc_parent_map_0,
  403. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  404. .clkr.hw.init = &(struct clk_init_data) {
  405. .name = "disp_cc_mdss_dptx1_pixel1_clk_src",
  406. .parent_data = disp_cc_parent_data_0,
  407. .num_parents = ARRAY_SIZE(disp_cc_parent_data_0),
  408. .flags = CLK_SET_RATE_PARENT,
  409. .ops = &clk_dp_ops,
  410. },
  411. };
  412. static struct clk_rcg2 disp_cc_mdss_dptx2_aux_clk_src = {
  413. .cmd_rcgr = 0x82bc,
  414. .mnd_width = 0,
  415. .hid_width = 5,
  416. .parent_map = disp_cc_parent_map_1,
  417. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  418. .clkr.hw.init = &(struct clk_init_data) {
  419. .name = "disp_cc_mdss_dptx2_aux_clk_src",
  420. .parent_data = disp_cc_parent_data_1,
  421. .num_parents = ARRAY_SIZE(disp_cc_parent_data_1),
  422. .flags = CLK_SET_RATE_PARENT,
  423. .ops = &clk_rcg2_ops,
  424. },
  425. };
  426. static struct clk_rcg2 disp_cc_mdss_dptx2_link_clk_src = {
  427. .cmd_rcgr = 0x826c,
  428. .mnd_width = 0,
  429. .hid_width = 5,
  430. .parent_map = disp_cc_parent_map_3,
  431. .clkr.hw.init = &(struct clk_init_data) {
  432. .name = "disp_cc_mdss_dptx2_link_clk_src",
  433. .parent_data = disp_cc_parent_data_3,
  434. .num_parents = ARRAY_SIZE(disp_cc_parent_data_3),
  435. .flags = CLK_SET_RATE_PARENT,
  436. .ops = &clk_byte2_ops,
  437. },
  438. };
  439. static struct clk_rcg2 disp_cc_mdss_dptx2_pixel0_clk_src = {
  440. .cmd_rcgr = 0x828c,
  441. .mnd_width = 16,
  442. .hid_width = 5,
  443. .parent_map = disp_cc_parent_map_0,
  444. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  445. .clkr.hw.init = &(struct clk_init_data) {
  446. .name = "disp_cc_mdss_dptx2_pixel0_clk_src",
  447. .parent_data = disp_cc_parent_data_0,
  448. .num_parents = ARRAY_SIZE(disp_cc_parent_data_0),
  449. .flags = CLK_SET_RATE_PARENT,
  450. .ops = &clk_dp_ops,
  451. },
  452. };
  453. static struct clk_rcg2 disp_cc_mdss_dptx2_pixel1_clk_src = {
  454. .cmd_rcgr = 0x82a4,
  455. .mnd_width = 16,
  456. .hid_width = 5,
  457. .parent_map = disp_cc_parent_map_0,
  458. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  459. .clkr.hw.init = &(struct clk_init_data) {
  460. .name = "disp_cc_mdss_dptx2_pixel1_clk_src",
  461. .parent_data = disp_cc_parent_data_0,
  462. .num_parents = ARRAY_SIZE(disp_cc_parent_data_0),
  463. .flags = CLK_SET_RATE_PARENT,
  464. .ops = &clk_dp_ops,
  465. },
  466. };
  467. static struct clk_rcg2 disp_cc_mdss_dptx3_aux_clk_src = {
  468. .cmd_rcgr = 0x8308,
  469. .mnd_width = 0,
  470. .hid_width = 5,
  471. .parent_map = disp_cc_parent_map_1,
  472. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  473. .clkr.hw.init = &(struct clk_init_data) {
  474. .name = "disp_cc_mdss_dptx3_aux_clk_src",
  475. .parent_data = disp_cc_parent_data_1,
  476. .num_parents = ARRAY_SIZE(disp_cc_parent_data_1),
  477. .flags = CLK_SET_RATE_PARENT,
  478. .ops = &clk_rcg2_ops,
  479. },
  480. };
  481. static struct clk_rcg2 disp_cc_mdss_dptx3_link_clk_src = {
  482. .cmd_rcgr = 0x82ec,
  483. .mnd_width = 0,
  484. .hid_width = 5,
  485. .parent_map = disp_cc_parent_map_3,
  486. .clkr.hw.init = &(struct clk_init_data) {
  487. .name = "disp_cc_mdss_dptx3_link_clk_src",
  488. .parent_data = disp_cc_parent_data_3,
  489. .num_parents = ARRAY_SIZE(disp_cc_parent_data_3),
  490. .flags = CLK_SET_RATE_PARENT,
  491. .ops = &clk_byte2_ops,
  492. },
  493. };
  494. static struct clk_rcg2 disp_cc_mdss_dptx3_pixel0_clk_src = {
  495. .cmd_rcgr = 0x82d4,
  496. .mnd_width = 16,
  497. .hid_width = 5,
  498. .parent_map = disp_cc_parent_map_0,
  499. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  500. .clkr.hw.init = &(struct clk_init_data) {
  501. .name = "disp_cc_mdss_dptx3_pixel0_clk_src",
  502. .parent_data = disp_cc_parent_data_0,
  503. .num_parents = ARRAY_SIZE(disp_cc_parent_data_0),
  504. .flags = CLK_SET_RATE_PARENT,
  505. .ops = &clk_dp_ops,
  506. },
  507. };
  508. static struct clk_rcg2 disp_cc_mdss_esc0_clk_src = {
  509. .cmd_rcgr = 0x816c,
  510. .mnd_width = 0,
  511. .hid_width = 5,
  512. .parent_map = disp_cc_parent_map_4,
  513. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  514. .clkr.hw.init = &(struct clk_init_data) {
  515. .name = "disp_cc_mdss_esc0_clk_src",
  516. .parent_data = disp_cc_parent_data_4,
  517. .num_parents = ARRAY_SIZE(disp_cc_parent_data_4),
  518. .flags = CLK_SET_RATE_PARENT,
  519. .ops = &clk_rcg2_ops,
  520. },
  521. };
  522. static struct clk_rcg2 disp_cc_mdss_esc1_clk_src = {
  523. .cmd_rcgr = 0x8184,
  524. .mnd_width = 0,
  525. .hid_width = 5,
  526. .parent_map = disp_cc_parent_map_4,
  527. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  528. .clkr.hw.init = &(struct clk_init_data) {
  529. .name = "disp_cc_mdss_esc1_clk_src",
  530. .parent_data = disp_cc_parent_data_4,
  531. .num_parents = ARRAY_SIZE(disp_cc_parent_data_4),
  532. .flags = CLK_SET_RATE_PARENT,
  533. .ops = &clk_rcg2_ops,
  534. },
  535. };
  536. static const struct freq_tbl ftbl_disp_cc_mdss_mdp_clk_src[] = {
  537. F(19200000, P_BI_TCXO, 1, 0, 0),
  538. F(85714286, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  539. F(100000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  540. F(150000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  541. F(172000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  542. F(200000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  543. F(325000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  544. F(375000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  545. F(500000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0),
  546. { }
  547. };
  548. static struct clk_rcg2 disp_cc_mdss_mdp_clk_src = {
  549. .cmd_rcgr = 0x80ec,
  550. .mnd_width = 0,
  551. .hid_width = 5,
  552. .parent_map = disp_cc_parent_map_5,
  553. .freq_tbl = ftbl_disp_cc_mdss_mdp_clk_src,
  554. .clkr.hw.init = &(struct clk_init_data) {
  555. .name = "disp_cc_mdss_mdp_clk_src",
  556. .parent_data = disp_cc_parent_data_5,
  557. .num_parents = ARRAY_SIZE(disp_cc_parent_data_5),
  558. .flags = CLK_SET_RATE_PARENT,
  559. .ops = &clk_rcg2_shared_ops,
  560. },
  561. };
  562. static struct clk_rcg2 disp_cc_mdss_pclk0_clk_src = {
  563. .cmd_rcgr = 0x80bc,
  564. .mnd_width = 8,
  565. .hid_width = 5,
  566. .parent_map = disp_cc_parent_map_2,
  567. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  568. .clkr.hw.init = &(struct clk_init_data) {
  569. .name = "disp_cc_mdss_pclk0_clk_src",
  570. .parent_data = disp_cc_parent_data_2,
  571. .num_parents = ARRAY_SIZE(disp_cc_parent_data_2),
  572. .flags = CLK_SET_RATE_PARENT,
  573. .ops = &clk_pixel_ops,
  574. },
  575. };
  576. static struct clk_rcg2 disp_cc_mdss_pclk1_clk_src = {
  577. .cmd_rcgr = 0x80d4,
  578. .mnd_width = 8,
  579. .hid_width = 5,
  580. .parent_map = disp_cc_parent_map_2,
  581. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  582. .clkr.hw.init = &(struct clk_init_data) {
  583. .name = "disp_cc_mdss_pclk1_clk_src",
  584. .parent_data = disp_cc_parent_data_2,
  585. .num_parents = ARRAY_SIZE(disp_cc_parent_data_2),
  586. .flags = CLK_SET_RATE_PARENT,
  587. .ops = &clk_pixel_ops,
  588. },
  589. };
  590. static const struct freq_tbl ftbl_disp_cc_mdss_rot_clk_src[] = {
  591. F(19200000, P_BI_TCXO, 1, 0, 0),
  592. F(150000000, P_DISP_CC_PLL1_OUT_MAIN, 4, 0, 0),
  593. F(200000000, P_DISP_CC_PLL1_OUT_MAIN, 3, 0, 0),
  594. F(300000000, P_DISP_CC_PLL1_OUT_MAIN, 2, 0, 0),
  595. { }
  596. };
  597. static struct clk_rcg2 disp_cc_mdss_rot_clk_src = {
  598. .cmd_rcgr = 0x8104,
  599. .mnd_width = 0,
  600. .hid_width = 5,
  601. .parent_map = disp_cc_parent_map_5,
  602. .freq_tbl = ftbl_disp_cc_mdss_rot_clk_src,
  603. .clkr.hw.init = &(struct clk_init_data) {
  604. .name = "disp_cc_mdss_rot_clk_src",
  605. .parent_data = disp_cc_parent_data_5,
  606. .num_parents = ARRAY_SIZE(disp_cc_parent_data_5),
  607. .flags = CLK_SET_RATE_PARENT,
  608. .ops = &clk_rcg2_shared_ops,
  609. },
  610. };
  611. static struct clk_rcg2 disp_cc_mdss_vsync_clk_src = {
  612. .cmd_rcgr = 0x811c,
  613. .mnd_width = 0,
  614. .hid_width = 5,
  615. .parent_map = disp_cc_parent_map_1,
  616. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  617. .clkr.hw.init = &(struct clk_init_data) {
  618. .name = "disp_cc_mdss_vsync_clk_src",
  619. .parent_data = disp_cc_parent_data_1,
  620. .num_parents = ARRAY_SIZE(disp_cc_parent_data_1),
  621. .flags = CLK_SET_RATE_PARENT,
  622. .ops = &clk_rcg2_ops,
  623. },
  624. };
  625. static const struct freq_tbl ftbl_disp_cc_sleep_clk_src[] = {
  626. F(32000, P_SLEEP_CLK, 1, 0, 0),
  627. { }
  628. };
  629. static struct clk_rcg2 disp_cc_sleep_clk_src = {
  630. .cmd_rcgr = 0xe060,
  631. .mnd_width = 0,
  632. .hid_width = 5,
  633. .parent_map = disp_cc_parent_map_7,
  634. .freq_tbl = ftbl_disp_cc_sleep_clk_src,
  635. .clkr.hw.init = &(struct clk_init_data) {
  636. .name = "disp_cc_sleep_clk_src",
  637. .parent_data = disp_cc_parent_data_7,
  638. .num_parents = ARRAY_SIZE(disp_cc_parent_data_7),
  639. .flags = CLK_SET_RATE_PARENT,
  640. .ops = &clk_rcg2_ops,
  641. },
  642. };
  643. static struct clk_rcg2 disp_cc_xo_clk_src = {
  644. .cmd_rcgr = 0xe044,
  645. .mnd_width = 0,
  646. .hid_width = 5,
  647. .parent_map = disp_cc_parent_map_1,
  648. .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src,
  649. .clkr.hw.init = &(struct clk_init_data) {
  650. .name = "disp_cc_xo_clk_src",
  651. .parent_data = disp_cc_parent_data_1_ao,
  652. .num_parents = ARRAY_SIZE(disp_cc_parent_data_1_ao),
  653. .flags = CLK_SET_RATE_PARENT,
  654. .ops = &clk_rcg2_ops,
  655. },
  656. };
  657. static struct clk_regmap_div disp_cc_mdss_byte0_div_clk_src = {
  658. .reg = 0x814c,
  659. .shift = 0,
  660. .width = 4,
  661. .clkr.hw.init = &(struct clk_init_data) {
  662. .name = "disp_cc_mdss_byte0_div_clk_src",
  663. .parent_hws = (const struct clk_hw*[]) {
  664. &disp_cc_mdss_byte0_clk_src.clkr.hw,
  665. },
  666. .num_parents = 1,
  667. .ops = &clk_regmap_div_ops,
  668. },
  669. };
  670. static struct clk_regmap_div disp_cc_mdss_byte1_div_clk_src = {
  671. .reg = 0x8168,
  672. .shift = 0,
  673. .width = 4,
  674. .clkr.hw.init = &(struct clk_init_data) {
  675. .name = "disp_cc_mdss_byte1_div_clk_src",
  676. .parent_hws = (const struct clk_hw*[]) {
  677. &disp_cc_mdss_byte1_clk_src.clkr.hw,
  678. },
  679. .num_parents = 1,
  680. .ops = &clk_regmap_div_ops,
  681. },
  682. };
  683. static struct clk_regmap_div disp_cc_mdss_dptx0_link_div_clk_src = {
  684. .reg = 0x81b4,
  685. .shift = 0,
  686. .width = 4,
  687. .clkr.hw.init = &(struct clk_init_data) {
  688. .name = "disp_cc_mdss_dptx0_link_div_clk_src",
  689. .parent_hws = (const struct clk_hw*[]) {
  690. &disp_cc_mdss_dptx0_link_clk_src.clkr.hw,
  691. },
  692. .num_parents = 1,
  693. .flags = CLK_SET_RATE_PARENT,
  694. .ops = &clk_regmap_div_ro_ops,
  695. },
  696. };
  697. static struct clk_regmap_div disp_cc_mdss_dptx1_link_div_clk_src = {
  698. .reg = 0x824c,
  699. .shift = 0,
  700. .width = 4,
  701. .clkr.hw.init = &(struct clk_init_data) {
  702. .name = "disp_cc_mdss_dptx1_link_div_clk_src",
  703. .parent_hws = (const struct clk_hw*[]) {
  704. &disp_cc_mdss_dptx1_link_clk_src.clkr.hw,
  705. },
  706. .num_parents = 1,
  707. .flags = CLK_SET_RATE_PARENT,
  708. .ops = &clk_regmap_div_ro_ops,
  709. },
  710. };
  711. static struct clk_regmap_div disp_cc_mdss_dptx2_link_div_clk_src = {
  712. .reg = 0x8284,
  713. .shift = 0,
  714. .width = 4,
  715. .clkr.hw.init = &(struct clk_init_data) {
  716. .name = "disp_cc_mdss_dptx2_link_div_clk_src",
  717. .parent_hws = (const struct clk_hw*[]) {
  718. &disp_cc_mdss_dptx2_link_clk_src.clkr.hw,
  719. },
  720. .num_parents = 1,
  721. .flags = CLK_SET_RATE_PARENT,
  722. .ops = &clk_regmap_div_ro_ops,
  723. },
  724. };
  725. static struct clk_regmap_div disp_cc_mdss_dptx3_link_div_clk_src = {
  726. .reg = 0x8304,
  727. .shift = 0,
  728. .width = 4,
  729. .clkr.hw.init = &(struct clk_init_data) {
  730. .name = "disp_cc_mdss_dptx3_link_div_clk_src",
  731. .parent_hws = (const struct clk_hw*[]) {
  732. &disp_cc_mdss_dptx3_link_clk_src.clkr.hw,
  733. },
  734. .num_parents = 1,
  735. .flags = CLK_SET_RATE_PARENT,
  736. .ops = &clk_regmap_div_ro_ops,
  737. },
  738. };
  739. static struct clk_branch disp_cc_mdss_ahb1_clk = {
  740. .halt_reg = 0xa020,
  741. .halt_check = BRANCH_HALT,
  742. .clkr = {
  743. .enable_reg = 0xa020,
  744. .enable_mask = BIT(0),
  745. .hw.init = &(struct clk_init_data) {
  746. .name = "disp_cc_mdss_ahb1_clk",
  747. .parent_hws = (const struct clk_hw*[]) {
  748. &disp_cc_mdss_ahb_clk_src.clkr.hw,
  749. },
  750. .num_parents = 1,
  751. .flags = CLK_SET_RATE_PARENT,
  752. .ops = &clk_branch2_ops,
  753. },
  754. },
  755. };
  756. static struct clk_branch disp_cc_mdss_ahb_clk = {
  757. .halt_reg = 0x80a4,
  758. .halt_check = BRANCH_HALT,
  759. .clkr = {
  760. .enable_reg = 0x80a4,
  761. .enable_mask = BIT(0),
  762. .hw.init = &(struct clk_init_data) {
  763. .name = "disp_cc_mdss_ahb_clk",
  764. .parent_hws = (const struct clk_hw*[]) {
  765. &disp_cc_mdss_ahb_clk_src.clkr.hw,
  766. },
  767. .num_parents = 1,
  768. .flags = CLK_SET_RATE_PARENT,
  769. .ops = &clk_branch2_ops,
  770. },
  771. },
  772. };
  773. static struct clk_branch disp_cc_mdss_byte0_clk = {
  774. .halt_reg = 0x8028,
  775. .halt_check = BRANCH_HALT,
  776. .clkr = {
  777. .enable_reg = 0x8028,
  778. .enable_mask = BIT(0),
  779. .hw.init = &(struct clk_init_data) {
  780. .name = "disp_cc_mdss_byte0_clk",
  781. .parent_hws = (const struct clk_hw*[]) {
  782. &disp_cc_mdss_byte0_clk_src.clkr.hw,
  783. },
  784. .num_parents = 1,
  785. .flags = CLK_SET_RATE_PARENT,
  786. .ops = &clk_branch2_ops,
  787. },
  788. },
  789. };
  790. static struct clk_branch disp_cc_mdss_byte0_intf_clk = {
  791. .halt_reg = 0x802c,
  792. .halt_check = BRANCH_HALT,
  793. .clkr = {
  794. .enable_reg = 0x802c,
  795. .enable_mask = BIT(0),
  796. .hw.init = &(struct clk_init_data) {
  797. .name = "disp_cc_mdss_byte0_intf_clk",
  798. .parent_hws = (const struct clk_hw*[]) {
  799. &disp_cc_mdss_byte0_div_clk_src.clkr.hw,
  800. },
  801. .num_parents = 1,
  802. .flags = CLK_SET_RATE_PARENT,
  803. .ops = &clk_branch2_ops,
  804. },
  805. },
  806. };
  807. static struct clk_branch disp_cc_mdss_byte1_clk = {
  808. .halt_reg = 0x8030,
  809. .halt_check = BRANCH_HALT,
  810. .clkr = {
  811. .enable_reg = 0x8030,
  812. .enable_mask = BIT(0),
  813. .hw.init = &(struct clk_init_data) {
  814. .name = "disp_cc_mdss_byte1_clk",
  815. .parent_hws = (const struct clk_hw*[]) {
  816. &disp_cc_mdss_byte1_clk_src.clkr.hw,
  817. },
  818. .num_parents = 1,
  819. .flags = CLK_SET_RATE_PARENT,
  820. .ops = &clk_branch2_ops,
  821. },
  822. },
  823. };
  824. static struct clk_branch disp_cc_mdss_byte1_intf_clk = {
  825. .halt_reg = 0x8034,
  826. .halt_check = BRANCH_HALT,
  827. .clkr = {
  828. .enable_reg = 0x8034,
  829. .enable_mask = BIT(0),
  830. .hw.init = &(struct clk_init_data) {
  831. .name = "disp_cc_mdss_byte1_intf_clk",
  832. .parent_hws = (const struct clk_hw*[]) {
  833. &disp_cc_mdss_byte1_div_clk_src.clkr.hw,
  834. },
  835. .num_parents = 1,
  836. .flags = CLK_SET_RATE_PARENT,
  837. .ops = &clk_branch2_ops,
  838. },
  839. },
  840. };
  841. static struct clk_branch disp_cc_mdss_dptx0_aux_clk = {
  842. .halt_reg = 0x8058,
  843. .halt_check = BRANCH_HALT,
  844. .clkr = {
  845. .enable_reg = 0x8058,
  846. .enable_mask = BIT(0),
  847. .hw.init = &(struct clk_init_data) {
  848. .name = "disp_cc_mdss_dptx0_aux_clk",
  849. .parent_hws = (const struct clk_hw*[]) {
  850. &disp_cc_mdss_dptx0_aux_clk_src.clkr.hw,
  851. },
  852. .num_parents = 1,
  853. .flags = CLK_SET_RATE_PARENT,
  854. .ops = &clk_branch2_ops,
  855. },
  856. },
  857. };
  858. static struct clk_branch disp_cc_mdss_dptx0_crypto_clk = {
  859. .halt_reg = 0x804c,
  860. .halt_check = BRANCH_HALT,
  861. .clkr = {
  862. .enable_reg = 0x804c,
  863. .enable_mask = BIT(0),
  864. .hw.init = &(struct clk_init_data) {
  865. .name = "disp_cc_mdss_dptx0_crypto_clk",
  866. .parent_hws = (const struct clk_hw*[]) {
  867. &disp_cc_mdss_dptx0_link_clk_src.clkr.hw,
  868. },
  869. .num_parents = 1,
  870. .flags = CLK_SET_RATE_PARENT,
  871. .ops = &clk_branch2_ops,
  872. },
  873. },
  874. };
  875. static struct clk_branch disp_cc_mdss_dptx0_link_clk = {
  876. .halt_reg = 0x8040,
  877. .halt_check = BRANCH_HALT,
  878. .clkr = {
  879. .enable_reg = 0x8040,
  880. .enable_mask = BIT(0),
  881. .hw.init = &(struct clk_init_data) {
  882. .name = "disp_cc_mdss_dptx0_link_clk",
  883. .parent_hws = (const struct clk_hw*[]) {
  884. &disp_cc_mdss_dptx0_link_clk_src.clkr.hw,
  885. },
  886. .num_parents = 1,
  887. .flags = CLK_SET_RATE_PARENT,
  888. .ops = &clk_branch2_ops,
  889. },
  890. },
  891. };
  892. static struct clk_branch disp_cc_mdss_dptx0_link_intf_clk = {
  893. .halt_reg = 0x8048,
  894. .halt_check = BRANCH_HALT,
  895. .clkr = {
  896. .enable_reg = 0x8048,
  897. .enable_mask = BIT(0),
  898. .hw.init = &(struct clk_init_data) {
  899. .name = "disp_cc_mdss_dptx0_link_intf_clk",
  900. .parent_hws = (const struct clk_hw*[]) {
  901. &disp_cc_mdss_dptx0_link_div_clk_src.clkr.hw,
  902. },
  903. .num_parents = 1,
  904. .flags = CLK_SET_RATE_PARENT,
  905. .ops = &clk_branch2_ops,
  906. },
  907. },
  908. };
  909. static struct clk_branch disp_cc_mdss_dptx0_pixel0_clk = {
  910. .halt_reg = 0x8050,
  911. .halt_check = BRANCH_HALT,
  912. .clkr = {
  913. .enable_reg = 0x8050,
  914. .enable_mask = BIT(0),
  915. .hw.init = &(struct clk_init_data) {
  916. .name = "disp_cc_mdss_dptx0_pixel0_clk",
  917. .parent_hws = (const struct clk_hw*[]) {
  918. &disp_cc_mdss_dptx0_pixel0_clk_src.clkr.hw,
  919. },
  920. .num_parents = 1,
  921. .flags = CLK_SET_RATE_PARENT,
  922. .ops = &clk_branch2_ops,
  923. },
  924. },
  925. };
  926. static struct clk_branch disp_cc_mdss_dptx0_pixel1_clk = {
  927. .halt_reg = 0x8054,
  928. .halt_check = BRANCH_HALT,
  929. .clkr = {
  930. .enable_reg = 0x8054,
  931. .enable_mask = BIT(0),
  932. .hw.init = &(struct clk_init_data) {
  933. .name = "disp_cc_mdss_dptx0_pixel1_clk",
  934. .parent_hws = (const struct clk_hw*[]) {
  935. &disp_cc_mdss_dptx0_pixel1_clk_src.clkr.hw,
  936. },
  937. .num_parents = 1,
  938. .flags = CLK_SET_RATE_PARENT,
  939. .ops = &clk_branch2_ops,
  940. },
  941. },
  942. };
  943. static struct clk_branch disp_cc_mdss_dptx0_usb_router_link_intf_clk = {
  944. .halt_reg = 0x8044,
  945. .halt_check = BRANCH_HALT,
  946. .clkr = {
  947. .enable_reg = 0x8044,
  948. .enable_mask = BIT(0),
  949. .hw.init = &(struct clk_init_data) {
  950. .name = "disp_cc_mdss_dptx0_usb_router_link_intf_clk",
  951. .parent_hws = (const struct clk_hw*[]) {
  952. &disp_cc_mdss_dptx0_link_div_clk_src.clkr.hw,
  953. },
  954. .num_parents = 1,
  955. .flags = CLK_SET_RATE_PARENT,
  956. .ops = &clk_branch2_ops,
  957. },
  958. },
  959. };
  960. static struct clk_branch disp_cc_mdss_dptx1_aux_clk = {
  961. .halt_reg = 0x8074,
  962. .halt_check = BRANCH_HALT,
  963. .clkr = {
  964. .enable_reg = 0x8074,
  965. .enable_mask = BIT(0),
  966. .hw.init = &(struct clk_init_data) {
  967. .name = "disp_cc_mdss_dptx1_aux_clk",
  968. .parent_hws = (const struct clk_hw*[]) {
  969. &disp_cc_mdss_dptx1_aux_clk_src.clkr.hw,
  970. },
  971. .num_parents = 1,
  972. .flags = CLK_SET_RATE_PARENT,
  973. .ops = &clk_branch2_ops,
  974. },
  975. },
  976. };
  977. static struct clk_branch disp_cc_mdss_dptx1_crypto_clk = {
  978. .halt_reg = 0x8070,
  979. .halt_check = BRANCH_HALT,
  980. .clkr = {
  981. .enable_reg = 0x8070,
  982. .enable_mask = BIT(0),
  983. .hw.init = &(struct clk_init_data) {
  984. .name = "disp_cc_mdss_dptx1_crypto_clk",
  985. .parent_hws = (const struct clk_hw*[]) {
  986. &disp_cc_mdss_dptx1_link_clk_src.clkr.hw,
  987. },
  988. .num_parents = 1,
  989. .flags = CLK_SET_RATE_PARENT,
  990. .ops = &clk_branch2_ops,
  991. },
  992. },
  993. };
  994. static struct clk_branch disp_cc_mdss_dptx1_link_clk = {
  995. .halt_reg = 0x8064,
  996. .halt_check = BRANCH_HALT,
  997. .clkr = {
  998. .enable_reg = 0x8064,
  999. .enable_mask = BIT(0),
  1000. .hw.init = &(struct clk_init_data) {
  1001. .name = "disp_cc_mdss_dptx1_link_clk",
  1002. .parent_hws = (const struct clk_hw*[]) {
  1003. &disp_cc_mdss_dptx1_link_clk_src.clkr.hw,
  1004. },
  1005. .num_parents = 1,
  1006. .flags = CLK_SET_RATE_PARENT,
  1007. .ops = &clk_branch2_ops,
  1008. },
  1009. },
  1010. };
  1011. static struct clk_branch disp_cc_mdss_dptx1_link_intf_clk = {
  1012. .halt_reg = 0x806c,
  1013. .halt_check = BRANCH_HALT,
  1014. .clkr = {
  1015. .enable_reg = 0x806c,
  1016. .enable_mask = BIT(0),
  1017. .hw.init = &(struct clk_init_data) {
  1018. .name = "disp_cc_mdss_dptx1_link_intf_clk",
  1019. .parent_hws = (const struct clk_hw*[]) {
  1020. &disp_cc_mdss_dptx1_link_div_clk_src.clkr.hw,
  1021. },
  1022. .num_parents = 1,
  1023. .flags = CLK_SET_RATE_PARENT,
  1024. .ops = &clk_branch2_ops,
  1025. },
  1026. },
  1027. };
  1028. static struct clk_branch disp_cc_mdss_dptx1_pixel0_clk = {
  1029. .halt_reg = 0x805c,
  1030. .halt_check = BRANCH_HALT,
  1031. .clkr = {
  1032. .enable_reg = 0x805c,
  1033. .enable_mask = BIT(0),
  1034. .hw.init = &(struct clk_init_data) {
  1035. .name = "disp_cc_mdss_dptx1_pixel0_clk",
  1036. .parent_hws = (const struct clk_hw*[]) {
  1037. &disp_cc_mdss_dptx1_pixel0_clk_src.clkr.hw,
  1038. },
  1039. .num_parents = 1,
  1040. .flags = CLK_SET_RATE_PARENT,
  1041. .ops = &clk_branch2_ops,
  1042. },
  1043. },
  1044. };
  1045. static struct clk_branch disp_cc_mdss_dptx1_pixel1_clk = {
  1046. .halt_reg = 0x8060,
  1047. .halt_check = BRANCH_HALT,
  1048. .clkr = {
  1049. .enable_reg = 0x8060,
  1050. .enable_mask = BIT(0),
  1051. .hw.init = &(struct clk_init_data) {
  1052. .name = "disp_cc_mdss_dptx1_pixel1_clk",
  1053. .parent_hws = (const struct clk_hw*[]) {
  1054. &disp_cc_mdss_dptx1_pixel1_clk_src.clkr.hw,
  1055. },
  1056. .num_parents = 1,
  1057. .flags = CLK_SET_RATE_PARENT,
  1058. .ops = &clk_branch2_ops,
  1059. },
  1060. },
  1061. };
  1062. static struct clk_branch disp_cc_mdss_dptx1_usb_router_link_intf_clk = {
  1063. .halt_reg = 0x8068,
  1064. .halt_check = BRANCH_HALT,
  1065. .clkr = {
  1066. .enable_reg = 0x8068,
  1067. .enable_mask = BIT(0),
  1068. .hw.init = &(struct clk_init_data) {
  1069. .name = "disp_cc_mdss_dptx1_usb_router_link_intf_clk",
  1070. .parent_hws = (const struct clk_hw*[]) {
  1071. &disp_cc_mdss_dptx0_link_div_clk_src.clkr.hw,
  1072. },
  1073. .num_parents = 1,
  1074. .flags = CLK_SET_RATE_PARENT,
  1075. .ops = &clk_branch2_ops,
  1076. },
  1077. },
  1078. };
  1079. static struct clk_branch disp_cc_mdss_dptx2_aux_clk = {
  1080. .halt_reg = 0x808c,
  1081. .halt_check = BRANCH_HALT,
  1082. .clkr = {
  1083. .enable_reg = 0x808c,
  1084. .enable_mask = BIT(0),
  1085. .hw.init = &(struct clk_init_data) {
  1086. .name = "disp_cc_mdss_dptx2_aux_clk",
  1087. .parent_hws = (const struct clk_hw*[]) {
  1088. &disp_cc_mdss_dptx2_aux_clk_src.clkr.hw,
  1089. },
  1090. .num_parents = 1,
  1091. .flags = CLK_SET_RATE_PARENT,
  1092. .ops = &clk_branch2_ops,
  1093. },
  1094. },
  1095. };
  1096. static struct clk_branch disp_cc_mdss_dptx2_crypto_clk = {
  1097. .halt_reg = 0x8088,
  1098. .halt_check = BRANCH_HALT,
  1099. .clkr = {
  1100. .enable_reg = 0x8088,
  1101. .enable_mask = BIT(0),
  1102. .hw.init = &(struct clk_init_data) {
  1103. .name = "disp_cc_mdss_dptx2_crypto_clk",
  1104. .parent_hws = (const struct clk_hw*[]) {
  1105. &disp_cc_mdss_dptx2_link_clk_src.clkr.hw,
  1106. },
  1107. .num_parents = 1,
  1108. .flags = CLK_SET_RATE_PARENT,
  1109. .ops = &clk_branch2_ops,
  1110. },
  1111. },
  1112. };
  1113. static struct clk_branch disp_cc_mdss_dptx2_link_clk = {
  1114. .halt_reg = 0x8080,
  1115. .halt_check = BRANCH_HALT,
  1116. .clkr = {
  1117. .enable_reg = 0x8080,
  1118. .enable_mask = BIT(0),
  1119. .hw.init = &(struct clk_init_data) {
  1120. .name = "disp_cc_mdss_dptx2_link_clk",
  1121. .parent_hws = (const struct clk_hw*[]) {
  1122. &disp_cc_mdss_dptx2_link_clk_src.clkr.hw,
  1123. },
  1124. .num_parents = 1,
  1125. .flags = CLK_SET_RATE_PARENT,
  1126. .ops = &clk_branch2_ops,
  1127. },
  1128. },
  1129. };
  1130. static struct clk_branch disp_cc_mdss_dptx2_link_intf_clk = {
  1131. .halt_reg = 0x8084,
  1132. .halt_check = BRANCH_HALT,
  1133. .clkr = {
  1134. .enable_reg = 0x8084,
  1135. .enable_mask = BIT(0),
  1136. .hw.init = &(struct clk_init_data) {
  1137. .name = "disp_cc_mdss_dptx2_link_intf_clk",
  1138. .parent_hws = (const struct clk_hw*[]) {
  1139. &disp_cc_mdss_dptx2_link_div_clk_src.clkr.hw,
  1140. },
  1141. .num_parents = 1,
  1142. .flags = CLK_SET_RATE_PARENT,
  1143. .ops = &clk_branch2_ops,
  1144. },
  1145. },
  1146. };
  1147. static struct clk_branch disp_cc_mdss_dptx2_pixel0_clk = {
  1148. .halt_reg = 0x8078,
  1149. .halt_check = BRANCH_HALT,
  1150. .clkr = {
  1151. .enable_reg = 0x8078,
  1152. .enable_mask = BIT(0),
  1153. .hw.init = &(struct clk_init_data) {
  1154. .name = "disp_cc_mdss_dptx2_pixel0_clk",
  1155. .parent_hws = (const struct clk_hw*[]) {
  1156. &disp_cc_mdss_dptx2_pixel0_clk_src.clkr.hw,
  1157. },
  1158. .num_parents = 1,
  1159. .flags = CLK_SET_RATE_PARENT,
  1160. .ops = &clk_branch2_ops,
  1161. },
  1162. },
  1163. };
  1164. static struct clk_branch disp_cc_mdss_dptx2_pixel1_clk = {
  1165. .halt_reg = 0x807c,
  1166. .halt_check = BRANCH_HALT,
  1167. .clkr = {
  1168. .enable_reg = 0x807c,
  1169. .enable_mask = BIT(0),
  1170. .hw.init = &(struct clk_init_data) {
  1171. .name = "disp_cc_mdss_dptx2_pixel1_clk",
  1172. .parent_hws = (const struct clk_hw*[]) {
  1173. &disp_cc_mdss_dptx2_pixel1_clk_src.clkr.hw,
  1174. },
  1175. .num_parents = 1,
  1176. .flags = CLK_SET_RATE_PARENT,
  1177. .ops = &clk_branch2_ops,
  1178. },
  1179. },
  1180. };
  1181. static struct clk_branch disp_cc_mdss_dptx3_aux_clk = {
  1182. .halt_reg = 0x809c,
  1183. .halt_check = BRANCH_HALT,
  1184. .clkr = {
  1185. .enable_reg = 0x809c,
  1186. .enable_mask = BIT(0),
  1187. .hw.init = &(struct clk_init_data) {
  1188. .name = "disp_cc_mdss_dptx3_aux_clk",
  1189. .parent_hws = (const struct clk_hw*[]) {
  1190. &disp_cc_mdss_dptx3_aux_clk_src.clkr.hw,
  1191. },
  1192. .num_parents = 1,
  1193. .flags = CLK_SET_RATE_PARENT,
  1194. .ops = &clk_branch2_ops,
  1195. },
  1196. },
  1197. };
  1198. static struct clk_branch disp_cc_mdss_dptx3_crypto_clk = {
  1199. .halt_reg = 0x80a0,
  1200. .halt_check = BRANCH_HALT,
  1201. .clkr = {
  1202. .enable_reg = 0x80a0,
  1203. .enable_mask = BIT(0),
  1204. .hw.init = &(struct clk_init_data) {
  1205. .name = "disp_cc_mdss_dptx3_crypto_clk",
  1206. .parent_hws = (const struct clk_hw*[]) {
  1207. &disp_cc_mdss_dptx3_link_clk_src.clkr.hw,
  1208. },
  1209. .num_parents = 1,
  1210. .flags = CLK_SET_RATE_PARENT,
  1211. .ops = &clk_branch2_ops,
  1212. },
  1213. },
  1214. };
  1215. static struct clk_branch disp_cc_mdss_dptx3_link_clk = {
  1216. .halt_reg = 0x8094,
  1217. .halt_check = BRANCH_HALT,
  1218. .clkr = {
  1219. .enable_reg = 0x8094,
  1220. .enable_mask = BIT(0),
  1221. .hw.init = &(struct clk_init_data) {
  1222. .name = "disp_cc_mdss_dptx3_link_clk",
  1223. .parent_hws = (const struct clk_hw*[]) {
  1224. &disp_cc_mdss_dptx3_link_clk_src.clkr.hw,
  1225. },
  1226. .num_parents = 1,
  1227. .flags = CLK_SET_RATE_PARENT,
  1228. .ops = &clk_branch2_ops,
  1229. },
  1230. },
  1231. };
  1232. static struct clk_branch disp_cc_mdss_dptx3_link_intf_clk = {
  1233. .halt_reg = 0x8098,
  1234. .halt_check = BRANCH_HALT,
  1235. .clkr = {
  1236. .enable_reg = 0x8098,
  1237. .enable_mask = BIT(0),
  1238. .hw.init = &(struct clk_init_data) {
  1239. .name = "disp_cc_mdss_dptx3_link_intf_clk",
  1240. .parent_hws = (const struct clk_hw*[]) {
  1241. &disp_cc_mdss_dptx3_link_div_clk_src.clkr.hw,
  1242. },
  1243. .num_parents = 1,
  1244. .flags = CLK_SET_RATE_PARENT,
  1245. .ops = &clk_branch2_ops,
  1246. },
  1247. },
  1248. };
  1249. static struct clk_branch disp_cc_mdss_dptx3_pixel0_clk = {
  1250. .halt_reg = 0x8090,
  1251. .halt_check = BRANCH_HALT,
  1252. .clkr = {
  1253. .enable_reg = 0x8090,
  1254. .enable_mask = BIT(0),
  1255. .hw.init = &(struct clk_init_data) {
  1256. .name = "disp_cc_mdss_dptx3_pixel0_clk",
  1257. .parent_hws = (const struct clk_hw*[]) {
  1258. &disp_cc_mdss_dptx3_pixel0_clk_src.clkr.hw,
  1259. },
  1260. .num_parents = 1,
  1261. .flags = CLK_SET_RATE_PARENT,
  1262. .ops = &clk_branch2_ops,
  1263. },
  1264. },
  1265. };
  1266. static struct clk_branch disp_cc_mdss_esc0_clk = {
  1267. .halt_reg = 0x8038,
  1268. .halt_check = BRANCH_HALT,
  1269. .clkr = {
  1270. .enable_reg = 0x8038,
  1271. .enable_mask = BIT(0),
  1272. .hw.init = &(struct clk_init_data) {
  1273. .name = "disp_cc_mdss_esc0_clk",
  1274. .parent_hws = (const struct clk_hw*[]) {
  1275. &disp_cc_mdss_esc0_clk_src.clkr.hw,
  1276. },
  1277. .num_parents = 1,
  1278. .flags = CLK_SET_RATE_PARENT,
  1279. .ops = &clk_branch2_ops,
  1280. },
  1281. },
  1282. };
  1283. static struct clk_branch disp_cc_mdss_esc1_clk = {
  1284. .halt_reg = 0x803c,
  1285. .halt_check = BRANCH_HALT,
  1286. .clkr = {
  1287. .enable_reg = 0x803c,
  1288. .enable_mask = BIT(0),
  1289. .hw.init = &(struct clk_init_data) {
  1290. .name = "disp_cc_mdss_esc1_clk",
  1291. .parent_hws = (const struct clk_hw*[]) {
  1292. &disp_cc_mdss_esc1_clk_src.clkr.hw,
  1293. },
  1294. .num_parents = 1,
  1295. .flags = CLK_SET_RATE_PARENT,
  1296. .ops = &clk_branch2_ops,
  1297. },
  1298. },
  1299. };
  1300. static struct clk_branch disp_cc_mdss_mdp1_clk = {
  1301. .halt_reg = 0xa004,
  1302. .halt_check = BRANCH_HALT,
  1303. .clkr = {
  1304. .enable_reg = 0xa004,
  1305. .enable_mask = BIT(0),
  1306. .hw.init = &(struct clk_init_data) {
  1307. .name = "disp_cc_mdss_mdp1_clk",
  1308. .parent_hws = (const struct clk_hw*[]) {
  1309. &disp_cc_mdss_mdp_clk_src.clkr.hw,
  1310. },
  1311. .num_parents = 1,
  1312. .flags = CLK_SET_RATE_PARENT,
  1313. .ops = &clk_branch2_ops,
  1314. },
  1315. },
  1316. };
  1317. static struct clk_branch disp_cc_mdss_mdp_clk = {
  1318. .halt_reg = 0x800c,
  1319. .halt_check = BRANCH_HALT,
  1320. .clkr = {
  1321. .enable_reg = 0x800c,
  1322. .enable_mask = BIT(0),
  1323. .hw.init = &(struct clk_init_data) {
  1324. .name = "disp_cc_mdss_mdp_clk",
  1325. .parent_hws = (const struct clk_hw*[]) {
  1326. &disp_cc_mdss_mdp_clk_src.clkr.hw,
  1327. },
  1328. .num_parents = 1,
  1329. .flags = CLK_SET_RATE_PARENT,
  1330. .ops = &clk_branch2_ops,
  1331. },
  1332. },
  1333. };
  1334. static struct clk_branch disp_cc_mdss_mdp_lut1_clk = {
  1335. .halt_reg = 0xa014,
  1336. .halt_check = BRANCH_HALT,
  1337. .clkr = {
  1338. .enable_reg = 0xa014,
  1339. .enable_mask = BIT(0),
  1340. .hw.init = &(struct clk_init_data) {
  1341. .name = "disp_cc_mdss_mdp_lut1_clk",
  1342. .parent_hws = (const struct clk_hw*[]) {
  1343. &disp_cc_mdss_mdp_clk_src.clkr.hw,
  1344. },
  1345. .num_parents = 1,
  1346. .flags = CLK_SET_RATE_PARENT,
  1347. .ops = &clk_branch2_ops,
  1348. },
  1349. },
  1350. };
  1351. static struct clk_branch disp_cc_mdss_mdp_lut_clk = {
  1352. .halt_reg = 0x801c,
  1353. .halt_check = BRANCH_HALT_VOTED,
  1354. .clkr = {
  1355. .enable_reg = 0x801c,
  1356. .enable_mask = BIT(0),
  1357. .hw.init = &(struct clk_init_data) {
  1358. .name = "disp_cc_mdss_mdp_lut_clk",
  1359. .parent_hws = (const struct clk_hw*[]) {
  1360. &disp_cc_mdss_mdp_clk_src.clkr.hw,
  1361. },
  1362. .num_parents = 1,
  1363. .flags = CLK_SET_RATE_PARENT,
  1364. .ops = &clk_branch2_ops,
  1365. },
  1366. },
  1367. };
  1368. static struct clk_branch disp_cc_mdss_non_gdsc_ahb_clk = {
  1369. .halt_reg = 0xc004,
  1370. .halt_check = BRANCH_HALT_VOTED,
  1371. .clkr = {
  1372. .enable_reg = 0xc004,
  1373. .enable_mask = BIT(0),
  1374. .hw.init = &(struct clk_init_data) {
  1375. .name = "disp_cc_mdss_non_gdsc_ahb_clk",
  1376. .parent_hws = (const struct clk_hw*[]) {
  1377. &disp_cc_mdss_ahb_clk_src.clkr.hw,
  1378. },
  1379. .num_parents = 1,
  1380. .flags = CLK_SET_RATE_PARENT,
  1381. .ops = &clk_branch2_ops,
  1382. },
  1383. },
  1384. };
  1385. static struct clk_branch disp_cc_mdss_pclk0_clk = {
  1386. .halt_reg = 0x8004,
  1387. .halt_check = BRANCH_HALT,
  1388. .clkr = {
  1389. .enable_reg = 0x8004,
  1390. .enable_mask = BIT(0),
  1391. .hw.init = &(struct clk_init_data) {
  1392. .name = "disp_cc_mdss_pclk0_clk",
  1393. .parent_hws = (const struct clk_hw*[]) {
  1394. &disp_cc_mdss_pclk0_clk_src.clkr.hw,
  1395. },
  1396. .num_parents = 1,
  1397. .flags = CLK_SET_RATE_PARENT,
  1398. .ops = &clk_branch2_ops,
  1399. },
  1400. },
  1401. };
  1402. static struct clk_branch disp_cc_mdss_pclk1_clk = {
  1403. .halt_reg = 0x8008,
  1404. .halt_check = BRANCH_HALT,
  1405. .clkr = {
  1406. .enable_reg = 0x8008,
  1407. .enable_mask = BIT(0),
  1408. .hw.init = &(struct clk_init_data) {
  1409. .name = "disp_cc_mdss_pclk1_clk",
  1410. .parent_hws = (const struct clk_hw*[]) {
  1411. &disp_cc_mdss_pclk1_clk_src.clkr.hw,
  1412. },
  1413. .num_parents = 1,
  1414. .flags = CLK_SET_RATE_PARENT,
  1415. .ops = &clk_branch2_ops,
  1416. },
  1417. },
  1418. };
  1419. static struct clk_branch disp_cc_mdss_rot1_clk = {
  1420. .halt_reg = 0xa00c,
  1421. .halt_check = BRANCH_HALT,
  1422. .clkr = {
  1423. .enable_reg = 0xa00c,
  1424. .enable_mask = BIT(0),
  1425. .hw.init = &(struct clk_init_data) {
  1426. .name = "disp_cc_mdss_rot1_clk",
  1427. .parent_hws = (const struct clk_hw*[]) {
  1428. &disp_cc_mdss_rot_clk_src.clkr.hw,
  1429. },
  1430. .num_parents = 1,
  1431. .flags = CLK_SET_RATE_PARENT,
  1432. .ops = &clk_branch2_ops,
  1433. },
  1434. },
  1435. };
  1436. static struct clk_branch disp_cc_mdss_rot_clk = {
  1437. .halt_reg = 0x8014,
  1438. .halt_check = BRANCH_HALT,
  1439. .clkr = {
  1440. .enable_reg = 0x8014,
  1441. .enable_mask = BIT(0),
  1442. .hw.init = &(struct clk_init_data) {
  1443. .name = "disp_cc_mdss_rot_clk",
  1444. .parent_hws = (const struct clk_hw*[]) {
  1445. &disp_cc_mdss_rot_clk_src.clkr.hw,
  1446. },
  1447. .num_parents = 1,
  1448. .flags = CLK_SET_RATE_PARENT,
  1449. .ops = &clk_branch2_ops,
  1450. },
  1451. },
  1452. };
  1453. static struct clk_branch disp_cc_mdss_rscc_ahb_clk = {
  1454. .halt_reg = 0xc00c,
  1455. .halt_check = BRANCH_HALT,
  1456. .clkr = {
  1457. .enable_reg = 0xc00c,
  1458. .enable_mask = BIT(0),
  1459. .hw.init = &(struct clk_init_data) {
  1460. .name = "disp_cc_mdss_rscc_ahb_clk",
  1461. .parent_hws = (const struct clk_hw*[]) {
  1462. &disp_cc_mdss_ahb_clk_src.clkr.hw,
  1463. },
  1464. .num_parents = 1,
  1465. .flags = CLK_SET_RATE_PARENT,
  1466. .ops = &clk_branch2_ops,
  1467. },
  1468. },
  1469. };
  1470. static struct clk_branch disp_cc_mdss_rscc_vsync_clk = {
  1471. .halt_reg = 0xc008,
  1472. .halt_check = BRANCH_HALT,
  1473. .clkr = {
  1474. .enable_reg = 0xc008,
  1475. .enable_mask = BIT(0),
  1476. .hw.init = &(struct clk_init_data) {
  1477. .name = "disp_cc_mdss_rscc_vsync_clk",
  1478. .parent_hws = (const struct clk_hw*[]) {
  1479. &disp_cc_mdss_vsync_clk_src.clkr.hw,
  1480. },
  1481. .num_parents = 1,
  1482. .flags = CLK_SET_RATE_PARENT,
  1483. .ops = &clk_branch2_ops,
  1484. },
  1485. },
  1486. };
  1487. static struct clk_branch disp_cc_mdss_vsync1_clk = {
  1488. .halt_reg = 0xa01c,
  1489. .halt_check = BRANCH_HALT,
  1490. .clkr = {
  1491. .enable_reg = 0xa01c,
  1492. .enable_mask = BIT(0),
  1493. .hw.init = &(struct clk_init_data) {
  1494. .name = "disp_cc_mdss_vsync1_clk",
  1495. .parent_hws = (const struct clk_hw*[]) {
  1496. &disp_cc_mdss_vsync_clk_src.clkr.hw,
  1497. },
  1498. .num_parents = 1,
  1499. .flags = CLK_SET_RATE_PARENT,
  1500. .ops = &clk_branch2_ops,
  1501. },
  1502. },
  1503. };
  1504. static struct clk_branch disp_cc_mdss_vsync_clk = {
  1505. .halt_reg = 0x8024,
  1506. .halt_check = BRANCH_HALT,
  1507. .clkr = {
  1508. .enable_reg = 0x8024,
  1509. .enable_mask = BIT(0),
  1510. .hw.init = &(struct clk_init_data) {
  1511. .name = "disp_cc_mdss_vsync_clk",
  1512. .parent_hws = (const struct clk_hw*[]) {
  1513. &disp_cc_mdss_vsync_clk_src.clkr.hw,
  1514. },
  1515. .num_parents = 1,
  1516. .flags = CLK_SET_RATE_PARENT,
  1517. .ops = &clk_branch2_ops,
  1518. },
  1519. },
  1520. };
  1521. static struct clk_branch disp_cc_sleep_clk = {
  1522. .halt_reg = 0xe078,
  1523. .halt_check = BRANCH_HALT,
  1524. .clkr = {
  1525. .enable_reg = 0xe078,
  1526. .enable_mask = BIT(0),
  1527. .hw.init = &(struct clk_init_data) {
  1528. .name = "disp_cc_sleep_clk",
  1529. .parent_hws = (const struct clk_hw*[]) {
  1530. &disp_cc_sleep_clk_src.clkr.hw,
  1531. },
  1532. .num_parents = 1,
  1533. .flags = CLK_SET_RATE_PARENT,
  1534. .ops = &clk_branch2_ops,
  1535. },
  1536. },
  1537. };
  1538. static struct gdsc mdss_gdsc = {
  1539. .gdscr = 0x9000,
  1540. .pd = {
  1541. .name = "mdss_gdsc",
  1542. },
  1543. .pwrsts = PWRSTS_OFF_ON,
  1544. .flags = HW_CTRL | RETAIN_FF_ENABLE,
  1545. };
  1546. static struct gdsc mdss_int2_gdsc = {
  1547. .gdscr = 0xb000,
  1548. .pd = {
  1549. .name = "mdss_int2_gdsc",
  1550. },
  1551. .pwrsts = PWRSTS_OFF_ON,
  1552. .flags = HW_CTRL | RETAIN_FF_ENABLE,
  1553. };
  1554. static struct clk_regmap *disp_cc_sm8450_clocks[] = {
  1555. [DISP_CC_MDSS_AHB1_CLK] = &disp_cc_mdss_ahb1_clk.clkr,
  1556. [DISP_CC_MDSS_AHB_CLK] = &disp_cc_mdss_ahb_clk.clkr,
  1557. [DISP_CC_MDSS_AHB_CLK_SRC] = &disp_cc_mdss_ahb_clk_src.clkr,
  1558. [DISP_CC_MDSS_BYTE0_CLK] = &disp_cc_mdss_byte0_clk.clkr,
  1559. [DISP_CC_MDSS_BYTE0_CLK_SRC] = &disp_cc_mdss_byte0_clk_src.clkr,
  1560. [DISP_CC_MDSS_BYTE0_DIV_CLK_SRC] = &disp_cc_mdss_byte0_div_clk_src.clkr,
  1561. [DISP_CC_MDSS_BYTE0_INTF_CLK] = &disp_cc_mdss_byte0_intf_clk.clkr,
  1562. [DISP_CC_MDSS_BYTE1_CLK] = &disp_cc_mdss_byte1_clk.clkr,
  1563. [DISP_CC_MDSS_BYTE1_CLK_SRC] = &disp_cc_mdss_byte1_clk_src.clkr,
  1564. [DISP_CC_MDSS_BYTE1_DIV_CLK_SRC] = &disp_cc_mdss_byte1_div_clk_src.clkr,
  1565. [DISP_CC_MDSS_BYTE1_INTF_CLK] = &disp_cc_mdss_byte1_intf_clk.clkr,
  1566. [DISP_CC_MDSS_DPTX0_AUX_CLK] = &disp_cc_mdss_dptx0_aux_clk.clkr,
  1567. [DISP_CC_MDSS_DPTX0_AUX_CLK_SRC] = &disp_cc_mdss_dptx0_aux_clk_src.clkr,
  1568. [DISP_CC_MDSS_DPTX0_CRYPTO_CLK] = &disp_cc_mdss_dptx0_crypto_clk.clkr,
  1569. [DISP_CC_MDSS_DPTX0_LINK_CLK] = &disp_cc_mdss_dptx0_link_clk.clkr,
  1570. [DISP_CC_MDSS_DPTX0_LINK_CLK_SRC] = &disp_cc_mdss_dptx0_link_clk_src.clkr,
  1571. [DISP_CC_MDSS_DPTX0_LINK_DIV_CLK_SRC] = &disp_cc_mdss_dptx0_link_div_clk_src.clkr,
  1572. [DISP_CC_MDSS_DPTX0_LINK_INTF_CLK] = &disp_cc_mdss_dptx0_link_intf_clk.clkr,
  1573. [DISP_CC_MDSS_DPTX0_PIXEL0_CLK] = &disp_cc_mdss_dptx0_pixel0_clk.clkr,
  1574. [DISP_CC_MDSS_DPTX0_PIXEL0_CLK_SRC] = &disp_cc_mdss_dptx0_pixel0_clk_src.clkr,
  1575. [DISP_CC_MDSS_DPTX0_PIXEL1_CLK] = &disp_cc_mdss_dptx0_pixel1_clk.clkr,
  1576. [DISP_CC_MDSS_DPTX0_PIXEL1_CLK_SRC] = &disp_cc_mdss_dptx0_pixel1_clk_src.clkr,
  1577. [DISP_CC_MDSS_DPTX0_USB_ROUTER_LINK_INTF_CLK] =
  1578. &disp_cc_mdss_dptx0_usb_router_link_intf_clk.clkr,
  1579. [DISP_CC_MDSS_DPTX1_AUX_CLK] = &disp_cc_mdss_dptx1_aux_clk.clkr,
  1580. [DISP_CC_MDSS_DPTX1_AUX_CLK_SRC] = &disp_cc_mdss_dptx1_aux_clk_src.clkr,
  1581. [DISP_CC_MDSS_DPTX1_CRYPTO_CLK] = &disp_cc_mdss_dptx1_crypto_clk.clkr,
  1582. [DISP_CC_MDSS_DPTX1_LINK_CLK] = &disp_cc_mdss_dptx1_link_clk.clkr,
  1583. [DISP_CC_MDSS_DPTX1_LINK_CLK_SRC] = &disp_cc_mdss_dptx1_link_clk_src.clkr,
  1584. [DISP_CC_MDSS_DPTX1_LINK_DIV_CLK_SRC] = &disp_cc_mdss_dptx1_link_div_clk_src.clkr,
  1585. [DISP_CC_MDSS_DPTX1_LINK_INTF_CLK] = &disp_cc_mdss_dptx1_link_intf_clk.clkr,
  1586. [DISP_CC_MDSS_DPTX1_PIXEL0_CLK] = &disp_cc_mdss_dptx1_pixel0_clk.clkr,
  1587. [DISP_CC_MDSS_DPTX1_PIXEL0_CLK_SRC] = &disp_cc_mdss_dptx1_pixel0_clk_src.clkr,
  1588. [DISP_CC_MDSS_DPTX1_PIXEL1_CLK] = &disp_cc_mdss_dptx1_pixel1_clk.clkr,
  1589. [DISP_CC_MDSS_DPTX1_PIXEL1_CLK_SRC] = &disp_cc_mdss_dptx1_pixel1_clk_src.clkr,
  1590. [DISP_CC_MDSS_DPTX1_USB_ROUTER_LINK_INTF_CLK] =
  1591. &disp_cc_mdss_dptx1_usb_router_link_intf_clk.clkr,
  1592. [DISP_CC_MDSS_DPTX2_AUX_CLK] = &disp_cc_mdss_dptx2_aux_clk.clkr,
  1593. [DISP_CC_MDSS_DPTX2_AUX_CLK_SRC] = &disp_cc_mdss_dptx2_aux_clk_src.clkr,
  1594. [DISP_CC_MDSS_DPTX2_CRYPTO_CLK] = &disp_cc_mdss_dptx2_crypto_clk.clkr,
  1595. [DISP_CC_MDSS_DPTX2_LINK_CLK] = &disp_cc_mdss_dptx2_link_clk.clkr,
  1596. [DISP_CC_MDSS_DPTX2_LINK_CLK_SRC] = &disp_cc_mdss_dptx2_link_clk_src.clkr,
  1597. [DISP_CC_MDSS_DPTX2_LINK_DIV_CLK_SRC] = &disp_cc_mdss_dptx2_link_div_clk_src.clkr,
  1598. [DISP_CC_MDSS_DPTX2_LINK_INTF_CLK] = &disp_cc_mdss_dptx2_link_intf_clk.clkr,
  1599. [DISP_CC_MDSS_DPTX2_PIXEL0_CLK] = &disp_cc_mdss_dptx2_pixel0_clk.clkr,
  1600. [DISP_CC_MDSS_DPTX2_PIXEL0_CLK_SRC] = &disp_cc_mdss_dptx2_pixel0_clk_src.clkr,
  1601. [DISP_CC_MDSS_DPTX2_PIXEL1_CLK] = &disp_cc_mdss_dptx2_pixel1_clk.clkr,
  1602. [DISP_CC_MDSS_DPTX2_PIXEL1_CLK_SRC] = &disp_cc_mdss_dptx2_pixel1_clk_src.clkr,
  1603. [DISP_CC_MDSS_DPTX3_AUX_CLK] = &disp_cc_mdss_dptx3_aux_clk.clkr,
  1604. [DISP_CC_MDSS_DPTX3_AUX_CLK_SRC] = &disp_cc_mdss_dptx3_aux_clk_src.clkr,
  1605. [DISP_CC_MDSS_DPTX3_CRYPTO_CLK] = &disp_cc_mdss_dptx3_crypto_clk.clkr,
  1606. [DISP_CC_MDSS_DPTX3_LINK_CLK] = &disp_cc_mdss_dptx3_link_clk.clkr,
  1607. [DISP_CC_MDSS_DPTX3_LINK_CLK_SRC] = &disp_cc_mdss_dptx3_link_clk_src.clkr,
  1608. [DISP_CC_MDSS_DPTX3_LINK_DIV_CLK_SRC] = &disp_cc_mdss_dptx3_link_div_clk_src.clkr,
  1609. [DISP_CC_MDSS_DPTX3_LINK_INTF_CLK] = &disp_cc_mdss_dptx3_link_intf_clk.clkr,
  1610. [DISP_CC_MDSS_DPTX3_PIXEL0_CLK] = &disp_cc_mdss_dptx3_pixel0_clk.clkr,
  1611. [DISP_CC_MDSS_DPTX3_PIXEL0_CLK_SRC] = &disp_cc_mdss_dptx3_pixel0_clk_src.clkr,
  1612. [DISP_CC_MDSS_ESC0_CLK] = &disp_cc_mdss_esc0_clk.clkr,
  1613. [DISP_CC_MDSS_ESC0_CLK_SRC] = &disp_cc_mdss_esc0_clk_src.clkr,
  1614. [DISP_CC_MDSS_ESC1_CLK] = &disp_cc_mdss_esc1_clk.clkr,
  1615. [DISP_CC_MDSS_ESC1_CLK_SRC] = &disp_cc_mdss_esc1_clk_src.clkr,
  1616. [DISP_CC_MDSS_MDP1_CLK] = &disp_cc_mdss_mdp1_clk.clkr,
  1617. [DISP_CC_MDSS_MDP_CLK] = &disp_cc_mdss_mdp_clk.clkr,
  1618. [DISP_CC_MDSS_MDP_CLK_SRC] = &disp_cc_mdss_mdp_clk_src.clkr,
  1619. [DISP_CC_MDSS_MDP_LUT1_CLK] = &disp_cc_mdss_mdp_lut1_clk.clkr,
  1620. [DISP_CC_MDSS_MDP_LUT_CLK] = &disp_cc_mdss_mdp_lut_clk.clkr,
  1621. [DISP_CC_MDSS_NON_GDSC_AHB_CLK] = &disp_cc_mdss_non_gdsc_ahb_clk.clkr,
  1622. [DISP_CC_MDSS_PCLK0_CLK] = &disp_cc_mdss_pclk0_clk.clkr,
  1623. [DISP_CC_MDSS_PCLK0_CLK_SRC] = &disp_cc_mdss_pclk0_clk_src.clkr,
  1624. [DISP_CC_MDSS_PCLK1_CLK] = &disp_cc_mdss_pclk1_clk.clkr,
  1625. [DISP_CC_MDSS_PCLK1_CLK_SRC] = &disp_cc_mdss_pclk1_clk_src.clkr,
  1626. [DISP_CC_MDSS_ROT1_CLK] = &disp_cc_mdss_rot1_clk.clkr,
  1627. [DISP_CC_MDSS_ROT_CLK] = &disp_cc_mdss_rot_clk.clkr,
  1628. [DISP_CC_MDSS_ROT_CLK_SRC] = &disp_cc_mdss_rot_clk_src.clkr,
  1629. [DISP_CC_MDSS_RSCC_AHB_CLK] = &disp_cc_mdss_rscc_ahb_clk.clkr,
  1630. [DISP_CC_MDSS_RSCC_VSYNC_CLK] = &disp_cc_mdss_rscc_vsync_clk.clkr,
  1631. [DISP_CC_MDSS_VSYNC1_CLK] = &disp_cc_mdss_vsync1_clk.clkr,
  1632. [DISP_CC_MDSS_VSYNC_CLK] = &disp_cc_mdss_vsync_clk.clkr,
  1633. [DISP_CC_MDSS_VSYNC_CLK_SRC] = &disp_cc_mdss_vsync_clk_src.clkr,
  1634. [DISP_CC_PLL0] = &disp_cc_pll0.clkr,
  1635. [DISP_CC_PLL1] = &disp_cc_pll1.clkr,
  1636. [DISP_CC_SLEEP_CLK] = &disp_cc_sleep_clk.clkr,
  1637. [DISP_CC_SLEEP_CLK_SRC] = &disp_cc_sleep_clk_src.clkr,
  1638. [DISP_CC_XO_CLK_SRC] = &disp_cc_xo_clk_src.clkr,
  1639. };
  1640. static const struct qcom_reset_map disp_cc_sm8450_resets[] = {
  1641. [DISP_CC_MDSS_CORE_BCR] = { 0x8000 },
  1642. [DISP_CC_MDSS_CORE_INT2_BCR] = { 0xa000 },
  1643. [DISP_CC_MDSS_RSCC_BCR] = { 0xc000 },
  1644. };
  1645. static struct gdsc *disp_cc_sm8450_gdscs[] = {
  1646. [MDSS_GDSC] = &mdss_gdsc,
  1647. [MDSS_INT2_GDSC] = &mdss_int2_gdsc,
  1648. };
  1649. static const struct regmap_config disp_cc_sm8450_regmap_config = {
  1650. .reg_bits = 32,
  1651. .reg_stride = 4,
  1652. .val_bits = 32,
  1653. .max_register = 0x11008,
  1654. .fast_io = true,
  1655. };
  1656. static const struct qcom_cc_desc disp_cc_sm8450_desc = {
  1657. .config = &disp_cc_sm8450_regmap_config,
  1658. .clks = disp_cc_sm8450_clocks,
  1659. .num_clks = ARRAY_SIZE(disp_cc_sm8450_clocks),
  1660. .resets = disp_cc_sm8450_resets,
  1661. .num_resets = ARRAY_SIZE(disp_cc_sm8450_resets),
  1662. .gdscs = disp_cc_sm8450_gdscs,
  1663. .num_gdscs = ARRAY_SIZE(disp_cc_sm8450_gdscs),
  1664. };
  1665. static const struct of_device_id disp_cc_sm8450_match_table[] = {
  1666. { .compatible = "qcom,sm8450-dispcc" },
  1667. { .compatible = "qcom,sm8475-dispcc" },
  1668. { }
  1669. };
  1670. MODULE_DEVICE_TABLE(of, disp_cc_sm8450_match_table);
  1671. static int disp_cc_sm8450_probe(struct platform_device *pdev)
  1672. {
  1673. struct regmap *regmap;
  1674. int ret;
  1675. ret = devm_pm_runtime_enable(&pdev->dev);
  1676. if (ret)
  1677. return ret;
  1678. ret = pm_runtime_resume_and_get(&pdev->dev);
  1679. if (ret)
  1680. return ret;
  1681. regmap = qcom_cc_map(pdev, &disp_cc_sm8450_desc);
  1682. if (IS_ERR(regmap)) {
  1683. ret = PTR_ERR(regmap);
  1684. goto err_put_rpm;
  1685. }
  1686. if (of_device_is_compatible(pdev->dev.of_node, "qcom,sm8475-dispcc")) {
  1687. /* Update DISPCC PLL0 */
  1688. disp_cc_pll0.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE];
  1689. disp_cc_pll0.clkr.hw.init = &sm8475_disp_cc_pll0_init;
  1690. /* Update DISPCC PLL1 */
  1691. disp_cc_pll1.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE];
  1692. disp_cc_pll1.clkr.hw.init = &sm8475_disp_cc_pll1_init;
  1693. clk_lucid_ole_pll_configure(&disp_cc_pll0, regmap, &sm8475_disp_cc_pll0_config);
  1694. clk_lucid_ole_pll_configure(&disp_cc_pll1, regmap, &sm8475_disp_cc_pll1_config);
  1695. } else {
  1696. clk_lucid_evo_pll_configure(&disp_cc_pll0, regmap, &disp_cc_pll0_config);
  1697. clk_lucid_evo_pll_configure(&disp_cc_pll1, regmap, &disp_cc_pll1_config);
  1698. }
  1699. /* Enable clock gating for MDP clocks */
  1700. regmap_update_bits(regmap, DISP_CC_MISC_CMD, 0x10, 0x10);
  1701. /* Keep some clocks always-on */
  1702. qcom_branch_set_clk_en(regmap, 0xe05c); /* DISP_CC_XO_CLK */
  1703. ret = qcom_cc_really_probe(&pdev->dev, &disp_cc_sm8450_desc, regmap);
  1704. if (ret)
  1705. goto err_put_rpm;
  1706. pm_runtime_put(&pdev->dev);
  1707. return 0;
  1708. err_put_rpm:
  1709. pm_runtime_put_sync(&pdev->dev);
  1710. return ret;
  1711. }
  1712. static struct platform_driver disp_cc_sm8450_driver = {
  1713. .probe = disp_cc_sm8450_probe,
  1714. .driver = {
  1715. .name = "disp_cc-sm8450",
  1716. .of_match_table = disp_cc_sm8450_match_table,
  1717. },
  1718. };
  1719. module_platform_driver(disp_cc_sm8450_driver);
  1720. MODULE_DESCRIPTION("QTI DISPCC SM8450 / SM8475 Driver");
  1721. MODULE_LICENSE("GPL");