mmcc-msm8960.c 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105
  1. /*
  2. * Copyright (c) 2013, The Linux Foundation. All rights reserved.
  3. *
  4. * This software is licensed under the terms of the GNU General Public
  5. * License version 2, as published by the Free Software Foundation, and
  6. * may be copied, distributed, and modified under those terms.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/bitops.h>
  15. #include <linux/err.h>
  16. #include <linux/delay.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/module.h>
  19. #include <linux/of.h>
  20. #include <linux/of_device.h>
  21. #include <linux/clk.h>
  22. #include <linux/clk-provider.h>
  23. #include <linux/regmap.h>
  24. #include <linux/reset-controller.h>
  25. #include <dt-bindings/clock/qcom,mmcc-msm8960.h>
  26. #include <dt-bindings/reset/qcom,mmcc-msm8960.h>
  27. #include "common.h"
  28. #include "clk-regmap.h"
  29. #include "clk-pll.h"
  30. #include "clk-rcg.h"
  31. #include "clk-branch.h"
  32. #include "reset.h"
  33. enum {
  34. P_PXO,
  35. P_PLL8,
  36. P_PLL2,
  37. P_PLL3,
  38. P_PLL15,
  39. P_HDMI_PLL,
  40. P_DSI1_PLL_DSICLK,
  41. P_DSI2_PLL_DSICLK,
  42. P_DSI1_PLL_BYTECLK,
  43. P_DSI2_PLL_BYTECLK,
  44. };
  45. #define F_MN(f, s, _m, _n) { .freq = f, .src = s, .m = _m, .n = _n }
  46. static const struct parent_map mmcc_pxo_pll8_pll2_map[] = {
  47. { P_PXO, 0 },
  48. { P_PLL8, 2 },
  49. { P_PLL2, 1 }
  50. };
  51. static const char * const mmcc_pxo_pll8_pll2[] = {
  52. "pxo",
  53. "pll8_vote",
  54. "pll2",
  55. };
  56. static const struct parent_map mmcc_pxo_pll8_pll2_pll3_map[] = {
  57. { P_PXO, 0 },
  58. { P_PLL8, 2 },
  59. { P_PLL2, 1 },
  60. { P_PLL3, 3 }
  61. };
  62. static const char * const mmcc_pxo_pll8_pll2_pll15[] = {
  63. "pxo",
  64. "pll8_vote",
  65. "pll2",
  66. "pll15",
  67. };
  68. static const struct parent_map mmcc_pxo_pll8_pll2_pll15_map[] = {
  69. { P_PXO, 0 },
  70. { P_PLL8, 2 },
  71. { P_PLL2, 1 },
  72. { P_PLL15, 3 }
  73. };
  74. static const char * const mmcc_pxo_pll8_pll2_pll3[] = {
  75. "pxo",
  76. "pll8_vote",
  77. "pll2",
  78. "pll3",
  79. };
  80. static const struct parent_map mmcc_pxo_dsi2_dsi1_map[] = {
  81. { P_PXO, 0 },
  82. { P_DSI2_PLL_DSICLK, 1 },
  83. { P_DSI1_PLL_DSICLK, 3 },
  84. };
  85. static const char * const mmcc_pxo_dsi2_dsi1[] = {
  86. "pxo",
  87. "dsi2pll",
  88. "dsi1pll",
  89. };
  90. static const struct parent_map mmcc_pxo_dsi1_dsi2_byte_map[] = {
  91. { P_PXO, 0 },
  92. { P_DSI1_PLL_BYTECLK, 1 },
  93. { P_DSI2_PLL_BYTECLK, 2 },
  94. };
  95. static const char * const mmcc_pxo_dsi1_dsi2_byte[] = {
  96. "pxo",
  97. "dsi1pllbyte",
  98. "dsi2pllbyte",
  99. };
  100. static struct clk_pll pll2 = {
  101. .l_reg = 0x320,
  102. .m_reg = 0x324,
  103. .n_reg = 0x328,
  104. .config_reg = 0x32c,
  105. .mode_reg = 0x31c,
  106. .status_reg = 0x334,
  107. .status_bit = 16,
  108. .clkr.hw.init = &(struct clk_init_data){
  109. .name = "pll2",
  110. .parent_names = (const char *[]){ "pxo" },
  111. .num_parents = 1,
  112. .ops = &clk_pll_ops,
  113. },
  114. };
  115. static struct clk_pll pll15 = {
  116. .l_reg = 0x33c,
  117. .m_reg = 0x340,
  118. .n_reg = 0x344,
  119. .config_reg = 0x348,
  120. .mode_reg = 0x338,
  121. .status_reg = 0x350,
  122. .status_bit = 16,
  123. .clkr.hw.init = &(struct clk_init_data){
  124. .name = "pll15",
  125. .parent_names = (const char *[]){ "pxo" },
  126. .num_parents = 1,
  127. .ops = &clk_pll_ops,
  128. },
  129. };
  130. static const struct pll_config pll15_config = {
  131. .l = 33,
  132. .m = 1,
  133. .n = 3,
  134. .vco_val = 0x2 << 16,
  135. .vco_mask = 0x3 << 16,
  136. .pre_div_val = 0x0,
  137. .pre_div_mask = BIT(19),
  138. .post_div_val = 0x0,
  139. .post_div_mask = 0x3 << 20,
  140. .mn_ena_mask = BIT(22),
  141. .main_output_mask = BIT(23),
  142. };
  143. static struct freq_tbl clk_tbl_cam[] = {
  144. { 6000000, P_PLL8, 4, 1, 16 },
  145. { 8000000, P_PLL8, 4, 1, 12 },
  146. { 12000000, P_PLL8, 4, 1, 8 },
  147. { 16000000, P_PLL8, 4, 1, 6 },
  148. { 19200000, P_PLL8, 4, 1, 5 },
  149. { 24000000, P_PLL8, 4, 1, 4 },
  150. { 32000000, P_PLL8, 4, 1, 3 },
  151. { 48000000, P_PLL8, 4, 1, 2 },
  152. { 64000000, P_PLL8, 3, 1, 2 },
  153. { 96000000, P_PLL8, 4, 0, 0 },
  154. { 128000000, P_PLL8, 3, 0, 0 },
  155. { }
  156. };
  157. static struct clk_rcg camclk0_src = {
  158. .ns_reg = 0x0148,
  159. .md_reg = 0x0144,
  160. .mn = {
  161. .mnctr_en_bit = 5,
  162. .mnctr_reset_bit = 8,
  163. .reset_in_cc = true,
  164. .mnctr_mode_shift = 6,
  165. .n_val_shift = 24,
  166. .m_val_shift = 8,
  167. .width = 8,
  168. },
  169. .p = {
  170. .pre_div_shift = 14,
  171. .pre_div_width = 2,
  172. },
  173. .s = {
  174. .src_sel_shift = 0,
  175. .parent_map = mmcc_pxo_pll8_pll2_map,
  176. },
  177. .freq_tbl = clk_tbl_cam,
  178. .clkr = {
  179. .enable_reg = 0x0140,
  180. .enable_mask = BIT(2),
  181. .hw.init = &(struct clk_init_data){
  182. .name = "camclk0_src",
  183. .parent_names = mmcc_pxo_pll8_pll2,
  184. .num_parents = 3,
  185. .ops = &clk_rcg_ops,
  186. },
  187. },
  188. };
  189. static struct clk_branch camclk0_clk = {
  190. .halt_reg = 0x01e8,
  191. .halt_bit = 15,
  192. .clkr = {
  193. .enable_reg = 0x0140,
  194. .enable_mask = BIT(0),
  195. .hw.init = &(struct clk_init_data){
  196. .name = "camclk0_clk",
  197. .parent_names = (const char *[]){ "camclk0_src" },
  198. .num_parents = 1,
  199. .ops = &clk_branch_ops,
  200. },
  201. },
  202. };
  203. static struct clk_rcg camclk1_src = {
  204. .ns_reg = 0x015c,
  205. .md_reg = 0x0158,
  206. .mn = {
  207. .mnctr_en_bit = 5,
  208. .mnctr_reset_bit = 8,
  209. .reset_in_cc = true,
  210. .mnctr_mode_shift = 6,
  211. .n_val_shift = 24,
  212. .m_val_shift = 8,
  213. .width = 8,
  214. },
  215. .p = {
  216. .pre_div_shift = 14,
  217. .pre_div_width = 2,
  218. },
  219. .s = {
  220. .src_sel_shift = 0,
  221. .parent_map = mmcc_pxo_pll8_pll2_map,
  222. },
  223. .freq_tbl = clk_tbl_cam,
  224. .clkr = {
  225. .enable_reg = 0x0154,
  226. .enable_mask = BIT(2),
  227. .hw.init = &(struct clk_init_data){
  228. .name = "camclk1_src",
  229. .parent_names = mmcc_pxo_pll8_pll2,
  230. .num_parents = 3,
  231. .ops = &clk_rcg_ops,
  232. },
  233. },
  234. };
  235. static struct clk_branch camclk1_clk = {
  236. .halt_reg = 0x01e8,
  237. .halt_bit = 16,
  238. .clkr = {
  239. .enable_reg = 0x0154,
  240. .enable_mask = BIT(0),
  241. .hw.init = &(struct clk_init_data){
  242. .name = "camclk1_clk",
  243. .parent_names = (const char *[]){ "camclk1_src" },
  244. .num_parents = 1,
  245. .ops = &clk_branch_ops,
  246. },
  247. },
  248. };
  249. static struct clk_rcg camclk2_src = {
  250. .ns_reg = 0x0228,
  251. .md_reg = 0x0224,
  252. .mn = {
  253. .mnctr_en_bit = 5,
  254. .mnctr_reset_bit = 8,
  255. .reset_in_cc = true,
  256. .mnctr_mode_shift = 6,
  257. .n_val_shift = 24,
  258. .m_val_shift = 8,
  259. .width = 8,
  260. },
  261. .p = {
  262. .pre_div_shift = 14,
  263. .pre_div_width = 2,
  264. },
  265. .s = {
  266. .src_sel_shift = 0,
  267. .parent_map = mmcc_pxo_pll8_pll2_map,
  268. },
  269. .freq_tbl = clk_tbl_cam,
  270. .clkr = {
  271. .enable_reg = 0x0220,
  272. .enable_mask = BIT(2),
  273. .hw.init = &(struct clk_init_data){
  274. .name = "camclk2_src",
  275. .parent_names = mmcc_pxo_pll8_pll2,
  276. .num_parents = 3,
  277. .ops = &clk_rcg_ops,
  278. },
  279. },
  280. };
  281. static struct clk_branch camclk2_clk = {
  282. .halt_reg = 0x01e8,
  283. .halt_bit = 16,
  284. .clkr = {
  285. .enable_reg = 0x0220,
  286. .enable_mask = BIT(0),
  287. .hw.init = &(struct clk_init_data){
  288. .name = "camclk2_clk",
  289. .parent_names = (const char *[]){ "camclk2_src" },
  290. .num_parents = 1,
  291. .ops = &clk_branch_ops,
  292. },
  293. },
  294. };
  295. static struct freq_tbl clk_tbl_csi[] = {
  296. { 27000000, P_PXO, 1, 0, 0 },
  297. { 85330000, P_PLL8, 1, 2, 9 },
  298. { 177780000, P_PLL2, 1, 2, 9 },
  299. { }
  300. };
  301. static struct clk_rcg csi0_src = {
  302. .ns_reg = 0x0048,
  303. .md_reg = 0x0044,
  304. .mn = {
  305. .mnctr_en_bit = 5,
  306. .mnctr_reset_bit = 7,
  307. .mnctr_mode_shift = 6,
  308. .n_val_shift = 24,
  309. .m_val_shift = 8,
  310. .width = 8,
  311. },
  312. .p = {
  313. .pre_div_shift = 14,
  314. .pre_div_width = 2,
  315. },
  316. .s = {
  317. .src_sel_shift = 0,
  318. .parent_map = mmcc_pxo_pll8_pll2_map,
  319. },
  320. .freq_tbl = clk_tbl_csi,
  321. .clkr = {
  322. .enable_reg = 0x0040,
  323. .enable_mask = BIT(2),
  324. .hw.init = &(struct clk_init_data){
  325. .name = "csi0_src",
  326. .parent_names = mmcc_pxo_pll8_pll2,
  327. .num_parents = 3,
  328. .ops = &clk_rcg_ops,
  329. },
  330. },
  331. };
  332. static struct clk_branch csi0_clk = {
  333. .halt_reg = 0x01cc,
  334. .halt_bit = 13,
  335. .clkr = {
  336. .enable_reg = 0x0040,
  337. .enable_mask = BIT(0),
  338. .hw.init = &(struct clk_init_data){
  339. .parent_names = (const char *[]){ "csi0_src" },
  340. .num_parents = 1,
  341. .name = "csi0_clk",
  342. .ops = &clk_branch_ops,
  343. .flags = CLK_SET_RATE_PARENT,
  344. },
  345. },
  346. };
  347. static struct clk_branch csi0_phy_clk = {
  348. .halt_reg = 0x01e8,
  349. .halt_bit = 9,
  350. .clkr = {
  351. .enable_reg = 0x0040,
  352. .enable_mask = BIT(8),
  353. .hw.init = &(struct clk_init_data){
  354. .parent_names = (const char *[]){ "csi0_src" },
  355. .num_parents = 1,
  356. .name = "csi0_phy_clk",
  357. .ops = &clk_branch_ops,
  358. .flags = CLK_SET_RATE_PARENT,
  359. },
  360. },
  361. };
  362. static struct clk_rcg csi1_src = {
  363. .ns_reg = 0x0010,
  364. .md_reg = 0x0028,
  365. .mn = {
  366. .mnctr_en_bit = 5,
  367. .mnctr_reset_bit = 7,
  368. .mnctr_mode_shift = 6,
  369. .n_val_shift = 24,
  370. .m_val_shift = 8,
  371. .width = 8,
  372. },
  373. .p = {
  374. .pre_div_shift = 14,
  375. .pre_div_width = 2,
  376. },
  377. .s = {
  378. .src_sel_shift = 0,
  379. .parent_map = mmcc_pxo_pll8_pll2_map,
  380. },
  381. .freq_tbl = clk_tbl_csi,
  382. .clkr = {
  383. .enable_reg = 0x0024,
  384. .enable_mask = BIT(2),
  385. .hw.init = &(struct clk_init_data){
  386. .name = "csi1_src",
  387. .parent_names = mmcc_pxo_pll8_pll2,
  388. .num_parents = 3,
  389. .ops = &clk_rcg_ops,
  390. },
  391. },
  392. };
  393. static struct clk_branch csi1_clk = {
  394. .halt_reg = 0x01cc,
  395. .halt_bit = 14,
  396. .clkr = {
  397. .enable_reg = 0x0024,
  398. .enable_mask = BIT(0),
  399. .hw.init = &(struct clk_init_data){
  400. .parent_names = (const char *[]){ "csi1_src" },
  401. .num_parents = 1,
  402. .name = "csi1_clk",
  403. .ops = &clk_branch_ops,
  404. .flags = CLK_SET_RATE_PARENT,
  405. },
  406. },
  407. };
  408. static struct clk_branch csi1_phy_clk = {
  409. .halt_reg = 0x01e8,
  410. .halt_bit = 10,
  411. .clkr = {
  412. .enable_reg = 0x0024,
  413. .enable_mask = BIT(8),
  414. .hw.init = &(struct clk_init_data){
  415. .parent_names = (const char *[]){ "csi1_src" },
  416. .num_parents = 1,
  417. .name = "csi1_phy_clk",
  418. .ops = &clk_branch_ops,
  419. .flags = CLK_SET_RATE_PARENT,
  420. },
  421. },
  422. };
  423. static struct clk_rcg csi2_src = {
  424. .ns_reg = 0x0234,
  425. .md_reg = 0x022c,
  426. .mn = {
  427. .mnctr_en_bit = 5,
  428. .mnctr_reset_bit = 7,
  429. .mnctr_mode_shift = 6,
  430. .n_val_shift = 24,
  431. .m_val_shift = 8,
  432. .width = 8,
  433. },
  434. .p = {
  435. .pre_div_shift = 14,
  436. .pre_div_width = 2,
  437. },
  438. .s = {
  439. .src_sel_shift = 0,
  440. .parent_map = mmcc_pxo_pll8_pll2_map,
  441. },
  442. .freq_tbl = clk_tbl_csi,
  443. .clkr = {
  444. .enable_reg = 0x022c,
  445. .enable_mask = BIT(2),
  446. .hw.init = &(struct clk_init_data){
  447. .name = "csi2_src",
  448. .parent_names = mmcc_pxo_pll8_pll2,
  449. .num_parents = 3,
  450. .ops = &clk_rcg_ops,
  451. },
  452. },
  453. };
  454. static struct clk_branch csi2_clk = {
  455. .halt_reg = 0x01cc,
  456. .halt_bit = 29,
  457. .clkr = {
  458. .enable_reg = 0x022c,
  459. .enable_mask = BIT(0),
  460. .hw.init = &(struct clk_init_data){
  461. .parent_names = (const char *[]){ "csi2_src" },
  462. .num_parents = 1,
  463. .name = "csi2_clk",
  464. .ops = &clk_branch_ops,
  465. .flags = CLK_SET_RATE_PARENT,
  466. },
  467. },
  468. };
  469. static struct clk_branch csi2_phy_clk = {
  470. .halt_reg = 0x01e8,
  471. .halt_bit = 29,
  472. .clkr = {
  473. .enable_reg = 0x022c,
  474. .enable_mask = BIT(8),
  475. .hw.init = &(struct clk_init_data){
  476. .parent_names = (const char *[]){ "csi2_src" },
  477. .num_parents = 1,
  478. .name = "csi2_phy_clk",
  479. .ops = &clk_branch_ops,
  480. .flags = CLK_SET_RATE_PARENT,
  481. },
  482. },
  483. };
  484. struct clk_pix_rdi {
  485. u32 s_reg;
  486. u32 s_mask;
  487. u32 s2_reg;
  488. u32 s2_mask;
  489. struct clk_regmap clkr;
  490. };
  491. #define to_clk_pix_rdi(_hw) \
  492. container_of(to_clk_regmap(_hw), struct clk_pix_rdi, clkr)
  493. static int pix_rdi_set_parent(struct clk_hw *hw, u8 index)
  494. {
  495. int i;
  496. int ret = 0;
  497. u32 val;
  498. struct clk_pix_rdi *rdi = to_clk_pix_rdi(hw);
  499. int num_parents = clk_hw_get_num_parents(hw);
  500. /*
  501. * These clocks select three inputs via two muxes. One mux selects
  502. * between csi0 and csi1 and the second mux selects between that mux's
  503. * output and csi2. The source and destination selections for each
  504. * mux must be clocking for the switch to succeed so just turn on
  505. * all three sources because it's easier than figuring out what source
  506. * needs to be on at what time.
  507. */
  508. for (i = 0; i < num_parents; i++) {
  509. struct clk_hw *p = clk_hw_get_parent_by_index(hw, i);
  510. ret = clk_prepare_enable(p->clk);
  511. if (ret)
  512. goto err;
  513. }
  514. if (index == 2)
  515. val = rdi->s2_mask;
  516. else
  517. val = 0;
  518. regmap_update_bits(rdi->clkr.regmap, rdi->s2_reg, rdi->s2_mask, val);
  519. /*
  520. * Wait at least 6 cycles of slowest clock
  521. * for the glitch-free MUX to fully switch sources.
  522. */
  523. udelay(1);
  524. if (index == 1)
  525. val = rdi->s_mask;
  526. else
  527. val = 0;
  528. regmap_update_bits(rdi->clkr.regmap, rdi->s_reg, rdi->s_mask, val);
  529. /*
  530. * Wait at least 6 cycles of slowest clock
  531. * for the glitch-free MUX to fully switch sources.
  532. */
  533. udelay(1);
  534. err:
  535. for (i--; i >= 0; i--) {
  536. struct clk_hw *p = clk_hw_get_parent_by_index(hw, i);
  537. clk_disable_unprepare(p->clk);
  538. }
  539. return ret;
  540. }
  541. static u8 pix_rdi_get_parent(struct clk_hw *hw)
  542. {
  543. u32 val;
  544. struct clk_pix_rdi *rdi = to_clk_pix_rdi(hw);
  545. regmap_read(rdi->clkr.regmap, rdi->s2_reg, &val);
  546. if (val & rdi->s2_mask)
  547. return 2;
  548. regmap_read(rdi->clkr.regmap, rdi->s_reg, &val);
  549. if (val & rdi->s_mask)
  550. return 1;
  551. return 0;
  552. }
  553. static const struct clk_ops clk_ops_pix_rdi = {
  554. .enable = clk_enable_regmap,
  555. .disable = clk_disable_regmap,
  556. .set_parent = pix_rdi_set_parent,
  557. .get_parent = pix_rdi_get_parent,
  558. .determine_rate = __clk_mux_determine_rate,
  559. };
  560. static const char * const pix_rdi_parents[] = {
  561. "csi0_clk",
  562. "csi1_clk",
  563. "csi2_clk",
  564. };
  565. static struct clk_pix_rdi csi_pix_clk = {
  566. .s_reg = 0x0058,
  567. .s_mask = BIT(25),
  568. .s2_reg = 0x0238,
  569. .s2_mask = BIT(13),
  570. .clkr = {
  571. .enable_reg = 0x0058,
  572. .enable_mask = BIT(26),
  573. .hw.init = &(struct clk_init_data){
  574. .name = "csi_pix_clk",
  575. .parent_names = pix_rdi_parents,
  576. .num_parents = 3,
  577. .ops = &clk_ops_pix_rdi,
  578. },
  579. },
  580. };
  581. static struct clk_pix_rdi csi_pix1_clk = {
  582. .s_reg = 0x0238,
  583. .s_mask = BIT(8),
  584. .s2_reg = 0x0238,
  585. .s2_mask = BIT(9),
  586. .clkr = {
  587. .enable_reg = 0x0238,
  588. .enable_mask = BIT(10),
  589. .hw.init = &(struct clk_init_data){
  590. .name = "csi_pix1_clk",
  591. .parent_names = pix_rdi_parents,
  592. .num_parents = 3,
  593. .ops = &clk_ops_pix_rdi,
  594. },
  595. },
  596. };
  597. static struct clk_pix_rdi csi_rdi_clk = {
  598. .s_reg = 0x0058,
  599. .s_mask = BIT(12),
  600. .s2_reg = 0x0238,
  601. .s2_mask = BIT(12),
  602. .clkr = {
  603. .enable_reg = 0x0058,
  604. .enable_mask = BIT(13),
  605. .hw.init = &(struct clk_init_data){
  606. .name = "csi_rdi_clk",
  607. .parent_names = pix_rdi_parents,
  608. .num_parents = 3,
  609. .ops = &clk_ops_pix_rdi,
  610. },
  611. },
  612. };
  613. static struct clk_pix_rdi csi_rdi1_clk = {
  614. .s_reg = 0x0238,
  615. .s_mask = BIT(0),
  616. .s2_reg = 0x0238,
  617. .s2_mask = BIT(1),
  618. .clkr = {
  619. .enable_reg = 0x0238,
  620. .enable_mask = BIT(2),
  621. .hw.init = &(struct clk_init_data){
  622. .name = "csi_rdi1_clk",
  623. .parent_names = pix_rdi_parents,
  624. .num_parents = 3,
  625. .ops = &clk_ops_pix_rdi,
  626. },
  627. },
  628. };
  629. static struct clk_pix_rdi csi_rdi2_clk = {
  630. .s_reg = 0x0238,
  631. .s_mask = BIT(4),
  632. .s2_reg = 0x0238,
  633. .s2_mask = BIT(5),
  634. .clkr = {
  635. .enable_reg = 0x0238,
  636. .enable_mask = BIT(6),
  637. .hw.init = &(struct clk_init_data){
  638. .name = "csi_rdi2_clk",
  639. .parent_names = pix_rdi_parents,
  640. .num_parents = 3,
  641. .ops = &clk_ops_pix_rdi,
  642. },
  643. },
  644. };
  645. static struct freq_tbl clk_tbl_csiphytimer[] = {
  646. { 85330000, P_PLL8, 1, 2, 9 },
  647. { 177780000, P_PLL2, 1, 2, 9 },
  648. { }
  649. };
  650. static struct clk_rcg csiphytimer_src = {
  651. .ns_reg = 0x0168,
  652. .md_reg = 0x0164,
  653. .mn = {
  654. .mnctr_en_bit = 5,
  655. .mnctr_reset_bit = 8,
  656. .reset_in_cc = true,
  657. .mnctr_mode_shift = 6,
  658. .n_val_shift = 24,
  659. .m_val_shift = 8,
  660. .width = 8,
  661. },
  662. .p = {
  663. .pre_div_shift = 14,
  664. .pre_div_width = 2,
  665. },
  666. .s = {
  667. .src_sel_shift = 0,
  668. .parent_map = mmcc_pxo_pll8_pll2_map,
  669. },
  670. .freq_tbl = clk_tbl_csiphytimer,
  671. .clkr = {
  672. .enable_reg = 0x0160,
  673. .enable_mask = BIT(2),
  674. .hw.init = &(struct clk_init_data){
  675. .name = "csiphytimer_src",
  676. .parent_names = mmcc_pxo_pll8_pll2,
  677. .num_parents = 3,
  678. .ops = &clk_rcg_ops,
  679. },
  680. },
  681. };
  682. static const char * const csixphy_timer_src[] = { "csiphytimer_src" };
  683. static struct clk_branch csiphy0_timer_clk = {
  684. .halt_reg = 0x01e8,
  685. .halt_bit = 17,
  686. .clkr = {
  687. .enable_reg = 0x0160,
  688. .enable_mask = BIT(0),
  689. .hw.init = &(struct clk_init_data){
  690. .parent_names = csixphy_timer_src,
  691. .num_parents = 1,
  692. .name = "csiphy0_timer_clk",
  693. .ops = &clk_branch_ops,
  694. .flags = CLK_SET_RATE_PARENT,
  695. },
  696. },
  697. };
  698. static struct clk_branch csiphy1_timer_clk = {
  699. .halt_reg = 0x01e8,
  700. .halt_bit = 18,
  701. .clkr = {
  702. .enable_reg = 0x0160,
  703. .enable_mask = BIT(9),
  704. .hw.init = &(struct clk_init_data){
  705. .parent_names = csixphy_timer_src,
  706. .num_parents = 1,
  707. .name = "csiphy1_timer_clk",
  708. .ops = &clk_branch_ops,
  709. .flags = CLK_SET_RATE_PARENT,
  710. },
  711. },
  712. };
  713. static struct clk_branch csiphy2_timer_clk = {
  714. .halt_reg = 0x01e8,
  715. .halt_bit = 30,
  716. .clkr = {
  717. .enable_reg = 0x0160,
  718. .enable_mask = BIT(11),
  719. .hw.init = &(struct clk_init_data){
  720. .parent_names = csixphy_timer_src,
  721. .num_parents = 1,
  722. .name = "csiphy2_timer_clk",
  723. .ops = &clk_branch_ops,
  724. .flags = CLK_SET_RATE_PARENT,
  725. },
  726. },
  727. };
  728. static struct freq_tbl clk_tbl_gfx2d[] = {
  729. F_MN( 27000000, P_PXO, 1, 0),
  730. F_MN( 48000000, P_PLL8, 1, 8),
  731. F_MN( 54857000, P_PLL8, 1, 7),
  732. F_MN( 64000000, P_PLL8, 1, 6),
  733. F_MN( 76800000, P_PLL8, 1, 5),
  734. F_MN( 96000000, P_PLL8, 1, 4),
  735. F_MN(128000000, P_PLL8, 1, 3),
  736. F_MN(145455000, P_PLL2, 2, 11),
  737. F_MN(160000000, P_PLL2, 1, 5),
  738. F_MN(177778000, P_PLL2, 2, 9),
  739. F_MN(200000000, P_PLL2, 1, 4),
  740. F_MN(228571000, P_PLL2, 2, 7),
  741. { }
  742. };
  743. static struct clk_dyn_rcg gfx2d0_src = {
  744. .ns_reg[0] = 0x0070,
  745. .ns_reg[1] = 0x0070,
  746. .md_reg[0] = 0x0064,
  747. .md_reg[1] = 0x0068,
  748. .bank_reg = 0x0060,
  749. .mn[0] = {
  750. .mnctr_en_bit = 8,
  751. .mnctr_reset_bit = 25,
  752. .mnctr_mode_shift = 9,
  753. .n_val_shift = 20,
  754. .m_val_shift = 4,
  755. .width = 4,
  756. },
  757. .mn[1] = {
  758. .mnctr_en_bit = 5,
  759. .mnctr_reset_bit = 24,
  760. .mnctr_mode_shift = 6,
  761. .n_val_shift = 16,
  762. .m_val_shift = 4,
  763. .width = 4,
  764. },
  765. .s[0] = {
  766. .src_sel_shift = 3,
  767. .parent_map = mmcc_pxo_pll8_pll2_map,
  768. },
  769. .s[1] = {
  770. .src_sel_shift = 0,
  771. .parent_map = mmcc_pxo_pll8_pll2_map,
  772. },
  773. .mux_sel_bit = 11,
  774. .freq_tbl = clk_tbl_gfx2d,
  775. .clkr = {
  776. .enable_reg = 0x0060,
  777. .enable_mask = BIT(2),
  778. .hw.init = &(struct clk_init_data){
  779. .name = "gfx2d0_src",
  780. .parent_names = mmcc_pxo_pll8_pll2,
  781. .num_parents = 3,
  782. .ops = &clk_dyn_rcg_ops,
  783. },
  784. },
  785. };
  786. static struct clk_branch gfx2d0_clk = {
  787. .halt_reg = 0x01c8,
  788. .halt_bit = 9,
  789. .clkr = {
  790. .enable_reg = 0x0060,
  791. .enable_mask = BIT(0),
  792. .hw.init = &(struct clk_init_data){
  793. .name = "gfx2d0_clk",
  794. .parent_names = (const char *[]){ "gfx2d0_src" },
  795. .num_parents = 1,
  796. .ops = &clk_branch_ops,
  797. .flags = CLK_SET_RATE_PARENT,
  798. },
  799. },
  800. };
  801. static struct clk_dyn_rcg gfx2d1_src = {
  802. .ns_reg[0] = 0x007c,
  803. .ns_reg[1] = 0x007c,
  804. .md_reg[0] = 0x0078,
  805. .md_reg[1] = 0x006c,
  806. .bank_reg = 0x0074,
  807. .mn[0] = {
  808. .mnctr_en_bit = 8,
  809. .mnctr_reset_bit = 25,
  810. .mnctr_mode_shift = 9,
  811. .n_val_shift = 20,
  812. .m_val_shift = 4,
  813. .width = 4,
  814. },
  815. .mn[1] = {
  816. .mnctr_en_bit = 5,
  817. .mnctr_reset_bit = 24,
  818. .mnctr_mode_shift = 6,
  819. .n_val_shift = 16,
  820. .m_val_shift = 4,
  821. .width = 4,
  822. },
  823. .s[0] = {
  824. .src_sel_shift = 3,
  825. .parent_map = mmcc_pxo_pll8_pll2_map,
  826. },
  827. .s[1] = {
  828. .src_sel_shift = 0,
  829. .parent_map = mmcc_pxo_pll8_pll2_map,
  830. },
  831. .mux_sel_bit = 11,
  832. .freq_tbl = clk_tbl_gfx2d,
  833. .clkr = {
  834. .enable_reg = 0x0074,
  835. .enable_mask = BIT(2),
  836. .hw.init = &(struct clk_init_data){
  837. .name = "gfx2d1_src",
  838. .parent_names = mmcc_pxo_pll8_pll2,
  839. .num_parents = 3,
  840. .ops = &clk_dyn_rcg_ops,
  841. },
  842. },
  843. };
  844. static struct clk_branch gfx2d1_clk = {
  845. .halt_reg = 0x01c8,
  846. .halt_bit = 14,
  847. .clkr = {
  848. .enable_reg = 0x0074,
  849. .enable_mask = BIT(0),
  850. .hw.init = &(struct clk_init_data){
  851. .name = "gfx2d1_clk",
  852. .parent_names = (const char *[]){ "gfx2d1_src" },
  853. .num_parents = 1,
  854. .ops = &clk_branch_ops,
  855. .flags = CLK_SET_RATE_PARENT,
  856. },
  857. },
  858. };
  859. static struct freq_tbl clk_tbl_gfx3d[] = {
  860. F_MN( 27000000, P_PXO, 1, 0),
  861. F_MN( 48000000, P_PLL8, 1, 8),
  862. F_MN( 54857000, P_PLL8, 1, 7),
  863. F_MN( 64000000, P_PLL8, 1, 6),
  864. F_MN( 76800000, P_PLL8, 1, 5),
  865. F_MN( 96000000, P_PLL8, 1, 4),
  866. F_MN(128000000, P_PLL8, 1, 3),
  867. F_MN(145455000, P_PLL2, 2, 11),
  868. F_MN(160000000, P_PLL2, 1, 5),
  869. F_MN(177778000, P_PLL2, 2, 9),
  870. F_MN(200000000, P_PLL2, 1, 4),
  871. F_MN(228571000, P_PLL2, 2, 7),
  872. F_MN(266667000, P_PLL2, 1, 3),
  873. F_MN(300000000, P_PLL3, 1, 4),
  874. F_MN(320000000, P_PLL2, 2, 5),
  875. F_MN(400000000, P_PLL2, 1, 2),
  876. { }
  877. };
  878. static struct freq_tbl clk_tbl_gfx3d_8064[] = {
  879. F_MN( 27000000, P_PXO, 0, 0),
  880. F_MN( 48000000, P_PLL8, 1, 8),
  881. F_MN( 54857000, P_PLL8, 1, 7),
  882. F_MN( 64000000, P_PLL8, 1, 6),
  883. F_MN( 76800000, P_PLL8, 1, 5),
  884. F_MN( 96000000, P_PLL8, 1, 4),
  885. F_MN(128000000, P_PLL8, 1, 3),
  886. F_MN(145455000, P_PLL2, 2, 11),
  887. F_MN(160000000, P_PLL2, 1, 5),
  888. F_MN(177778000, P_PLL2, 2, 9),
  889. F_MN(192000000, P_PLL8, 1, 2),
  890. F_MN(200000000, P_PLL2, 1, 4),
  891. F_MN(228571000, P_PLL2, 2, 7),
  892. F_MN(266667000, P_PLL2, 1, 3),
  893. F_MN(320000000, P_PLL2, 2, 5),
  894. F_MN(400000000, P_PLL2, 1, 2),
  895. F_MN(450000000, P_PLL15, 1, 2),
  896. { }
  897. };
  898. static struct clk_dyn_rcg gfx3d_src = {
  899. .ns_reg[0] = 0x008c,
  900. .ns_reg[1] = 0x008c,
  901. .md_reg[0] = 0x0084,
  902. .md_reg[1] = 0x0088,
  903. .bank_reg = 0x0080,
  904. .mn[0] = {
  905. .mnctr_en_bit = 8,
  906. .mnctr_reset_bit = 25,
  907. .mnctr_mode_shift = 9,
  908. .n_val_shift = 18,
  909. .m_val_shift = 4,
  910. .width = 4,
  911. },
  912. .mn[1] = {
  913. .mnctr_en_bit = 5,
  914. .mnctr_reset_bit = 24,
  915. .mnctr_mode_shift = 6,
  916. .n_val_shift = 14,
  917. .m_val_shift = 4,
  918. .width = 4,
  919. },
  920. .s[0] = {
  921. .src_sel_shift = 3,
  922. .parent_map = mmcc_pxo_pll8_pll2_pll3_map,
  923. },
  924. .s[1] = {
  925. .src_sel_shift = 0,
  926. .parent_map = mmcc_pxo_pll8_pll2_pll3_map,
  927. },
  928. .mux_sel_bit = 11,
  929. .freq_tbl = clk_tbl_gfx3d,
  930. .clkr = {
  931. .enable_reg = 0x0080,
  932. .enable_mask = BIT(2),
  933. .hw.init = &(struct clk_init_data){
  934. .name = "gfx3d_src",
  935. .parent_names = mmcc_pxo_pll8_pll2_pll3,
  936. .num_parents = 4,
  937. .ops = &clk_dyn_rcg_ops,
  938. },
  939. },
  940. };
  941. static const struct clk_init_data gfx3d_8064_init = {
  942. .name = "gfx3d_src",
  943. .parent_names = mmcc_pxo_pll8_pll2_pll15,
  944. .num_parents = 4,
  945. .ops = &clk_dyn_rcg_ops,
  946. };
  947. static struct clk_branch gfx3d_clk = {
  948. .halt_reg = 0x01c8,
  949. .halt_bit = 4,
  950. .clkr = {
  951. .enable_reg = 0x0080,
  952. .enable_mask = BIT(0),
  953. .hw.init = &(struct clk_init_data){
  954. .name = "gfx3d_clk",
  955. .parent_names = (const char *[]){ "gfx3d_src" },
  956. .num_parents = 1,
  957. .ops = &clk_branch_ops,
  958. .flags = CLK_SET_RATE_PARENT,
  959. },
  960. },
  961. };
  962. static struct freq_tbl clk_tbl_vcap[] = {
  963. F_MN( 27000000, P_PXO, 0, 0),
  964. F_MN( 54860000, P_PLL8, 1, 7),
  965. F_MN( 64000000, P_PLL8, 1, 6),
  966. F_MN( 76800000, P_PLL8, 1, 5),
  967. F_MN(128000000, P_PLL8, 1, 3),
  968. F_MN(160000000, P_PLL2, 1, 5),
  969. F_MN(200000000, P_PLL2, 1, 4),
  970. { }
  971. };
  972. static struct clk_dyn_rcg vcap_src = {
  973. .ns_reg[0] = 0x021c,
  974. .ns_reg[1] = 0x021c,
  975. .md_reg[0] = 0x01ec,
  976. .md_reg[1] = 0x0218,
  977. .bank_reg = 0x0178,
  978. .mn[0] = {
  979. .mnctr_en_bit = 8,
  980. .mnctr_reset_bit = 23,
  981. .mnctr_mode_shift = 9,
  982. .n_val_shift = 18,
  983. .m_val_shift = 4,
  984. .width = 4,
  985. },
  986. .mn[1] = {
  987. .mnctr_en_bit = 5,
  988. .mnctr_reset_bit = 22,
  989. .mnctr_mode_shift = 6,
  990. .n_val_shift = 14,
  991. .m_val_shift = 4,
  992. .width = 4,
  993. },
  994. .s[0] = {
  995. .src_sel_shift = 3,
  996. .parent_map = mmcc_pxo_pll8_pll2_map,
  997. },
  998. .s[1] = {
  999. .src_sel_shift = 0,
  1000. .parent_map = mmcc_pxo_pll8_pll2_map,
  1001. },
  1002. .mux_sel_bit = 11,
  1003. .freq_tbl = clk_tbl_vcap,
  1004. .clkr = {
  1005. .enable_reg = 0x0178,
  1006. .enable_mask = BIT(2),
  1007. .hw.init = &(struct clk_init_data){
  1008. .name = "vcap_src",
  1009. .parent_names = mmcc_pxo_pll8_pll2,
  1010. .num_parents = 3,
  1011. .ops = &clk_dyn_rcg_ops,
  1012. },
  1013. },
  1014. };
  1015. static struct clk_branch vcap_clk = {
  1016. .halt_reg = 0x0240,
  1017. .halt_bit = 15,
  1018. .clkr = {
  1019. .enable_reg = 0x0178,
  1020. .enable_mask = BIT(0),
  1021. .hw.init = &(struct clk_init_data){
  1022. .name = "vcap_clk",
  1023. .parent_names = (const char *[]){ "vcap_src" },
  1024. .num_parents = 1,
  1025. .ops = &clk_branch_ops,
  1026. .flags = CLK_SET_RATE_PARENT,
  1027. },
  1028. },
  1029. };
  1030. static struct clk_branch vcap_npl_clk = {
  1031. .halt_reg = 0x0240,
  1032. .halt_bit = 25,
  1033. .clkr = {
  1034. .enable_reg = 0x0178,
  1035. .enable_mask = BIT(13),
  1036. .hw.init = &(struct clk_init_data){
  1037. .name = "vcap_npl_clk",
  1038. .parent_names = (const char *[]){ "vcap_src" },
  1039. .num_parents = 1,
  1040. .ops = &clk_branch_ops,
  1041. .flags = CLK_SET_RATE_PARENT,
  1042. },
  1043. },
  1044. };
  1045. static struct freq_tbl clk_tbl_ijpeg[] = {
  1046. { 27000000, P_PXO, 1, 0, 0 },
  1047. { 36570000, P_PLL8, 1, 2, 21 },
  1048. { 54860000, P_PLL8, 7, 0, 0 },
  1049. { 96000000, P_PLL8, 4, 0, 0 },
  1050. { 109710000, P_PLL8, 1, 2, 7 },
  1051. { 128000000, P_PLL8, 3, 0, 0 },
  1052. { 153600000, P_PLL8, 1, 2, 5 },
  1053. { 200000000, P_PLL2, 4, 0, 0 },
  1054. { 228571000, P_PLL2, 1, 2, 7 },
  1055. { 266667000, P_PLL2, 1, 1, 3 },
  1056. { 320000000, P_PLL2, 1, 2, 5 },
  1057. { }
  1058. };
  1059. static struct clk_rcg ijpeg_src = {
  1060. .ns_reg = 0x00a0,
  1061. .md_reg = 0x009c,
  1062. .mn = {
  1063. .mnctr_en_bit = 5,
  1064. .mnctr_reset_bit = 7,
  1065. .mnctr_mode_shift = 6,
  1066. .n_val_shift = 16,
  1067. .m_val_shift = 8,
  1068. .width = 8,
  1069. },
  1070. .p = {
  1071. .pre_div_shift = 12,
  1072. .pre_div_width = 2,
  1073. },
  1074. .s = {
  1075. .src_sel_shift = 0,
  1076. .parent_map = mmcc_pxo_pll8_pll2_map,
  1077. },
  1078. .freq_tbl = clk_tbl_ijpeg,
  1079. .clkr = {
  1080. .enable_reg = 0x0098,
  1081. .enable_mask = BIT(2),
  1082. .hw.init = &(struct clk_init_data){
  1083. .name = "ijpeg_src",
  1084. .parent_names = mmcc_pxo_pll8_pll2,
  1085. .num_parents = 3,
  1086. .ops = &clk_rcg_ops,
  1087. },
  1088. },
  1089. };
  1090. static struct clk_branch ijpeg_clk = {
  1091. .halt_reg = 0x01c8,
  1092. .halt_bit = 24,
  1093. .clkr = {
  1094. .enable_reg = 0x0098,
  1095. .enable_mask = BIT(0),
  1096. .hw.init = &(struct clk_init_data){
  1097. .name = "ijpeg_clk",
  1098. .parent_names = (const char *[]){ "ijpeg_src" },
  1099. .num_parents = 1,
  1100. .ops = &clk_branch_ops,
  1101. .flags = CLK_SET_RATE_PARENT,
  1102. },
  1103. },
  1104. };
  1105. static struct freq_tbl clk_tbl_jpegd[] = {
  1106. { 64000000, P_PLL8, 6 },
  1107. { 76800000, P_PLL8, 5 },
  1108. { 96000000, P_PLL8, 4 },
  1109. { 160000000, P_PLL2, 5 },
  1110. { 200000000, P_PLL2, 4 },
  1111. { }
  1112. };
  1113. static struct clk_rcg jpegd_src = {
  1114. .ns_reg = 0x00ac,
  1115. .p = {
  1116. .pre_div_shift = 12,
  1117. .pre_div_width = 4,
  1118. },
  1119. .s = {
  1120. .src_sel_shift = 0,
  1121. .parent_map = mmcc_pxo_pll8_pll2_map,
  1122. },
  1123. .freq_tbl = clk_tbl_jpegd,
  1124. .clkr = {
  1125. .enable_reg = 0x00a4,
  1126. .enable_mask = BIT(2),
  1127. .hw.init = &(struct clk_init_data){
  1128. .name = "jpegd_src",
  1129. .parent_names = mmcc_pxo_pll8_pll2,
  1130. .num_parents = 3,
  1131. .ops = &clk_rcg_ops,
  1132. },
  1133. },
  1134. };
  1135. static struct clk_branch jpegd_clk = {
  1136. .halt_reg = 0x01c8,
  1137. .halt_bit = 19,
  1138. .clkr = {
  1139. .enable_reg = 0x00a4,
  1140. .enable_mask = BIT(0),
  1141. .hw.init = &(struct clk_init_data){
  1142. .name = "jpegd_clk",
  1143. .parent_names = (const char *[]){ "jpegd_src" },
  1144. .num_parents = 1,
  1145. .ops = &clk_branch_ops,
  1146. .flags = CLK_SET_RATE_PARENT,
  1147. },
  1148. },
  1149. };
  1150. static struct freq_tbl clk_tbl_mdp[] = {
  1151. { 9600000, P_PLL8, 1, 1, 40 },
  1152. { 13710000, P_PLL8, 1, 1, 28 },
  1153. { 27000000, P_PXO, 1, 0, 0 },
  1154. { 29540000, P_PLL8, 1, 1, 13 },
  1155. { 34910000, P_PLL8, 1, 1, 11 },
  1156. { 38400000, P_PLL8, 1, 1, 10 },
  1157. { 59080000, P_PLL8, 1, 2, 13 },
  1158. { 76800000, P_PLL8, 1, 1, 5 },
  1159. { 85330000, P_PLL8, 1, 2, 9 },
  1160. { 96000000, P_PLL8, 1, 1, 4 },
  1161. { 128000000, P_PLL8, 1, 1, 3 },
  1162. { 160000000, P_PLL2, 1, 1, 5 },
  1163. { 177780000, P_PLL2, 1, 2, 9 },
  1164. { 200000000, P_PLL2, 1, 1, 4 },
  1165. { 228571000, P_PLL2, 1, 2, 7 },
  1166. { 266667000, P_PLL2, 1, 1, 3 },
  1167. { }
  1168. };
  1169. static struct clk_dyn_rcg mdp_src = {
  1170. .ns_reg[0] = 0x00d0,
  1171. .ns_reg[1] = 0x00d0,
  1172. .md_reg[0] = 0x00c4,
  1173. .md_reg[1] = 0x00c8,
  1174. .bank_reg = 0x00c0,
  1175. .mn[0] = {
  1176. .mnctr_en_bit = 8,
  1177. .mnctr_reset_bit = 31,
  1178. .mnctr_mode_shift = 9,
  1179. .n_val_shift = 22,
  1180. .m_val_shift = 8,
  1181. .width = 8,
  1182. },
  1183. .mn[1] = {
  1184. .mnctr_en_bit = 5,
  1185. .mnctr_reset_bit = 30,
  1186. .mnctr_mode_shift = 6,
  1187. .n_val_shift = 14,
  1188. .m_val_shift = 8,
  1189. .width = 8,
  1190. },
  1191. .s[0] = {
  1192. .src_sel_shift = 3,
  1193. .parent_map = mmcc_pxo_pll8_pll2_map,
  1194. },
  1195. .s[1] = {
  1196. .src_sel_shift = 0,
  1197. .parent_map = mmcc_pxo_pll8_pll2_map,
  1198. },
  1199. .mux_sel_bit = 11,
  1200. .freq_tbl = clk_tbl_mdp,
  1201. .clkr = {
  1202. .enable_reg = 0x00c0,
  1203. .enable_mask = BIT(2),
  1204. .hw.init = &(struct clk_init_data){
  1205. .name = "mdp_src",
  1206. .parent_names = mmcc_pxo_pll8_pll2,
  1207. .num_parents = 3,
  1208. .ops = &clk_dyn_rcg_ops,
  1209. },
  1210. },
  1211. };
  1212. static struct clk_branch mdp_clk = {
  1213. .halt_reg = 0x01d0,
  1214. .halt_bit = 10,
  1215. .clkr = {
  1216. .enable_reg = 0x00c0,
  1217. .enable_mask = BIT(0),
  1218. .hw.init = &(struct clk_init_data){
  1219. .name = "mdp_clk",
  1220. .parent_names = (const char *[]){ "mdp_src" },
  1221. .num_parents = 1,
  1222. .ops = &clk_branch_ops,
  1223. .flags = CLK_SET_RATE_PARENT,
  1224. },
  1225. },
  1226. };
  1227. static struct clk_branch mdp_lut_clk = {
  1228. .halt_reg = 0x01e8,
  1229. .halt_bit = 13,
  1230. .clkr = {
  1231. .enable_reg = 0x016c,
  1232. .enable_mask = BIT(0),
  1233. .hw.init = &(struct clk_init_data){
  1234. .parent_names = (const char *[]){ "mdp_src" },
  1235. .num_parents = 1,
  1236. .name = "mdp_lut_clk",
  1237. .ops = &clk_branch_ops,
  1238. .flags = CLK_SET_RATE_PARENT,
  1239. },
  1240. },
  1241. };
  1242. static struct clk_branch mdp_vsync_clk = {
  1243. .halt_reg = 0x01cc,
  1244. .halt_bit = 22,
  1245. .clkr = {
  1246. .enable_reg = 0x0058,
  1247. .enable_mask = BIT(6),
  1248. .hw.init = &(struct clk_init_data){
  1249. .name = "mdp_vsync_clk",
  1250. .parent_names = (const char *[]){ "pxo" },
  1251. .num_parents = 1,
  1252. .ops = &clk_branch_ops
  1253. },
  1254. },
  1255. };
  1256. static struct freq_tbl clk_tbl_rot[] = {
  1257. { 27000000, P_PXO, 1 },
  1258. { 29540000, P_PLL8, 13 },
  1259. { 32000000, P_PLL8, 12 },
  1260. { 38400000, P_PLL8, 10 },
  1261. { 48000000, P_PLL8, 8 },
  1262. { 54860000, P_PLL8, 7 },
  1263. { 64000000, P_PLL8, 6 },
  1264. { 76800000, P_PLL8, 5 },
  1265. { 96000000, P_PLL8, 4 },
  1266. { 100000000, P_PLL2, 8 },
  1267. { 114290000, P_PLL2, 7 },
  1268. { 133330000, P_PLL2, 6 },
  1269. { 160000000, P_PLL2, 5 },
  1270. { 200000000, P_PLL2, 4 },
  1271. { }
  1272. };
  1273. static struct clk_dyn_rcg rot_src = {
  1274. .ns_reg[0] = 0x00e8,
  1275. .ns_reg[1] = 0x00e8,
  1276. .bank_reg = 0x00e8,
  1277. .p[0] = {
  1278. .pre_div_shift = 22,
  1279. .pre_div_width = 4,
  1280. },
  1281. .p[1] = {
  1282. .pre_div_shift = 26,
  1283. .pre_div_width = 4,
  1284. },
  1285. .s[0] = {
  1286. .src_sel_shift = 16,
  1287. .parent_map = mmcc_pxo_pll8_pll2_map,
  1288. },
  1289. .s[1] = {
  1290. .src_sel_shift = 19,
  1291. .parent_map = mmcc_pxo_pll8_pll2_map,
  1292. },
  1293. .mux_sel_bit = 30,
  1294. .freq_tbl = clk_tbl_rot,
  1295. .clkr = {
  1296. .enable_reg = 0x00e0,
  1297. .enable_mask = BIT(2),
  1298. .hw.init = &(struct clk_init_data){
  1299. .name = "rot_src",
  1300. .parent_names = mmcc_pxo_pll8_pll2,
  1301. .num_parents = 3,
  1302. .ops = &clk_dyn_rcg_ops,
  1303. },
  1304. },
  1305. };
  1306. static struct clk_branch rot_clk = {
  1307. .halt_reg = 0x01d0,
  1308. .halt_bit = 15,
  1309. .clkr = {
  1310. .enable_reg = 0x00e0,
  1311. .enable_mask = BIT(0),
  1312. .hw.init = &(struct clk_init_data){
  1313. .name = "rot_clk",
  1314. .parent_names = (const char *[]){ "rot_src" },
  1315. .num_parents = 1,
  1316. .ops = &clk_branch_ops,
  1317. .flags = CLK_SET_RATE_PARENT,
  1318. },
  1319. },
  1320. };
  1321. static const struct parent_map mmcc_pxo_hdmi_map[] = {
  1322. { P_PXO, 0 },
  1323. { P_HDMI_PLL, 3 }
  1324. };
  1325. static const char * const mmcc_pxo_hdmi[] = {
  1326. "pxo",
  1327. "hdmi_pll",
  1328. };
  1329. static struct freq_tbl clk_tbl_tv[] = {
  1330. { .src = P_HDMI_PLL, .pre_div = 1 },
  1331. { }
  1332. };
  1333. static struct clk_rcg tv_src = {
  1334. .ns_reg = 0x00f4,
  1335. .md_reg = 0x00f0,
  1336. .mn = {
  1337. .mnctr_en_bit = 5,
  1338. .mnctr_reset_bit = 7,
  1339. .mnctr_mode_shift = 6,
  1340. .n_val_shift = 16,
  1341. .m_val_shift = 8,
  1342. .width = 8,
  1343. },
  1344. .p = {
  1345. .pre_div_shift = 14,
  1346. .pre_div_width = 2,
  1347. },
  1348. .s = {
  1349. .src_sel_shift = 0,
  1350. .parent_map = mmcc_pxo_hdmi_map,
  1351. },
  1352. .freq_tbl = clk_tbl_tv,
  1353. .clkr = {
  1354. .enable_reg = 0x00ec,
  1355. .enable_mask = BIT(2),
  1356. .hw.init = &(struct clk_init_data){
  1357. .name = "tv_src",
  1358. .parent_names = mmcc_pxo_hdmi,
  1359. .num_parents = 2,
  1360. .ops = &clk_rcg_bypass_ops,
  1361. .flags = CLK_SET_RATE_PARENT,
  1362. },
  1363. },
  1364. };
  1365. static const char * const tv_src_name[] = { "tv_src" };
  1366. static struct clk_branch tv_enc_clk = {
  1367. .halt_reg = 0x01d4,
  1368. .halt_bit = 9,
  1369. .clkr = {
  1370. .enable_reg = 0x00ec,
  1371. .enable_mask = BIT(8),
  1372. .hw.init = &(struct clk_init_data){
  1373. .parent_names = tv_src_name,
  1374. .num_parents = 1,
  1375. .name = "tv_enc_clk",
  1376. .ops = &clk_branch_ops,
  1377. .flags = CLK_SET_RATE_PARENT,
  1378. },
  1379. },
  1380. };
  1381. static struct clk_branch tv_dac_clk = {
  1382. .halt_reg = 0x01d4,
  1383. .halt_bit = 10,
  1384. .clkr = {
  1385. .enable_reg = 0x00ec,
  1386. .enable_mask = BIT(10),
  1387. .hw.init = &(struct clk_init_data){
  1388. .parent_names = tv_src_name,
  1389. .num_parents = 1,
  1390. .name = "tv_dac_clk",
  1391. .ops = &clk_branch_ops,
  1392. .flags = CLK_SET_RATE_PARENT,
  1393. },
  1394. },
  1395. };
  1396. static struct clk_branch mdp_tv_clk = {
  1397. .halt_reg = 0x01d4,
  1398. .halt_bit = 12,
  1399. .clkr = {
  1400. .enable_reg = 0x00ec,
  1401. .enable_mask = BIT(0),
  1402. .hw.init = &(struct clk_init_data){
  1403. .parent_names = tv_src_name,
  1404. .num_parents = 1,
  1405. .name = "mdp_tv_clk",
  1406. .ops = &clk_branch_ops,
  1407. .flags = CLK_SET_RATE_PARENT,
  1408. },
  1409. },
  1410. };
  1411. static struct clk_branch hdmi_tv_clk = {
  1412. .halt_reg = 0x01d4,
  1413. .halt_bit = 11,
  1414. .clkr = {
  1415. .enable_reg = 0x00ec,
  1416. .enable_mask = BIT(12),
  1417. .hw.init = &(struct clk_init_data){
  1418. .parent_names = tv_src_name,
  1419. .num_parents = 1,
  1420. .name = "hdmi_tv_clk",
  1421. .ops = &clk_branch_ops,
  1422. .flags = CLK_SET_RATE_PARENT,
  1423. },
  1424. },
  1425. };
  1426. static struct clk_branch rgb_tv_clk = {
  1427. .halt_reg = 0x0240,
  1428. .halt_bit = 27,
  1429. .clkr = {
  1430. .enable_reg = 0x0124,
  1431. .enable_mask = BIT(14),
  1432. .hw.init = &(struct clk_init_data){
  1433. .parent_names = tv_src_name,
  1434. .num_parents = 1,
  1435. .name = "rgb_tv_clk",
  1436. .ops = &clk_branch_ops,
  1437. .flags = CLK_SET_RATE_PARENT,
  1438. },
  1439. },
  1440. };
  1441. static struct clk_branch npl_tv_clk = {
  1442. .halt_reg = 0x0240,
  1443. .halt_bit = 26,
  1444. .clkr = {
  1445. .enable_reg = 0x0124,
  1446. .enable_mask = BIT(16),
  1447. .hw.init = &(struct clk_init_data){
  1448. .parent_names = tv_src_name,
  1449. .num_parents = 1,
  1450. .name = "npl_tv_clk",
  1451. .ops = &clk_branch_ops,
  1452. .flags = CLK_SET_RATE_PARENT,
  1453. },
  1454. },
  1455. };
  1456. static struct clk_branch hdmi_app_clk = {
  1457. .halt_reg = 0x01cc,
  1458. .halt_bit = 25,
  1459. .clkr = {
  1460. .enable_reg = 0x005c,
  1461. .enable_mask = BIT(11),
  1462. .hw.init = &(struct clk_init_data){
  1463. .parent_names = (const char *[]){ "pxo" },
  1464. .num_parents = 1,
  1465. .name = "hdmi_app_clk",
  1466. .ops = &clk_branch_ops,
  1467. },
  1468. },
  1469. };
  1470. static struct freq_tbl clk_tbl_vcodec[] = {
  1471. F_MN( 27000000, P_PXO, 1, 0),
  1472. F_MN( 32000000, P_PLL8, 1, 12),
  1473. F_MN( 48000000, P_PLL8, 1, 8),
  1474. F_MN( 54860000, P_PLL8, 1, 7),
  1475. F_MN( 96000000, P_PLL8, 1, 4),
  1476. F_MN(133330000, P_PLL2, 1, 6),
  1477. F_MN(200000000, P_PLL2, 1, 4),
  1478. F_MN(228570000, P_PLL2, 2, 7),
  1479. F_MN(266670000, P_PLL2, 1, 3),
  1480. { }
  1481. };
  1482. static struct clk_dyn_rcg vcodec_src = {
  1483. .ns_reg[0] = 0x0100,
  1484. .ns_reg[1] = 0x0100,
  1485. .md_reg[0] = 0x00fc,
  1486. .md_reg[1] = 0x0128,
  1487. .bank_reg = 0x00f8,
  1488. .mn[0] = {
  1489. .mnctr_en_bit = 5,
  1490. .mnctr_reset_bit = 31,
  1491. .mnctr_mode_shift = 6,
  1492. .n_val_shift = 11,
  1493. .m_val_shift = 8,
  1494. .width = 8,
  1495. },
  1496. .mn[1] = {
  1497. .mnctr_en_bit = 10,
  1498. .mnctr_reset_bit = 30,
  1499. .mnctr_mode_shift = 11,
  1500. .n_val_shift = 19,
  1501. .m_val_shift = 8,
  1502. .width = 8,
  1503. },
  1504. .s[0] = {
  1505. .src_sel_shift = 27,
  1506. .parent_map = mmcc_pxo_pll8_pll2_map,
  1507. },
  1508. .s[1] = {
  1509. .src_sel_shift = 0,
  1510. .parent_map = mmcc_pxo_pll8_pll2_map,
  1511. },
  1512. .mux_sel_bit = 13,
  1513. .freq_tbl = clk_tbl_vcodec,
  1514. .clkr = {
  1515. .enable_reg = 0x00f8,
  1516. .enable_mask = BIT(2),
  1517. .hw.init = &(struct clk_init_data){
  1518. .name = "vcodec_src",
  1519. .parent_names = mmcc_pxo_pll8_pll2,
  1520. .num_parents = 3,
  1521. .ops = &clk_dyn_rcg_ops,
  1522. },
  1523. },
  1524. };
  1525. static struct clk_branch vcodec_clk = {
  1526. .halt_reg = 0x01d0,
  1527. .halt_bit = 29,
  1528. .clkr = {
  1529. .enable_reg = 0x00f8,
  1530. .enable_mask = BIT(0),
  1531. .hw.init = &(struct clk_init_data){
  1532. .name = "vcodec_clk",
  1533. .parent_names = (const char *[]){ "vcodec_src" },
  1534. .num_parents = 1,
  1535. .ops = &clk_branch_ops,
  1536. .flags = CLK_SET_RATE_PARENT,
  1537. },
  1538. },
  1539. };
  1540. static struct freq_tbl clk_tbl_vpe[] = {
  1541. { 27000000, P_PXO, 1 },
  1542. { 34909000, P_PLL8, 11 },
  1543. { 38400000, P_PLL8, 10 },
  1544. { 64000000, P_PLL8, 6 },
  1545. { 76800000, P_PLL8, 5 },
  1546. { 96000000, P_PLL8, 4 },
  1547. { 100000000, P_PLL2, 8 },
  1548. { 160000000, P_PLL2, 5 },
  1549. { }
  1550. };
  1551. static struct clk_rcg vpe_src = {
  1552. .ns_reg = 0x0118,
  1553. .p = {
  1554. .pre_div_shift = 12,
  1555. .pre_div_width = 4,
  1556. },
  1557. .s = {
  1558. .src_sel_shift = 0,
  1559. .parent_map = mmcc_pxo_pll8_pll2_map,
  1560. },
  1561. .freq_tbl = clk_tbl_vpe,
  1562. .clkr = {
  1563. .enable_reg = 0x0110,
  1564. .enable_mask = BIT(2),
  1565. .hw.init = &(struct clk_init_data){
  1566. .name = "vpe_src",
  1567. .parent_names = mmcc_pxo_pll8_pll2,
  1568. .num_parents = 3,
  1569. .ops = &clk_rcg_ops,
  1570. },
  1571. },
  1572. };
  1573. static struct clk_branch vpe_clk = {
  1574. .halt_reg = 0x01c8,
  1575. .halt_bit = 28,
  1576. .clkr = {
  1577. .enable_reg = 0x0110,
  1578. .enable_mask = BIT(0),
  1579. .hw.init = &(struct clk_init_data){
  1580. .name = "vpe_clk",
  1581. .parent_names = (const char *[]){ "vpe_src" },
  1582. .num_parents = 1,
  1583. .ops = &clk_branch_ops,
  1584. .flags = CLK_SET_RATE_PARENT,
  1585. },
  1586. },
  1587. };
  1588. static struct freq_tbl clk_tbl_vfe[] = {
  1589. { 13960000, P_PLL8, 1, 2, 55 },
  1590. { 27000000, P_PXO, 1, 0, 0 },
  1591. { 36570000, P_PLL8, 1, 2, 21 },
  1592. { 38400000, P_PLL8, 2, 1, 5 },
  1593. { 45180000, P_PLL8, 1, 2, 17 },
  1594. { 48000000, P_PLL8, 2, 1, 4 },
  1595. { 54860000, P_PLL8, 1, 1, 7 },
  1596. { 64000000, P_PLL8, 2, 1, 3 },
  1597. { 76800000, P_PLL8, 1, 1, 5 },
  1598. { 96000000, P_PLL8, 2, 1, 2 },
  1599. { 109710000, P_PLL8, 1, 2, 7 },
  1600. { 128000000, P_PLL8, 1, 1, 3 },
  1601. { 153600000, P_PLL8, 1, 2, 5 },
  1602. { 200000000, P_PLL2, 2, 1, 2 },
  1603. { 228570000, P_PLL2, 1, 2, 7 },
  1604. { 266667000, P_PLL2, 1, 1, 3 },
  1605. { 320000000, P_PLL2, 1, 2, 5 },
  1606. { }
  1607. };
  1608. static struct clk_rcg vfe_src = {
  1609. .ns_reg = 0x0108,
  1610. .mn = {
  1611. .mnctr_en_bit = 5,
  1612. .mnctr_reset_bit = 7,
  1613. .mnctr_mode_shift = 6,
  1614. .n_val_shift = 16,
  1615. .m_val_shift = 8,
  1616. .width = 8,
  1617. },
  1618. .p = {
  1619. .pre_div_shift = 10,
  1620. .pre_div_width = 1,
  1621. },
  1622. .s = {
  1623. .src_sel_shift = 0,
  1624. .parent_map = mmcc_pxo_pll8_pll2_map,
  1625. },
  1626. .freq_tbl = clk_tbl_vfe,
  1627. .clkr = {
  1628. .enable_reg = 0x0104,
  1629. .enable_mask = BIT(2),
  1630. .hw.init = &(struct clk_init_data){
  1631. .name = "vfe_src",
  1632. .parent_names = mmcc_pxo_pll8_pll2,
  1633. .num_parents = 3,
  1634. .ops = &clk_rcg_ops,
  1635. },
  1636. },
  1637. };
  1638. static struct clk_branch vfe_clk = {
  1639. .halt_reg = 0x01cc,
  1640. .halt_bit = 6,
  1641. .clkr = {
  1642. .enable_reg = 0x0104,
  1643. .enable_mask = BIT(0),
  1644. .hw.init = &(struct clk_init_data){
  1645. .name = "vfe_clk",
  1646. .parent_names = (const char *[]){ "vfe_src" },
  1647. .num_parents = 1,
  1648. .ops = &clk_branch_ops,
  1649. .flags = CLK_SET_RATE_PARENT,
  1650. },
  1651. },
  1652. };
  1653. static struct clk_branch vfe_csi_clk = {
  1654. .halt_reg = 0x01cc,
  1655. .halt_bit = 8,
  1656. .clkr = {
  1657. .enable_reg = 0x0104,
  1658. .enable_mask = BIT(12),
  1659. .hw.init = &(struct clk_init_data){
  1660. .parent_names = (const char *[]){ "vfe_src" },
  1661. .num_parents = 1,
  1662. .name = "vfe_csi_clk",
  1663. .ops = &clk_branch_ops,
  1664. .flags = CLK_SET_RATE_PARENT,
  1665. },
  1666. },
  1667. };
  1668. static struct clk_branch gmem_axi_clk = {
  1669. .halt_reg = 0x01d8,
  1670. .halt_bit = 6,
  1671. .clkr = {
  1672. .enable_reg = 0x0018,
  1673. .enable_mask = BIT(24),
  1674. .hw.init = &(struct clk_init_data){
  1675. .name = "gmem_axi_clk",
  1676. .ops = &clk_branch_ops,
  1677. .flags = CLK_IS_ROOT,
  1678. },
  1679. },
  1680. };
  1681. static struct clk_branch ijpeg_axi_clk = {
  1682. .hwcg_reg = 0x0018,
  1683. .hwcg_bit = 11,
  1684. .halt_reg = 0x01d8,
  1685. .halt_bit = 4,
  1686. .clkr = {
  1687. .enable_reg = 0x0018,
  1688. .enable_mask = BIT(21),
  1689. .hw.init = &(struct clk_init_data){
  1690. .name = "ijpeg_axi_clk",
  1691. .ops = &clk_branch_ops,
  1692. .flags = CLK_IS_ROOT,
  1693. },
  1694. },
  1695. };
  1696. static struct clk_branch mmss_imem_axi_clk = {
  1697. .hwcg_reg = 0x0018,
  1698. .hwcg_bit = 15,
  1699. .halt_reg = 0x01d8,
  1700. .halt_bit = 7,
  1701. .clkr = {
  1702. .enable_reg = 0x0018,
  1703. .enable_mask = BIT(22),
  1704. .hw.init = &(struct clk_init_data){
  1705. .name = "mmss_imem_axi_clk",
  1706. .ops = &clk_branch_ops,
  1707. .flags = CLK_IS_ROOT,
  1708. },
  1709. },
  1710. };
  1711. static struct clk_branch jpegd_axi_clk = {
  1712. .halt_reg = 0x01d8,
  1713. .halt_bit = 5,
  1714. .clkr = {
  1715. .enable_reg = 0x0018,
  1716. .enable_mask = BIT(25),
  1717. .hw.init = &(struct clk_init_data){
  1718. .name = "jpegd_axi_clk",
  1719. .ops = &clk_branch_ops,
  1720. .flags = CLK_IS_ROOT,
  1721. },
  1722. },
  1723. };
  1724. static struct clk_branch vcodec_axi_b_clk = {
  1725. .hwcg_reg = 0x0114,
  1726. .hwcg_bit = 22,
  1727. .halt_reg = 0x01e8,
  1728. .halt_bit = 25,
  1729. .clkr = {
  1730. .enable_reg = 0x0114,
  1731. .enable_mask = BIT(23),
  1732. .hw.init = &(struct clk_init_data){
  1733. .name = "vcodec_axi_b_clk",
  1734. .ops = &clk_branch_ops,
  1735. .flags = CLK_IS_ROOT,
  1736. },
  1737. },
  1738. };
  1739. static struct clk_branch vcodec_axi_a_clk = {
  1740. .hwcg_reg = 0x0114,
  1741. .hwcg_bit = 24,
  1742. .halt_reg = 0x01e8,
  1743. .halt_bit = 26,
  1744. .clkr = {
  1745. .enable_reg = 0x0114,
  1746. .enable_mask = BIT(25),
  1747. .hw.init = &(struct clk_init_data){
  1748. .name = "vcodec_axi_a_clk",
  1749. .ops = &clk_branch_ops,
  1750. .flags = CLK_IS_ROOT,
  1751. },
  1752. },
  1753. };
  1754. static struct clk_branch vcodec_axi_clk = {
  1755. .hwcg_reg = 0x0018,
  1756. .hwcg_bit = 13,
  1757. .halt_reg = 0x01d8,
  1758. .halt_bit = 3,
  1759. .clkr = {
  1760. .enable_reg = 0x0018,
  1761. .enable_mask = BIT(19),
  1762. .hw.init = &(struct clk_init_data){
  1763. .name = "vcodec_axi_clk",
  1764. .ops = &clk_branch_ops,
  1765. .flags = CLK_IS_ROOT,
  1766. },
  1767. },
  1768. };
  1769. static struct clk_branch vfe_axi_clk = {
  1770. .halt_reg = 0x01d8,
  1771. .halt_bit = 0,
  1772. .clkr = {
  1773. .enable_reg = 0x0018,
  1774. .enable_mask = BIT(18),
  1775. .hw.init = &(struct clk_init_data){
  1776. .name = "vfe_axi_clk",
  1777. .ops = &clk_branch_ops,
  1778. .flags = CLK_IS_ROOT,
  1779. },
  1780. },
  1781. };
  1782. static struct clk_branch mdp_axi_clk = {
  1783. .hwcg_reg = 0x0018,
  1784. .hwcg_bit = 16,
  1785. .halt_reg = 0x01d8,
  1786. .halt_bit = 8,
  1787. .clkr = {
  1788. .enable_reg = 0x0018,
  1789. .enable_mask = BIT(23),
  1790. .hw.init = &(struct clk_init_data){
  1791. .name = "mdp_axi_clk",
  1792. .ops = &clk_branch_ops,
  1793. .flags = CLK_IS_ROOT,
  1794. },
  1795. },
  1796. };
  1797. static struct clk_branch rot_axi_clk = {
  1798. .hwcg_reg = 0x0020,
  1799. .hwcg_bit = 25,
  1800. .halt_reg = 0x01d8,
  1801. .halt_bit = 2,
  1802. .clkr = {
  1803. .enable_reg = 0x0020,
  1804. .enable_mask = BIT(24),
  1805. .hw.init = &(struct clk_init_data){
  1806. .name = "rot_axi_clk",
  1807. .ops = &clk_branch_ops,
  1808. .flags = CLK_IS_ROOT,
  1809. },
  1810. },
  1811. };
  1812. static struct clk_branch vcap_axi_clk = {
  1813. .halt_reg = 0x0240,
  1814. .halt_bit = 20,
  1815. .hwcg_reg = 0x0244,
  1816. .hwcg_bit = 11,
  1817. .clkr = {
  1818. .enable_reg = 0x0244,
  1819. .enable_mask = BIT(12),
  1820. .hw.init = &(struct clk_init_data){
  1821. .name = "vcap_axi_clk",
  1822. .ops = &clk_branch_ops,
  1823. .flags = CLK_IS_ROOT,
  1824. },
  1825. },
  1826. };
  1827. static struct clk_branch vpe_axi_clk = {
  1828. .hwcg_reg = 0x0020,
  1829. .hwcg_bit = 27,
  1830. .halt_reg = 0x01d8,
  1831. .halt_bit = 1,
  1832. .clkr = {
  1833. .enable_reg = 0x0020,
  1834. .enable_mask = BIT(26),
  1835. .hw.init = &(struct clk_init_data){
  1836. .name = "vpe_axi_clk",
  1837. .ops = &clk_branch_ops,
  1838. .flags = CLK_IS_ROOT,
  1839. },
  1840. },
  1841. };
  1842. static struct clk_branch gfx3d_axi_clk = {
  1843. .hwcg_reg = 0x0244,
  1844. .hwcg_bit = 24,
  1845. .halt_reg = 0x0240,
  1846. .halt_bit = 30,
  1847. .clkr = {
  1848. .enable_reg = 0x0244,
  1849. .enable_mask = BIT(25),
  1850. .hw.init = &(struct clk_init_data){
  1851. .name = "gfx3d_axi_clk",
  1852. .ops = &clk_branch_ops,
  1853. .flags = CLK_IS_ROOT,
  1854. },
  1855. },
  1856. };
  1857. static struct clk_branch amp_ahb_clk = {
  1858. .halt_reg = 0x01dc,
  1859. .halt_bit = 18,
  1860. .clkr = {
  1861. .enable_reg = 0x0008,
  1862. .enable_mask = BIT(24),
  1863. .hw.init = &(struct clk_init_data){
  1864. .name = "amp_ahb_clk",
  1865. .ops = &clk_branch_ops,
  1866. .flags = CLK_IS_ROOT,
  1867. },
  1868. },
  1869. };
  1870. static struct clk_branch csi_ahb_clk = {
  1871. .halt_reg = 0x01dc,
  1872. .halt_bit = 16,
  1873. .clkr = {
  1874. .enable_reg = 0x0008,
  1875. .enable_mask = BIT(7),
  1876. .hw.init = &(struct clk_init_data){
  1877. .name = "csi_ahb_clk",
  1878. .ops = &clk_branch_ops,
  1879. .flags = CLK_IS_ROOT
  1880. },
  1881. },
  1882. };
  1883. static struct clk_branch dsi_m_ahb_clk = {
  1884. .halt_reg = 0x01dc,
  1885. .halt_bit = 19,
  1886. .clkr = {
  1887. .enable_reg = 0x0008,
  1888. .enable_mask = BIT(9),
  1889. .hw.init = &(struct clk_init_data){
  1890. .name = "dsi_m_ahb_clk",
  1891. .ops = &clk_branch_ops,
  1892. .flags = CLK_IS_ROOT,
  1893. },
  1894. },
  1895. };
  1896. static struct clk_branch dsi_s_ahb_clk = {
  1897. .hwcg_reg = 0x0038,
  1898. .hwcg_bit = 20,
  1899. .halt_reg = 0x01dc,
  1900. .halt_bit = 21,
  1901. .clkr = {
  1902. .enable_reg = 0x0008,
  1903. .enable_mask = BIT(18),
  1904. .hw.init = &(struct clk_init_data){
  1905. .name = "dsi_s_ahb_clk",
  1906. .ops = &clk_branch_ops,
  1907. .flags = CLK_IS_ROOT,
  1908. },
  1909. },
  1910. };
  1911. static struct clk_branch dsi2_m_ahb_clk = {
  1912. .halt_reg = 0x01d8,
  1913. .halt_bit = 18,
  1914. .clkr = {
  1915. .enable_reg = 0x0008,
  1916. .enable_mask = BIT(17),
  1917. .hw.init = &(struct clk_init_data){
  1918. .name = "dsi2_m_ahb_clk",
  1919. .ops = &clk_branch_ops,
  1920. .flags = CLK_IS_ROOT
  1921. },
  1922. },
  1923. };
  1924. static struct clk_branch dsi2_s_ahb_clk = {
  1925. .hwcg_reg = 0x0038,
  1926. .hwcg_bit = 15,
  1927. .halt_reg = 0x01dc,
  1928. .halt_bit = 20,
  1929. .clkr = {
  1930. .enable_reg = 0x0008,
  1931. .enable_mask = BIT(22),
  1932. .hw.init = &(struct clk_init_data){
  1933. .name = "dsi2_s_ahb_clk",
  1934. .ops = &clk_branch_ops,
  1935. .flags = CLK_IS_ROOT,
  1936. },
  1937. },
  1938. };
  1939. static struct clk_rcg dsi1_src = {
  1940. .ns_reg = 0x0054,
  1941. .md_reg = 0x0050,
  1942. .mn = {
  1943. .mnctr_en_bit = 5,
  1944. .mnctr_reset_bit = 7,
  1945. .mnctr_mode_shift = 6,
  1946. .n_val_shift = 24,
  1947. .m_val_shift = 8,
  1948. .width = 8,
  1949. },
  1950. .p = {
  1951. .pre_div_shift = 14,
  1952. .pre_div_width = 2,
  1953. },
  1954. .s = {
  1955. .src_sel_shift = 0,
  1956. .parent_map = mmcc_pxo_dsi2_dsi1_map,
  1957. },
  1958. .clkr = {
  1959. .enable_reg = 0x004c,
  1960. .enable_mask = BIT(2),
  1961. .hw.init = &(struct clk_init_data){
  1962. .name = "dsi1_src",
  1963. .parent_names = mmcc_pxo_dsi2_dsi1,
  1964. .num_parents = 3,
  1965. .ops = &clk_rcg_bypass2_ops,
  1966. .flags = CLK_SET_RATE_PARENT,
  1967. },
  1968. },
  1969. };
  1970. static struct clk_branch dsi1_clk = {
  1971. .halt_reg = 0x01d0,
  1972. .halt_bit = 2,
  1973. .clkr = {
  1974. .enable_reg = 0x004c,
  1975. .enable_mask = BIT(0),
  1976. .hw.init = &(struct clk_init_data){
  1977. .name = "dsi1_clk",
  1978. .parent_names = (const char *[]){ "dsi1_src" },
  1979. .num_parents = 1,
  1980. .ops = &clk_branch_ops,
  1981. .flags = CLK_SET_RATE_PARENT,
  1982. },
  1983. },
  1984. };
  1985. static struct clk_rcg dsi2_src = {
  1986. .ns_reg = 0x012c,
  1987. .md_reg = 0x00a8,
  1988. .mn = {
  1989. .mnctr_en_bit = 5,
  1990. .mnctr_reset_bit = 7,
  1991. .mnctr_mode_shift = 6,
  1992. .n_val_shift = 24,
  1993. .m_val_shift = 8,
  1994. .width = 8,
  1995. },
  1996. .p = {
  1997. .pre_div_shift = 14,
  1998. .pre_div_width = 2,
  1999. },
  2000. .s = {
  2001. .src_sel_shift = 0,
  2002. .parent_map = mmcc_pxo_dsi2_dsi1_map,
  2003. },
  2004. .clkr = {
  2005. .enable_reg = 0x003c,
  2006. .enable_mask = BIT(2),
  2007. .hw.init = &(struct clk_init_data){
  2008. .name = "dsi2_src",
  2009. .parent_names = mmcc_pxo_dsi2_dsi1,
  2010. .num_parents = 3,
  2011. .ops = &clk_rcg_bypass2_ops,
  2012. .flags = CLK_SET_RATE_PARENT,
  2013. },
  2014. },
  2015. };
  2016. static struct clk_branch dsi2_clk = {
  2017. .halt_reg = 0x01d0,
  2018. .halt_bit = 20,
  2019. .clkr = {
  2020. .enable_reg = 0x003c,
  2021. .enable_mask = BIT(0),
  2022. .hw.init = &(struct clk_init_data){
  2023. .name = "dsi2_clk",
  2024. .parent_names = (const char *[]){ "dsi2_src" },
  2025. .num_parents = 1,
  2026. .ops = &clk_branch_ops,
  2027. .flags = CLK_SET_RATE_PARENT,
  2028. },
  2029. },
  2030. };
  2031. static struct clk_rcg dsi1_byte_src = {
  2032. .ns_reg = 0x00b0,
  2033. .p = {
  2034. .pre_div_shift = 12,
  2035. .pre_div_width = 4,
  2036. },
  2037. .s = {
  2038. .src_sel_shift = 0,
  2039. .parent_map = mmcc_pxo_dsi1_dsi2_byte_map,
  2040. },
  2041. .clkr = {
  2042. .enable_reg = 0x0090,
  2043. .enable_mask = BIT(2),
  2044. .hw.init = &(struct clk_init_data){
  2045. .name = "dsi1_byte_src",
  2046. .parent_names = mmcc_pxo_dsi1_dsi2_byte,
  2047. .num_parents = 3,
  2048. .ops = &clk_rcg_bypass2_ops,
  2049. .flags = CLK_SET_RATE_PARENT,
  2050. },
  2051. },
  2052. };
  2053. static struct clk_branch dsi1_byte_clk = {
  2054. .halt_reg = 0x01cc,
  2055. .halt_bit = 21,
  2056. .clkr = {
  2057. .enable_reg = 0x0090,
  2058. .enable_mask = BIT(0),
  2059. .hw.init = &(struct clk_init_data){
  2060. .name = "dsi1_byte_clk",
  2061. .parent_names = (const char *[]){ "dsi1_byte_src" },
  2062. .num_parents = 1,
  2063. .ops = &clk_branch_ops,
  2064. .flags = CLK_SET_RATE_PARENT,
  2065. },
  2066. },
  2067. };
  2068. static struct clk_rcg dsi2_byte_src = {
  2069. .ns_reg = 0x012c,
  2070. .p = {
  2071. .pre_div_shift = 12,
  2072. .pre_div_width = 4,
  2073. },
  2074. .s = {
  2075. .src_sel_shift = 0,
  2076. .parent_map = mmcc_pxo_dsi1_dsi2_byte_map,
  2077. },
  2078. .clkr = {
  2079. .enable_reg = 0x0130,
  2080. .enable_mask = BIT(2),
  2081. .hw.init = &(struct clk_init_data){
  2082. .name = "dsi2_byte_src",
  2083. .parent_names = mmcc_pxo_dsi1_dsi2_byte,
  2084. .num_parents = 3,
  2085. .ops = &clk_rcg_bypass2_ops,
  2086. .flags = CLK_SET_RATE_PARENT,
  2087. },
  2088. },
  2089. };
  2090. static struct clk_branch dsi2_byte_clk = {
  2091. .halt_reg = 0x01cc,
  2092. .halt_bit = 20,
  2093. .clkr = {
  2094. .enable_reg = 0x00b4,
  2095. .enable_mask = BIT(0),
  2096. .hw.init = &(struct clk_init_data){
  2097. .name = "dsi2_byte_clk",
  2098. .parent_names = (const char *[]){ "dsi2_byte_src" },
  2099. .num_parents = 1,
  2100. .ops = &clk_branch_ops,
  2101. .flags = CLK_SET_RATE_PARENT,
  2102. },
  2103. },
  2104. };
  2105. static struct clk_rcg dsi1_esc_src = {
  2106. .ns_reg = 0x0011c,
  2107. .p = {
  2108. .pre_div_shift = 12,
  2109. .pre_div_width = 4,
  2110. },
  2111. .s = {
  2112. .src_sel_shift = 0,
  2113. .parent_map = mmcc_pxo_dsi1_dsi2_byte_map,
  2114. },
  2115. .clkr = {
  2116. .enable_reg = 0x00cc,
  2117. .enable_mask = BIT(2),
  2118. .hw.init = &(struct clk_init_data){
  2119. .name = "dsi1_esc_src",
  2120. .parent_names = mmcc_pxo_dsi1_dsi2_byte,
  2121. .num_parents = 3,
  2122. .ops = &clk_rcg_esc_ops,
  2123. },
  2124. },
  2125. };
  2126. static struct clk_branch dsi1_esc_clk = {
  2127. .halt_reg = 0x01e8,
  2128. .halt_bit = 1,
  2129. .clkr = {
  2130. .enable_reg = 0x00cc,
  2131. .enable_mask = BIT(0),
  2132. .hw.init = &(struct clk_init_data){
  2133. .name = "dsi1_esc_clk",
  2134. .parent_names = (const char *[]){ "dsi1_esc_src" },
  2135. .num_parents = 1,
  2136. .ops = &clk_branch_ops,
  2137. .flags = CLK_SET_RATE_PARENT,
  2138. },
  2139. },
  2140. };
  2141. static struct clk_rcg dsi2_esc_src = {
  2142. .ns_reg = 0x0150,
  2143. .p = {
  2144. .pre_div_shift = 12,
  2145. .pre_div_width = 4,
  2146. },
  2147. .s = {
  2148. .src_sel_shift = 0,
  2149. .parent_map = mmcc_pxo_dsi1_dsi2_byte_map,
  2150. },
  2151. .clkr = {
  2152. .enable_reg = 0x013c,
  2153. .enable_mask = BIT(2),
  2154. .hw.init = &(struct clk_init_data){
  2155. .name = "dsi2_esc_src",
  2156. .parent_names = mmcc_pxo_dsi1_dsi2_byte,
  2157. .num_parents = 3,
  2158. .ops = &clk_rcg_esc_ops,
  2159. },
  2160. },
  2161. };
  2162. static struct clk_branch dsi2_esc_clk = {
  2163. .halt_reg = 0x01e8,
  2164. .halt_bit = 3,
  2165. .clkr = {
  2166. .enable_reg = 0x013c,
  2167. .enable_mask = BIT(0),
  2168. .hw.init = &(struct clk_init_data){
  2169. .name = "dsi2_esc_clk",
  2170. .parent_names = (const char *[]){ "dsi2_esc_src" },
  2171. .num_parents = 1,
  2172. .ops = &clk_branch_ops,
  2173. .flags = CLK_SET_RATE_PARENT,
  2174. },
  2175. },
  2176. };
  2177. static struct clk_rcg dsi1_pixel_src = {
  2178. .ns_reg = 0x0138,
  2179. .md_reg = 0x0134,
  2180. .mn = {
  2181. .mnctr_en_bit = 5,
  2182. .mnctr_reset_bit = 7,
  2183. .mnctr_mode_shift = 6,
  2184. .n_val_shift = 16,
  2185. .m_val_shift = 8,
  2186. .width = 8,
  2187. },
  2188. .p = {
  2189. .pre_div_shift = 12,
  2190. .pre_div_width = 4,
  2191. },
  2192. .s = {
  2193. .src_sel_shift = 0,
  2194. .parent_map = mmcc_pxo_dsi2_dsi1_map,
  2195. },
  2196. .clkr = {
  2197. .enable_reg = 0x0130,
  2198. .enable_mask = BIT(2),
  2199. .hw.init = &(struct clk_init_data){
  2200. .name = "dsi1_pixel_src",
  2201. .parent_names = mmcc_pxo_dsi2_dsi1,
  2202. .num_parents = 3,
  2203. .ops = &clk_rcg_pixel_ops,
  2204. },
  2205. },
  2206. };
  2207. static struct clk_branch dsi1_pixel_clk = {
  2208. .halt_reg = 0x01d0,
  2209. .halt_bit = 6,
  2210. .clkr = {
  2211. .enable_reg = 0x0130,
  2212. .enable_mask = BIT(0),
  2213. .hw.init = &(struct clk_init_data){
  2214. .name = "mdp_pclk1_clk",
  2215. .parent_names = (const char *[]){ "dsi1_pixel_src" },
  2216. .num_parents = 1,
  2217. .ops = &clk_branch_ops,
  2218. .flags = CLK_SET_RATE_PARENT,
  2219. },
  2220. },
  2221. };
  2222. static struct clk_rcg dsi2_pixel_src = {
  2223. .ns_reg = 0x00e4,
  2224. .md_reg = 0x00b8,
  2225. .mn = {
  2226. .mnctr_en_bit = 5,
  2227. .mnctr_reset_bit = 7,
  2228. .mnctr_mode_shift = 6,
  2229. .n_val_shift = 16,
  2230. .m_val_shift = 8,
  2231. .width = 8,
  2232. },
  2233. .p = {
  2234. .pre_div_shift = 12,
  2235. .pre_div_width = 4,
  2236. },
  2237. .s = {
  2238. .src_sel_shift = 0,
  2239. .parent_map = mmcc_pxo_dsi2_dsi1_map,
  2240. },
  2241. .clkr = {
  2242. .enable_reg = 0x0094,
  2243. .enable_mask = BIT(2),
  2244. .hw.init = &(struct clk_init_data){
  2245. .name = "dsi2_pixel_src",
  2246. .parent_names = mmcc_pxo_dsi2_dsi1,
  2247. .num_parents = 3,
  2248. .ops = &clk_rcg_pixel_ops,
  2249. },
  2250. },
  2251. };
  2252. static struct clk_branch dsi2_pixel_clk = {
  2253. .halt_reg = 0x01d0,
  2254. .halt_bit = 19,
  2255. .clkr = {
  2256. .enable_reg = 0x0094,
  2257. .enable_mask = BIT(0),
  2258. .hw.init = &(struct clk_init_data){
  2259. .name = "mdp_pclk2_clk",
  2260. .parent_names = (const char *[]){ "dsi2_pixel_src" },
  2261. .num_parents = 1,
  2262. .ops = &clk_branch_ops,
  2263. .flags = CLK_SET_RATE_PARENT,
  2264. },
  2265. },
  2266. };
  2267. static struct clk_branch gfx2d0_ahb_clk = {
  2268. .hwcg_reg = 0x0038,
  2269. .hwcg_bit = 28,
  2270. .halt_reg = 0x01dc,
  2271. .halt_bit = 2,
  2272. .clkr = {
  2273. .enable_reg = 0x0008,
  2274. .enable_mask = BIT(19),
  2275. .hw.init = &(struct clk_init_data){
  2276. .name = "gfx2d0_ahb_clk",
  2277. .ops = &clk_branch_ops,
  2278. .flags = CLK_IS_ROOT,
  2279. },
  2280. },
  2281. };
  2282. static struct clk_branch gfx2d1_ahb_clk = {
  2283. .hwcg_reg = 0x0038,
  2284. .hwcg_bit = 29,
  2285. .halt_reg = 0x01dc,
  2286. .halt_bit = 3,
  2287. .clkr = {
  2288. .enable_reg = 0x0008,
  2289. .enable_mask = BIT(2),
  2290. .hw.init = &(struct clk_init_data){
  2291. .name = "gfx2d1_ahb_clk",
  2292. .ops = &clk_branch_ops,
  2293. .flags = CLK_IS_ROOT,
  2294. },
  2295. },
  2296. };
  2297. static struct clk_branch gfx3d_ahb_clk = {
  2298. .hwcg_reg = 0x0038,
  2299. .hwcg_bit = 27,
  2300. .halt_reg = 0x01dc,
  2301. .halt_bit = 4,
  2302. .clkr = {
  2303. .enable_reg = 0x0008,
  2304. .enable_mask = BIT(3),
  2305. .hw.init = &(struct clk_init_data){
  2306. .name = "gfx3d_ahb_clk",
  2307. .ops = &clk_branch_ops,
  2308. .flags = CLK_IS_ROOT,
  2309. },
  2310. },
  2311. };
  2312. static struct clk_branch hdmi_m_ahb_clk = {
  2313. .hwcg_reg = 0x0038,
  2314. .hwcg_bit = 21,
  2315. .halt_reg = 0x01dc,
  2316. .halt_bit = 5,
  2317. .clkr = {
  2318. .enable_reg = 0x0008,
  2319. .enable_mask = BIT(14),
  2320. .hw.init = &(struct clk_init_data){
  2321. .name = "hdmi_m_ahb_clk",
  2322. .ops = &clk_branch_ops,
  2323. .flags = CLK_IS_ROOT,
  2324. },
  2325. },
  2326. };
  2327. static struct clk_branch hdmi_s_ahb_clk = {
  2328. .hwcg_reg = 0x0038,
  2329. .hwcg_bit = 22,
  2330. .halt_reg = 0x01dc,
  2331. .halt_bit = 6,
  2332. .clkr = {
  2333. .enable_reg = 0x0008,
  2334. .enable_mask = BIT(4),
  2335. .hw.init = &(struct clk_init_data){
  2336. .name = "hdmi_s_ahb_clk",
  2337. .ops = &clk_branch_ops,
  2338. .flags = CLK_IS_ROOT,
  2339. },
  2340. },
  2341. };
  2342. static struct clk_branch ijpeg_ahb_clk = {
  2343. .halt_reg = 0x01dc,
  2344. .halt_bit = 9,
  2345. .clkr = {
  2346. .enable_reg = 0x0008,
  2347. .enable_mask = BIT(5),
  2348. .hw.init = &(struct clk_init_data){
  2349. .name = "ijpeg_ahb_clk",
  2350. .ops = &clk_branch_ops,
  2351. .flags = CLK_IS_ROOT
  2352. },
  2353. },
  2354. };
  2355. static struct clk_branch mmss_imem_ahb_clk = {
  2356. .hwcg_reg = 0x0038,
  2357. .hwcg_bit = 12,
  2358. .halt_reg = 0x01dc,
  2359. .halt_bit = 10,
  2360. .clkr = {
  2361. .enable_reg = 0x0008,
  2362. .enable_mask = BIT(6),
  2363. .hw.init = &(struct clk_init_data){
  2364. .name = "mmss_imem_ahb_clk",
  2365. .ops = &clk_branch_ops,
  2366. .flags = CLK_IS_ROOT
  2367. },
  2368. },
  2369. };
  2370. static struct clk_branch jpegd_ahb_clk = {
  2371. .halt_reg = 0x01dc,
  2372. .halt_bit = 7,
  2373. .clkr = {
  2374. .enable_reg = 0x0008,
  2375. .enable_mask = BIT(21),
  2376. .hw.init = &(struct clk_init_data){
  2377. .name = "jpegd_ahb_clk",
  2378. .ops = &clk_branch_ops,
  2379. .flags = CLK_IS_ROOT,
  2380. },
  2381. },
  2382. };
  2383. static struct clk_branch mdp_ahb_clk = {
  2384. .halt_reg = 0x01dc,
  2385. .halt_bit = 11,
  2386. .clkr = {
  2387. .enable_reg = 0x0008,
  2388. .enable_mask = BIT(10),
  2389. .hw.init = &(struct clk_init_data){
  2390. .name = "mdp_ahb_clk",
  2391. .ops = &clk_branch_ops,
  2392. .flags = CLK_IS_ROOT,
  2393. },
  2394. },
  2395. };
  2396. static struct clk_branch rot_ahb_clk = {
  2397. .halt_reg = 0x01dc,
  2398. .halt_bit = 13,
  2399. .clkr = {
  2400. .enable_reg = 0x0008,
  2401. .enable_mask = BIT(12),
  2402. .hw.init = &(struct clk_init_data){
  2403. .name = "rot_ahb_clk",
  2404. .ops = &clk_branch_ops,
  2405. .flags = CLK_IS_ROOT
  2406. },
  2407. },
  2408. };
  2409. static struct clk_branch smmu_ahb_clk = {
  2410. .hwcg_reg = 0x0008,
  2411. .hwcg_bit = 26,
  2412. .halt_reg = 0x01dc,
  2413. .halt_bit = 22,
  2414. .clkr = {
  2415. .enable_reg = 0x0008,
  2416. .enable_mask = BIT(15),
  2417. .hw.init = &(struct clk_init_data){
  2418. .name = "smmu_ahb_clk",
  2419. .ops = &clk_branch_ops,
  2420. .flags = CLK_IS_ROOT,
  2421. },
  2422. },
  2423. };
  2424. static struct clk_branch tv_enc_ahb_clk = {
  2425. .halt_reg = 0x01dc,
  2426. .halt_bit = 23,
  2427. .clkr = {
  2428. .enable_reg = 0x0008,
  2429. .enable_mask = BIT(25),
  2430. .hw.init = &(struct clk_init_data){
  2431. .name = "tv_enc_ahb_clk",
  2432. .ops = &clk_branch_ops,
  2433. .flags = CLK_IS_ROOT,
  2434. },
  2435. },
  2436. };
  2437. static struct clk_branch vcap_ahb_clk = {
  2438. .halt_reg = 0x0240,
  2439. .halt_bit = 23,
  2440. .clkr = {
  2441. .enable_reg = 0x0248,
  2442. .enable_mask = BIT(1),
  2443. .hw.init = &(struct clk_init_data){
  2444. .name = "vcap_ahb_clk",
  2445. .ops = &clk_branch_ops,
  2446. .flags = CLK_IS_ROOT,
  2447. },
  2448. },
  2449. };
  2450. static struct clk_branch vcodec_ahb_clk = {
  2451. .hwcg_reg = 0x0038,
  2452. .hwcg_bit = 26,
  2453. .halt_reg = 0x01dc,
  2454. .halt_bit = 12,
  2455. .clkr = {
  2456. .enable_reg = 0x0008,
  2457. .enable_mask = BIT(11),
  2458. .hw.init = &(struct clk_init_data){
  2459. .name = "vcodec_ahb_clk",
  2460. .ops = &clk_branch_ops,
  2461. .flags = CLK_IS_ROOT,
  2462. },
  2463. },
  2464. };
  2465. static struct clk_branch vfe_ahb_clk = {
  2466. .halt_reg = 0x01dc,
  2467. .halt_bit = 14,
  2468. .clkr = {
  2469. .enable_reg = 0x0008,
  2470. .enable_mask = BIT(13),
  2471. .hw.init = &(struct clk_init_data){
  2472. .name = "vfe_ahb_clk",
  2473. .ops = &clk_branch_ops,
  2474. .flags = CLK_IS_ROOT,
  2475. },
  2476. },
  2477. };
  2478. static struct clk_branch vpe_ahb_clk = {
  2479. .halt_reg = 0x01dc,
  2480. .halt_bit = 15,
  2481. .clkr = {
  2482. .enable_reg = 0x0008,
  2483. .enable_mask = BIT(16),
  2484. .hw.init = &(struct clk_init_data){
  2485. .name = "vpe_ahb_clk",
  2486. .ops = &clk_branch_ops,
  2487. .flags = CLK_IS_ROOT,
  2488. },
  2489. },
  2490. };
  2491. static struct clk_regmap *mmcc_msm8960_clks[] = {
  2492. [TV_ENC_AHB_CLK] = &tv_enc_ahb_clk.clkr,
  2493. [AMP_AHB_CLK] = &amp_ahb_clk.clkr,
  2494. [DSI2_S_AHB_CLK] = &dsi2_s_ahb_clk.clkr,
  2495. [JPEGD_AHB_CLK] = &jpegd_ahb_clk.clkr,
  2496. [GFX2D0_AHB_CLK] = &gfx2d0_ahb_clk.clkr,
  2497. [DSI_S_AHB_CLK] = &dsi_s_ahb_clk.clkr,
  2498. [DSI2_M_AHB_CLK] = &dsi2_m_ahb_clk.clkr,
  2499. [VPE_AHB_CLK] = &vpe_ahb_clk.clkr,
  2500. [SMMU_AHB_CLK] = &smmu_ahb_clk.clkr,
  2501. [HDMI_M_AHB_CLK] = &hdmi_m_ahb_clk.clkr,
  2502. [VFE_AHB_CLK] = &vfe_ahb_clk.clkr,
  2503. [ROT_AHB_CLK] = &rot_ahb_clk.clkr,
  2504. [VCODEC_AHB_CLK] = &vcodec_ahb_clk.clkr,
  2505. [MDP_AHB_CLK] = &mdp_ahb_clk.clkr,
  2506. [DSI_M_AHB_CLK] = &dsi_m_ahb_clk.clkr,
  2507. [CSI_AHB_CLK] = &csi_ahb_clk.clkr,
  2508. [MMSS_IMEM_AHB_CLK] = &mmss_imem_ahb_clk.clkr,
  2509. [IJPEG_AHB_CLK] = &ijpeg_ahb_clk.clkr,
  2510. [HDMI_S_AHB_CLK] = &hdmi_s_ahb_clk.clkr,
  2511. [GFX3D_AHB_CLK] = &gfx3d_ahb_clk.clkr,
  2512. [GFX2D1_AHB_CLK] = &gfx2d1_ahb_clk.clkr,
  2513. [JPEGD_AXI_CLK] = &jpegd_axi_clk.clkr,
  2514. [GMEM_AXI_CLK] = &gmem_axi_clk.clkr,
  2515. [MDP_AXI_CLK] = &mdp_axi_clk.clkr,
  2516. [MMSS_IMEM_AXI_CLK] = &mmss_imem_axi_clk.clkr,
  2517. [IJPEG_AXI_CLK] = &ijpeg_axi_clk.clkr,
  2518. [GFX3D_AXI_CLK] = &gfx3d_axi_clk.clkr,
  2519. [VCODEC_AXI_CLK] = &vcodec_axi_clk.clkr,
  2520. [VFE_AXI_CLK] = &vfe_axi_clk.clkr,
  2521. [VPE_AXI_CLK] = &vpe_axi_clk.clkr,
  2522. [ROT_AXI_CLK] = &rot_axi_clk.clkr,
  2523. [VCODEC_AXI_A_CLK] = &vcodec_axi_a_clk.clkr,
  2524. [VCODEC_AXI_B_CLK] = &vcodec_axi_b_clk.clkr,
  2525. [CSI0_SRC] = &csi0_src.clkr,
  2526. [CSI0_CLK] = &csi0_clk.clkr,
  2527. [CSI0_PHY_CLK] = &csi0_phy_clk.clkr,
  2528. [CSI1_SRC] = &csi1_src.clkr,
  2529. [CSI1_CLK] = &csi1_clk.clkr,
  2530. [CSI1_PHY_CLK] = &csi1_phy_clk.clkr,
  2531. [CSI2_SRC] = &csi2_src.clkr,
  2532. [CSI2_CLK] = &csi2_clk.clkr,
  2533. [CSI2_PHY_CLK] = &csi2_phy_clk.clkr,
  2534. [DSI_SRC] = &dsi1_src.clkr,
  2535. [DSI_CLK] = &dsi1_clk.clkr,
  2536. [CSI_PIX_CLK] = &csi_pix_clk.clkr,
  2537. [CSI_RDI_CLK] = &csi_rdi_clk.clkr,
  2538. [MDP_VSYNC_CLK] = &mdp_vsync_clk.clkr,
  2539. [HDMI_APP_CLK] = &hdmi_app_clk.clkr,
  2540. [CSI_PIX1_CLK] = &csi_pix1_clk.clkr,
  2541. [CSI_RDI2_CLK] = &csi_rdi2_clk.clkr,
  2542. [CSI_RDI1_CLK] = &csi_rdi1_clk.clkr,
  2543. [GFX2D0_SRC] = &gfx2d0_src.clkr,
  2544. [GFX2D0_CLK] = &gfx2d0_clk.clkr,
  2545. [GFX2D1_SRC] = &gfx2d1_src.clkr,
  2546. [GFX2D1_CLK] = &gfx2d1_clk.clkr,
  2547. [GFX3D_SRC] = &gfx3d_src.clkr,
  2548. [GFX3D_CLK] = &gfx3d_clk.clkr,
  2549. [IJPEG_SRC] = &ijpeg_src.clkr,
  2550. [IJPEG_CLK] = &ijpeg_clk.clkr,
  2551. [JPEGD_SRC] = &jpegd_src.clkr,
  2552. [JPEGD_CLK] = &jpegd_clk.clkr,
  2553. [MDP_SRC] = &mdp_src.clkr,
  2554. [MDP_CLK] = &mdp_clk.clkr,
  2555. [MDP_LUT_CLK] = &mdp_lut_clk.clkr,
  2556. [DSI2_PIXEL_SRC] = &dsi2_pixel_src.clkr,
  2557. [DSI2_PIXEL_CLK] = &dsi2_pixel_clk.clkr,
  2558. [DSI2_SRC] = &dsi2_src.clkr,
  2559. [DSI2_CLK] = &dsi2_clk.clkr,
  2560. [DSI1_BYTE_SRC] = &dsi1_byte_src.clkr,
  2561. [DSI1_BYTE_CLK] = &dsi1_byte_clk.clkr,
  2562. [DSI2_BYTE_SRC] = &dsi2_byte_src.clkr,
  2563. [DSI2_BYTE_CLK] = &dsi2_byte_clk.clkr,
  2564. [DSI1_ESC_SRC] = &dsi1_esc_src.clkr,
  2565. [DSI1_ESC_CLK] = &dsi1_esc_clk.clkr,
  2566. [DSI2_ESC_SRC] = &dsi2_esc_src.clkr,
  2567. [DSI2_ESC_CLK] = &dsi2_esc_clk.clkr,
  2568. [ROT_SRC] = &rot_src.clkr,
  2569. [ROT_CLK] = &rot_clk.clkr,
  2570. [TV_ENC_CLK] = &tv_enc_clk.clkr,
  2571. [TV_DAC_CLK] = &tv_dac_clk.clkr,
  2572. [HDMI_TV_CLK] = &hdmi_tv_clk.clkr,
  2573. [MDP_TV_CLK] = &mdp_tv_clk.clkr,
  2574. [TV_SRC] = &tv_src.clkr,
  2575. [VCODEC_SRC] = &vcodec_src.clkr,
  2576. [VCODEC_CLK] = &vcodec_clk.clkr,
  2577. [VFE_SRC] = &vfe_src.clkr,
  2578. [VFE_CLK] = &vfe_clk.clkr,
  2579. [VFE_CSI_CLK] = &vfe_csi_clk.clkr,
  2580. [VPE_SRC] = &vpe_src.clkr,
  2581. [VPE_CLK] = &vpe_clk.clkr,
  2582. [DSI_PIXEL_SRC] = &dsi1_pixel_src.clkr,
  2583. [DSI_PIXEL_CLK] = &dsi1_pixel_clk.clkr,
  2584. [CAMCLK0_SRC] = &camclk0_src.clkr,
  2585. [CAMCLK0_CLK] = &camclk0_clk.clkr,
  2586. [CAMCLK1_SRC] = &camclk1_src.clkr,
  2587. [CAMCLK1_CLK] = &camclk1_clk.clkr,
  2588. [CAMCLK2_SRC] = &camclk2_src.clkr,
  2589. [CAMCLK2_CLK] = &camclk2_clk.clkr,
  2590. [CSIPHYTIMER_SRC] = &csiphytimer_src.clkr,
  2591. [CSIPHY2_TIMER_CLK] = &csiphy2_timer_clk.clkr,
  2592. [CSIPHY1_TIMER_CLK] = &csiphy1_timer_clk.clkr,
  2593. [CSIPHY0_TIMER_CLK] = &csiphy0_timer_clk.clkr,
  2594. [PLL2] = &pll2.clkr,
  2595. };
  2596. static const struct qcom_reset_map mmcc_msm8960_resets[] = {
  2597. [VPE_AXI_RESET] = { 0x0208, 15 },
  2598. [IJPEG_AXI_RESET] = { 0x0208, 14 },
  2599. [MPD_AXI_RESET] = { 0x0208, 13 },
  2600. [VFE_AXI_RESET] = { 0x0208, 9 },
  2601. [SP_AXI_RESET] = { 0x0208, 8 },
  2602. [VCODEC_AXI_RESET] = { 0x0208, 7 },
  2603. [ROT_AXI_RESET] = { 0x0208, 6 },
  2604. [VCODEC_AXI_A_RESET] = { 0x0208, 5 },
  2605. [VCODEC_AXI_B_RESET] = { 0x0208, 4 },
  2606. [FAB_S3_AXI_RESET] = { 0x0208, 3 },
  2607. [FAB_S2_AXI_RESET] = { 0x0208, 2 },
  2608. [FAB_S1_AXI_RESET] = { 0x0208, 1 },
  2609. [FAB_S0_AXI_RESET] = { 0x0208 },
  2610. [SMMU_GFX3D_ABH_RESET] = { 0x020c, 31 },
  2611. [SMMU_VPE_AHB_RESET] = { 0x020c, 30 },
  2612. [SMMU_VFE_AHB_RESET] = { 0x020c, 29 },
  2613. [SMMU_ROT_AHB_RESET] = { 0x020c, 28 },
  2614. [SMMU_VCODEC_B_AHB_RESET] = { 0x020c, 27 },
  2615. [SMMU_VCODEC_A_AHB_RESET] = { 0x020c, 26 },
  2616. [SMMU_MDP1_AHB_RESET] = { 0x020c, 25 },
  2617. [SMMU_MDP0_AHB_RESET] = { 0x020c, 24 },
  2618. [SMMU_JPEGD_AHB_RESET] = { 0x020c, 23 },
  2619. [SMMU_IJPEG_AHB_RESET] = { 0x020c, 22 },
  2620. [SMMU_GFX2D0_AHB_RESET] = { 0x020c, 21 },
  2621. [SMMU_GFX2D1_AHB_RESET] = { 0x020c, 20 },
  2622. [APU_AHB_RESET] = { 0x020c, 18 },
  2623. [CSI_AHB_RESET] = { 0x020c, 17 },
  2624. [TV_ENC_AHB_RESET] = { 0x020c, 15 },
  2625. [VPE_AHB_RESET] = { 0x020c, 14 },
  2626. [FABRIC_AHB_RESET] = { 0x020c, 13 },
  2627. [GFX2D0_AHB_RESET] = { 0x020c, 12 },
  2628. [GFX2D1_AHB_RESET] = { 0x020c, 11 },
  2629. [GFX3D_AHB_RESET] = { 0x020c, 10 },
  2630. [HDMI_AHB_RESET] = { 0x020c, 9 },
  2631. [MSSS_IMEM_AHB_RESET] = { 0x020c, 8 },
  2632. [IJPEG_AHB_RESET] = { 0x020c, 7 },
  2633. [DSI_M_AHB_RESET] = { 0x020c, 6 },
  2634. [DSI_S_AHB_RESET] = { 0x020c, 5 },
  2635. [JPEGD_AHB_RESET] = { 0x020c, 4 },
  2636. [MDP_AHB_RESET] = { 0x020c, 3 },
  2637. [ROT_AHB_RESET] = { 0x020c, 2 },
  2638. [VCODEC_AHB_RESET] = { 0x020c, 1 },
  2639. [VFE_AHB_RESET] = { 0x020c, 0 },
  2640. [DSI2_M_AHB_RESET] = { 0x0210, 31 },
  2641. [DSI2_S_AHB_RESET] = { 0x0210, 30 },
  2642. [CSIPHY2_RESET] = { 0x0210, 29 },
  2643. [CSI_PIX1_RESET] = { 0x0210, 28 },
  2644. [CSIPHY0_RESET] = { 0x0210, 27 },
  2645. [CSIPHY1_RESET] = { 0x0210, 26 },
  2646. [DSI2_RESET] = { 0x0210, 25 },
  2647. [VFE_CSI_RESET] = { 0x0210, 24 },
  2648. [MDP_RESET] = { 0x0210, 21 },
  2649. [AMP_RESET] = { 0x0210, 20 },
  2650. [JPEGD_RESET] = { 0x0210, 19 },
  2651. [CSI1_RESET] = { 0x0210, 18 },
  2652. [VPE_RESET] = { 0x0210, 17 },
  2653. [MMSS_FABRIC_RESET] = { 0x0210, 16 },
  2654. [VFE_RESET] = { 0x0210, 15 },
  2655. [GFX2D0_RESET] = { 0x0210, 14 },
  2656. [GFX2D1_RESET] = { 0x0210, 13 },
  2657. [GFX3D_RESET] = { 0x0210, 12 },
  2658. [HDMI_RESET] = { 0x0210, 11 },
  2659. [MMSS_IMEM_RESET] = { 0x0210, 10 },
  2660. [IJPEG_RESET] = { 0x0210, 9 },
  2661. [CSI0_RESET] = { 0x0210, 8 },
  2662. [DSI_RESET] = { 0x0210, 7 },
  2663. [VCODEC_RESET] = { 0x0210, 6 },
  2664. [MDP_TV_RESET] = { 0x0210, 4 },
  2665. [MDP_VSYNC_RESET] = { 0x0210, 3 },
  2666. [ROT_RESET] = { 0x0210, 2 },
  2667. [TV_HDMI_RESET] = { 0x0210, 1 },
  2668. [TV_ENC_RESET] = { 0x0210 },
  2669. [CSI2_RESET] = { 0x0214, 2 },
  2670. [CSI_RDI1_RESET] = { 0x0214, 1 },
  2671. [CSI_RDI2_RESET] = { 0x0214 },
  2672. };
  2673. static struct clk_regmap *mmcc_apq8064_clks[] = {
  2674. [AMP_AHB_CLK] = &amp_ahb_clk.clkr,
  2675. [DSI2_S_AHB_CLK] = &dsi2_s_ahb_clk.clkr,
  2676. [JPEGD_AHB_CLK] = &jpegd_ahb_clk.clkr,
  2677. [DSI_S_AHB_CLK] = &dsi_s_ahb_clk.clkr,
  2678. [DSI2_M_AHB_CLK] = &dsi2_m_ahb_clk.clkr,
  2679. [VPE_AHB_CLK] = &vpe_ahb_clk.clkr,
  2680. [SMMU_AHB_CLK] = &smmu_ahb_clk.clkr,
  2681. [HDMI_M_AHB_CLK] = &hdmi_m_ahb_clk.clkr,
  2682. [VFE_AHB_CLK] = &vfe_ahb_clk.clkr,
  2683. [ROT_AHB_CLK] = &rot_ahb_clk.clkr,
  2684. [VCODEC_AHB_CLK] = &vcodec_ahb_clk.clkr,
  2685. [MDP_AHB_CLK] = &mdp_ahb_clk.clkr,
  2686. [DSI_M_AHB_CLK] = &dsi_m_ahb_clk.clkr,
  2687. [CSI_AHB_CLK] = &csi_ahb_clk.clkr,
  2688. [MMSS_IMEM_AHB_CLK] = &mmss_imem_ahb_clk.clkr,
  2689. [IJPEG_AHB_CLK] = &ijpeg_ahb_clk.clkr,
  2690. [HDMI_S_AHB_CLK] = &hdmi_s_ahb_clk.clkr,
  2691. [GFX3D_AHB_CLK] = &gfx3d_ahb_clk.clkr,
  2692. [JPEGD_AXI_CLK] = &jpegd_axi_clk.clkr,
  2693. [GMEM_AXI_CLK] = &gmem_axi_clk.clkr,
  2694. [MDP_AXI_CLK] = &mdp_axi_clk.clkr,
  2695. [MMSS_IMEM_AXI_CLK] = &mmss_imem_axi_clk.clkr,
  2696. [IJPEG_AXI_CLK] = &ijpeg_axi_clk.clkr,
  2697. [GFX3D_AXI_CLK] = &gfx3d_axi_clk.clkr,
  2698. [VCODEC_AXI_CLK] = &vcodec_axi_clk.clkr,
  2699. [VFE_AXI_CLK] = &vfe_axi_clk.clkr,
  2700. [VPE_AXI_CLK] = &vpe_axi_clk.clkr,
  2701. [ROT_AXI_CLK] = &rot_axi_clk.clkr,
  2702. [VCODEC_AXI_A_CLK] = &vcodec_axi_a_clk.clkr,
  2703. [VCODEC_AXI_B_CLK] = &vcodec_axi_b_clk.clkr,
  2704. [CSI0_SRC] = &csi0_src.clkr,
  2705. [CSI0_CLK] = &csi0_clk.clkr,
  2706. [CSI0_PHY_CLK] = &csi0_phy_clk.clkr,
  2707. [CSI1_SRC] = &csi1_src.clkr,
  2708. [CSI1_CLK] = &csi1_clk.clkr,
  2709. [CSI1_PHY_CLK] = &csi1_phy_clk.clkr,
  2710. [CSI2_SRC] = &csi2_src.clkr,
  2711. [CSI2_CLK] = &csi2_clk.clkr,
  2712. [CSI2_PHY_CLK] = &csi2_phy_clk.clkr,
  2713. [DSI_SRC] = &dsi1_src.clkr,
  2714. [DSI_CLK] = &dsi1_clk.clkr,
  2715. [CSI_PIX_CLK] = &csi_pix_clk.clkr,
  2716. [CSI_RDI_CLK] = &csi_rdi_clk.clkr,
  2717. [MDP_VSYNC_CLK] = &mdp_vsync_clk.clkr,
  2718. [HDMI_APP_CLK] = &hdmi_app_clk.clkr,
  2719. [CSI_PIX1_CLK] = &csi_pix1_clk.clkr,
  2720. [CSI_RDI2_CLK] = &csi_rdi2_clk.clkr,
  2721. [CSI_RDI1_CLK] = &csi_rdi1_clk.clkr,
  2722. [GFX3D_SRC] = &gfx3d_src.clkr,
  2723. [GFX3D_CLK] = &gfx3d_clk.clkr,
  2724. [IJPEG_SRC] = &ijpeg_src.clkr,
  2725. [IJPEG_CLK] = &ijpeg_clk.clkr,
  2726. [JPEGD_SRC] = &jpegd_src.clkr,
  2727. [JPEGD_CLK] = &jpegd_clk.clkr,
  2728. [MDP_SRC] = &mdp_src.clkr,
  2729. [MDP_CLK] = &mdp_clk.clkr,
  2730. [MDP_LUT_CLK] = &mdp_lut_clk.clkr,
  2731. [DSI2_PIXEL_SRC] = &dsi2_pixel_src.clkr,
  2732. [DSI2_PIXEL_CLK] = &dsi2_pixel_clk.clkr,
  2733. [DSI2_SRC] = &dsi2_src.clkr,
  2734. [DSI2_CLK] = &dsi2_clk.clkr,
  2735. [DSI1_BYTE_SRC] = &dsi1_byte_src.clkr,
  2736. [DSI1_BYTE_CLK] = &dsi1_byte_clk.clkr,
  2737. [DSI2_BYTE_SRC] = &dsi2_byte_src.clkr,
  2738. [DSI2_BYTE_CLK] = &dsi2_byte_clk.clkr,
  2739. [DSI1_ESC_SRC] = &dsi1_esc_src.clkr,
  2740. [DSI1_ESC_CLK] = &dsi1_esc_clk.clkr,
  2741. [DSI2_ESC_SRC] = &dsi2_esc_src.clkr,
  2742. [DSI2_ESC_CLK] = &dsi2_esc_clk.clkr,
  2743. [ROT_SRC] = &rot_src.clkr,
  2744. [ROT_CLK] = &rot_clk.clkr,
  2745. [TV_DAC_CLK] = &tv_dac_clk.clkr,
  2746. [HDMI_TV_CLK] = &hdmi_tv_clk.clkr,
  2747. [MDP_TV_CLK] = &mdp_tv_clk.clkr,
  2748. [TV_SRC] = &tv_src.clkr,
  2749. [VCODEC_SRC] = &vcodec_src.clkr,
  2750. [VCODEC_CLK] = &vcodec_clk.clkr,
  2751. [VFE_SRC] = &vfe_src.clkr,
  2752. [VFE_CLK] = &vfe_clk.clkr,
  2753. [VFE_CSI_CLK] = &vfe_csi_clk.clkr,
  2754. [VPE_SRC] = &vpe_src.clkr,
  2755. [VPE_CLK] = &vpe_clk.clkr,
  2756. [DSI_PIXEL_SRC] = &dsi1_pixel_src.clkr,
  2757. [DSI_PIXEL_CLK] = &dsi1_pixel_clk.clkr,
  2758. [CAMCLK0_SRC] = &camclk0_src.clkr,
  2759. [CAMCLK0_CLK] = &camclk0_clk.clkr,
  2760. [CAMCLK1_SRC] = &camclk1_src.clkr,
  2761. [CAMCLK1_CLK] = &camclk1_clk.clkr,
  2762. [CAMCLK2_SRC] = &camclk2_src.clkr,
  2763. [CAMCLK2_CLK] = &camclk2_clk.clkr,
  2764. [CSIPHYTIMER_SRC] = &csiphytimer_src.clkr,
  2765. [CSIPHY2_TIMER_CLK] = &csiphy2_timer_clk.clkr,
  2766. [CSIPHY1_TIMER_CLK] = &csiphy1_timer_clk.clkr,
  2767. [CSIPHY0_TIMER_CLK] = &csiphy0_timer_clk.clkr,
  2768. [PLL2] = &pll2.clkr,
  2769. [RGB_TV_CLK] = &rgb_tv_clk.clkr,
  2770. [NPL_TV_CLK] = &npl_tv_clk.clkr,
  2771. [VCAP_AHB_CLK] = &vcap_ahb_clk.clkr,
  2772. [VCAP_AXI_CLK] = &vcap_axi_clk.clkr,
  2773. [VCAP_SRC] = &vcap_src.clkr,
  2774. [VCAP_CLK] = &vcap_clk.clkr,
  2775. [VCAP_NPL_CLK] = &vcap_npl_clk.clkr,
  2776. [PLL15] = &pll15.clkr,
  2777. };
  2778. static const struct qcom_reset_map mmcc_apq8064_resets[] = {
  2779. [GFX3D_AXI_RESET] = { 0x0208, 17 },
  2780. [VCAP_AXI_RESET] = { 0x0208, 16 },
  2781. [VPE_AXI_RESET] = { 0x0208, 15 },
  2782. [IJPEG_AXI_RESET] = { 0x0208, 14 },
  2783. [MPD_AXI_RESET] = { 0x0208, 13 },
  2784. [VFE_AXI_RESET] = { 0x0208, 9 },
  2785. [SP_AXI_RESET] = { 0x0208, 8 },
  2786. [VCODEC_AXI_RESET] = { 0x0208, 7 },
  2787. [ROT_AXI_RESET] = { 0x0208, 6 },
  2788. [VCODEC_AXI_A_RESET] = { 0x0208, 5 },
  2789. [VCODEC_AXI_B_RESET] = { 0x0208, 4 },
  2790. [FAB_S3_AXI_RESET] = { 0x0208, 3 },
  2791. [FAB_S2_AXI_RESET] = { 0x0208, 2 },
  2792. [FAB_S1_AXI_RESET] = { 0x0208, 1 },
  2793. [FAB_S0_AXI_RESET] = { 0x0208 },
  2794. [SMMU_GFX3D_ABH_RESET] = { 0x020c, 31 },
  2795. [SMMU_VPE_AHB_RESET] = { 0x020c, 30 },
  2796. [SMMU_VFE_AHB_RESET] = { 0x020c, 29 },
  2797. [SMMU_ROT_AHB_RESET] = { 0x020c, 28 },
  2798. [SMMU_VCODEC_B_AHB_RESET] = { 0x020c, 27 },
  2799. [SMMU_VCODEC_A_AHB_RESET] = { 0x020c, 26 },
  2800. [SMMU_MDP1_AHB_RESET] = { 0x020c, 25 },
  2801. [SMMU_MDP0_AHB_RESET] = { 0x020c, 24 },
  2802. [SMMU_JPEGD_AHB_RESET] = { 0x020c, 23 },
  2803. [SMMU_IJPEG_AHB_RESET] = { 0x020c, 22 },
  2804. [APU_AHB_RESET] = { 0x020c, 18 },
  2805. [CSI_AHB_RESET] = { 0x020c, 17 },
  2806. [TV_ENC_AHB_RESET] = { 0x020c, 15 },
  2807. [VPE_AHB_RESET] = { 0x020c, 14 },
  2808. [FABRIC_AHB_RESET] = { 0x020c, 13 },
  2809. [GFX3D_AHB_RESET] = { 0x020c, 10 },
  2810. [HDMI_AHB_RESET] = { 0x020c, 9 },
  2811. [MSSS_IMEM_AHB_RESET] = { 0x020c, 8 },
  2812. [IJPEG_AHB_RESET] = { 0x020c, 7 },
  2813. [DSI_M_AHB_RESET] = { 0x020c, 6 },
  2814. [DSI_S_AHB_RESET] = { 0x020c, 5 },
  2815. [JPEGD_AHB_RESET] = { 0x020c, 4 },
  2816. [MDP_AHB_RESET] = { 0x020c, 3 },
  2817. [ROT_AHB_RESET] = { 0x020c, 2 },
  2818. [VCODEC_AHB_RESET] = { 0x020c, 1 },
  2819. [VFE_AHB_RESET] = { 0x020c, 0 },
  2820. [SMMU_VCAP_AHB_RESET] = { 0x0200, 3 },
  2821. [VCAP_AHB_RESET] = { 0x0200, 2 },
  2822. [DSI2_M_AHB_RESET] = { 0x0200, 1 },
  2823. [DSI2_S_AHB_RESET] = { 0x0200, 0 },
  2824. [CSIPHY2_RESET] = { 0x0210, 31 },
  2825. [CSI_PIX1_RESET] = { 0x0210, 30 },
  2826. [CSIPHY0_RESET] = { 0x0210, 29 },
  2827. [CSIPHY1_RESET] = { 0x0210, 28 },
  2828. [CSI_RDI_RESET] = { 0x0210, 27 },
  2829. [CSI_PIX_RESET] = { 0x0210, 26 },
  2830. [DSI2_RESET] = { 0x0210, 25 },
  2831. [VFE_CSI_RESET] = { 0x0210, 24 },
  2832. [MDP_RESET] = { 0x0210, 21 },
  2833. [AMP_RESET] = { 0x0210, 20 },
  2834. [JPEGD_RESET] = { 0x0210, 19 },
  2835. [CSI1_RESET] = { 0x0210, 18 },
  2836. [VPE_RESET] = { 0x0210, 17 },
  2837. [MMSS_FABRIC_RESET] = { 0x0210, 16 },
  2838. [VFE_RESET] = { 0x0210, 15 },
  2839. [GFX3D_RESET] = { 0x0210, 12 },
  2840. [HDMI_RESET] = { 0x0210, 11 },
  2841. [MMSS_IMEM_RESET] = { 0x0210, 10 },
  2842. [IJPEG_RESET] = { 0x0210, 9 },
  2843. [CSI0_RESET] = { 0x0210, 8 },
  2844. [DSI_RESET] = { 0x0210, 7 },
  2845. [VCODEC_RESET] = { 0x0210, 6 },
  2846. [MDP_TV_RESET] = { 0x0210, 4 },
  2847. [MDP_VSYNC_RESET] = { 0x0210, 3 },
  2848. [ROT_RESET] = { 0x0210, 2 },
  2849. [TV_HDMI_RESET] = { 0x0210, 1 },
  2850. [VCAP_NPL_RESET] = { 0x0214, 4 },
  2851. [VCAP_RESET] = { 0x0214, 3 },
  2852. [CSI2_RESET] = { 0x0214, 2 },
  2853. [CSI_RDI1_RESET] = { 0x0214, 1 },
  2854. [CSI_RDI2_RESET] = { 0x0214 },
  2855. };
  2856. static const struct regmap_config mmcc_msm8960_regmap_config = {
  2857. .reg_bits = 32,
  2858. .reg_stride = 4,
  2859. .val_bits = 32,
  2860. .max_register = 0x334,
  2861. .fast_io = true,
  2862. };
  2863. static const struct regmap_config mmcc_apq8064_regmap_config = {
  2864. .reg_bits = 32,
  2865. .reg_stride = 4,
  2866. .val_bits = 32,
  2867. .max_register = 0x350,
  2868. .fast_io = true,
  2869. };
  2870. static const struct qcom_cc_desc mmcc_msm8960_desc = {
  2871. .config = &mmcc_msm8960_regmap_config,
  2872. .clks = mmcc_msm8960_clks,
  2873. .num_clks = ARRAY_SIZE(mmcc_msm8960_clks),
  2874. .resets = mmcc_msm8960_resets,
  2875. .num_resets = ARRAY_SIZE(mmcc_msm8960_resets),
  2876. };
  2877. static const struct qcom_cc_desc mmcc_apq8064_desc = {
  2878. .config = &mmcc_apq8064_regmap_config,
  2879. .clks = mmcc_apq8064_clks,
  2880. .num_clks = ARRAY_SIZE(mmcc_apq8064_clks),
  2881. .resets = mmcc_apq8064_resets,
  2882. .num_resets = ARRAY_SIZE(mmcc_apq8064_resets),
  2883. };
  2884. static const struct of_device_id mmcc_msm8960_match_table[] = {
  2885. { .compatible = "qcom,mmcc-msm8960", .data = &mmcc_msm8960_desc },
  2886. { .compatible = "qcom,mmcc-apq8064", .data = &mmcc_apq8064_desc },
  2887. { }
  2888. };
  2889. MODULE_DEVICE_TABLE(of, mmcc_msm8960_match_table);
  2890. static int mmcc_msm8960_probe(struct platform_device *pdev)
  2891. {
  2892. const struct of_device_id *match;
  2893. struct regmap *regmap;
  2894. bool is_8064;
  2895. struct device *dev = &pdev->dev;
  2896. match = of_match_device(mmcc_msm8960_match_table, dev);
  2897. if (!match)
  2898. return -EINVAL;
  2899. is_8064 = of_device_is_compatible(dev->of_node, "qcom,mmcc-apq8064");
  2900. if (is_8064) {
  2901. gfx3d_src.freq_tbl = clk_tbl_gfx3d_8064;
  2902. gfx3d_src.clkr.hw.init = &gfx3d_8064_init;
  2903. gfx3d_src.s[0].parent_map = mmcc_pxo_pll8_pll2_pll15_map;
  2904. gfx3d_src.s[1].parent_map = mmcc_pxo_pll8_pll2_pll15_map;
  2905. }
  2906. regmap = qcom_cc_map(pdev, match->data);
  2907. if (IS_ERR(regmap))
  2908. return PTR_ERR(regmap);
  2909. clk_pll_configure_sr(&pll15, regmap, &pll15_config, false);
  2910. return qcom_cc_really_probe(pdev, match->data, regmap);
  2911. }
  2912. static struct platform_driver mmcc_msm8960_driver = {
  2913. .probe = mmcc_msm8960_probe,
  2914. .driver = {
  2915. .name = "mmcc-msm8960",
  2916. .of_match_table = mmcc_msm8960_match_table,
  2917. },
  2918. };
  2919. module_platform_driver(mmcc_msm8960_driver);
  2920. MODULE_DESCRIPTION("QCOM MMCC MSM8960 Driver");
  2921. MODULE_LICENSE("GPL v2");
  2922. MODULE_ALIAS("platform:mmcc-msm8960");