gcc-ipq806x.c 66 KB

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