gcc-ipq806x.c 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123
  1. /*
  2. * Copyright (c) 2014, 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/platform_device.h>
  17. #include <linux/module.h>
  18. #include <linux/of.h>
  19. #include <linux/of_device.h>
  20. #include <linux/clk-provider.h>
  21. #include <linux/regmap.h>
  22. #include <linux/reset-controller.h>
  23. #include <dt-bindings/clock/qcom,gcc-ipq806x.h>
  24. #include <dt-bindings/reset/qcom,gcc-ipq806x.h>
  25. #include "common.h"
  26. #include "clk-regmap.h"
  27. #include "clk-pll.h"
  28. #include "clk-rcg.h"
  29. #include "clk-branch.h"
  30. #include "clk-hfpll.h"
  31. #include "reset.h"
  32. static struct clk_pll pll0 = {
  33. .l_reg = 0x30c4,
  34. .m_reg = 0x30c8,
  35. .n_reg = 0x30cc,
  36. .config_reg = 0x30d4,
  37. .mode_reg = 0x30c0,
  38. .status_reg = 0x30d8,
  39. .status_bit = 16,
  40. .clkr.hw.init = &(struct clk_init_data){
  41. .name = "pll0",
  42. .parent_names = (const char *[]){ "pxo" },
  43. .num_parents = 1,
  44. .ops = &clk_pll_ops,
  45. },
  46. };
  47. static struct clk_regmap pll0_vote = {
  48. .enable_reg = 0x34c0,
  49. .enable_mask = BIT(0),
  50. .hw.init = &(struct clk_init_data){
  51. .name = "pll0_vote",
  52. .parent_names = (const char *[]){ "pll0" },
  53. .num_parents = 1,
  54. .ops = &clk_pll_vote_ops,
  55. },
  56. };
  57. static struct clk_pll pll3 = {
  58. .l_reg = 0x3164,
  59. .m_reg = 0x3168,
  60. .n_reg = 0x316c,
  61. .config_reg = 0x3174,
  62. .mode_reg = 0x3160,
  63. .status_reg = 0x3178,
  64. .status_bit = 16,
  65. .clkr.hw.init = &(struct clk_init_data){
  66. .name = "pll3",
  67. .parent_names = (const char *[]){ "pxo" },
  68. .num_parents = 1,
  69. .ops = &clk_pll_ops,
  70. },
  71. };
  72. static struct clk_regmap pll4_vote = {
  73. .enable_reg = 0x34c0,
  74. .enable_mask = BIT(4),
  75. .hw.init = &(struct clk_init_data){
  76. .name = "pll4_vote",
  77. .parent_names = (const char *[]){ "pll4" },
  78. .num_parents = 1,
  79. .ops = &clk_pll_vote_ops,
  80. },
  81. };
  82. static struct clk_pll pll8 = {
  83. .l_reg = 0x3144,
  84. .m_reg = 0x3148,
  85. .n_reg = 0x314c,
  86. .config_reg = 0x3154,
  87. .mode_reg = 0x3140,
  88. .status_reg = 0x3158,
  89. .status_bit = 16,
  90. .clkr.hw.init = &(struct clk_init_data){
  91. .name = "pll8",
  92. .parent_names = (const char *[]){ "pxo" },
  93. .num_parents = 1,
  94. .ops = &clk_pll_ops,
  95. },
  96. };
  97. static struct clk_regmap pll8_vote = {
  98. .enable_reg = 0x34c0,
  99. .enable_mask = BIT(8),
  100. .hw.init = &(struct clk_init_data){
  101. .name = "pll8_vote",
  102. .parent_names = (const char *[]){ "pll8" },
  103. .num_parents = 1,
  104. .ops = &clk_pll_vote_ops,
  105. },
  106. };
  107. static struct hfpll_data hfpll0_data = {
  108. .mode_reg = 0x3200,
  109. .l_reg = 0x3208,
  110. .m_reg = 0x320c,
  111. .n_reg = 0x3210,
  112. .config_reg = 0x3204,
  113. .status_reg = 0x321c,
  114. .config_val = 0x7845c665,
  115. .droop_reg = 0x3214,
  116. .droop_val = 0x0108c000,
  117. .min_rate = 600000000UL,
  118. .max_rate = 1800000000UL,
  119. };
  120. static struct clk_hfpll hfpll0 = {
  121. .d = &hfpll0_data,
  122. .clkr.hw.init = &(struct clk_init_data){
  123. .parent_names = (const char *[]){ "pxo" },
  124. .num_parents = 1,
  125. .name = "hfpll0",
  126. .ops = &clk_ops_hfpll,
  127. .flags = CLK_IGNORE_UNUSED,
  128. },
  129. .lock = __SPIN_LOCK_UNLOCKED(hfpll0.lock),
  130. };
  131. static struct hfpll_data hfpll1_data = {
  132. .mode_reg = 0x3240,
  133. .l_reg = 0x3248,
  134. .m_reg = 0x324c,
  135. .n_reg = 0x3250,
  136. .config_reg = 0x3244,
  137. .status_reg = 0x325c,
  138. .config_val = 0x7845c665,
  139. .droop_reg = 0x3314,
  140. .droop_val = 0x0108c000,
  141. .min_rate = 600000000UL,
  142. .max_rate = 1800000000UL,
  143. };
  144. static struct clk_hfpll hfpll1 = {
  145. .d = &hfpll1_data,
  146. .clkr.hw.init = &(struct clk_init_data){
  147. .parent_names = (const char *[]){ "pxo" },
  148. .num_parents = 1,
  149. .name = "hfpll1",
  150. .ops = &clk_ops_hfpll,
  151. .flags = CLK_IGNORE_UNUSED,
  152. },
  153. .lock = __SPIN_LOCK_UNLOCKED(hfpll1.lock),
  154. };
  155. static struct hfpll_data hfpll_l2_data = {
  156. .mode_reg = 0x3300,
  157. .l_reg = 0x3308,
  158. .m_reg = 0x330c,
  159. .n_reg = 0x3310,
  160. .config_reg = 0x3304,
  161. .status_reg = 0x331c,
  162. .config_val = 0x7845c665,
  163. .droop_reg = 0x3314,
  164. .droop_val = 0x0108c000,
  165. .min_rate = 600000000UL,
  166. .max_rate = 1800000000UL,
  167. };
  168. static struct clk_hfpll hfpll_l2 = {
  169. .d = &hfpll_l2_data,
  170. .clkr.hw.init = &(struct clk_init_data){
  171. .parent_names = (const char *[]){ "pxo" },
  172. .num_parents = 1,
  173. .name = "hfpll_l2",
  174. .ops = &clk_ops_hfpll,
  175. .flags = CLK_IGNORE_UNUSED,
  176. },
  177. .lock = __SPIN_LOCK_UNLOCKED(hfpll_l2.lock),
  178. };
  179. static struct clk_pll pll14 = {
  180. .l_reg = 0x31c4,
  181. .m_reg = 0x31c8,
  182. .n_reg = 0x31cc,
  183. .config_reg = 0x31d4,
  184. .mode_reg = 0x31c0,
  185. .status_reg = 0x31d8,
  186. .status_bit = 16,
  187. .clkr.hw.init = &(struct clk_init_data){
  188. .name = "pll14",
  189. .parent_names = (const char *[]){ "pxo" },
  190. .num_parents = 1,
  191. .ops = &clk_pll_ops,
  192. },
  193. };
  194. static struct clk_regmap pll14_vote = {
  195. .enable_reg = 0x34c0,
  196. .enable_mask = BIT(14),
  197. .hw.init = &(struct clk_init_data){
  198. .name = "pll14_vote",
  199. .parent_names = (const char *[]){ "pll14" },
  200. .num_parents = 1,
  201. .ops = &clk_pll_vote_ops,
  202. },
  203. };
  204. #define NSS_PLL_RATE(f, _l, _m, _n, i) \
  205. { \
  206. .freq = f, \
  207. .l = _l, \
  208. .m = _m, \
  209. .n = _n, \
  210. .ibits = i, \
  211. }
  212. static struct pll_freq_tbl pll18_freq_tbl[] = {
  213. NSS_PLL_RATE(550000000, 44, 0, 1, 0x01495625),
  214. NSS_PLL_RATE(733000000, 58, 16, 25, 0x014b5625),
  215. };
  216. static struct clk_pll pll18 = {
  217. .l_reg = 0x31a4,
  218. .m_reg = 0x31a8,
  219. .n_reg = 0x31ac,
  220. .config_reg = 0x31b4,
  221. .mode_reg = 0x31a0,
  222. .status_reg = 0x31b8,
  223. .status_bit = 16,
  224. .post_div_shift = 16,
  225. .post_div_width = 1,
  226. .freq_tbl = pll18_freq_tbl,
  227. .clkr.hw.init = &(struct clk_init_data){
  228. .name = "pll18",
  229. .parent_names = (const char *[]){ "pxo" },
  230. .num_parents = 1,
  231. .ops = &clk_pll_ops,
  232. },
  233. };
  234. enum {
  235. P_PXO,
  236. P_PLL8,
  237. P_PLL3,
  238. P_PLL0,
  239. P_CXO,
  240. P_PLL14,
  241. P_PLL18,
  242. };
  243. static const struct parent_map gcc_pxo_pll8_map[] = {
  244. { P_PXO, 0 },
  245. { P_PLL8, 3 }
  246. };
  247. static const char * const gcc_pxo_pll8[] = {
  248. "pxo",
  249. "pll8_vote",
  250. };
  251. static const struct parent_map gcc_pxo_pll8_cxo_map[] = {
  252. { P_PXO, 0 },
  253. { P_PLL8, 3 },
  254. { P_CXO, 5 }
  255. };
  256. static const char * const gcc_pxo_pll8_cxo[] = {
  257. "pxo",
  258. "pll8_vote",
  259. "cxo",
  260. };
  261. static const struct parent_map gcc_pxo_pll3_map[] = {
  262. { P_PXO, 0 },
  263. { P_PLL3, 1 }
  264. };
  265. static const struct parent_map gcc_pxo_pll3_sata_map[] = {
  266. { P_PXO, 0 },
  267. { P_PLL3, 6 }
  268. };
  269. static const char * const gcc_pxo_pll3[] = {
  270. "pxo",
  271. "pll3",
  272. };
  273. static const struct parent_map gcc_pxo_pll8_pll0[] = {
  274. { P_PXO, 0 },
  275. { P_PLL8, 3 },
  276. { P_PLL0, 2 }
  277. };
  278. static const char * const gcc_pxo_pll8_pll0_map[] = {
  279. "pxo",
  280. "pll8_vote",
  281. "pll0_vote",
  282. };
  283. static const struct parent_map gcc_pxo_pll8_pll14_pll18_pll0_map[] = {
  284. { P_PXO, 0 },
  285. { P_PLL8, 4 },
  286. { P_PLL0, 2 },
  287. { P_PLL14, 5 },
  288. { P_PLL18, 1 }
  289. };
  290. static const char * const gcc_pxo_pll8_pll14_pll18_pll0[] = {
  291. "pxo",
  292. "pll8_vote",
  293. "pll0_vote",
  294. "pll14",
  295. "pll18",
  296. };
  297. static struct freq_tbl clk_tbl_gsbi_uart[] = {
  298. { 1843200, P_PLL8, 2, 6, 625 },
  299. { 3686400, P_PLL8, 2, 12, 625 },
  300. { 7372800, P_PLL8, 2, 24, 625 },
  301. { 14745600, P_PLL8, 2, 48, 625 },
  302. { 16000000, P_PLL8, 4, 1, 6 },
  303. { 24000000, P_PLL8, 4, 1, 4 },
  304. { 32000000, P_PLL8, 4, 1, 3 },
  305. { 40000000, P_PLL8, 1, 5, 48 },
  306. { 46400000, P_PLL8, 1, 29, 240 },
  307. { 48000000, P_PLL8, 4, 1, 2 },
  308. { 51200000, P_PLL8, 1, 2, 15 },
  309. { 56000000, P_PLL8, 1, 7, 48 },
  310. { 58982400, P_PLL8, 1, 96, 625 },
  311. { 64000000, P_PLL8, 2, 1, 3 },
  312. { }
  313. };
  314. static struct clk_rcg gsbi1_uart_src = {
  315. .ns_reg = 0x29d4,
  316. .md_reg = 0x29d0,
  317. .mn = {
  318. .mnctr_en_bit = 8,
  319. .mnctr_reset_bit = 7,
  320. .mnctr_mode_shift = 5,
  321. .n_val_shift = 16,
  322. .m_val_shift = 16,
  323. .width = 16,
  324. },
  325. .p = {
  326. .pre_div_shift = 3,
  327. .pre_div_width = 2,
  328. },
  329. .s = {
  330. .src_sel_shift = 0,
  331. .parent_map = gcc_pxo_pll8_map,
  332. },
  333. .freq_tbl = clk_tbl_gsbi_uart,
  334. .clkr = {
  335. .enable_reg = 0x29d4,
  336. .enable_mask = BIT(11),
  337. .hw.init = &(struct clk_init_data){
  338. .name = "gsbi1_uart_src",
  339. .parent_names = gcc_pxo_pll8,
  340. .num_parents = 2,
  341. .ops = &clk_rcg_ops,
  342. .flags = CLK_SET_PARENT_GATE,
  343. },
  344. },
  345. };
  346. static struct clk_branch gsbi1_uart_clk = {
  347. .halt_reg = 0x2fcc,
  348. .halt_bit = 12,
  349. .clkr = {
  350. .enable_reg = 0x29d4,
  351. .enable_mask = BIT(9),
  352. .hw.init = &(struct clk_init_data){
  353. .name = "gsbi1_uart_clk",
  354. .parent_names = (const char *[]){
  355. "gsbi1_uart_src",
  356. },
  357. .num_parents = 1,
  358. .ops = &clk_branch_ops,
  359. .flags = CLK_SET_RATE_PARENT,
  360. },
  361. },
  362. };
  363. static struct clk_rcg gsbi2_uart_src = {
  364. .ns_reg = 0x29f4,
  365. .md_reg = 0x29f0,
  366. .mn = {
  367. .mnctr_en_bit = 8,
  368. .mnctr_reset_bit = 7,
  369. .mnctr_mode_shift = 5,
  370. .n_val_shift = 16,
  371. .m_val_shift = 16,
  372. .width = 16,
  373. },
  374. .p = {
  375. .pre_div_shift = 3,
  376. .pre_div_width = 2,
  377. },
  378. .s = {
  379. .src_sel_shift = 0,
  380. .parent_map = gcc_pxo_pll8_map,
  381. },
  382. .freq_tbl = clk_tbl_gsbi_uart,
  383. .clkr = {
  384. .enable_reg = 0x29f4,
  385. .enable_mask = BIT(11),
  386. .hw.init = &(struct clk_init_data){
  387. .name = "gsbi2_uart_src",
  388. .parent_names = gcc_pxo_pll8,
  389. .num_parents = 2,
  390. .ops = &clk_rcg_ops,
  391. .flags = CLK_SET_PARENT_GATE,
  392. },
  393. },
  394. };
  395. static struct clk_branch gsbi2_uart_clk = {
  396. .halt_reg = 0x2fcc,
  397. .halt_bit = 8,
  398. .clkr = {
  399. .enable_reg = 0x29f4,
  400. .enable_mask = BIT(9),
  401. .hw.init = &(struct clk_init_data){
  402. .name = "gsbi2_uart_clk",
  403. .parent_names = (const char *[]){
  404. "gsbi2_uart_src",
  405. },
  406. .num_parents = 1,
  407. .ops = &clk_branch_ops,
  408. .flags = CLK_SET_RATE_PARENT,
  409. },
  410. },
  411. };
  412. static struct clk_rcg gsbi4_uart_src = {
  413. .ns_reg = 0x2a34,
  414. .md_reg = 0x2a30,
  415. .mn = {
  416. .mnctr_en_bit = 8,
  417. .mnctr_reset_bit = 7,
  418. .mnctr_mode_shift = 5,
  419. .n_val_shift = 16,
  420. .m_val_shift = 16,
  421. .width = 16,
  422. },
  423. .p = {
  424. .pre_div_shift = 3,
  425. .pre_div_width = 2,
  426. },
  427. .s = {
  428. .src_sel_shift = 0,
  429. .parent_map = gcc_pxo_pll8_map,
  430. },
  431. .freq_tbl = clk_tbl_gsbi_uart,
  432. .clkr = {
  433. .enable_reg = 0x2a34,
  434. .enable_mask = BIT(11),
  435. .hw.init = &(struct clk_init_data){
  436. .name = "gsbi4_uart_src",
  437. .parent_names = gcc_pxo_pll8,
  438. .num_parents = 2,
  439. .ops = &clk_rcg_ops,
  440. .flags = CLK_SET_PARENT_GATE,
  441. },
  442. },
  443. };
  444. static struct clk_branch gsbi4_uart_clk = {
  445. .halt_reg = 0x2fd0,
  446. .halt_bit = 26,
  447. .clkr = {
  448. .enable_reg = 0x2a34,
  449. .enable_mask = BIT(9),
  450. .hw.init = &(struct clk_init_data){
  451. .name = "gsbi4_uart_clk",
  452. .parent_names = (const char *[]){
  453. "gsbi4_uart_src",
  454. },
  455. .num_parents = 1,
  456. .ops = &clk_branch_ops,
  457. .flags = CLK_SET_RATE_PARENT,
  458. },
  459. },
  460. };
  461. static struct clk_rcg gsbi5_uart_src = {
  462. .ns_reg = 0x2a54,
  463. .md_reg = 0x2a50,
  464. .mn = {
  465. .mnctr_en_bit = 8,
  466. .mnctr_reset_bit = 7,
  467. .mnctr_mode_shift = 5,
  468. .n_val_shift = 16,
  469. .m_val_shift = 16,
  470. .width = 16,
  471. },
  472. .p = {
  473. .pre_div_shift = 3,
  474. .pre_div_width = 2,
  475. },
  476. .s = {
  477. .src_sel_shift = 0,
  478. .parent_map = gcc_pxo_pll8_map,
  479. },
  480. .freq_tbl = clk_tbl_gsbi_uart,
  481. .clkr = {
  482. .enable_reg = 0x2a54,
  483. .enable_mask = BIT(11),
  484. .hw.init = &(struct clk_init_data){
  485. .name = "gsbi5_uart_src",
  486. .parent_names = gcc_pxo_pll8,
  487. .num_parents = 2,
  488. .ops = &clk_rcg_ops,
  489. .flags = CLK_SET_PARENT_GATE,
  490. },
  491. },
  492. };
  493. static struct clk_branch gsbi5_uart_clk = {
  494. .halt_reg = 0x2fd0,
  495. .halt_bit = 22,
  496. .clkr = {
  497. .enable_reg = 0x2a54,
  498. .enable_mask = BIT(9),
  499. .hw.init = &(struct clk_init_data){
  500. .name = "gsbi5_uart_clk",
  501. .parent_names = (const char *[]){
  502. "gsbi5_uart_src",
  503. },
  504. .num_parents = 1,
  505. .ops = &clk_branch_ops,
  506. .flags = CLK_SET_RATE_PARENT,
  507. },
  508. },
  509. };
  510. static struct clk_rcg gsbi6_uart_src = {
  511. .ns_reg = 0x2a74,
  512. .md_reg = 0x2a70,
  513. .mn = {
  514. .mnctr_en_bit = 8,
  515. .mnctr_reset_bit = 7,
  516. .mnctr_mode_shift = 5,
  517. .n_val_shift = 16,
  518. .m_val_shift = 16,
  519. .width = 16,
  520. },
  521. .p = {
  522. .pre_div_shift = 3,
  523. .pre_div_width = 2,
  524. },
  525. .s = {
  526. .src_sel_shift = 0,
  527. .parent_map = gcc_pxo_pll8_map,
  528. },
  529. .freq_tbl = clk_tbl_gsbi_uart,
  530. .clkr = {
  531. .enable_reg = 0x2a74,
  532. .enable_mask = BIT(11),
  533. .hw.init = &(struct clk_init_data){
  534. .name = "gsbi6_uart_src",
  535. .parent_names = gcc_pxo_pll8,
  536. .num_parents = 2,
  537. .ops = &clk_rcg_ops,
  538. .flags = CLK_SET_PARENT_GATE,
  539. },
  540. },
  541. };
  542. static struct clk_branch gsbi6_uart_clk = {
  543. .halt_reg = 0x2fd0,
  544. .halt_bit = 18,
  545. .clkr = {
  546. .enable_reg = 0x2a74,
  547. .enable_mask = BIT(9),
  548. .hw.init = &(struct clk_init_data){
  549. .name = "gsbi6_uart_clk",
  550. .parent_names = (const char *[]){
  551. "gsbi6_uart_src",
  552. },
  553. .num_parents = 1,
  554. .ops = &clk_branch_ops,
  555. .flags = CLK_SET_RATE_PARENT,
  556. },
  557. },
  558. };
  559. static struct clk_rcg gsbi7_uart_src = {
  560. .ns_reg = 0x2a94,
  561. .md_reg = 0x2a90,
  562. .mn = {
  563. .mnctr_en_bit = 8,
  564. .mnctr_reset_bit = 7,
  565. .mnctr_mode_shift = 5,
  566. .n_val_shift = 16,
  567. .m_val_shift = 16,
  568. .width = 16,
  569. },
  570. .p = {
  571. .pre_div_shift = 3,
  572. .pre_div_width = 2,
  573. },
  574. .s = {
  575. .src_sel_shift = 0,
  576. .parent_map = gcc_pxo_pll8_map,
  577. },
  578. .freq_tbl = clk_tbl_gsbi_uart,
  579. .clkr = {
  580. .enable_reg = 0x2a94,
  581. .enable_mask = BIT(11),
  582. .hw.init = &(struct clk_init_data){
  583. .name = "gsbi7_uart_src",
  584. .parent_names = gcc_pxo_pll8,
  585. .num_parents = 2,
  586. .ops = &clk_rcg_ops,
  587. .flags = CLK_SET_PARENT_GATE,
  588. },
  589. },
  590. };
  591. static struct clk_branch gsbi7_uart_clk = {
  592. .halt_reg = 0x2fd0,
  593. .halt_bit = 14,
  594. .clkr = {
  595. .enable_reg = 0x2a94,
  596. .enable_mask = BIT(9),
  597. .hw.init = &(struct clk_init_data){
  598. .name = "gsbi7_uart_clk",
  599. .parent_names = (const char *[]){
  600. "gsbi7_uart_src",
  601. },
  602. .num_parents = 1,
  603. .ops = &clk_branch_ops,
  604. .flags = CLK_SET_RATE_PARENT,
  605. },
  606. },
  607. };
  608. static struct freq_tbl clk_tbl_gsbi_qup[] = {
  609. { 1100000, P_PXO, 1, 2, 49 },
  610. { 5400000, P_PXO, 1, 1, 5 },
  611. { 10800000, P_PXO, 1, 2, 5 },
  612. { 15060000, P_PLL8, 1, 2, 51 },
  613. { 24000000, P_PLL8, 4, 1, 4 },
  614. { 25000000, P_PXO, 1, 0, 0 },
  615. { 25600000, P_PLL8, 1, 1, 15 },
  616. { 48000000, P_PLL8, 4, 1, 2 },
  617. { 51200000, P_PLL8, 1, 2, 15 },
  618. { }
  619. };
  620. static struct clk_rcg gsbi1_qup_src = {
  621. .ns_reg = 0x29cc,
  622. .md_reg = 0x29c8,
  623. .mn = {
  624. .mnctr_en_bit = 8,
  625. .mnctr_reset_bit = 7,
  626. .mnctr_mode_shift = 5,
  627. .n_val_shift = 16,
  628. .m_val_shift = 16,
  629. .width = 8,
  630. },
  631. .p = {
  632. .pre_div_shift = 3,
  633. .pre_div_width = 2,
  634. },
  635. .s = {
  636. .src_sel_shift = 0,
  637. .parent_map = gcc_pxo_pll8_map,
  638. },
  639. .freq_tbl = clk_tbl_gsbi_qup,
  640. .clkr = {
  641. .enable_reg = 0x29cc,
  642. .enable_mask = BIT(11),
  643. .hw.init = &(struct clk_init_data){
  644. .name = "gsbi1_qup_src",
  645. .parent_names = gcc_pxo_pll8,
  646. .num_parents = 2,
  647. .ops = &clk_rcg_ops,
  648. .flags = CLK_SET_PARENT_GATE,
  649. },
  650. },
  651. };
  652. static struct clk_branch gsbi1_qup_clk = {
  653. .halt_reg = 0x2fcc,
  654. .halt_bit = 11,
  655. .clkr = {
  656. .enable_reg = 0x29cc,
  657. .enable_mask = BIT(9),
  658. .hw.init = &(struct clk_init_data){
  659. .name = "gsbi1_qup_clk",
  660. .parent_names = (const char *[]){ "gsbi1_qup_src" },
  661. .num_parents = 1,
  662. .ops = &clk_branch_ops,
  663. .flags = CLK_SET_RATE_PARENT,
  664. },
  665. },
  666. };
  667. static struct clk_rcg gsbi2_qup_src = {
  668. .ns_reg = 0x29ec,
  669. .md_reg = 0x29e8,
  670. .mn = {
  671. .mnctr_en_bit = 8,
  672. .mnctr_reset_bit = 7,
  673. .mnctr_mode_shift = 5,
  674. .n_val_shift = 16,
  675. .m_val_shift = 16,
  676. .width = 8,
  677. },
  678. .p = {
  679. .pre_div_shift = 3,
  680. .pre_div_width = 2,
  681. },
  682. .s = {
  683. .src_sel_shift = 0,
  684. .parent_map = gcc_pxo_pll8_map,
  685. },
  686. .freq_tbl = clk_tbl_gsbi_qup,
  687. .clkr = {
  688. .enable_reg = 0x29ec,
  689. .enable_mask = BIT(11),
  690. .hw.init = &(struct clk_init_data){
  691. .name = "gsbi2_qup_src",
  692. .parent_names = gcc_pxo_pll8,
  693. .num_parents = 2,
  694. .ops = &clk_rcg_ops,
  695. .flags = CLK_SET_PARENT_GATE,
  696. },
  697. },
  698. };
  699. static struct clk_branch gsbi2_qup_clk = {
  700. .halt_reg = 0x2fcc,
  701. .halt_bit = 6,
  702. .clkr = {
  703. .enable_reg = 0x29ec,
  704. .enable_mask = BIT(9),
  705. .hw.init = &(struct clk_init_data){
  706. .name = "gsbi2_qup_clk",
  707. .parent_names = (const char *[]){ "gsbi2_qup_src" },
  708. .num_parents = 1,
  709. .ops = &clk_branch_ops,
  710. .flags = CLK_SET_RATE_PARENT,
  711. },
  712. },
  713. };
  714. static struct clk_rcg gsbi4_qup_src = {
  715. .ns_reg = 0x2a2c,
  716. .md_reg = 0x2a28,
  717. .mn = {
  718. .mnctr_en_bit = 8,
  719. .mnctr_reset_bit = 7,
  720. .mnctr_mode_shift = 5,
  721. .n_val_shift = 16,
  722. .m_val_shift = 16,
  723. .width = 8,
  724. },
  725. .p = {
  726. .pre_div_shift = 3,
  727. .pre_div_width = 2,
  728. },
  729. .s = {
  730. .src_sel_shift = 0,
  731. .parent_map = gcc_pxo_pll8_map,
  732. },
  733. .freq_tbl = clk_tbl_gsbi_qup,
  734. .clkr = {
  735. .enable_reg = 0x2a2c,
  736. .enable_mask = BIT(11),
  737. .hw.init = &(struct clk_init_data){
  738. .name = "gsbi4_qup_src",
  739. .parent_names = gcc_pxo_pll8,
  740. .num_parents = 2,
  741. .ops = &clk_rcg_ops,
  742. .flags = CLK_SET_PARENT_GATE,
  743. },
  744. },
  745. };
  746. static struct clk_branch gsbi4_qup_clk = {
  747. .halt_reg = 0x2fd0,
  748. .halt_bit = 24,
  749. .clkr = {
  750. .enable_reg = 0x2a2c,
  751. .enable_mask = BIT(9),
  752. .hw.init = &(struct clk_init_data){
  753. .name = "gsbi4_qup_clk",
  754. .parent_names = (const char *[]){ "gsbi4_qup_src" },
  755. .num_parents = 1,
  756. .ops = &clk_branch_ops,
  757. .flags = CLK_SET_RATE_PARENT,
  758. },
  759. },
  760. };
  761. static struct clk_rcg gsbi5_qup_src = {
  762. .ns_reg = 0x2a4c,
  763. .md_reg = 0x2a48,
  764. .mn = {
  765. .mnctr_en_bit = 8,
  766. .mnctr_reset_bit = 7,
  767. .mnctr_mode_shift = 5,
  768. .n_val_shift = 16,
  769. .m_val_shift = 16,
  770. .width = 8,
  771. },
  772. .p = {
  773. .pre_div_shift = 3,
  774. .pre_div_width = 2,
  775. },
  776. .s = {
  777. .src_sel_shift = 0,
  778. .parent_map = gcc_pxo_pll8_map,
  779. },
  780. .freq_tbl = clk_tbl_gsbi_qup,
  781. .clkr = {
  782. .enable_reg = 0x2a4c,
  783. .enable_mask = BIT(11),
  784. .hw.init = &(struct clk_init_data){
  785. .name = "gsbi5_qup_src",
  786. .parent_names = gcc_pxo_pll8,
  787. .num_parents = 2,
  788. .ops = &clk_rcg_ops,
  789. .flags = CLK_SET_PARENT_GATE,
  790. },
  791. },
  792. };
  793. static struct clk_branch gsbi5_qup_clk = {
  794. .halt_reg = 0x2fd0,
  795. .halt_bit = 20,
  796. .clkr = {
  797. .enable_reg = 0x2a4c,
  798. .enable_mask = BIT(9),
  799. .hw.init = &(struct clk_init_data){
  800. .name = "gsbi5_qup_clk",
  801. .parent_names = (const char *[]){ "gsbi5_qup_src" },
  802. .num_parents = 1,
  803. .ops = &clk_branch_ops,
  804. .flags = CLK_SET_RATE_PARENT,
  805. },
  806. },
  807. };
  808. static struct clk_rcg gsbi6_qup_src = {
  809. .ns_reg = 0x2a6c,
  810. .md_reg = 0x2a68,
  811. .mn = {
  812. .mnctr_en_bit = 8,
  813. .mnctr_reset_bit = 7,
  814. .mnctr_mode_shift = 5,
  815. .n_val_shift = 16,
  816. .m_val_shift = 16,
  817. .width = 8,
  818. },
  819. .p = {
  820. .pre_div_shift = 3,
  821. .pre_div_width = 2,
  822. },
  823. .s = {
  824. .src_sel_shift = 0,
  825. .parent_map = gcc_pxo_pll8_map,
  826. },
  827. .freq_tbl = clk_tbl_gsbi_qup,
  828. .clkr = {
  829. .enable_reg = 0x2a6c,
  830. .enable_mask = BIT(11),
  831. .hw.init = &(struct clk_init_data){
  832. .name = "gsbi6_qup_src",
  833. .parent_names = gcc_pxo_pll8,
  834. .num_parents = 2,
  835. .ops = &clk_rcg_ops,
  836. .flags = CLK_SET_PARENT_GATE,
  837. },
  838. },
  839. };
  840. static struct clk_branch gsbi6_qup_clk = {
  841. .halt_reg = 0x2fd0,
  842. .halt_bit = 16,
  843. .clkr = {
  844. .enable_reg = 0x2a6c,
  845. .enable_mask = BIT(9),
  846. .hw.init = &(struct clk_init_data){
  847. .name = "gsbi6_qup_clk",
  848. .parent_names = (const char *[]){ "gsbi6_qup_src" },
  849. .num_parents = 1,
  850. .ops = &clk_branch_ops,
  851. .flags = CLK_SET_RATE_PARENT,
  852. },
  853. },
  854. };
  855. static struct clk_rcg gsbi7_qup_src = {
  856. .ns_reg = 0x2a8c,
  857. .md_reg = 0x2a88,
  858. .mn = {
  859. .mnctr_en_bit = 8,
  860. .mnctr_reset_bit = 7,
  861. .mnctr_mode_shift = 5,
  862. .n_val_shift = 16,
  863. .m_val_shift = 16,
  864. .width = 8,
  865. },
  866. .p = {
  867. .pre_div_shift = 3,
  868. .pre_div_width = 2,
  869. },
  870. .s = {
  871. .src_sel_shift = 0,
  872. .parent_map = gcc_pxo_pll8_map,
  873. },
  874. .freq_tbl = clk_tbl_gsbi_qup,
  875. .clkr = {
  876. .enable_reg = 0x2a8c,
  877. .enable_mask = BIT(11),
  878. .hw.init = &(struct clk_init_data){
  879. .name = "gsbi7_qup_src",
  880. .parent_names = gcc_pxo_pll8,
  881. .num_parents = 2,
  882. .ops = &clk_rcg_ops,
  883. .flags = CLK_SET_PARENT_GATE,
  884. },
  885. },
  886. };
  887. static struct clk_branch gsbi7_qup_clk = {
  888. .halt_reg = 0x2fd0,
  889. .halt_bit = 12,
  890. .clkr = {
  891. .enable_reg = 0x2a8c,
  892. .enable_mask = BIT(9),
  893. .hw.init = &(struct clk_init_data){
  894. .name = "gsbi7_qup_clk",
  895. .parent_names = (const char *[]){ "gsbi7_qup_src" },
  896. .num_parents = 1,
  897. .ops = &clk_branch_ops,
  898. .flags = CLK_SET_RATE_PARENT,
  899. },
  900. },
  901. };
  902. static struct clk_branch gsbi1_h_clk = {
  903. .hwcg_reg = 0x29c0,
  904. .hwcg_bit = 6,
  905. .halt_reg = 0x2fcc,
  906. .halt_bit = 13,
  907. .clkr = {
  908. .enable_reg = 0x29c0,
  909. .enable_mask = BIT(4),
  910. .hw.init = &(struct clk_init_data){
  911. .name = "gsbi1_h_clk",
  912. .ops = &clk_branch_ops,
  913. },
  914. },
  915. };
  916. static struct clk_branch gsbi2_h_clk = {
  917. .hwcg_reg = 0x29e0,
  918. .hwcg_bit = 6,
  919. .halt_reg = 0x2fcc,
  920. .halt_bit = 9,
  921. .clkr = {
  922. .enable_reg = 0x29e0,
  923. .enable_mask = BIT(4),
  924. .hw.init = &(struct clk_init_data){
  925. .name = "gsbi2_h_clk",
  926. .ops = &clk_branch_ops,
  927. },
  928. },
  929. };
  930. static struct clk_branch gsbi4_h_clk = {
  931. .hwcg_reg = 0x2a20,
  932. .hwcg_bit = 6,
  933. .halt_reg = 0x2fd0,
  934. .halt_bit = 27,
  935. .clkr = {
  936. .enable_reg = 0x2a20,
  937. .enable_mask = BIT(4),
  938. .hw.init = &(struct clk_init_data){
  939. .name = "gsbi4_h_clk",
  940. .ops = &clk_branch_ops,
  941. },
  942. },
  943. };
  944. static struct clk_branch gsbi5_h_clk = {
  945. .hwcg_reg = 0x2a40,
  946. .hwcg_bit = 6,
  947. .halt_reg = 0x2fd0,
  948. .halt_bit = 23,
  949. .clkr = {
  950. .enable_reg = 0x2a40,
  951. .enable_mask = BIT(4),
  952. .hw.init = &(struct clk_init_data){
  953. .name = "gsbi5_h_clk",
  954. .ops = &clk_branch_ops,
  955. },
  956. },
  957. };
  958. static struct clk_branch gsbi6_h_clk = {
  959. .hwcg_reg = 0x2a60,
  960. .hwcg_bit = 6,
  961. .halt_reg = 0x2fd0,
  962. .halt_bit = 19,
  963. .clkr = {
  964. .enable_reg = 0x2a60,
  965. .enable_mask = BIT(4),
  966. .hw.init = &(struct clk_init_data){
  967. .name = "gsbi6_h_clk",
  968. .ops = &clk_branch_ops,
  969. },
  970. },
  971. };
  972. static struct clk_branch gsbi7_h_clk = {
  973. .hwcg_reg = 0x2a80,
  974. .hwcg_bit = 6,
  975. .halt_reg = 0x2fd0,
  976. .halt_bit = 15,
  977. .clkr = {
  978. .enable_reg = 0x2a80,
  979. .enable_mask = BIT(4),
  980. .hw.init = &(struct clk_init_data){
  981. .name = "gsbi7_h_clk",
  982. .ops = &clk_branch_ops,
  983. },
  984. },
  985. };
  986. static const struct freq_tbl clk_tbl_gp[] = {
  987. { 12500000, P_PXO, 2, 0, 0 },
  988. { 25000000, P_PXO, 1, 0, 0 },
  989. { 64000000, P_PLL8, 2, 1, 3 },
  990. { 76800000, P_PLL8, 1, 1, 5 },
  991. { 96000000, P_PLL8, 4, 0, 0 },
  992. { 128000000, P_PLL8, 3, 0, 0 },
  993. { 192000000, P_PLL8, 2, 0, 0 },
  994. { }
  995. };
  996. static struct clk_rcg gp0_src = {
  997. .ns_reg = 0x2d24,
  998. .md_reg = 0x2d00,
  999. .mn = {
  1000. .mnctr_en_bit = 8,
  1001. .mnctr_reset_bit = 7,
  1002. .mnctr_mode_shift = 5,
  1003. .n_val_shift = 16,
  1004. .m_val_shift = 16,
  1005. .width = 8,
  1006. },
  1007. .p = {
  1008. .pre_div_shift = 3,
  1009. .pre_div_width = 2,
  1010. },
  1011. .s = {
  1012. .src_sel_shift = 0,
  1013. .parent_map = gcc_pxo_pll8_cxo_map,
  1014. },
  1015. .freq_tbl = clk_tbl_gp,
  1016. .clkr = {
  1017. .enable_reg = 0x2d24,
  1018. .enable_mask = BIT(11),
  1019. .hw.init = &(struct clk_init_data){
  1020. .name = "gp0_src",
  1021. .parent_names = gcc_pxo_pll8_cxo,
  1022. .num_parents = 3,
  1023. .ops = &clk_rcg_ops,
  1024. .flags = CLK_SET_PARENT_GATE,
  1025. },
  1026. }
  1027. };
  1028. static struct clk_branch gp0_clk = {
  1029. .halt_reg = 0x2fd8,
  1030. .halt_bit = 7,
  1031. .clkr = {
  1032. .enable_reg = 0x2d24,
  1033. .enable_mask = BIT(9),
  1034. .hw.init = &(struct clk_init_data){
  1035. .name = "gp0_clk",
  1036. .parent_names = (const char *[]){ "gp0_src" },
  1037. .num_parents = 1,
  1038. .ops = &clk_branch_ops,
  1039. .flags = CLK_SET_RATE_PARENT,
  1040. },
  1041. },
  1042. };
  1043. static struct clk_rcg gp1_src = {
  1044. .ns_reg = 0x2d44,
  1045. .md_reg = 0x2d40,
  1046. .mn = {
  1047. .mnctr_en_bit = 8,
  1048. .mnctr_reset_bit = 7,
  1049. .mnctr_mode_shift = 5,
  1050. .n_val_shift = 16,
  1051. .m_val_shift = 16,
  1052. .width = 8,
  1053. },
  1054. .p = {
  1055. .pre_div_shift = 3,
  1056. .pre_div_width = 2,
  1057. },
  1058. .s = {
  1059. .src_sel_shift = 0,
  1060. .parent_map = gcc_pxo_pll8_cxo_map,
  1061. },
  1062. .freq_tbl = clk_tbl_gp,
  1063. .clkr = {
  1064. .enable_reg = 0x2d44,
  1065. .enable_mask = BIT(11),
  1066. .hw.init = &(struct clk_init_data){
  1067. .name = "gp1_src",
  1068. .parent_names = gcc_pxo_pll8_cxo,
  1069. .num_parents = 3,
  1070. .ops = &clk_rcg_ops,
  1071. .flags = CLK_SET_RATE_GATE,
  1072. },
  1073. }
  1074. };
  1075. static struct clk_branch gp1_clk = {
  1076. .halt_reg = 0x2fd8,
  1077. .halt_bit = 6,
  1078. .clkr = {
  1079. .enable_reg = 0x2d44,
  1080. .enable_mask = BIT(9),
  1081. .hw.init = &(struct clk_init_data){
  1082. .name = "gp1_clk",
  1083. .parent_names = (const char *[]){ "gp1_src" },
  1084. .num_parents = 1,
  1085. .ops = &clk_branch_ops,
  1086. .flags = CLK_SET_RATE_PARENT,
  1087. },
  1088. },
  1089. };
  1090. static struct clk_rcg gp2_src = {
  1091. .ns_reg = 0x2d64,
  1092. .md_reg = 0x2d60,
  1093. .mn = {
  1094. .mnctr_en_bit = 8,
  1095. .mnctr_reset_bit = 7,
  1096. .mnctr_mode_shift = 5,
  1097. .n_val_shift = 16,
  1098. .m_val_shift = 16,
  1099. .width = 8,
  1100. },
  1101. .p = {
  1102. .pre_div_shift = 3,
  1103. .pre_div_width = 2,
  1104. },
  1105. .s = {
  1106. .src_sel_shift = 0,
  1107. .parent_map = gcc_pxo_pll8_cxo_map,
  1108. },
  1109. .freq_tbl = clk_tbl_gp,
  1110. .clkr = {
  1111. .enable_reg = 0x2d64,
  1112. .enable_mask = BIT(11),
  1113. .hw.init = &(struct clk_init_data){
  1114. .name = "gp2_src",
  1115. .parent_names = gcc_pxo_pll8_cxo,
  1116. .num_parents = 3,
  1117. .ops = &clk_rcg_ops,
  1118. .flags = CLK_SET_RATE_GATE,
  1119. },
  1120. }
  1121. };
  1122. static struct clk_branch gp2_clk = {
  1123. .halt_reg = 0x2fd8,
  1124. .halt_bit = 5,
  1125. .clkr = {
  1126. .enable_reg = 0x2d64,
  1127. .enable_mask = BIT(9),
  1128. .hw.init = &(struct clk_init_data){
  1129. .name = "gp2_clk",
  1130. .parent_names = (const char *[]){ "gp2_src" },
  1131. .num_parents = 1,
  1132. .ops = &clk_branch_ops,
  1133. .flags = CLK_SET_RATE_PARENT,
  1134. },
  1135. },
  1136. };
  1137. static struct clk_branch pmem_clk = {
  1138. .hwcg_reg = 0x25a0,
  1139. .hwcg_bit = 6,
  1140. .halt_reg = 0x2fc8,
  1141. .halt_bit = 20,
  1142. .clkr = {
  1143. .enable_reg = 0x25a0,
  1144. .enable_mask = BIT(4),
  1145. .hw.init = &(struct clk_init_data){
  1146. .name = "pmem_clk",
  1147. .ops = &clk_branch_ops,
  1148. },
  1149. },
  1150. };
  1151. static struct clk_rcg prng_src = {
  1152. .ns_reg = 0x2e80,
  1153. .p = {
  1154. .pre_div_shift = 3,
  1155. .pre_div_width = 4,
  1156. },
  1157. .s = {
  1158. .src_sel_shift = 0,
  1159. .parent_map = gcc_pxo_pll8_map,
  1160. },
  1161. .clkr = {
  1162. .hw.init = &(struct clk_init_data){
  1163. .name = "prng_src",
  1164. .parent_names = gcc_pxo_pll8,
  1165. .num_parents = 2,
  1166. .ops = &clk_rcg_ops,
  1167. },
  1168. },
  1169. };
  1170. static struct clk_branch prng_clk = {
  1171. .halt_reg = 0x2fd8,
  1172. .halt_check = BRANCH_HALT_VOTED,
  1173. .halt_bit = 10,
  1174. .clkr = {
  1175. .enable_reg = 0x3080,
  1176. .enable_mask = BIT(10),
  1177. .hw.init = &(struct clk_init_data){
  1178. .name = "prng_clk",
  1179. .parent_names = (const char *[]){ "prng_src" },
  1180. .num_parents = 1,
  1181. .ops = &clk_branch_ops,
  1182. },
  1183. },
  1184. };
  1185. static const struct freq_tbl clk_tbl_sdc[] = {
  1186. { 200000, P_PXO, 2, 2, 125 },
  1187. { 400000, P_PLL8, 4, 1, 240 },
  1188. { 16000000, P_PLL8, 4, 1, 6 },
  1189. { 17070000, P_PLL8, 1, 2, 45 },
  1190. { 20210000, P_PLL8, 1, 1, 19 },
  1191. { 24000000, P_PLL8, 4, 1, 4 },
  1192. { 48000000, P_PLL8, 4, 1, 2 },
  1193. { 64000000, P_PLL8, 3, 1, 2 },
  1194. { 96000000, P_PLL8, 4, 0, 0 },
  1195. { 192000000, P_PLL8, 2, 0, 0 },
  1196. { }
  1197. };
  1198. static struct clk_rcg sdc1_src = {
  1199. .ns_reg = 0x282c,
  1200. .md_reg = 0x2828,
  1201. .mn = {
  1202. .mnctr_en_bit = 8,
  1203. .mnctr_reset_bit = 7,
  1204. .mnctr_mode_shift = 5,
  1205. .n_val_shift = 16,
  1206. .m_val_shift = 16,
  1207. .width = 8,
  1208. },
  1209. .p = {
  1210. .pre_div_shift = 3,
  1211. .pre_div_width = 2,
  1212. },
  1213. .s = {
  1214. .src_sel_shift = 0,
  1215. .parent_map = gcc_pxo_pll8_map,
  1216. },
  1217. .freq_tbl = clk_tbl_sdc,
  1218. .clkr = {
  1219. .enable_reg = 0x282c,
  1220. .enable_mask = BIT(11),
  1221. .hw.init = &(struct clk_init_data){
  1222. .name = "sdc1_src",
  1223. .parent_names = gcc_pxo_pll8,
  1224. .num_parents = 2,
  1225. .ops = &clk_rcg_ops,
  1226. },
  1227. }
  1228. };
  1229. static struct clk_branch sdc1_clk = {
  1230. .halt_reg = 0x2fc8,
  1231. .halt_bit = 6,
  1232. .clkr = {
  1233. .enable_reg = 0x282c,
  1234. .enable_mask = BIT(9),
  1235. .hw.init = &(struct clk_init_data){
  1236. .name = "sdc1_clk",
  1237. .parent_names = (const char *[]){ "sdc1_src" },
  1238. .num_parents = 1,
  1239. .ops = &clk_branch_ops,
  1240. .flags = CLK_SET_RATE_PARENT,
  1241. },
  1242. },
  1243. };
  1244. static struct clk_rcg sdc3_src = {
  1245. .ns_reg = 0x286c,
  1246. .md_reg = 0x2868,
  1247. .mn = {
  1248. .mnctr_en_bit = 8,
  1249. .mnctr_reset_bit = 7,
  1250. .mnctr_mode_shift = 5,
  1251. .n_val_shift = 16,
  1252. .m_val_shift = 16,
  1253. .width = 8,
  1254. },
  1255. .p = {
  1256. .pre_div_shift = 3,
  1257. .pre_div_width = 2,
  1258. },
  1259. .s = {
  1260. .src_sel_shift = 0,
  1261. .parent_map = gcc_pxo_pll8_map,
  1262. },
  1263. .freq_tbl = clk_tbl_sdc,
  1264. .clkr = {
  1265. .enable_reg = 0x286c,
  1266. .enable_mask = BIT(11),
  1267. .hw.init = &(struct clk_init_data){
  1268. .name = "sdc3_src",
  1269. .parent_names = gcc_pxo_pll8,
  1270. .num_parents = 2,
  1271. .ops = &clk_rcg_ops,
  1272. },
  1273. }
  1274. };
  1275. static struct clk_branch sdc3_clk = {
  1276. .halt_reg = 0x2fc8,
  1277. .halt_bit = 4,
  1278. .clkr = {
  1279. .enable_reg = 0x286c,
  1280. .enable_mask = BIT(9),
  1281. .hw.init = &(struct clk_init_data){
  1282. .name = "sdc3_clk",
  1283. .parent_names = (const char *[]){ "sdc3_src" },
  1284. .num_parents = 1,
  1285. .ops = &clk_branch_ops,
  1286. .flags = CLK_SET_RATE_PARENT,
  1287. },
  1288. },
  1289. };
  1290. static struct clk_branch sdc1_h_clk = {
  1291. .hwcg_reg = 0x2820,
  1292. .hwcg_bit = 6,
  1293. .halt_reg = 0x2fc8,
  1294. .halt_bit = 11,
  1295. .clkr = {
  1296. .enable_reg = 0x2820,
  1297. .enable_mask = BIT(4),
  1298. .hw.init = &(struct clk_init_data){
  1299. .name = "sdc1_h_clk",
  1300. .ops = &clk_branch_ops,
  1301. },
  1302. },
  1303. };
  1304. static struct clk_branch sdc3_h_clk = {
  1305. .hwcg_reg = 0x2860,
  1306. .hwcg_bit = 6,
  1307. .halt_reg = 0x2fc8,
  1308. .halt_bit = 9,
  1309. .clkr = {
  1310. .enable_reg = 0x2860,
  1311. .enable_mask = BIT(4),
  1312. .hw.init = &(struct clk_init_data){
  1313. .name = "sdc3_h_clk",
  1314. .ops = &clk_branch_ops,
  1315. },
  1316. },
  1317. };
  1318. static const struct freq_tbl clk_tbl_tsif_ref[] = {
  1319. { 105000, P_PXO, 1, 1, 256 },
  1320. { }
  1321. };
  1322. static struct clk_rcg tsif_ref_src = {
  1323. .ns_reg = 0x2710,
  1324. .md_reg = 0x270c,
  1325. .mn = {
  1326. .mnctr_en_bit = 8,
  1327. .mnctr_reset_bit = 7,
  1328. .mnctr_mode_shift = 5,
  1329. .n_val_shift = 16,
  1330. .m_val_shift = 16,
  1331. .width = 16,
  1332. },
  1333. .p = {
  1334. .pre_div_shift = 3,
  1335. .pre_div_width = 2,
  1336. },
  1337. .s = {
  1338. .src_sel_shift = 0,
  1339. .parent_map = gcc_pxo_pll8_map,
  1340. },
  1341. .freq_tbl = clk_tbl_tsif_ref,
  1342. .clkr = {
  1343. .enable_reg = 0x2710,
  1344. .enable_mask = BIT(11),
  1345. .hw.init = &(struct clk_init_data){
  1346. .name = "tsif_ref_src",
  1347. .parent_names = gcc_pxo_pll8,
  1348. .num_parents = 2,
  1349. .ops = &clk_rcg_ops,
  1350. },
  1351. }
  1352. };
  1353. static struct clk_branch tsif_ref_clk = {
  1354. .halt_reg = 0x2fd4,
  1355. .halt_bit = 5,
  1356. .clkr = {
  1357. .enable_reg = 0x2710,
  1358. .enable_mask = BIT(9),
  1359. .hw.init = &(struct clk_init_data){
  1360. .name = "tsif_ref_clk",
  1361. .parent_names = (const char *[]){ "tsif_ref_src" },
  1362. .num_parents = 1,
  1363. .ops = &clk_branch_ops,
  1364. .flags = CLK_SET_RATE_PARENT,
  1365. },
  1366. },
  1367. };
  1368. static struct clk_branch tsif_h_clk = {
  1369. .hwcg_reg = 0x2700,
  1370. .hwcg_bit = 6,
  1371. .halt_reg = 0x2fd4,
  1372. .halt_bit = 7,
  1373. .clkr = {
  1374. .enable_reg = 0x2700,
  1375. .enable_mask = BIT(4),
  1376. .hw.init = &(struct clk_init_data){
  1377. .name = "tsif_h_clk",
  1378. .ops = &clk_branch_ops,
  1379. },
  1380. },
  1381. };
  1382. static struct clk_branch dma_bam_h_clk = {
  1383. .hwcg_reg = 0x25c0,
  1384. .hwcg_bit = 6,
  1385. .halt_reg = 0x2fc8,
  1386. .halt_bit = 12,
  1387. .clkr = {
  1388. .enable_reg = 0x25c0,
  1389. .enable_mask = BIT(4),
  1390. .hw.init = &(struct clk_init_data){
  1391. .name = "dma_bam_h_clk",
  1392. .ops = &clk_branch_ops,
  1393. },
  1394. },
  1395. };
  1396. static struct clk_branch adm0_clk = {
  1397. .halt_reg = 0x2fdc,
  1398. .halt_check = BRANCH_HALT_VOTED,
  1399. .halt_bit = 12,
  1400. .clkr = {
  1401. .enable_reg = 0x3080,
  1402. .enable_mask = BIT(2),
  1403. .hw.init = &(struct clk_init_data){
  1404. .name = "adm0_clk",
  1405. .ops = &clk_branch_ops,
  1406. },
  1407. },
  1408. };
  1409. static struct clk_branch adm0_pbus_clk = {
  1410. .hwcg_reg = 0x2208,
  1411. .hwcg_bit = 6,
  1412. .halt_reg = 0x2fdc,
  1413. .halt_check = BRANCH_HALT_VOTED,
  1414. .halt_bit = 11,
  1415. .clkr = {
  1416. .enable_reg = 0x3080,
  1417. .enable_mask = BIT(3),
  1418. .hw.init = &(struct clk_init_data){
  1419. .name = "adm0_pbus_clk",
  1420. .ops = &clk_branch_ops,
  1421. },
  1422. },
  1423. };
  1424. static struct clk_branch pmic_arb0_h_clk = {
  1425. .halt_reg = 0x2fd8,
  1426. .halt_check = BRANCH_HALT_VOTED,
  1427. .halt_bit = 22,
  1428. .clkr = {
  1429. .enable_reg = 0x3080,
  1430. .enable_mask = BIT(8),
  1431. .hw.init = &(struct clk_init_data){
  1432. .name = "pmic_arb0_h_clk",
  1433. .ops = &clk_branch_ops,
  1434. },
  1435. },
  1436. };
  1437. static struct clk_branch pmic_arb1_h_clk = {
  1438. .halt_reg = 0x2fd8,
  1439. .halt_check = BRANCH_HALT_VOTED,
  1440. .halt_bit = 21,
  1441. .clkr = {
  1442. .enable_reg = 0x3080,
  1443. .enable_mask = BIT(9),
  1444. .hw.init = &(struct clk_init_data){
  1445. .name = "pmic_arb1_h_clk",
  1446. .ops = &clk_branch_ops,
  1447. },
  1448. },
  1449. };
  1450. static struct clk_branch pmic_ssbi2_clk = {
  1451. .halt_reg = 0x2fd8,
  1452. .halt_check = BRANCH_HALT_VOTED,
  1453. .halt_bit = 23,
  1454. .clkr = {
  1455. .enable_reg = 0x3080,
  1456. .enable_mask = BIT(7),
  1457. .hw.init = &(struct clk_init_data){
  1458. .name = "pmic_ssbi2_clk",
  1459. .ops = &clk_branch_ops,
  1460. },
  1461. },
  1462. };
  1463. static struct clk_branch rpm_msg_ram_h_clk = {
  1464. .hwcg_reg = 0x27e0,
  1465. .hwcg_bit = 6,
  1466. .halt_reg = 0x2fd8,
  1467. .halt_check = BRANCH_HALT_VOTED,
  1468. .halt_bit = 12,
  1469. .clkr = {
  1470. .enable_reg = 0x3080,
  1471. .enable_mask = BIT(6),
  1472. .hw.init = &(struct clk_init_data){
  1473. .name = "rpm_msg_ram_h_clk",
  1474. .ops = &clk_branch_ops,
  1475. },
  1476. },
  1477. };
  1478. static const struct freq_tbl clk_tbl_pcie_ref[] = {
  1479. { 100000000, P_PLL3, 12, 0, 0 },
  1480. { }
  1481. };
  1482. static struct clk_rcg pcie_ref_src = {
  1483. .ns_reg = 0x3860,
  1484. .p = {
  1485. .pre_div_shift = 3,
  1486. .pre_div_width = 4,
  1487. },
  1488. .s = {
  1489. .src_sel_shift = 0,
  1490. .parent_map = gcc_pxo_pll3_map,
  1491. },
  1492. .freq_tbl = clk_tbl_pcie_ref,
  1493. .clkr = {
  1494. .enable_reg = 0x3860,
  1495. .enable_mask = BIT(11),
  1496. .hw.init = &(struct clk_init_data){
  1497. .name = "pcie_ref_src",
  1498. .parent_names = gcc_pxo_pll3,
  1499. .num_parents = 2,
  1500. .ops = &clk_rcg_ops,
  1501. .flags = CLK_SET_RATE_GATE,
  1502. },
  1503. },
  1504. };
  1505. static struct clk_branch pcie_ref_src_clk = {
  1506. .halt_reg = 0x2fdc,
  1507. .halt_bit = 30,
  1508. .clkr = {
  1509. .enable_reg = 0x3860,
  1510. .enable_mask = BIT(9),
  1511. .hw.init = &(struct clk_init_data){
  1512. .name = "pcie_ref_src_clk",
  1513. .parent_names = (const char *[]){ "pcie_ref_src" },
  1514. .num_parents = 1,
  1515. .ops = &clk_branch_ops,
  1516. .flags = CLK_SET_RATE_PARENT,
  1517. },
  1518. },
  1519. };
  1520. static struct clk_branch pcie_a_clk = {
  1521. .halt_reg = 0x2fc0,
  1522. .halt_bit = 13,
  1523. .clkr = {
  1524. .enable_reg = 0x22c0,
  1525. .enable_mask = BIT(4),
  1526. .hw.init = &(struct clk_init_data){
  1527. .name = "pcie_a_clk",
  1528. .ops = &clk_branch_ops,
  1529. },
  1530. },
  1531. };
  1532. static struct clk_branch pcie_aux_clk = {
  1533. .halt_reg = 0x2fdc,
  1534. .halt_bit = 31,
  1535. .clkr = {
  1536. .enable_reg = 0x22c8,
  1537. .enable_mask = BIT(4),
  1538. .hw.init = &(struct clk_init_data){
  1539. .name = "pcie_aux_clk",
  1540. .ops = &clk_branch_ops,
  1541. },
  1542. },
  1543. };
  1544. static struct clk_branch pcie_h_clk = {
  1545. .halt_reg = 0x2fd4,
  1546. .halt_bit = 8,
  1547. .clkr = {
  1548. .enable_reg = 0x22cc,
  1549. .enable_mask = BIT(4),
  1550. .hw.init = &(struct clk_init_data){
  1551. .name = "pcie_h_clk",
  1552. .ops = &clk_branch_ops,
  1553. },
  1554. },
  1555. };
  1556. static struct clk_branch pcie_phy_clk = {
  1557. .halt_reg = 0x2fdc,
  1558. .halt_bit = 29,
  1559. .clkr = {
  1560. .enable_reg = 0x22d0,
  1561. .enable_mask = BIT(4),
  1562. .hw.init = &(struct clk_init_data){
  1563. .name = "pcie_phy_clk",
  1564. .ops = &clk_branch_ops,
  1565. },
  1566. },
  1567. };
  1568. static struct clk_rcg pcie1_ref_src = {
  1569. .ns_reg = 0x3aa0,
  1570. .p = {
  1571. .pre_div_shift = 3,
  1572. .pre_div_width = 4,
  1573. },
  1574. .s = {
  1575. .src_sel_shift = 0,
  1576. .parent_map = gcc_pxo_pll3_map,
  1577. },
  1578. .freq_tbl = clk_tbl_pcie_ref,
  1579. .clkr = {
  1580. .enable_reg = 0x3aa0,
  1581. .enable_mask = BIT(11),
  1582. .hw.init = &(struct clk_init_data){
  1583. .name = "pcie1_ref_src",
  1584. .parent_names = gcc_pxo_pll3,
  1585. .num_parents = 2,
  1586. .ops = &clk_rcg_ops,
  1587. .flags = CLK_SET_RATE_GATE,
  1588. },
  1589. },
  1590. };
  1591. static struct clk_branch pcie1_ref_src_clk = {
  1592. .halt_reg = 0x2fdc,
  1593. .halt_bit = 27,
  1594. .clkr = {
  1595. .enable_reg = 0x3aa0,
  1596. .enable_mask = BIT(9),
  1597. .hw.init = &(struct clk_init_data){
  1598. .name = "pcie1_ref_src_clk",
  1599. .parent_names = (const char *[]){ "pcie1_ref_src" },
  1600. .num_parents = 1,
  1601. .ops = &clk_branch_ops,
  1602. .flags = CLK_SET_RATE_PARENT,
  1603. },
  1604. },
  1605. };
  1606. static struct clk_branch pcie1_a_clk = {
  1607. .halt_reg = 0x2fc0,
  1608. .halt_bit = 10,
  1609. .clkr = {
  1610. .enable_reg = 0x3a80,
  1611. .enable_mask = BIT(4),
  1612. .hw.init = &(struct clk_init_data){
  1613. .name = "pcie1_a_clk",
  1614. .ops = &clk_branch_ops,
  1615. },
  1616. },
  1617. };
  1618. static struct clk_branch pcie1_aux_clk = {
  1619. .halt_reg = 0x2fdc,
  1620. .halt_bit = 28,
  1621. .clkr = {
  1622. .enable_reg = 0x3a88,
  1623. .enable_mask = BIT(4),
  1624. .hw.init = &(struct clk_init_data){
  1625. .name = "pcie1_aux_clk",
  1626. .ops = &clk_branch_ops,
  1627. },
  1628. },
  1629. };
  1630. static struct clk_branch pcie1_h_clk = {
  1631. .halt_reg = 0x2fd4,
  1632. .halt_bit = 9,
  1633. .clkr = {
  1634. .enable_reg = 0x3a8c,
  1635. .enable_mask = BIT(4),
  1636. .hw.init = &(struct clk_init_data){
  1637. .name = "pcie1_h_clk",
  1638. .ops = &clk_branch_ops,
  1639. },
  1640. },
  1641. };
  1642. static struct clk_branch pcie1_phy_clk = {
  1643. .halt_reg = 0x2fdc,
  1644. .halt_bit = 26,
  1645. .clkr = {
  1646. .enable_reg = 0x3a90,
  1647. .enable_mask = BIT(4),
  1648. .hw.init = &(struct clk_init_data){
  1649. .name = "pcie1_phy_clk",
  1650. .ops = &clk_branch_ops,
  1651. },
  1652. },
  1653. };
  1654. static struct clk_rcg pcie2_ref_src = {
  1655. .ns_reg = 0x3ae0,
  1656. .p = {
  1657. .pre_div_shift = 3,
  1658. .pre_div_width = 4,
  1659. },
  1660. .s = {
  1661. .src_sel_shift = 0,
  1662. .parent_map = gcc_pxo_pll3_map,
  1663. },
  1664. .freq_tbl = clk_tbl_pcie_ref,
  1665. .clkr = {
  1666. .enable_reg = 0x3ae0,
  1667. .enable_mask = BIT(11),
  1668. .hw.init = &(struct clk_init_data){
  1669. .name = "pcie2_ref_src",
  1670. .parent_names = gcc_pxo_pll3,
  1671. .num_parents = 2,
  1672. .ops = &clk_rcg_ops,
  1673. .flags = CLK_SET_RATE_GATE,
  1674. },
  1675. },
  1676. };
  1677. static struct clk_branch pcie2_ref_src_clk = {
  1678. .halt_reg = 0x2fdc,
  1679. .halt_bit = 24,
  1680. .clkr = {
  1681. .enable_reg = 0x3ae0,
  1682. .enable_mask = BIT(9),
  1683. .hw.init = &(struct clk_init_data){
  1684. .name = "pcie2_ref_src_clk",
  1685. .parent_names = (const char *[]){ "pcie2_ref_src" },
  1686. .num_parents = 1,
  1687. .ops = &clk_branch_ops,
  1688. .flags = CLK_SET_RATE_PARENT,
  1689. },
  1690. },
  1691. };
  1692. static struct clk_branch pcie2_a_clk = {
  1693. .halt_reg = 0x2fc0,
  1694. .halt_bit = 9,
  1695. .clkr = {
  1696. .enable_reg = 0x3ac0,
  1697. .enable_mask = BIT(4),
  1698. .hw.init = &(struct clk_init_data){
  1699. .name = "pcie2_a_clk",
  1700. .ops = &clk_branch_ops,
  1701. },
  1702. },
  1703. };
  1704. static struct clk_branch pcie2_aux_clk = {
  1705. .halt_reg = 0x2fdc,
  1706. .halt_bit = 25,
  1707. .clkr = {
  1708. .enable_reg = 0x3ac8,
  1709. .enable_mask = BIT(4),
  1710. .hw.init = &(struct clk_init_data){
  1711. .name = "pcie2_aux_clk",
  1712. .ops = &clk_branch_ops,
  1713. },
  1714. },
  1715. };
  1716. static struct clk_branch pcie2_h_clk = {
  1717. .halt_reg = 0x2fd4,
  1718. .halt_bit = 10,
  1719. .clkr = {
  1720. .enable_reg = 0x3acc,
  1721. .enable_mask = BIT(4),
  1722. .hw.init = &(struct clk_init_data){
  1723. .name = "pcie2_h_clk",
  1724. .ops = &clk_branch_ops,
  1725. },
  1726. },
  1727. };
  1728. static struct clk_branch pcie2_phy_clk = {
  1729. .halt_reg = 0x2fdc,
  1730. .halt_bit = 23,
  1731. .clkr = {
  1732. .enable_reg = 0x3ad0,
  1733. .enable_mask = BIT(4),
  1734. .hw.init = &(struct clk_init_data){
  1735. .name = "pcie2_phy_clk",
  1736. .ops = &clk_branch_ops,
  1737. },
  1738. },
  1739. };
  1740. static const struct freq_tbl clk_tbl_sata_ref[] = {
  1741. { 100000000, P_PLL3, 12, 0, 0 },
  1742. { }
  1743. };
  1744. static struct clk_rcg sata_ref_src = {
  1745. .ns_reg = 0x2c08,
  1746. .p = {
  1747. .pre_div_shift = 3,
  1748. .pre_div_width = 4,
  1749. },
  1750. .s = {
  1751. .src_sel_shift = 0,
  1752. .parent_map = gcc_pxo_pll3_sata_map,
  1753. },
  1754. .freq_tbl = clk_tbl_sata_ref,
  1755. .clkr = {
  1756. .enable_reg = 0x2c08,
  1757. .enable_mask = BIT(7),
  1758. .hw.init = &(struct clk_init_data){
  1759. .name = "sata_ref_src",
  1760. .parent_names = gcc_pxo_pll3,
  1761. .num_parents = 2,
  1762. .ops = &clk_rcg_ops,
  1763. .flags = CLK_SET_RATE_GATE,
  1764. },
  1765. },
  1766. };
  1767. static struct clk_branch sata_rxoob_clk = {
  1768. .halt_reg = 0x2fdc,
  1769. .halt_bit = 20,
  1770. .clkr = {
  1771. .enable_reg = 0x2c0c,
  1772. .enable_mask = BIT(4),
  1773. .hw.init = &(struct clk_init_data){
  1774. .name = "sata_rxoob_clk",
  1775. .parent_names = (const char *[]){ "sata_ref_src" },
  1776. .num_parents = 1,
  1777. .ops = &clk_branch_ops,
  1778. .flags = CLK_SET_RATE_PARENT,
  1779. },
  1780. },
  1781. };
  1782. static struct clk_branch sata_pmalive_clk = {
  1783. .halt_reg = 0x2fdc,
  1784. .halt_bit = 19,
  1785. .clkr = {
  1786. .enable_reg = 0x2c10,
  1787. .enable_mask = BIT(4),
  1788. .hw.init = &(struct clk_init_data){
  1789. .name = "sata_pmalive_clk",
  1790. .parent_names = (const char *[]){ "sata_ref_src" },
  1791. .num_parents = 1,
  1792. .ops = &clk_branch_ops,
  1793. .flags = CLK_SET_RATE_PARENT,
  1794. },
  1795. },
  1796. };
  1797. static struct clk_branch sata_phy_ref_clk = {
  1798. .halt_reg = 0x2fdc,
  1799. .halt_bit = 18,
  1800. .clkr = {
  1801. .enable_reg = 0x2c14,
  1802. .enable_mask = BIT(4),
  1803. .hw.init = &(struct clk_init_data){
  1804. .name = "sata_phy_ref_clk",
  1805. .parent_names = (const char *[]){ "pxo" },
  1806. .num_parents = 1,
  1807. .ops = &clk_branch_ops,
  1808. },
  1809. },
  1810. };
  1811. static struct clk_branch sata_a_clk = {
  1812. .halt_reg = 0x2fc0,
  1813. .halt_bit = 12,
  1814. .clkr = {
  1815. .enable_reg = 0x2c20,
  1816. .enable_mask = BIT(4),
  1817. .hw.init = &(struct clk_init_data){
  1818. .name = "sata_a_clk",
  1819. .ops = &clk_branch_ops,
  1820. },
  1821. },
  1822. };
  1823. static struct clk_branch sata_h_clk = {
  1824. .halt_reg = 0x2fdc,
  1825. .halt_bit = 21,
  1826. .clkr = {
  1827. .enable_reg = 0x2c00,
  1828. .enable_mask = BIT(4),
  1829. .hw.init = &(struct clk_init_data){
  1830. .name = "sata_h_clk",
  1831. .ops = &clk_branch_ops,
  1832. },
  1833. },
  1834. };
  1835. static struct clk_branch sfab_sata_s_h_clk = {
  1836. .halt_reg = 0x2fc4,
  1837. .halt_bit = 14,
  1838. .clkr = {
  1839. .enable_reg = 0x2480,
  1840. .enable_mask = BIT(4),
  1841. .hw.init = &(struct clk_init_data){
  1842. .name = "sfab_sata_s_h_clk",
  1843. .ops = &clk_branch_ops,
  1844. },
  1845. },
  1846. };
  1847. static struct clk_branch sata_phy_cfg_clk = {
  1848. .halt_reg = 0x2fcc,
  1849. .halt_bit = 14,
  1850. .clkr = {
  1851. .enable_reg = 0x2c40,
  1852. .enable_mask = BIT(4),
  1853. .hw.init = &(struct clk_init_data){
  1854. .name = "sata_phy_cfg_clk",
  1855. .ops = &clk_branch_ops,
  1856. },
  1857. },
  1858. };
  1859. static const struct freq_tbl clk_tbl_usb30_master[] = {
  1860. { 125000000, P_PLL0, 1, 5, 32 },
  1861. { }
  1862. };
  1863. static struct clk_rcg usb30_master_clk_src = {
  1864. .ns_reg = 0x3b2c,
  1865. .md_reg = 0x3b28,
  1866. .mn = {
  1867. .mnctr_en_bit = 8,
  1868. .mnctr_reset_bit = 7,
  1869. .mnctr_mode_shift = 5,
  1870. .n_val_shift = 16,
  1871. .m_val_shift = 16,
  1872. .width = 8,
  1873. },
  1874. .p = {
  1875. .pre_div_shift = 3,
  1876. .pre_div_width = 2,
  1877. },
  1878. .s = {
  1879. .src_sel_shift = 0,
  1880. .parent_map = gcc_pxo_pll8_pll0,
  1881. },
  1882. .freq_tbl = clk_tbl_usb30_master,
  1883. .clkr = {
  1884. .enable_reg = 0x3b2c,
  1885. .enable_mask = BIT(11),
  1886. .hw.init = &(struct clk_init_data){
  1887. .name = "usb30_master_ref_src",
  1888. .parent_names = gcc_pxo_pll8_pll0_map,
  1889. .num_parents = 3,
  1890. .ops = &clk_rcg_ops,
  1891. .flags = CLK_SET_RATE_GATE,
  1892. },
  1893. },
  1894. };
  1895. static struct clk_branch usb30_0_branch_clk = {
  1896. .halt_reg = 0x2fc4,
  1897. .halt_bit = 22,
  1898. .clkr = {
  1899. .enable_reg = 0x3b24,
  1900. .enable_mask = BIT(4),
  1901. .hw.init = &(struct clk_init_data){
  1902. .name = "usb30_0_branch_clk",
  1903. .parent_names = (const char *[]){ "usb30_master_ref_src", },
  1904. .num_parents = 1,
  1905. .ops = &clk_branch_ops,
  1906. .flags = CLK_SET_RATE_PARENT,
  1907. },
  1908. },
  1909. };
  1910. static struct clk_branch usb30_1_branch_clk = {
  1911. .halt_reg = 0x2fc4,
  1912. .halt_bit = 17,
  1913. .clkr = {
  1914. .enable_reg = 0x3b34,
  1915. .enable_mask = BIT(4),
  1916. .hw.init = &(struct clk_init_data){
  1917. .name = "usb30_1_branch_clk",
  1918. .parent_names = (const char *[]){ "usb30_master_ref_src", },
  1919. .num_parents = 1,
  1920. .ops = &clk_branch_ops,
  1921. .flags = CLK_SET_RATE_PARENT,
  1922. },
  1923. },
  1924. };
  1925. static const struct freq_tbl clk_tbl_usb30_utmi[] = {
  1926. { 60000000, P_PLL8, 1, 5, 32 },
  1927. { }
  1928. };
  1929. static struct clk_rcg usb30_utmi_clk = {
  1930. .ns_reg = 0x3b44,
  1931. .md_reg = 0x3b40,
  1932. .mn = {
  1933. .mnctr_en_bit = 8,
  1934. .mnctr_reset_bit = 7,
  1935. .mnctr_mode_shift = 5,
  1936. .n_val_shift = 16,
  1937. .m_val_shift = 16,
  1938. .width = 8,
  1939. },
  1940. .p = {
  1941. .pre_div_shift = 3,
  1942. .pre_div_width = 2,
  1943. },
  1944. .s = {
  1945. .src_sel_shift = 0,
  1946. .parent_map = gcc_pxo_pll8_pll0,
  1947. },
  1948. .freq_tbl = clk_tbl_usb30_utmi,
  1949. .clkr = {
  1950. .enable_reg = 0x3b44,
  1951. .enable_mask = BIT(11),
  1952. .hw.init = &(struct clk_init_data){
  1953. .name = "usb30_utmi_clk",
  1954. .parent_names = gcc_pxo_pll8_pll0_map,
  1955. .num_parents = 3,
  1956. .ops = &clk_rcg_ops,
  1957. .flags = CLK_SET_RATE_GATE,
  1958. },
  1959. },
  1960. };
  1961. static struct clk_branch usb30_0_utmi_clk_ctl = {
  1962. .halt_reg = 0x2fc4,
  1963. .halt_bit = 21,
  1964. .clkr = {
  1965. .enable_reg = 0x3b48,
  1966. .enable_mask = BIT(4),
  1967. .hw.init = &(struct clk_init_data){
  1968. .name = "usb30_0_utmi_clk_ctl",
  1969. .parent_names = (const char *[]){ "usb30_utmi_clk", },
  1970. .num_parents = 1,
  1971. .ops = &clk_branch_ops,
  1972. .flags = CLK_SET_RATE_PARENT,
  1973. },
  1974. },
  1975. };
  1976. static struct clk_branch usb30_1_utmi_clk_ctl = {
  1977. .halt_reg = 0x2fc4,
  1978. .halt_bit = 15,
  1979. .clkr = {
  1980. .enable_reg = 0x3b4c,
  1981. .enable_mask = BIT(4),
  1982. .hw.init = &(struct clk_init_data){
  1983. .name = "usb30_1_utmi_clk_ctl",
  1984. .parent_names = (const char *[]){ "usb30_utmi_clk", },
  1985. .num_parents = 1,
  1986. .ops = &clk_branch_ops,
  1987. .flags = CLK_SET_RATE_PARENT,
  1988. },
  1989. },
  1990. };
  1991. static const struct freq_tbl clk_tbl_usb[] = {
  1992. { 60000000, P_PLL8, 1, 5, 32 },
  1993. { }
  1994. };
  1995. static struct clk_rcg usb_hs1_xcvr_clk_src = {
  1996. .ns_reg = 0x290C,
  1997. .md_reg = 0x2908,
  1998. .mn = {
  1999. .mnctr_en_bit = 8,
  2000. .mnctr_reset_bit = 7,
  2001. .mnctr_mode_shift = 5,
  2002. .n_val_shift = 16,
  2003. .m_val_shift = 16,
  2004. .width = 8,
  2005. },
  2006. .p = {
  2007. .pre_div_shift = 3,
  2008. .pre_div_width = 2,
  2009. },
  2010. .s = {
  2011. .src_sel_shift = 0,
  2012. .parent_map = gcc_pxo_pll8_pll0,
  2013. },
  2014. .freq_tbl = clk_tbl_usb,
  2015. .clkr = {
  2016. .enable_reg = 0x2968,
  2017. .enable_mask = BIT(11),
  2018. .hw.init = &(struct clk_init_data){
  2019. .name = "usb_hs1_xcvr_src",
  2020. .parent_names = gcc_pxo_pll8_pll0_map,
  2021. .num_parents = 3,
  2022. .ops = &clk_rcg_ops,
  2023. .flags = CLK_SET_RATE_GATE,
  2024. },
  2025. },
  2026. };
  2027. static struct clk_branch usb_hs1_xcvr_clk = {
  2028. .halt_reg = 0x2fcc,
  2029. .halt_bit = 17,
  2030. .clkr = {
  2031. .enable_reg = 0x290c,
  2032. .enable_mask = BIT(9),
  2033. .hw.init = &(struct clk_init_data){
  2034. .name = "usb_hs1_xcvr_clk",
  2035. .parent_names = (const char *[]){ "usb_hs1_xcvr_src" },
  2036. .num_parents = 1,
  2037. .ops = &clk_branch_ops,
  2038. .flags = CLK_SET_RATE_PARENT,
  2039. },
  2040. },
  2041. };
  2042. static struct clk_branch usb_hs1_h_clk = {
  2043. .hwcg_reg = 0x2900,
  2044. .hwcg_bit = 6,
  2045. .halt_reg = 0x2fc8,
  2046. .halt_bit = 1,
  2047. .clkr = {
  2048. .enable_reg = 0x2900,
  2049. .enable_mask = BIT(4),
  2050. .hw.init = &(struct clk_init_data){
  2051. .name = "usb_hs1_h_clk",
  2052. .ops = &clk_branch_ops,
  2053. },
  2054. },
  2055. };
  2056. static struct clk_rcg usb_fs1_xcvr_clk_src = {
  2057. .ns_reg = 0x2968,
  2058. .md_reg = 0x2964,
  2059. .mn = {
  2060. .mnctr_en_bit = 8,
  2061. .mnctr_reset_bit = 7,
  2062. .mnctr_mode_shift = 5,
  2063. .n_val_shift = 16,
  2064. .m_val_shift = 16,
  2065. .width = 8,
  2066. },
  2067. .p = {
  2068. .pre_div_shift = 3,
  2069. .pre_div_width = 2,
  2070. },
  2071. .s = {
  2072. .src_sel_shift = 0,
  2073. .parent_map = gcc_pxo_pll8_pll0,
  2074. },
  2075. .freq_tbl = clk_tbl_usb,
  2076. .clkr = {
  2077. .enable_reg = 0x2968,
  2078. .enable_mask = BIT(11),
  2079. .hw.init = &(struct clk_init_data){
  2080. .name = "usb_fs1_xcvr_src",
  2081. .parent_names = gcc_pxo_pll8_pll0_map,
  2082. .num_parents = 3,
  2083. .ops = &clk_rcg_ops,
  2084. .flags = CLK_SET_RATE_GATE,
  2085. },
  2086. },
  2087. };
  2088. static struct clk_branch usb_fs1_xcvr_clk = {
  2089. .halt_reg = 0x2fcc,
  2090. .halt_bit = 17,
  2091. .clkr = {
  2092. .enable_reg = 0x2968,
  2093. .enable_mask = BIT(9),
  2094. .hw.init = &(struct clk_init_data){
  2095. .name = "usb_fs1_xcvr_clk",
  2096. .parent_names = (const char *[]){ "usb_fs1_xcvr_src", },
  2097. .num_parents = 1,
  2098. .ops = &clk_branch_ops,
  2099. .flags = CLK_SET_RATE_PARENT,
  2100. },
  2101. },
  2102. };
  2103. static struct clk_branch usb_fs1_sys_clk = {
  2104. .halt_reg = 0x2fcc,
  2105. .halt_bit = 18,
  2106. .clkr = {
  2107. .enable_reg = 0x296c,
  2108. .enable_mask = BIT(4),
  2109. .hw.init = &(struct clk_init_data){
  2110. .name = "usb_fs1_sys_clk",
  2111. .parent_names = (const char *[]){ "usb_fs1_xcvr_src", },
  2112. .num_parents = 1,
  2113. .ops = &clk_branch_ops,
  2114. .flags = CLK_SET_RATE_PARENT,
  2115. },
  2116. },
  2117. };
  2118. static struct clk_branch usb_fs1_h_clk = {
  2119. .halt_reg = 0x2fcc,
  2120. .halt_bit = 19,
  2121. .clkr = {
  2122. .enable_reg = 0x2960,
  2123. .enable_mask = BIT(4),
  2124. .hw.init = &(struct clk_init_data){
  2125. .name = "usb_fs1_h_clk",
  2126. .ops = &clk_branch_ops,
  2127. },
  2128. },
  2129. };
  2130. static struct clk_branch ebi2_clk = {
  2131. .hwcg_reg = 0x3b00,
  2132. .hwcg_bit = 6,
  2133. .halt_reg = 0x2fcc,
  2134. .halt_bit = 1,
  2135. .clkr = {
  2136. .enable_reg = 0x3b00,
  2137. .enable_mask = BIT(4),
  2138. .hw.init = &(struct clk_init_data){
  2139. .name = "ebi2_clk",
  2140. .ops = &clk_branch_ops,
  2141. },
  2142. },
  2143. };
  2144. static struct clk_branch ebi2_aon_clk = {
  2145. .halt_reg = 0x2fcc,
  2146. .halt_bit = 0,
  2147. .clkr = {
  2148. .enable_reg = 0x3b00,
  2149. .enable_mask = BIT(8),
  2150. .hw.init = &(struct clk_init_data){
  2151. .name = "ebi2_always_on_clk",
  2152. .ops = &clk_branch_ops,
  2153. },
  2154. },
  2155. };
  2156. static const struct freq_tbl clk_tbl_gmac[] = {
  2157. { 133000000, P_PLL0, 1, 50, 301 },
  2158. { 266000000, P_PLL0, 1, 127, 382 },
  2159. { }
  2160. };
  2161. static struct clk_dyn_rcg gmac_core1_src = {
  2162. .ns_reg[0] = 0x3cac,
  2163. .ns_reg[1] = 0x3cb0,
  2164. .md_reg[0] = 0x3ca4,
  2165. .md_reg[1] = 0x3ca8,
  2166. .bank_reg = 0x3ca0,
  2167. .mn[0] = {
  2168. .mnctr_en_bit = 8,
  2169. .mnctr_reset_bit = 7,
  2170. .mnctr_mode_shift = 5,
  2171. .n_val_shift = 16,
  2172. .m_val_shift = 16,
  2173. .width = 8,
  2174. },
  2175. .mn[1] = {
  2176. .mnctr_en_bit = 8,
  2177. .mnctr_reset_bit = 7,
  2178. .mnctr_mode_shift = 5,
  2179. .n_val_shift = 16,
  2180. .m_val_shift = 16,
  2181. .width = 8,
  2182. },
  2183. .s[0] = {
  2184. .src_sel_shift = 0,
  2185. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2186. },
  2187. .s[1] = {
  2188. .src_sel_shift = 0,
  2189. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2190. },
  2191. .p[0] = {
  2192. .pre_div_shift = 3,
  2193. .pre_div_width = 2,
  2194. },
  2195. .p[1] = {
  2196. .pre_div_shift = 3,
  2197. .pre_div_width = 2,
  2198. },
  2199. .mux_sel_bit = 0,
  2200. .freq_tbl = clk_tbl_gmac,
  2201. .clkr = {
  2202. .enable_reg = 0x3ca0,
  2203. .enable_mask = BIT(1),
  2204. .hw.init = &(struct clk_init_data){
  2205. .name = "gmac_core1_src",
  2206. .parent_names = gcc_pxo_pll8_pll14_pll18_pll0,
  2207. .num_parents = 5,
  2208. .ops = &clk_dyn_rcg_ops,
  2209. },
  2210. },
  2211. };
  2212. static struct clk_branch gmac_core1_clk = {
  2213. .halt_reg = 0x3c20,
  2214. .halt_bit = 4,
  2215. .hwcg_reg = 0x3cb4,
  2216. .hwcg_bit = 6,
  2217. .clkr = {
  2218. .enable_reg = 0x3cb4,
  2219. .enable_mask = BIT(4),
  2220. .hw.init = &(struct clk_init_data){
  2221. .name = "gmac_core1_clk",
  2222. .parent_names = (const char *[]){
  2223. "gmac_core1_src",
  2224. },
  2225. .num_parents = 1,
  2226. .ops = &clk_branch_ops,
  2227. .flags = CLK_SET_RATE_PARENT,
  2228. },
  2229. },
  2230. };
  2231. static struct clk_dyn_rcg gmac_core2_src = {
  2232. .ns_reg[0] = 0x3ccc,
  2233. .ns_reg[1] = 0x3cd0,
  2234. .md_reg[0] = 0x3cc4,
  2235. .md_reg[1] = 0x3cc8,
  2236. .bank_reg = 0x3ca0,
  2237. .mn[0] = {
  2238. .mnctr_en_bit = 8,
  2239. .mnctr_reset_bit = 7,
  2240. .mnctr_mode_shift = 5,
  2241. .n_val_shift = 16,
  2242. .m_val_shift = 16,
  2243. .width = 8,
  2244. },
  2245. .mn[1] = {
  2246. .mnctr_en_bit = 8,
  2247. .mnctr_reset_bit = 7,
  2248. .mnctr_mode_shift = 5,
  2249. .n_val_shift = 16,
  2250. .m_val_shift = 16,
  2251. .width = 8,
  2252. },
  2253. .s[0] = {
  2254. .src_sel_shift = 0,
  2255. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2256. },
  2257. .s[1] = {
  2258. .src_sel_shift = 0,
  2259. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2260. },
  2261. .p[0] = {
  2262. .pre_div_shift = 3,
  2263. .pre_div_width = 2,
  2264. },
  2265. .p[1] = {
  2266. .pre_div_shift = 3,
  2267. .pre_div_width = 2,
  2268. },
  2269. .mux_sel_bit = 0,
  2270. .freq_tbl = clk_tbl_gmac,
  2271. .clkr = {
  2272. .enable_reg = 0x3cc0,
  2273. .enable_mask = BIT(1),
  2274. .hw.init = &(struct clk_init_data){
  2275. .name = "gmac_core2_src",
  2276. .parent_names = gcc_pxo_pll8_pll14_pll18_pll0,
  2277. .num_parents = 5,
  2278. .ops = &clk_dyn_rcg_ops,
  2279. },
  2280. },
  2281. };
  2282. static struct clk_branch gmac_core2_clk = {
  2283. .halt_reg = 0x3c20,
  2284. .halt_bit = 5,
  2285. .hwcg_reg = 0x3cd4,
  2286. .hwcg_bit = 6,
  2287. .clkr = {
  2288. .enable_reg = 0x3cd4,
  2289. .enable_mask = BIT(4),
  2290. .hw.init = &(struct clk_init_data){
  2291. .name = "gmac_core2_clk",
  2292. .parent_names = (const char *[]){
  2293. "gmac_core2_src",
  2294. },
  2295. .num_parents = 1,
  2296. .ops = &clk_branch_ops,
  2297. .flags = CLK_SET_RATE_PARENT,
  2298. },
  2299. },
  2300. };
  2301. static struct clk_dyn_rcg gmac_core3_src = {
  2302. .ns_reg[0] = 0x3cec,
  2303. .ns_reg[1] = 0x3cf0,
  2304. .md_reg[0] = 0x3ce4,
  2305. .md_reg[1] = 0x3ce8,
  2306. .bank_reg = 0x3ce0,
  2307. .mn[0] = {
  2308. .mnctr_en_bit = 8,
  2309. .mnctr_reset_bit = 7,
  2310. .mnctr_mode_shift = 5,
  2311. .n_val_shift = 16,
  2312. .m_val_shift = 16,
  2313. .width = 8,
  2314. },
  2315. .mn[1] = {
  2316. .mnctr_en_bit = 8,
  2317. .mnctr_reset_bit = 7,
  2318. .mnctr_mode_shift = 5,
  2319. .n_val_shift = 16,
  2320. .m_val_shift = 16,
  2321. .width = 8,
  2322. },
  2323. .s[0] = {
  2324. .src_sel_shift = 0,
  2325. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2326. },
  2327. .s[1] = {
  2328. .src_sel_shift = 0,
  2329. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2330. },
  2331. .p[0] = {
  2332. .pre_div_shift = 3,
  2333. .pre_div_width = 2,
  2334. },
  2335. .p[1] = {
  2336. .pre_div_shift = 3,
  2337. .pre_div_width = 2,
  2338. },
  2339. .mux_sel_bit = 0,
  2340. .freq_tbl = clk_tbl_gmac,
  2341. .clkr = {
  2342. .enable_reg = 0x3ce0,
  2343. .enable_mask = BIT(1),
  2344. .hw.init = &(struct clk_init_data){
  2345. .name = "gmac_core3_src",
  2346. .parent_names = gcc_pxo_pll8_pll14_pll18_pll0,
  2347. .num_parents = 5,
  2348. .ops = &clk_dyn_rcg_ops,
  2349. },
  2350. },
  2351. };
  2352. static struct clk_branch gmac_core3_clk = {
  2353. .halt_reg = 0x3c20,
  2354. .halt_bit = 6,
  2355. .hwcg_reg = 0x3cf4,
  2356. .hwcg_bit = 6,
  2357. .clkr = {
  2358. .enable_reg = 0x3cf4,
  2359. .enable_mask = BIT(4),
  2360. .hw.init = &(struct clk_init_data){
  2361. .name = "gmac_core3_clk",
  2362. .parent_names = (const char *[]){
  2363. "gmac_core3_src",
  2364. },
  2365. .num_parents = 1,
  2366. .ops = &clk_branch_ops,
  2367. .flags = CLK_SET_RATE_PARENT,
  2368. },
  2369. },
  2370. };
  2371. static struct clk_dyn_rcg gmac_core4_src = {
  2372. .ns_reg[0] = 0x3d0c,
  2373. .ns_reg[1] = 0x3d10,
  2374. .md_reg[0] = 0x3d04,
  2375. .md_reg[1] = 0x3d08,
  2376. .bank_reg = 0x3d00,
  2377. .mn[0] = {
  2378. .mnctr_en_bit = 8,
  2379. .mnctr_reset_bit = 7,
  2380. .mnctr_mode_shift = 5,
  2381. .n_val_shift = 16,
  2382. .m_val_shift = 16,
  2383. .width = 8,
  2384. },
  2385. .mn[1] = {
  2386. .mnctr_en_bit = 8,
  2387. .mnctr_reset_bit = 7,
  2388. .mnctr_mode_shift = 5,
  2389. .n_val_shift = 16,
  2390. .m_val_shift = 16,
  2391. .width = 8,
  2392. },
  2393. .s[0] = {
  2394. .src_sel_shift = 0,
  2395. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2396. },
  2397. .s[1] = {
  2398. .src_sel_shift = 0,
  2399. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2400. },
  2401. .p[0] = {
  2402. .pre_div_shift = 3,
  2403. .pre_div_width = 2,
  2404. },
  2405. .p[1] = {
  2406. .pre_div_shift = 3,
  2407. .pre_div_width = 2,
  2408. },
  2409. .mux_sel_bit = 0,
  2410. .freq_tbl = clk_tbl_gmac,
  2411. .clkr = {
  2412. .enable_reg = 0x3d00,
  2413. .enable_mask = BIT(1),
  2414. .hw.init = &(struct clk_init_data){
  2415. .name = "gmac_core4_src",
  2416. .parent_names = gcc_pxo_pll8_pll14_pll18_pll0,
  2417. .num_parents = 5,
  2418. .ops = &clk_dyn_rcg_ops,
  2419. },
  2420. },
  2421. };
  2422. static struct clk_branch gmac_core4_clk = {
  2423. .halt_reg = 0x3c20,
  2424. .halt_bit = 7,
  2425. .hwcg_reg = 0x3d14,
  2426. .hwcg_bit = 6,
  2427. .clkr = {
  2428. .enable_reg = 0x3d14,
  2429. .enable_mask = BIT(4),
  2430. .hw.init = &(struct clk_init_data){
  2431. .name = "gmac_core4_clk",
  2432. .parent_names = (const char *[]){
  2433. "gmac_core4_src",
  2434. },
  2435. .num_parents = 1,
  2436. .ops = &clk_branch_ops,
  2437. .flags = CLK_SET_RATE_PARENT,
  2438. },
  2439. },
  2440. };
  2441. static const struct freq_tbl clk_tbl_nss_tcm[] = {
  2442. { 266000000, P_PLL0, 3, 0, 0 },
  2443. { 400000000, P_PLL0, 2, 0, 0 },
  2444. { }
  2445. };
  2446. static struct clk_dyn_rcg nss_tcm_src = {
  2447. .ns_reg[0] = 0x3dc4,
  2448. .ns_reg[1] = 0x3dc8,
  2449. .bank_reg = 0x3dc0,
  2450. .s[0] = {
  2451. .src_sel_shift = 0,
  2452. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2453. },
  2454. .s[1] = {
  2455. .src_sel_shift = 0,
  2456. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2457. },
  2458. .p[0] = {
  2459. .pre_div_shift = 3,
  2460. .pre_div_width = 4,
  2461. },
  2462. .p[1] = {
  2463. .pre_div_shift = 3,
  2464. .pre_div_width = 4,
  2465. },
  2466. .mux_sel_bit = 0,
  2467. .freq_tbl = clk_tbl_nss_tcm,
  2468. .clkr = {
  2469. .enable_reg = 0x3dc0,
  2470. .enable_mask = BIT(1),
  2471. .hw.init = &(struct clk_init_data){
  2472. .name = "nss_tcm_src",
  2473. .parent_names = gcc_pxo_pll8_pll14_pll18_pll0,
  2474. .num_parents = 5,
  2475. .ops = &clk_dyn_rcg_ops,
  2476. },
  2477. },
  2478. };
  2479. static struct clk_branch nss_tcm_clk = {
  2480. .halt_reg = 0x3c20,
  2481. .halt_bit = 14,
  2482. .clkr = {
  2483. .enable_reg = 0x3dd0,
  2484. .enable_mask = BIT(6) | BIT(4),
  2485. .hw.init = &(struct clk_init_data){
  2486. .name = "nss_tcm_clk",
  2487. .parent_names = (const char *[]){
  2488. "nss_tcm_src",
  2489. },
  2490. .num_parents = 1,
  2491. .ops = &clk_branch_ops,
  2492. .flags = CLK_SET_RATE_PARENT,
  2493. },
  2494. },
  2495. };
  2496. static const struct freq_tbl clk_tbl_nss[] = {
  2497. { 110000000, P_PLL18, 1, 1, 5 },
  2498. { 275000000, P_PLL18, 2, 0, 0 },
  2499. { 550000000, P_PLL18, 1, 0, 0 },
  2500. { 733000000, P_PLL18, 1, 0, 0 },
  2501. { }
  2502. };
  2503. static struct clk_dyn_rcg ubi32_core1_src_clk = {
  2504. .ns_reg[0] = 0x3d2c,
  2505. .ns_reg[1] = 0x3d30,
  2506. .md_reg[0] = 0x3d24,
  2507. .md_reg[1] = 0x3d28,
  2508. .bank_reg = 0x3d20,
  2509. .mn[0] = {
  2510. .mnctr_en_bit = 8,
  2511. .mnctr_reset_bit = 7,
  2512. .mnctr_mode_shift = 5,
  2513. .n_val_shift = 16,
  2514. .m_val_shift = 16,
  2515. .width = 8,
  2516. },
  2517. .mn[1] = {
  2518. .mnctr_en_bit = 8,
  2519. .mnctr_reset_bit = 7,
  2520. .mnctr_mode_shift = 5,
  2521. .n_val_shift = 16,
  2522. .m_val_shift = 16,
  2523. .width = 8,
  2524. },
  2525. .s[0] = {
  2526. .src_sel_shift = 0,
  2527. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2528. },
  2529. .s[1] = {
  2530. .src_sel_shift = 0,
  2531. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2532. },
  2533. .p[0] = {
  2534. .pre_div_shift = 3,
  2535. .pre_div_width = 2,
  2536. },
  2537. .p[1] = {
  2538. .pre_div_shift = 3,
  2539. .pre_div_width = 2,
  2540. },
  2541. .mux_sel_bit = 0,
  2542. .freq_tbl = clk_tbl_nss,
  2543. .clkr = {
  2544. .enable_reg = 0x3d20,
  2545. .enable_mask = BIT(1),
  2546. .hw.init = &(struct clk_init_data){
  2547. .name = "ubi32_core1_src_clk",
  2548. .parent_names = gcc_pxo_pll8_pll14_pll18_pll0,
  2549. .num_parents = 5,
  2550. .ops = &clk_dyn_rcg_ops,
  2551. .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
  2552. },
  2553. },
  2554. };
  2555. static struct clk_dyn_rcg ubi32_core2_src_clk = {
  2556. .ns_reg[0] = 0x3d4c,
  2557. .ns_reg[1] = 0x3d50,
  2558. .md_reg[0] = 0x3d44,
  2559. .md_reg[1] = 0x3d48,
  2560. .bank_reg = 0x3d40,
  2561. .mn[0] = {
  2562. .mnctr_en_bit = 8,
  2563. .mnctr_reset_bit = 7,
  2564. .mnctr_mode_shift = 5,
  2565. .n_val_shift = 16,
  2566. .m_val_shift = 16,
  2567. .width = 8,
  2568. },
  2569. .mn[1] = {
  2570. .mnctr_en_bit = 8,
  2571. .mnctr_reset_bit = 7,
  2572. .mnctr_mode_shift = 5,
  2573. .n_val_shift = 16,
  2574. .m_val_shift = 16,
  2575. .width = 8,
  2576. },
  2577. .s[0] = {
  2578. .src_sel_shift = 0,
  2579. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2580. },
  2581. .s[1] = {
  2582. .src_sel_shift = 0,
  2583. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2584. },
  2585. .p[0] = {
  2586. .pre_div_shift = 3,
  2587. .pre_div_width = 2,
  2588. },
  2589. .p[1] = {
  2590. .pre_div_shift = 3,
  2591. .pre_div_width = 2,
  2592. },
  2593. .mux_sel_bit = 0,
  2594. .freq_tbl = clk_tbl_nss,
  2595. .clkr = {
  2596. .enable_reg = 0x3d40,
  2597. .enable_mask = BIT(1),
  2598. .hw.init = &(struct clk_init_data){
  2599. .name = "ubi32_core2_src_clk",
  2600. .parent_names = gcc_pxo_pll8_pll14_pll18_pll0,
  2601. .num_parents = 5,
  2602. .ops = &clk_dyn_rcg_ops,
  2603. .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
  2604. },
  2605. },
  2606. };
  2607. static struct clk_regmap *gcc_ipq806x_clks[] = {
  2608. [PLL0] = &pll0.clkr,
  2609. [PLL0_VOTE] = &pll0_vote,
  2610. [PLL3] = &pll3.clkr,
  2611. [PLL4_VOTE] = &pll4_vote,
  2612. [PLL8] = &pll8.clkr,
  2613. [PLL8_VOTE] = &pll8_vote,
  2614. [PLL14] = &pll14.clkr,
  2615. [PLL14_VOTE] = &pll14_vote,
  2616. [PLL18] = &pll18.clkr,
  2617. [GSBI1_UART_SRC] = &gsbi1_uart_src.clkr,
  2618. [GSBI1_UART_CLK] = &gsbi1_uart_clk.clkr,
  2619. [GSBI2_UART_SRC] = &gsbi2_uart_src.clkr,
  2620. [GSBI2_UART_CLK] = &gsbi2_uart_clk.clkr,
  2621. [GSBI4_UART_SRC] = &gsbi4_uart_src.clkr,
  2622. [GSBI4_UART_CLK] = &gsbi4_uart_clk.clkr,
  2623. [GSBI5_UART_SRC] = &gsbi5_uart_src.clkr,
  2624. [GSBI5_UART_CLK] = &gsbi5_uart_clk.clkr,
  2625. [GSBI6_UART_SRC] = &gsbi6_uart_src.clkr,
  2626. [GSBI6_UART_CLK] = &gsbi6_uart_clk.clkr,
  2627. [GSBI7_UART_SRC] = &gsbi7_uart_src.clkr,
  2628. [GSBI7_UART_CLK] = &gsbi7_uart_clk.clkr,
  2629. [GSBI1_QUP_SRC] = &gsbi1_qup_src.clkr,
  2630. [GSBI1_QUP_CLK] = &gsbi1_qup_clk.clkr,
  2631. [GSBI2_QUP_SRC] = &gsbi2_qup_src.clkr,
  2632. [GSBI2_QUP_CLK] = &gsbi2_qup_clk.clkr,
  2633. [GSBI4_QUP_SRC] = &gsbi4_qup_src.clkr,
  2634. [GSBI4_QUP_CLK] = &gsbi4_qup_clk.clkr,
  2635. [GSBI5_QUP_SRC] = &gsbi5_qup_src.clkr,
  2636. [GSBI5_QUP_CLK] = &gsbi5_qup_clk.clkr,
  2637. [GSBI6_QUP_SRC] = &gsbi6_qup_src.clkr,
  2638. [GSBI6_QUP_CLK] = &gsbi6_qup_clk.clkr,
  2639. [GSBI7_QUP_SRC] = &gsbi7_qup_src.clkr,
  2640. [GSBI7_QUP_CLK] = &gsbi7_qup_clk.clkr,
  2641. [GP0_SRC] = &gp0_src.clkr,
  2642. [GP0_CLK] = &gp0_clk.clkr,
  2643. [GP1_SRC] = &gp1_src.clkr,
  2644. [GP1_CLK] = &gp1_clk.clkr,
  2645. [GP2_SRC] = &gp2_src.clkr,
  2646. [GP2_CLK] = &gp2_clk.clkr,
  2647. [PMEM_A_CLK] = &pmem_clk.clkr,
  2648. [PRNG_SRC] = &prng_src.clkr,
  2649. [PRNG_CLK] = &prng_clk.clkr,
  2650. [SDC1_SRC] = &sdc1_src.clkr,
  2651. [SDC1_CLK] = &sdc1_clk.clkr,
  2652. [SDC3_SRC] = &sdc3_src.clkr,
  2653. [SDC3_CLK] = &sdc3_clk.clkr,
  2654. [TSIF_REF_SRC] = &tsif_ref_src.clkr,
  2655. [TSIF_REF_CLK] = &tsif_ref_clk.clkr,
  2656. [DMA_BAM_H_CLK] = &dma_bam_h_clk.clkr,
  2657. [GSBI1_H_CLK] = &gsbi1_h_clk.clkr,
  2658. [GSBI2_H_CLK] = &gsbi2_h_clk.clkr,
  2659. [GSBI4_H_CLK] = &gsbi4_h_clk.clkr,
  2660. [GSBI5_H_CLK] = &gsbi5_h_clk.clkr,
  2661. [GSBI6_H_CLK] = &gsbi6_h_clk.clkr,
  2662. [GSBI7_H_CLK] = &gsbi7_h_clk.clkr,
  2663. [TSIF_H_CLK] = &tsif_h_clk.clkr,
  2664. [SDC1_H_CLK] = &sdc1_h_clk.clkr,
  2665. [SDC3_H_CLK] = &sdc3_h_clk.clkr,
  2666. [ADM0_CLK] = &adm0_clk.clkr,
  2667. [ADM0_PBUS_CLK] = &adm0_pbus_clk.clkr,
  2668. [PCIE_A_CLK] = &pcie_a_clk.clkr,
  2669. [PCIE_AUX_CLK] = &pcie_aux_clk.clkr,
  2670. [PCIE_H_CLK] = &pcie_h_clk.clkr,
  2671. [PCIE_PHY_CLK] = &pcie_phy_clk.clkr,
  2672. [SFAB_SATA_S_H_CLK] = &sfab_sata_s_h_clk.clkr,
  2673. [PMIC_ARB0_H_CLK] = &pmic_arb0_h_clk.clkr,
  2674. [PMIC_ARB1_H_CLK] = &pmic_arb1_h_clk.clkr,
  2675. [PMIC_SSBI2_CLK] = &pmic_ssbi2_clk.clkr,
  2676. [RPM_MSG_RAM_H_CLK] = &rpm_msg_ram_h_clk.clkr,
  2677. [SATA_H_CLK] = &sata_h_clk.clkr,
  2678. [SATA_CLK_SRC] = &sata_ref_src.clkr,
  2679. [SATA_RXOOB_CLK] = &sata_rxoob_clk.clkr,
  2680. [SATA_PMALIVE_CLK] = &sata_pmalive_clk.clkr,
  2681. [SATA_PHY_REF_CLK] = &sata_phy_ref_clk.clkr,
  2682. [SATA_A_CLK] = &sata_a_clk.clkr,
  2683. [SATA_PHY_CFG_CLK] = &sata_phy_cfg_clk.clkr,
  2684. [PCIE_ALT_REF_SRC] = &pcie_ref_src.clkr,
  2685. [PCIE_ALT_REF_CLK] = &pcie_ref_src_clk.clkr,
  2686. [PCIE_1_A_CLK] = &pcie1_a_clk.clkr,
  2687. [PCIE_1_AUX_CLK] = &pcie1_aux_clk.clkr,
  2688. [PCIE_1_H_CLK] = &pcie1_h_clk.clkr,
  2689. [PCIE_1_PHY_CLK] = &pcie1_phy_clk.clkr,
  2690. [PCIE_1_ALT_REF_SRC] = &pcie1_ref_src.clkr,
  2691. [PCIE_1_ALT_REF_CLK] = &pcie1_ref_src_clk.clkr,
  2692. [PCIE_2_A_CLK] = &pcie2_a_clk.clkr,
  2693. [PCIE_2_AUX_CLK] = &pcie2_aux_clk.clkr,
  2694. [PCIE_2_H_CLK] = &pcie2_h_clk.clkr,
  2695. [PCIE_2_PHY_CLK] = &pcie2_phy_clk.clkr,
  2696. [PCIE_2_ALT_REF_SRC] = &pcie2_ref_src.clkr,
  2697. [PCIE_2_ALT_REF_CLK] = &pcie2_ref_src_clk.clkr,
  2698. [USB30_MASTER_SRC] = &usb30_master_clk_src.clkr,
  2699. [USB30_0_MASTER_CLK] = &usb30_0_branch_clk.clkr,
  2700. [USB30_1_MASTER_CLK] = &usb30_1_branch_clk.clkr,
  2701. [USB30_UTMI_SRC] = &usb30_utmi_clk.clkr,
  2702. [USB30_0_UTMI_CLK] = &usb30_0_utmi_clk_ctl.clkr,
  2703. [USB30_1_UTMI_CLK] = &usb30_1_utmi_clk_ctl.clkr,
  2704. [USB_HS1_H_CLK] = &usb_hs1_h_clk.clkr,
  2705. [USB_HS1_XCVR_SRC] = &usb_hs1_xcvr_clk_src.clkr,
  2706. [USB_HS1_XCVR_CLK] = &usb_hs1_xcvr_clk.clkr,
  2707. [USB_FS1_H_CLK] = &usb_fs1_h_clk.clkr,
  2708. [USB_FS1_XCVR_SRC] = &usb_fs1_xcvr_clk_src.clkr,
  2709. [USB_FS1_XCVR_CLK] = &usb_fs1_xcvr_clk.clkr,
  2710. [USB_FS1_SYSTEM_CLK] = &usb_fs1_sys_clk.clkr,
  2711. [EBI2_CLK] = &ebi2_clk.clkr,
  2712. [EBI2_AON_CLK] = &ebi2_aon_clk.clkr,
  2713. [GMAC_CORE1_CLK_SRC] = &gmac_core1_src.clkr,
  2714. [GMAC_CORE1_CLK] = &gmac_core1_clk.clkr,
  2715. [GMAC_CORE2_CLK_SRC] = &gmac_core2_src.clkr,
  2716. [GMAC_CORE2_CLK] = &gmac_core2_clk.clkr,
  2717. [GMAC_CORE3_CLK_SRC] = &gmac_core3_src.clkr,
  2718. [GMAC_CORE3_CLK] = &gmac_core3_clk.clkr,
  2719. [GMAC_CORE4_CLK_SRC] = &gmac_core4_src.clkr,
  2720. [GMAC_CORE4_CLK] = &gmac_core4_clk.clkr,
  2721. [UBI32_CORE1_CLK_SRC] = &ubi32_core1_src_clk.clkr,
  2722. [UBI32_CORE2_CLK_SRC] = &ubi32_core2_src_clk.clkr,
  2723. [NSSTCM_CLK_SRC] = &nss_tcm_src.clkr,
  2724. [NSSTCM_CLK] = &nss_tcm_clk.clkr,
  2725. [PLL9] = &hfpll0.clkr,
  2726. [PLL10] = &hfpll1.clkr,
  2727. [PLL12] = &hfpll_l2.clkr,
  2728. };
  2729. static const struct qcom_reset_map gcc_ipq806x_resets[] = {
  2730. [QDSS_STM_RESET] = { 0x2060, 6 },
  2731. [AFAB_SMPSS_S_RESET] = { 0x20b8, 2 },
  2732. [AFAB_SMPSS_M1_RESET] = { 0x20b8, 1 },
  2733. [AFAB_SMPSS_M0_RESET] = { 0x20b8, 0 },
  2734. [AFAB_EBI1_CH0_RESET] = { 0x20c0, 7 },
  2735. [AFAB_EBI1_CH1_RESET] = { 0x20c4, 7 },
  2736. [SFAB_ADM0_M0_RESET] = { 0x21e0, 7 },
  2737. [SFAB_ADM0_M1_RESET] = { 0x21e4, 7 },
  2738. [SFAB_ADM0_M2_RESET] = { 0x21e8, 7 },
  2739. [ADM0_C2_RESET] = { 0x220c, 4 },
  2740. [ADM0_C1_RESET] = { 0x220c, 3 },
  2741. [ADM0_C0_RESET] = { 0x220c, 2 },
  2742. [ADM0_PBUS_RESET] = { 0x220c, 1 },
  2743. [ADM0_RESET] = { 0x220c, 0 },
  2744. [QDSS_CLKS_SW_RESET] = { 0x2260, 5 },
  2745. [QDSS_POR_RESET] = { 0x2260, 4 },
  2746. [QDSS_TSCTR_RESET] = { 0x2260, 3 },
  2747. [QDSS_HRESET_RESET] = { 0x2260, 2 },
  2748. [QDSS_AXI_RESET] = { 0x2260, 1 },
  2749. [QDSS_DBG_RESET] = { 0x2260, 0 },
  2750. [SFAB_PCIE_M_RESET] = { 0x22d8, 1 },
  2751. [SFAB_PCIE_S_RESET] = { 0x22d8, 0 },
  2752. [PCIE_EXT_RESET] = { 0x22dc, 6 },
  2753. [PCIE_PHY_RESET] = { 0x22dc, 5 },
  2754. [PCIE_PCI_RESET] = { 0x22dc, 4 },
  2755. [PCIE_POR_RESET] = { 0x22dc, 3 },
  2756. [PCIE_HCLK_RESET] = { 0x22dc, 2 },
  2757. [PCIE_ACLK_RESET] = { 0x22dc, 0 },
  2758. [SFAB_LPASS_RESET] = { 0x23a0, 7 },
  2759. [SFAB_AFAB_M_RESET] = { 0x23e0, 7 },
  2760. [AFAB_SFAB_M0_RESET] = { 0x2420, 7 },
  2761. [AFAB_SFAB_M1_RESET] = { 0x2424, 7 },
  2762. [SFAB_SATA_S_RESET] = { 0x2480, 7 },
  2763. [SFAB_DFAB_M_RESET] = { 0x2500, 7 },
  2764. [DFAB_SFAB_M_RESET] = { 0x2520, 7 },
  2765. [DFAB_SWAY0_RESET] = { 0x2540, 7 },
  2766. [DFAB_SWAY1_RESET] = { 0x2544, 7 },
  2767. [DFAB_ARB0_RESET] = { 0x2560, 7 },
  2768. [DFAB_ARB1_RESET] = { 0x2564, 7 },
  2769. [PPSS_PROC_RESET] = { 0x2594, 1 },
  2770. [PPSS_RESET] = { 0x2594, 0 },
  2771. [DMA_BAM_RESET] = { 0x25c0, 7 },
  2772. [SPS_TIC_H_RESET] = { 0x2600, 7 },
  2773. [SFAB_CFPB_M_RESET] = { 0x2680, 7 },
  2774. [SFAB_CFPB_S_RESET] = { 0x26c0, 7 },
  2775. [TSIF_H_RESET] = { 0x2700, 7 },
  2776. [CE1_H_RESET] = { 0x2720, 7 },
  2777. [CE1_CORE_RESET] = { 0x2724, 7 },
  2778. [CE1_SLEEP_RESET] = { 0x2728, 7 },
  2779. [CE2_H_RESET] = { 0x2740, 7 },
  2780. [CE2_CORE_RESET] = { 0x2744, 7 },
  2781. [SFAB_SFPB_M_RESET] = { 0x2780, 7 },
  2782. [SFAB_SFPB_S_RESET] = { 0x27a0, 7 },
  2783. [RPM_PROC_RESET] = { 0x27c0, 7 },
  2784. [PMIC_SSBI2_RESET] = { 0x280c, 12 },
  2785. [SDC1_RESET] = { 0x2830, 0 },
  2786. [SDC2_RESET] = { 0x2850, 0 },
  2787. [SDC3_RESET] = { 0x2870, 0 },
  2788. [SDC4_RESET] = { 0x2890, 0 },
  2789. [USB_HS1_RESET] = { 0x2910, 0 },
  2790. [USB_HSIC_RESET] = { 0x2934, 0 },
  2791. [USB_FS1_XCVR_RESET] = { 0x2974, 1 },
  2792. [USB_FS1_RESET] = { 0x2974, 0 },
  2793. [GSBI1_RESET] = { 0x29dc, 0 },
  2794. [GSBI2_RESET] = { 0x29fc, 0 },
  2795. [GSBI3_RESET] = { 0x2a1c, 0 },
  2796. [GSBI4_RESET] = { 0x2a3c, 0 },
  2797. [GSBI5_RESET] = { 0x2a5c, 0 },
  2798. [GSBI6_RESET] = { 0x2a7c, 0 },
  2799. [GSBI7_RESET] = { 0x2a9c, 0 },
  2800. [SPDM_RESET] = { 0x2b6c, 0 },
  2801. [SEC_CTRL_RESET] = { 0x2b80, 7 },
  2802. [TLMM_H_RESET] = { 0x2ba0, 7 },
  2803. [SFAB_SATA_M_RESET] = { 0x2c18, 0 },
  2804. [SATA_RESET] = { 0x2c1c, 0 },
  2805. [TSSC_RESET] = { 0x2ca0, 7 },
  2806. [PDM_RESET] = { 0x2cc0, 12 },
  2807. [MPM_H_RESET] = { 0x2da0, 7 },
  2808. [MPM_RESET] = { 0x2da4, 0 },
  2809. [SFAB_SMPSS_S_RESET] = { 0x2e00, 7 },
  2810. [PRNG_RESET] = { 0x2e80, 12 },
  2811. [SFAB_CE3_M_RESET] = { 0x36c8, 1 },
  2812. [SFAB_CE3_S_RESET] = { 0x36c8, 0 },
  2813. [CE3_SLEEP_RESET] = { 0x36d0, 7 },
  2814. [PCIE_1_M_RESET] = { 0x3a98, 1 },
  2815. [PCIE_1_S_RESET] = { 0x3a98, 0 },
  2816. [PCIE_1_EXT_RESET] = { 0x3a9c, 6 },
  2817. [PCIE_1_PHY_RESET] = { 0x3a9c, 5 },
  2818. [PCIE_1_PCI_RESET] = { 0x3a9c, 4 },
  2819. [PCIE_1_POR_RESET] = { 0x3a9c, 3 },
  2820. [PCIE_1_HCLK_RESET] = { 0x3a9c, 2 },
  2821. [PCIE_1_ACLK_RESET] = { 0x3a9c, 0 },
  2822. [PCIE_2_M_RESET] = { 0x3ad8, 1 },
  2823. [PCIE_2_S_RESET] = { 0x3ad8, 0 },
  2824. [PCIE_2_EXT_RESET] = { 0x3adc, 6 },
  2825. [PCIE_2_PHY_RESET] = { 0x3adc, 5 },
  2826. [PCIE_2_PCI_RESET] = { 0x3adc, 4 },
  2827. [PCIE_2_POR_RESET] = { 0x3adc, 3 },
  2828. [PCIE_2_HCLK_RESET] = { 0x3adc, 2 },
  2829. [PCIE_2_ACLK_RESET] = { 0x3adc, 0 },
  2830. [SFAB_USB30_S_RESET] = { 0x3b54, 1 },
  2831. [SFAB_USB30_M_RESET] = { 0x3b54, 0 },
  2832. [USB30_0_PORT2_HS_PHY_RESET] = { 0x3b50, 5 },
  2833. [USB30_0_MASTER_RESET] = { 0x3b50, 4 },
  2834. [USB30_0_SLEEP_RESET] = { 0x3b50, 3 },
  2835. [USB30_0_UTMI_PHY_RESET] = { 0x3b50, 2 },
  2836. [USB30_0_POWERON_RESET] = { 0x3b50, 1 },
  2837. [USB30_0_PHY_RESET] = { 0x3b50, 0 },
  2838. [USB30_1_MASTER_RESET] = { 0x3b58, 4 },
  2839. [USB30_1_SLEEP_RESET] = { 0x3b58, 3 },
  2840. [USB30_1_UTMI_PHY_RESET] = { 0x3b58, 2 },
  2841. [USB30_1_POWERON_RESET] = { 0x3b58, 1 },
  2842. [USB30_1_PHY_RESET] = { 0x3b58, 0 },
  2843. [NSSFB0_RESET] = { 0x3b60, 6 },
  2844. [NSSFB1_RESET] = { 0x3b60, 7 },
  2845. [UBI32_CORE1_CLKRST_CLAMP_RESET] = { 0x3d3c, 3},
  2846. [UBI32_CORE1_CLAMP_RESET] = { 0x3d3c, 2 },
  2847. [UBI32_CORE1_AHB_RESET] = { 0x3d3c, 1 },
  2848. [UBI32_CORE1_AXI_RESET] = { 0x3d3c, 0 },
  2849. [UBI32_CORE2_CLKRST_CLAMP_RESET] = { 0x3d5c, 3 },
  2850. [UBI32_CORE2_CLAMP_RESET] = { 0x3d5c, 2 },
  2851. [UBI32_CORE2_AHB_RESET] = { 0x3d5c, 1 },
  2852. [UBI32_CORE2_AXI_RESET] = { 0x3d5c, 0 },
  2853. [GMAC_CORE1_RESET] = { 0x3cbc, 0 },
  2854. [GMAC_CORE2_RESET] = { 0x3cdc, 0 },
  2855. [GMAC_CORE3_RESET] = { 0x3cfc, 0 },
  2856. [GMAC_CORE4_RESET] = { 0x3d1c, 0 },
  2857. [GMAC_AHB_RESET] = { 0x3e24, 0 },
  2858. [NSS_CH0_RST_RX_CLK_N_RESET] = { 0x3b60, 0 },
  2859. [NSS_CH0_RST_TX_CLK_N_RESET] = { 0x3b60, 1 },
  2860. [NSS_CH0_RST_RX_125M_N_RESET] = { 0x3b60, 2 },
  2861. [NSS_CH0_HW_RST_RX_125M_N_RESET] = { 0x3b60, 3 },
  2862. [NSS_CH0_RST_TX_125M_N_RESET] = { 0x3b60, 4 },
  2863. [NSS_CH1_RST_RX_CLK_N_RESET] = { 0x3b60, 5 },
  2864. [NSS_CH1_RST_TX_CLK_N_RESET] = { 0x3b60, 6 },
  2865. [NSS_CH1_RST_RX_125M_N_RESET] = { 0x3b60, 7 },
  2866. [NSS_CH1_HW_RST_RX_125M_N_RESET] = { 0x3b60, 8 },
  2867. [NSS_CH1_RST_TX_125M_N_RESET] = { 0x3b60, 9 },
  2868. [NSS_CH2_RST_RX_CLK_N_RESET] = { 0x3b60, 10 },
  2869. [NSS_CH2_RST_TX_CLK_N_RESET] = { 0x3b60, 11 },
  2870. [NSS_CH2_RST_RX_125M_N_RESET] = { 0x3b60, 12 },
  2871. [NSS_CH2_HW_RST_RX_125M_N_RESET] = { 0x3b60, 13 },
  2872. [NSS_CH2_RST_TX_125M_N_RESET] = { 0x3b60, 14 },
  2873. [NSS_CH3_RST_RX_CLK_N_RESET] = { 0x3b60, 15 },
  2874. [NSS_CH3_RST_TX_CLK_N_RESET] = { 0x3b60, 16 },
  2875. [NSS_CH3_RST_RX_125M_N_RESET] = { 0x3b60, 17 },
  2876. [NSS_CH3_HW_RST_RX_125M_N_RESET] = { 0x3b60, 18 },
  2877. [NSS_CH3_RST_TX_125M_N_RESET] = { 0x3b60, 19 },
  2878. [NSS_RST_RX_250M_125M_N_RESET] = { 0x3b60, 20 },
  2879. [NSS_RST_TX_250M_125M_N_RESET] = { 0x3b60, 21 },
  2880. [NSS_QSGMII_TXPI_RST_N_RESET] = { 0x3b60, 22 },
  2881. [NSS_QSGMII_CDR_RST_N_RESET] = { 0x3b60, 23 },
  2882. [NSS_SGMII2_CDR_RST_N_RESET] = { 0x3b60, 24 },
  2883. [NSS_SGMII3_CDR_RST_N_RESET] = { 0x3b60, 25 },
  2884. [NSS_CAL_PRBS_RST_N_RESET] = { 0x3b60, 26 },
  2885. [NSS_LCKDT_RST_N_RESET] = { 0x3b60, 27 },
  2886. [NSS_SRDS_N_RESET] = { 0x3b60, 28 },
  2887. };
  2888. static const struct regmap_config gcc_ipq806x_regmap_config = {
  2889. .reg_bits = 32,
  2890. .reg_stride = 4,
  2891. .val_bits = 32,
  2892. .max_register = 0x3e40,
  2893. .fast_io = true,
  2894. };
  2895. static const struct qcom_cc_desc gcc_ipq806x_desc = {
  2896. .config = &gcc_ipq806x_regmap_config,
  2897. .clks = gcc_ipq806x_clks,
  2898. .num_clks = ARRAY_SIZE(gcc_ipq806x_clks),
  2899. .resets = gcc_ipq806x_resets,
  2900. .num_resets = ARRAY_SIZE(gcc_ipq806x_resets),
  2901. };
  2902. static const struct of_device_id gcc_ipq806x_match_table[] = {
  2903. { .compatible = "qcom,gcc-ipq8064" },
  2904. { }
  2905. };
  2906. MODULE_DEVICE_TABLE(of, gcc_ipq806x_match_table);
  2907. static int gcc_ipq806x_probe(struct platform_device *pdev)
  2908. {
  2909. struct device *dev = &pdev->dev;
  2910. struct regmap *regmap;
  2911. int ret;
  2912. ret = qcom_cc_register_board_clk(dev, "cxo_board", "cxo", 25000000);
  2913. if (ret)
  2914. return ret;
  2915. ret = qcom_cc_register_board_clk(dev, "pxo_board", "pxo", 25000000);
  2916. if (ret)
  2917. return ret;
  2918. ret = qcom_cc_probe(pdev, &gcc_ipq806x_desc);
  2919. if (ret)
  2920. return ret;
  2921. regmap = dev_get_regmap(dev, NULL);
  2922. if (!regmap)
  2923. return -ENODEV;
  2924. /* Setup PLL18 static bits */
  2925. regmap_update_bits(regmap, 0x31a4, 0xffffffc0, 0x40000400);
  2926. regmap_write(regmap, 0x31b0, 0x3080);
  2927. /* Set GMAC footswitch sleep/wakeup values */
  2928. regmap_write(regmap, 0x3cb8, 8);
  2929. regmap_write(regmap, 0x3cd8, 8);
  2930. regmap_write(regmap, 0x3cf8, 8);
  2931. regmap_write(regmap, 0x3d18, 8);
  2932. return 0;
  2933. }
  2934. static struct platform_driver gcc_ipq806x_driver = {
  2935. .probe = gcc_ipq806x_probe,
  2936. .driver = {
  2937. .name = "gcc-ipq806x",
  2938. .of_match_table = gcc_ipq806x_match_table,
  2939. },
  2940. };
  2941. static int __init gcc_ipq806x_init(void)
  2942. {
  2943. return platform_driver_register(&gcc_ipq806x_driver);
  2944. }
  2945. core_initcall(gcc_ipq806x_init);
  2946. static void __exit gcc_ipq806x_exit(void)
  2947. {
  2948. platform_driver_unregister(&gcc_ipq806x_driver);
  2949. }
  2950. module_exit(gcc_ipq806x_exit);
  2951. MODULE_DESCRIPTION("QCOM GCC IPQ806x Driver");
  2952. MODULE_LICENSE("GPL v2");
  2953. MODULE_ALIAS("platform:gcc-ipq806x");