gcc-ipq806x.c 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041
  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. },
  841. },
  842. };
  843. static struct clk_branch gsbi2_h_clk = {
  844. .hwcg_reg = 0x29e0,
  845. .hwcg_bit = 6,
  846. .halt_reg = 0x2fcc,
  847. .halt_bit = 9,
  848. .clkr = {
  849. .enable_reg = 0x29e0,
  850. .enable_mask = BIT(4),
  851. .hw.init = &(struct clk_init_data){
  852. .name = "gsbi2_h_clk",
  853. .ops = &clk_branch_ops,
  854. },
  855. },
  856. };
  857. static struct clk_branch gsbi4_h_clk = {
  858. .hwcg_reg = 0x2a20,
  859. .hwcg_bit = 6,
  860. .halt_reg = 0x2fd0,
  861. .halt_bit = 27,
  862. .clkr = {
  863. .enable_reg = 0x2a20,
  864. .enable_mask = BIT(4),
  865. .hw.init = &(struct clk_init_data){
  866. .name = "gsbi4_h_clk",
  867. .ops = &clk_branch_ops,
  868. },
  869. },
  870. };
  871. static struct clk_branch gsbi5_h_clk = {
  872. .hwcg_reg = 0x2a40,
  873. .hwcg_bit = 6,
  874. .halt_reg = 0x2fd0,
  875. .halt_bit = 23,
  876. .clkr = {
  877. .enable_reg = 0x2a40,
  878. .enable_mask = BIT(4),
  879. .hw.init = &(struct clk_init_data){
  880. .name = "gsbi5_h_clk",
  881. .ops = &clk_branch_ops,
  882. },
  883. },
  884. };
  885. static struct clk_branch gsbi6_h_clk = {
  886. .hwcg_reg = 0x2a60,
  887. .hwcg_bit = 6,
  888. .halt_reg = 0x2fd0,
  889. .halt_bit = 19,
  890. .clkr = {
  891. .enable_reg = 0x2a60,
  892. .enable_mask = BIT(4),
  893. .hw.init = &(struct clk_init_data){
  894. .name = "gsbi6_h_clk",
  895. .ops = &clk_branch_ops,
  896. },
  897. },
  898. };
  899. static struct clk_branch gsbi7_h_clk = {
  900. .hwcg_reg = 0x2a80,
  901. .hwcg_bit = 6,
  902. .halt_reg = 0x2fd0,
  903. .halt_bit = 15,
  904. .clkr = {
  905. .enable_reg = 0x2a80,
  906. .enable_mask = BIT(4),
  907. .hw.init = &(struct clk_init_data){
  908. .name = "gsbi7_h_clk",
  909. .ops = &clk_branch_ops,
  910. },
  911. },
  912. };
  913. static const struct freq_tbl clk_tbl_gp[] = {
  914. { 12500000, P_PXO, 2, 0, 0 },
  915. { 25000000, P_PXO, 1, 0, 0 },
  916. { 64000000, P_PLL8, 2, 1, 3 },
  917. { 76800000, P_PLL8, 1, 1, 5 },
  918. { 96000000, P_PLL8, 4, 0, 0 },
  919. { 128000000, P_PLL8, 3, 0, 0 },
  920. { 192000000, P_PLL8, 2, 0, 0 },
  921. { }
  922. };
  923. static struct clk_rcg gp0_src = {
  924. .ns_reg = 0x2d24,
  925. .md_reg = 0x2d00,
  926. .mn = {
  927. .mnctr_en_bit = 8,
  928. .mnctr_reset_bit = 7,
  929. .mnctr_mode_shift = 5,
  930. .n_val_shift = 16,
  931. .m_val_shift = 16,
  932. .width = 8,
  933. },
  934. .p = {
  935. .pre_div_shift = 3,
  936. .pre_div_width = 2,
  937. },
  938. .s = {
  939. .src_sel_shift = 0,
  940. .parent_map = gcc_pxo_pll8_cxo_map,
  941. },
  942. .freq_tbl = clk_tbl_gp,
  943. .clkr = {
  944. .enable_reg = 0x2d24,
  945. .enable_mask = BIT(11),
  946. .hw.init = &(struct clk_init_data){
  947. .name = "gp0_src",
  948. .parent_names = gcc_pxo_pll8_cxo,
  949. .num_parents = 3,
  950. .ops = &clk_rcg_ops,
  951. .flags = CLK_SET_PARENT_GATE,
  952. },
  953. }
  954. };
  955. static struct clk_branch gp0_clk = {
  956. .halt_reg = 0x2fd8,
  957. .halt_bit = 7,
  958. .clkr = {
  959. .enable_reg = 0x2d24,
  960. .enable_mask = BIT(9),
  961. .hw.init = &(struct clk_init_data){
  962. .name = "gp0_clk",
  963. .parent_names = (const char *[]){ "gp0_src" },
  964. .num_parents = 1,
  965. .ops = &clk_branch_ops,
  966. .flags = CLK_SET_RATE_PARENT,
  967. },
  968. },
  969. };
  970. static struct clk_rcg gp1_src = {
  971. .ns_reg = 0x2d44,
  972. .md_reg = 0x2d40,
  973. .mn = {
  974. .mnctr_en_bit = 8,
  975. .mnctr_reset_bit = 7,
  976. .mnctr_mode_shift = 5,
  977. .n_val_shift = 16,
  978. .m_val_shift = 16,
  979. .width = 8,
  980. },
  981. .p = {
  982. .pre_div_shift = 3,
  983. .pre_div_width = 2,
  984. },
  985. .s = {
  986. .src_sel_shift = 0,
  987. .parent_map = gcc_pxo_pll8_cxo_map,
  988. },
  989. .freq_tbl = clk_tbl_gp,
  990. .clkr = {
  991. .enable_reg = 0x2d44,
  992. .enable_mask = BIT(11),
  993. .hw.init = &(struct clk_init_data){
  994. .name = "gp1_src",
  995. .parent_names = gcc_pxo_pll8_cxo,
  996. .num_parents = 3,
  997. .ops = &clk_rcg_ops,
  998. .flags = CLK_SET_RATE_GATE,
  999. },
  1000. }
  1001. };
  1002. static struct clk_branch gp1_clk = {
  1003. .halt_reg = 0x2fd8,
  1004. .halt_bit = 6,
  1005. .clkr = {
  1006. .enable_reg = 0x2d44,
  1007. .enable_mask = BIT(9),
  1008. .hw.init = &(struct clk_init_data){
  1009. .name = "gp1_clk",
  1010. .parent_names = (const char *[]){ "gp1_src" },
  1011. .num_parents = 1,
  1012. .ops = &clk_branch_ops,
  1013. .flags = CLK_SET_RATE_PARENT,
  1014. },
  1015. },
  1016. };
  1017. static struct clk_rcg gp2_src = {
  1018. .ns_reg = 0x2d64,
  1019. .md_reg = 0x2d60,
  1020. .mn = {
  1021. .mnctr_en_bit = 8,
  1022. .mnctr_reset_bit = 7,
  1023. .mnctr_mode_shift = 5,
  1024. .n_val_shift = 16,
  1025. .m_val_shift = 16,
  1026. .width = 8,
  1027. },
  1028. .p = {
  1029. .pre_div_shift = 3,
  1030. .pre_div_width = 2,
  1031. },
  1032. .s = {
  1033. .src_sel_shift = 0,
  1034. .parent_map = gcc_pxo_pll8_cxo_map,
  1035. },
  1036. .freq_tbl = clk_tbl_gp,
  1037. .clkr = {
  1038. .enable_reg = 0x2d64,
  1039. .enable_mask = BIT(11),
  1040. .hw.init = &(struct clk_init_data){
  1041. .name = "gp2_src",
  1042. .parent_names = gcc_pxo_pll8_cxo,
  1043. .num_parents = 3,
  1044. .ops = &clk_rcg_ops,
  1045. .flags = CLK_SET_RATE_GATE,
  1046. },
  1047. }
  1048. };
  1049. static struct clk_branch gp2_clk = {
  1050. .halt_reg = 0x2fd8,
  1051. .halt_bit = 5,
  1052. .clkr = {
  1053. .enable_reg = 0x2d64,
  1054. .enable_mask = BIT(9),
  1055. .hw.init = &(struct clk_init_data){
  1056. .name = "gp2_clk",
  1057. .parent_names = (const char *[]){ "gp2_src" },
  1058. .num_parents = 1,
  1059. .ops = &clk_branch_ops,
  1060. .flags = CLK_SET_RATE_PARENT,
  1061. },
  1062. },
  1063. };
  1064. static struct clk_branch pmem_clk = {
  1065. .hwcg_reg = 0x25a0,
  1066. .hwcg_bit = 6,
  1067. .halt_reg = 0x2fc8,
  1068. .halt_bit = 20,
  1069. .clkr = {
  1070. .enable_reg = 0x25a0,
  1071. .enable_mask = BIT(4),
  1072. .hw.init = &(struct clk_init_data){
  1073. .name = "pmem_clk",
  1074. .ops = &clk_branch_ops,
  1075. },
  1076. },
  1077. };
  1078. static struct clk_rcg prng_src = {
  1079. .ns_reg = 0x2e80,
  1080. .p = {
  1081. .pre_div_shift = 3,
  1082. .pre_div_width = 4,
  1083. },
  1084. .s = {
  1085. .src_sel_shift = 0,
  1086. .parent_map = gcc_pxo_pll8_map,
  1087. },
  1088. .clkr = {
  1089. .hw.init = &(struct clk_init_data){
  1090. .name = "prng_src",
  1091. .parent_names = gcc_pxo_pll8,
  1092. .num_parents = 2,
  1093. .ops = &clk_rcg_ops,
  1094. },
  1095. },
  1096. };
  1097. static struct clk_branch prng_clk = {
  1098. .halt_reg = 0x2fd8,
  1099. .halt_check = BRANCH_HALT_VOTED,
  1100. .halt_bit = 10,
  1101. .clkr = {
  1102. .enable_reg = 0x3080,
  1103. .enable_mask = BIT(10),
  1104. .hw.init = &(struct clk_init_data){
  1105. .name = "prng_clk",
  1106. .parent_names = (const char *[]){ "prng_src" },
  1107. .num_parents = 1,
  1108. .ops = &clk_branch_ops,
  1109. },
  1110. },
  1111. };
  1112. static const struct freq_tbl clk_tbl_sdc[] = {
  1113. { 200000, P_PXO, 2, 2, 125 },
  1114. { 400000, P_PLL8, 4, 1, 240 },
  1115. { 16000000, P_PLL8, 4, 1, 6 },
  1116. { 17070000, P_PLL8, 1, 2, 45 },
  1117. { 20210000, P_PLL8, 1, 1, 19 },
  1118. { 24000000, P_PLL8, 4, 1, 4 },
  1119. { 48000000, P_PLL8, 4, 1, 2 },
  1120. { 64000000, P_PLL8, 3, 1, 2 },
  1121. { 96000000, P_PLL8, 4, 0, 0 },
  1122. { 192000000, P_PLL8, 2, 0, 0 },
  1123. { }
  1124. };
  1125. static struct clk_rcg sdc1_src = {
  1126. .ns_reg = 0x282c,
  1127. .md_reg = 0x2828,
  1128. .mn = {
  1129. .mnctr_en_bit = 8,
  1130. .mnctr_reset_bit = 7,
  1131. .mnctr_mode_shift = 5,
  1132. .n_val_shift = 16,
  1133. .m_val_shift = 16,
  1134. .width = 8,
  1135. },
  1136. .p = {
  1137. .pre_div_shift = 3,
  1138. .pre_div_width = 2,
  1139. },
  1140. .s = {
  1141. .src_sel_shift = 0,
  1142. .parent_map = gcc_pxo_pll8_map,
  1143. },
  1144. .freq_tbl = clk_tbl_sdc,
  1145. .clkr = {
  1146. .enable_reg = 0x282c,
  1147. .enable_mask = BIT(11),
  1148. .hw.init = &(struct clk_init_data){
  1149. .name = "sdc1_src",
  1150. .parent_names = gcc_pxo_pll8,
  1151. .num_parents = 2,
  1152. .ops = &clk_rcg_ops,
  1153. },
  1154. }
  1155. };
  1156. static struct clk_branch sdc1_clk = {
  1157. .halt_reg = 0x2fc8,
  1158. .halt_bit = 6,
  1159. .clkr = {
  1160. .enable_reg = 0x282c,
  1161. .enable_mask = BIT(9),
  1162. .hw.init = &(struct clk_init_data){
  1163. .name = "sdc1_clk",
  1164. .parent_names = (const char *[]){ "sdc1_src" },
  1165. .num_parents = 1,
  1166. .ops = &clk_branch_ops,
  1167. .flags = CLK_SET_RATE_PARENT,
  1168. },
  1169. },
  1170. };
  1171. static struct clk_rcg sdc3_src = {
  1172. .ns_reg = 0x286c,
  1173. .md_reg = 0x2868,
  1174. .mn = {
  1175. .mnctr_en_bit = 8,
  1176. .mnctr_reset_bit = 7,
  1177. .mnctr_mode_shift = 5,
  1178. .n_val_shift = 16,
  1179. .m_val_shift = 16,
  1180. .width = 8,
  1181. },
  1182. .p = {
  1183. .pre_div_shift = 3,
  1184. .pre_div_width = 2,
  1185. },
  1186. .s = {
  1187. .src_sel_shift = 0,
  1188. .parent_map = gcc_pxo_pll8_map,
  1189. },
  1190. .freq_tbl = clk_tbl_sdc,
  1191. .clkr = {
  1192. .enable_reg = 0x286c,
  1193. .enable_mask = BIT(11),
  1194. .hw.init = &(struct clk_init_data){
  1195. .name = "sdc3_src",
  1196. .parent_names = gcc_pxo_pll8,
  1197. .num_parents = 2,
  1198. .ops = &clk_rcg_ops,
  1199. },
  1200. }
  1201. };
  1202. static struct clk_branch sdc3_clk = {
  1203. .halt_reg = 0x2fc8,
  1204. .halt_bit = 4,
  1205. .clkr = {
  1206. .enable_reg = 0x286c,
  1207. .enable_mask = BIT(9),
  1208. .hw.init = &(struct clk_init_data){
  1209. .name = "sdc3_clk",
  1210. .parent_names = (const char *[]){ "sdc3_src" },
  1211. .num_parents = 1,
  1212. .ops = &clk_branch_ops,
  1213. .flags = CLK_SET_RATE_PARENT,
  1214. },
  1215. },
  1216. };
  1217. static struct clk_branch sdc1_h_clk = {
  1218. .hwcg_reg = 0x2820,
  1219. .hwcg_bit = 6,
  1220. .halt_reg = 0x2fc8,
  1221. .halt_bit = 11,
  1222. .clkr = {
  1223. .enable_reg = 0x2820,
  1224. .enable_mask = BIT(4),
  1225. .hw.init = &(struct clk_init_data){
  1226. .name = "sdc1_h_clk",
  1227. .ops = &clk_branch_ops,
  1228. },
  1229. },
  1230. };
  1231. static struct clk_branch sdc3_h_clk = {
  1232. .hwcg_reg = 0x2860,
  1233. .hwcg_bit = 6,
  1234. .halt_reg = 0x2fc8,
  1235. .halt_bit = 9,
  1236. .clkr = {
  1237. .enable_reg = 0x2860,
  1238. .enable_mask = BIT(4),
  1239. .hw.init = &(struct clk_init_data){
  1240. .name = "sdc3_h_clk",
  1241. .ops = &clk_branch_ops,
  1242. },
  1243. },
  1244. };
  1245. static const struct freq_tbl clk_tbl_tsif_ref[] = {
  1246. { 105000, P_PXO, 1, 1, 256 },
  1247. { }
  1248. };
  1249. static struct clk_rcg tsif_ref_src = {
  1250. .ns_reg = 0x2710,
  1251. .md_reg = 0x270c,
  1252. .mn = {
  1253. .mnctr_en_bit = 8,
  1254. .mnctr_reset_bit = 7,
  1255. .mnctr_mode_shift = 5,
  1256. .n_val_shift = 16,
  1257. .m_val_shift = 16,
  1258. .width = 16,
  1259. },
  1260. .p = {
  1261. .pre_div_shift = 3,
  1262. .pre_div_width = 2,
  1263. },
  1264. .s = {
  1265. .src_sel_shift = 0,
  1266. .parent_map = gcc_pxo_pll8_map,
  1267. },
  1268. .freq_tbl = clk_tbl_tsif_ref,
  1269. .clkr = {
  1270. .enable_reg = 0x2710,
  1271. .enable_mask = BIT(11),
  1272. .hw.init = &(struct clk_init_data){
  1273. .name = "tsif_ref_src",
  1274. .parent_names = gcc_pxo_pll8,
  1275. .num_parents = 2,
  1276. .ops = &clk_rcg_ops,
  1277. },
  1278. }
  1279. };
  1280. static struct clk_branch tsif_ref_clk = {
  1281. .halt_reg = 0x2fd4,
  1282. .halt_bit = 5,
  1283. .clkr = {
  1284. .enable_reg = 0x2710,
  1285. .enable_mask = BIT(9),
  1286. .hw.init = &(struct clk_init_data){
  1287. .name = "tsif_ref_clk",
  1288. .parent_names = (const char *[]){ "tsif_ref_src" },
  1289. .num_parents = 1,
  1290. .ops = &clk_branch_ops,
  1291. .flags = CLK_SET_RATE_PARENT,
  1292. },
  1293. },
  1294. };
  1295. static struct clk_branch tsif_h_clk = {
  1296. .hwcg_reg = 0x2700,
  1297. .hwcg_bit = 6,
  1298. .halt_reg = 0x2fd4,
  1299. .halt_bit = 7,
  1300. .clkr = {
  1301. .enable_reg = 0x2700,
  1302. .enable_mask = BIT(4),
  1303. .hw.init = &(struct clk_init_data){
  1304. .name = "tsif_h_clk",
  1305. .ops = &clk_branch_ops,
  1306. },
  1307. },
  1308. };
  1309. static struct clk_branch dma_bam_h_clk = {
  1310. .hwcg_reg = 0x25c0,
  1311. .hwcg_bit = 6,
  1312. .halt_reg = 0x2fc8,
  1313. .halt_bit = 12,
  1314. .clkr = {
  1315. .enable_reg = 0x25c0,
  1316. .enable_mask = BIT(4),
  1317. .hw.init = &(struct clk_init_data){
  1318. .name = "dma_bam_h_clk",
  1319. .ops = &clk_branch_ops,
  1320. },
  1321. },
  1322. };
  1323. static struct clk_branch adm0_clk = {
  1324. .halt_reg = 0x2fdc,
  1325. .halt_check = BRANCH_HALT_VOTED,
  1326. .halt_bit = 12,
  1327. .clkr = {
  1328. .enable_reg = 0x3080,
  1329. .enable_mask = BIT(2),
  1330. .hw.init = &(struct clk_init_data){
  1331. .name = "adm0_clk",
  1332. .ops = &clk_branch_ops,
  1333. },
  1334. },
  1335. };
  1336. static struct clk_branch adm0_pbus_clk = {
  1337. .hwcg_reg = 0x2208,
  1338. .hwcg_bit = 6,
  1339. .halt_reg = 0x2fdc,
  1340. .halt_check = BRANCH_HALT_VOTED,
  1341. .halt_bit = 11,
  1342. .clkr = {
  1343. .enable_reg = 0x3080,
  1344. .enable_mask = BIT(3),
  1345. .hw.init = &(struct clk_init_data){
  1346. .name = "adm0_pbus_clk",
  1347. .ops = &clk_branch_ops,
  1348. },
  1349. },
  1350. };
  1351. static struct clk_branch pmic_arb0_h_clk = {
  1352. .halt_reg = 0x2fd8,
  1353. .halt_check = BRANCH_HALT_VOTED,
  1354. .halt_bit = 22,
  1355. .clkr = {
  1356. .enable_reg = 0x3080,
  1357. .enable_mask = BIT(8),
  1358. .hw.init = &(struct clk_init_data){
  1359. .name = "pmic_arb0_h_clk",
  1360. .ops = &clk_branch_ops,
  1361. },
  1362. },
  1363. };
  1364. static struct clk_branch pmic_arb1_h_clk = {
  1365. .halt_reg = 0x2fd8,
  1366. .halt_check = BRANCH_HALT_VOTED,
  1367. .halt_bit = 21,
  1368. .clkr = {
  1369. .enable_reg = 0x3080,
  1370. .enable_mask = BIT(9),
  1371. .hw.init = &(struct clk_init_data){
  1372. .name = "pmic_arb1_h_clk",
  1373. .ops = &clk_branch_ops,
  1374. },
  1375. },
  1376. };
  1377. static struct clk_branch pmic_ssbi2_clk = {
  1378. .halt_reg = 0x2fd8,
  1379. .halt_check = BRANCH_HALT_VOTED,
  1380. .halt_bit = 23,
  1381. .clkr = {
  1382. .enable_reg = 0x3080,
  1383. .enable_mask = BIT(7),
  1384. .hw.init = &(struct clk_init_data){
  1385. .name = "pmic_ssbi2_clk",
  1386. .ops = &clk_branch_ops,
  1387. },
  1388. },
  1389. };
  1390. static struct clk_branch rpm_msg_ram_h_clk = {
  1391. .hwcg_reg = 0x27e0,
  1392. .hwcg_bit = 6,
  1393. .halt_reg = 0x2fd8,
  1394. .halt_check = BRANCH_HALT_VOTED,
  1395. .halt_bit = 12,
  1396. .clkr = {
  1397. .enable_reg = 0x3080,
  1398. .enable_mask = BIT(6),
  1399. .hw.init = &(struct clk_init_data){
  1400. .name = "rpm_msg_ram_h_clk",
  1401. .ops = &clk_branch_ops,
  1402. },
  1403. },
  1404. };
  1405. static const struct freq_tbl clk_tbl_pcie_ref[] = {
  1406. { 100000000, P_PLL3, 12, 0, 0 },
  1407. { }
  1408. };
  1409. static struct clk_rcg pcie_ref_src = {
  1410. .ns_reg = 0x3860,
  1411. .p = {
  1412. .pre_div_shift = 3,
  1413. .pre_div_width = 4,
  1414. },
  1415. .s = {
  1416. .src_sel_shift = 0,
  1417. .parent_map = gcc_pxo_pll3_map,
  1418. },
  1419. .freq_tbl = clk_tbl_pcie_ref,
  1420. .clkr = {
  1421. .enable_reg = 0x3860,
  1422. .enable_mask = BIT(11),
  1423. .hw.init = &(struct clk_init_data){
  1424. .name = "pcie_ref_src",
  1425. .parent_names = gcc_pxo_pll3,
  1426. .num_parents = 2,
  1427. .ops = &clk_rcg_ops,
  1428. .flags = CLK_SET_RATE_GATE,
  1429. },
  1430. },
  1431. };
  1432. static struct clk_branch pcie_ref_src_clk = {
  1433. .halt_reg = 0x2fdc,
  1434. .halt_bit = 30,
  1435. .clkr = {
  1436. .enable_reg = 0x3860,
  1437. .enable_mask = BIT(9),
  1438. .hw.init = &(struct clk_init_data){
  1439. .name = "pcie_ref_src_clk",
  1440. .parent_names = (const char *[]){ "pcie_ref_src" },
  1441. .num_parents = 1,
  1442. .ops = &clk_branch_ops,
  1443. .flags = CLK_SET_RATE_PARENT,
  1444. },
  1445. },
  1446. };
  1447. static struct clk_branch pcie_a_clk = {
  1448. .halt_reg = 0x2fc0,
  1449. .halt_bit = 13,
  1450. .clkr = {
  1451. .enable_reg = 0x22c0,
  1452. .enable_mask = BIT(4),
  1453. .hw.init = &(struct clk_init_data){
  1454. .name = "pcie_a_clk",
  1455. .ops = &clk_branch_ops,
  1456. },
  1457. },
  1458. };
  1459. static struct clk_branch pcie_aux_clk = {
  1460. .halt_reg = 0x2fdc,
  1461. .halt_bit = 31,
  1462. .clkr = {
  1463. .enable_reg = 0x22c8,
  1464. .enable_mask = BIT(4),
  1465. .hw.init = &(struct clk_init_data){
  1466. .name = "pcie_aux_clk",
  1467. .ops = &clk_branch_ops,
  1468. },
  1469. },
  1470. };
  1471. static struct clk_branch pcie_h_clk = {
  1472. .halt_reg = 0x2fd4,
  1473. .halt_bit = 8,
  1474. .clkr = {
  1475. .enable_reg = 0x22cc,
  1476. .enable_mask = BIT(4),
  1477. .hw.init = &(struct clk_init_data){
  1478. .name = "pcie_h_clk",
  1479. .ops = &clk_branch_ops,
  1480. },
  1481. },
  1482. };
  1483. static struct clk_branch pcie_phy_clk = {
  1484. .halt_reg = 0x2fdc,
  1485. .halt_bit = 29,
  1486. .clkr = {
  1487. .enable_reg = 0x22d0,
  1488. .enable_mask = BIT(4),
  1489. .hw.init = &(struct clk_init_data){
  1490. .name = "pcie_phy_clk",
  1491. .ops = &clk_branch_ops,
  1492. },
  1493. },
  1494. };
  1495. static struct clk_rcg pcie1_ref_src = {
  1496. .ns_reg = 0x3aa0,
  1497. .p = {
  1498. .pre_div_shift = 3,
  1499. .pre_div_width = 4,
  1500. },
  1501. .s = {
  1502. .src_sel_shift = 0,
  1503. .parent_map = gcc_pxo_pll3_map,
  1504. },
  1505. .freq_tbl = clk_tbl_pcie_ref,
  1506. .clkr = {
  1507. .enable_reg = 0x3aa0,
  1508. .enable_mask = BIT(11),
  1509. .hw.init = &(struct clk_init_data){
  1510. .name = "pcie1_ref_src",
  1511. .parent_names = gcc_pxo_pll3,
  1512. .num_parents = 2,
  1513. .ops = &clk_rcg_ops,
  1514. .flags = CLK_SET_RATE_GATE,
  1515. },
  1516. },
  1517. };
  1518. static struct clk_branch pcie1_ref_src_clk = {
  1519. .halt_reg = 0x2fdc,
  1520. .halt_bit = 27,
  1521. .clkr = {
  1522. .enable_reg = 0x3aa0,
  1523. .enable_mask = BIT(9),
  1524. .hw.init = &(struct clk_init_data){
  1525. .name = "pcie1_ref_src_clk",
  1526. .parent_names = (const char *[]){ "pcie1_ref_src" },
  1527. .num_parents = 1,
  1528. .ops = &clk_branch_ops,
  1529. .flags = CLK_SET_RATE_PARENT,
  1530. },
  1531. },
  1532. };
  1533. static struct clk_branch pcie1_a_clk = {
  1534. .halt_reg = 0x2fc0,
  1535. .halt_bit = 10,
  1536. .clkr = {
  1537. .enable_reg = 0x3a80,
  1538. .enable_mask = BIT(4),
  1539. .hw.init = &(struct clk_init_data){
  1540. .name = "pcie1_a_clk",
  1541. .ops = &clk_branch_ops,
  1542. },
  1543. },
  1544. };
  1545. static struct clk_branch pcie1_aux_clk = {
  1546. .halt_reg = 0x2fdc,
  1547. .halt_bit = 28,
  1548. .clkr = {
  1549. .enable_reg = 0x3a88,
  1550. .enable_mask = BIT(4),
  1551. .hw.init = &(struct clk_init_data){
  1552. .name = "pcie1_aux_clk",
  1553. .ops = &clk_branch_ops,
  1554. },
  1555. },
  1556. };
  1557. static struct clk_branch pcie1_h_clk = {
  1558. .halt_reg = 0x2fd4,
  1559. .halt_bit = 9,
  1560. .clkr = {
  1561. .enable_reg = 0x3a8c,
  1562. .enable_mask = BIT(4),
  1563. .hw.init = &(struct clk_init_data){
  1564. .name = "pcie1_h_clk",
  1565. .ops = &clk_branch_ops,
  1566. },
  1567. },
  1568. };
  1569. static struct clk_branch pcie1_phy_clk = {
  1570. .halt_reg = 0x2fdc,
  1571. .halt_bit = 26,
  1572. .clkr = {
  1573. .enable_reg = 0x3a90,
  1574. .enable_mask = BIT(4),
  1575. .hw.init = &(struct clk_init_data){
  1576. .name = "pcie1_phy_clk",
  1577. .ops = &clk_branch_ops,
  1578. },
  1579. },
  1580. };
  1581. static struct clk_rcg pcie2_ref_src = {
  1582. .ns_reg = 0x3ae0,
  1583. .p = {
  1584. .pre_div_shift = 3,
  1585. .pre_div_width = 4,
  1586. },
  1587. .s = {
  1588. .src_sel_shift = 0,
  1589. .parent_map = gcc_pxo_pll3_map,
  1590. },
  1591. .freq_tbl = clk_tbl_pcie_ref,
  1592. .clkr = {
  1593. .enable_reg = 0x3ae0,
  1594. .enable_mask = BIT(11),
  1595. .hw.init = &(struct clk_init_data){
  1596. .name = "pcie2_ref_src",
  1597. .parent_names = gcc_pxo_pll3,
  1598. .num_parents = 2,
  1599. .ops = &clk_rcg_ops,
  1600. .flags = CLK_SET_RATE_GATE,
  1601. },
  1602. },
  1603. };
  1604. static struct clk_branch pcie2_ref_src_clk = {
  1605. .halt_reg = 0x2fdc,
  1606. .halt_bit = 24,
  1607. .clkr = {
  1608. .enable_reg = 0x3ae0,
  1609. .enable_mask = BIT(9),
  1610. .hw.init = &(struct clk_init_data){
  1611. .name = "pcie2_ref_src_clk",
  1612. .parent_names = (const char *[]){ "pcie2_ref_src" },
  1613. .num_parents = 1,
  1614. .ops = &clk_branch_ops,
  1615. .flags = CLK_SET_RATE_PARENT,
  1616. },
  1617. },
  1618. };
  1619. static struct clk_branch pcie2_a_clk = {
  1620. .halt_reg = 0x2fc0,
  1621. .halt_bit = 9,
  1622. .clkr = {
  1623. .enable_reg = 0x3ac0,
  1624. .enable_mask = BIT(4),
  1625. .hw.init = &(struct clk_init_data){
  1626. .name = "pcie2_a_clk",
  1627. .ops = &clk_branch_ops,
  1628. },
  1629. },
  1630. };
  1631. static struct clk_branch pcie2_aux_clk = {
  1632. .halt_reg = 0x2fdc,
  1633. .halt_bit = 25,
  1634. .clkr = {
  1635. .enable_reg = 0x3ac8,
  1636. .enable_mask = BIT(4),
  1637. .hw.init = &(struct clk_init_data){
  1638. .name = "pcie2_aux_clk",
  1639. .ops = &clk_branch_ops,
  1640. },
  1641. },
  1642. };
  1643. static struct clk_branch pcie2_h_clk = {
  1644. .halt_reg = 0x2fd4,
  1645. .halt_bit = 10,
  1646. .clkr = {
  1647. .enable_reg = 0x3acc,
  1648. .enable_mask = BIT(4),
  1649. .hw.init = &(struct clk_init_data){
  1650. .name = "pcie2_h_clk",
  1651. .ops = &clk_branch_ops,
  1652. },
  1653. },
  1654. };
  1655. static struct clk_branch pcie2_phy_clk = {
  1656. .halt_reg = 0x2fdc,
  1657. .halt_bit = 23,
  1658. .clkr = {
  1659. .enable_reg = 0x3ad0,
  1660. .enable_mask = BIT(4),
  1661. .hw.init = &(struct clk_init_data){
  1662. .name = "pcie2_phy_clk",
  1663. .ops = &clk_branch_ops,
  1664. },
  1665. },
  1666. };
  1667. static const struct freq_tbl clk_tbl_sata_ref[] = {
  1668. { 100000000, P_PLL3, 12, 0, 0 },
  1669. { }
  1670. };
  1671. static struct clk_rcg sata_ref_src = {
  1672. .ns_reg = 0x2c08,
  1673. .p = {
  1674. .pre_div_shift = 3,
  1675. .pre_div_width = 4,
  1676. },
  1677. .s = {
  1678. .src_sel_shift = 0,
  1679. .parent_map = gcc_pxo_pll3_sata_map,
  1680. },
  1681. .freq_tbl = clk_tbl_sata_ref,
  1682. .clkr = {
  1683. .enable_reg = 0x2c08,
  1684. .enable_mask = BIT(7),
  1685. .hw.init = &(struct clk_init_data){
  1686. .name = "sata_ref_src",
  1687. .parent_names = gcc_pxo_pll3,
  1688. .num_parents = 2,
  1689. .ops = &clk_rcg_ops,
  1690. .flags = CLK_SET_RATE_GATE,
  1691. },
  1692. },
  1693. };
  1694. static struct clk_branch sata_rxoob_clk = {
  1695. .halt_reg = 0x2fdc,
  1696. .halt_bit = 20,
  1697. .clkr = {
  1698. .enable_reg = 0x2c0c,
  1699. .enable_mask = BIT(4),
  1700. .hw.init = &(struct clk_init_data){
  1701. .name = "sata_rxoob_clk",
  1702. .parent_names = (const char *[]){ "sata_ref_src" },
  1703. .num_parents = 1,
  1704. .ops = &clk_branch_ops,
  1705. .flags = CLK_SET_RATE_PARENT,
  1706. },
  1707. },
  1708. };
  1709. static struct clk_branch sata_pmalive_clk = {
  1710. .halt_reg = 0x2fdc,
  1711. .halt_bit = 19,
  1712. .clkr = {
  1713. .enable_reg = 0x2c10,
  1714. .enable_mask = BIT(4),
  1715. .hw.init = &(struct clk_init_data){
  1716. .name = "sata_pmalive_clk",
  1717. .parent_names = (const char *[]){ "sata_ref_src" },
  1718. .num_parents = 1,
  1719. .ops = &clk_branch_ops,
  1720. .flags = CLK_SET_RATE_PARENT,
  1721. },
  1722. },
  1723. };
  1724. static struct clk_branch sata_phy_ref_clk = {
  1725. .halt_reg = 0x2fdc,
  1726. .halt_bit = 18,
  1727. .clkr = {
  1728. .enable_reg = 0x2c14,
  1729. .enable_mask = BIT(4),
  1730. .hw.init = &(struct clk_init_data){
  1731. .name = "sata_phy_ref_clk",
  1732. .parent_names = (const char *[]){ "pxo" },
  1733. .num_parents = 1,
  1734. .ops = &clk_branch_ops,
  1735. },
  1736. },
  1737. };
  1738. static struct clk_branch sata_a_clk = {
  1739. .halt_reg = 0x2fc0,
  1740. .halt_bit = 12,
  1741. .clkr = {
  1742. .enable_reg = 0x2c20,
  1743. .enable_mask = BIT(4),
  1744. .hw.init = &(struct clk_init_data){
  1745. .name = "sata_a_clk",
  1746. .ops = &clk_branch_ops,
  1747. },
  1748. },
  1749. };
  1750. static struct clk_branch sata_h_clk = {
  1751. .halt_reg = 0x2fdc,
  1752. .halt_bit = 21,
  1753. .clkr = {
  1754. .enable_reg = 0x2c00,
  1755. .enable_mask = BIT(4),
  1756. .hw.init = &(struct clk_init_data){
  1757. .name = "sata_h_clk",
  1758. .ops = &clk_branch_ops,
  1759. },
  1760. },
  1761. };
  1762. static struct clk_branch sfab_sata_s_h_clk = {
  1763. .halt_reg = 0x2fc4,
  1764. .halt_bit = 14,
  1765. .clkr = {
  1766. .enable_reg = 0x2480,
  1767. .enable_mask = BIT(4),
  1768. .hw.init = &(struct clk_init_data){
  1769. .name = "sfab_sata_s_h_clk",
  1770. .ops = &clk_branch_ops,
  1771. },
  1772. },
  1773. };
  1774. static struct clk_branch sata_phy_cfg_clk = {
  1775. .halt_reg = 0x2fcc,
  1776. .halt_bit = 14,
  1777. .clkr = {
  1778. .enable_reg = 0x2c40,
  1779. .enable_mask = BIT(4),
  1780. .hw.init = &(struct clk_init_data){
  1781. .name = "sata_phy_cfg_clk",
  1782. .ops = &clk_branch_ops,
  1783. },
  1784. },
  1785. };
  1786. static const struct freq_tbl clk_tbl_usb30_master[] = {
  1787. { 125000000, P_PLL0, 1, 5, 32 },
  1788. { }
  1789. };
  1790. static struct clk_rcg usb30_master_clk_src = {
  1791. .ns_reg = 0x3b2c,
  1792. .md_reg = 0x3b28,
  1793. .mn = {
  1794. .mnctr_en_bit = 8,
  1795. .mnctr_reset_bit = 7,
  1796. .mnctr_mode_shift = 5,
  1797. .n_val_shift = 16,
  1798. .m_val_shift = 16,
  1799. .width = 8,
  1800. },
  1801. .p = {
  1802. .pre_div_shift = 3,
  1803. .pre_div_width = 2,
  1804. },
  1805. .s = {
  1806. .src_sel_shift = 0,
  1807. .parent_map = gcc_pxo_pll8_pll0,
  1808. },
  1809. .freq_tbl = clk_tbl_usb30_master,
  1810. .clkr = {
  1811. .enable_reg = 0x3b2c,
  1812. .enable_mask = BIT(11),
  1813. .hw.init = &(struct clk_init_data){
  1814. .name = "usb30_master_ref_src",
  1815. .parent_names = gcc_pxo_pll8_pll0_map,
  1816. .num_parents = 3,
  1817. .ops = &clk_rcg_ops,
  1818. .flags = CLK_SET_RATE_GATE,
  1819. },
  1820. },
  1821. };
  1822. static struct clk_branch usb30_0_branch_clk = {
  1823. .halt_reg = 0x2fc4,
  1824. .halt_bit = 22,
  1825. .clkr = {
  1826. .enable_reg = 0x3b24,
  1827. .enable_mask = BIT(4),
  1828. .hw.init = &(struct clk_init_data){
  1829. .name = "usb30_0_branch_clk",
  1830. .parent_names = (const char *[]){ "usb30_master_ref_src", },
  1831. .num_parents = 1,
  1832. .ops = &clk_branch_ops,
  1833. .flags = CLK_SET_RATE_PARENT,
  1834. },
  1835. },
  1836. };
  1837. static struct clk_branch usb30_1_branch_clk = {
  1838. .halt_reg = 0x2fc4,
  1839. .halt_bit = 17,
  1840. .clkr = {
  1841. .enable_reg = 0x3b34,
  1842. .enable_mask = BIT(4),
  1843. .hw.init = &(struct clk_init_data){
  1844. .name = "usb30_1_branch_clk",
  1845. .parent_names = (const char *[]){ "usb30_master_ref_src", },
  1846. .num_parents = 1,
  1847. .ops = &clk_branch_ops,
  1848. .flags = CLK_SET_RATE_PARENT,
  1849. },
  1850. },
  1851. };
  1852. static const struct freq_tbl clk_tbl_usb30_utmi[] = {
  1853. { 60000000, P_PLL8, 1, 5, 32 },
  1854. { }
  1855. };
  1856. static struct clk_rcg usb30_utmi_clk = {
  1857. .ns_reg = 0x3b44,
  1858. .md_reg = 0x3b40,
  1859. .mn = {
  1860. .mnctr_en_bit = 8,
  1861. .mnctr_reset_bit = 7,
  1862. .mnctr_mode_shift = 5,
  1863. .n_val_shift = 16,
  1864. .m_val_shift = 16,
  1865. .width = 8,
  1866. },
  1867. .p = {
  1868. .pre_div_shift = 3,
  1869. .pre_div_width = 2,
  1870. },
  1871. .s = {
  1872. .src_sel_shift = 0,
  1873. .parent_map = gcc_pxo_pll8_pll0,
  1874. },
  1875. .freq_tbl = clk_tbl_usb30_utmi,
  1876. .clkr = {
  1877. .enable_reg = 0x3b44,
  1878. .enable_mask = BIT(11),
  1879. .hw.init = &(struct clk_init_data){
  1880. .name = "usb30_utmi_clk",
  1881. .parent_names = gcc_pxo_pll8_pll0_map,
  1882. .num_parents = 3,
  1883. .ops = &clk_rcg_ops,
  1884. .flags = CLK_SET_RATE_GATE,
  1885. },
  1886. },
  1887. };
  1888. static struct clk_branch usb30_0_utmi_clk_ctl = {
  1889. .halt_reg = 0x2fc4,
  1890. .halt_bit = 21,
  1891. .clkr = {
  1892. .enable_reg = 0x3b48,
  1893. .enable_mask = BIT(4),
  1894. .hw.init = &(struct clk_init_data){
  1895. .name = "usb30_0_utmi_clk_ctl",
  1896. .parent_names = (const char *[]){ "usb30_utmi_clk", },
  1897. .num_parents = 1,
  1898. .ops = &clk_branch_ops,
  1899. .flags = CLK_SET_RATE_PARENT,
  1900. },
  1901. },
  1902. };
  1903. static struct clk_branch usb30_1_utmi_clk_ctl = {
  1904. .halt_reg = 0x2fc4,
  1905. .halt_bit = 15,
  1906. .clkr = {
  1907. .enable_reg = 0x3b4c,
  1908. .enable_mask = BIT(4),
  1909. .hw.init = &(struct clk_init_data){
  1910. .name = "usb30_1_utmi_clk_ctl",
  1911. .parent_names = (const char *[]){ "usb30_utmi_clk", },
  1912. .num_parents = 1,
  1913. .ops = &clk_branch_ops,
  1914. .flags = CLK_SET_RATE_PARENT,
  1915. },
  1916. },
  1917. };
  1918. static const struct freq_tbl clk_tbl_usb[] = {
  1919. { 60000000, P_PLL8, 1, 5, 32 },
  1920. { }
  1921. };
  1922. static struct clk_rcg usb_hs1_xcvr_clk_src = {
  1923. .ns_reg = 0x290C,
  1924. .md_reg = 0x2908,
  1925. .mn = {
  1926. .mnctr_en_bit = 8,
  1927. .mnctr_reset_bit = 7,
  1928. .mnctr_mode_shift = 5,
  1929. .n_val_shift = 16,
  1930. .m_val_shift = 16,
  1931. .width = 8,
  1932. },
  1933. .p = {
  1934. .pre_div_shift = 3,
  1935. .pre_div_width = 2,
  1936. },
  1937. .s = {
  1938. .src_sel_shift = 0,
  1939. .parent_map = gcc_pxo_pll8_pll0,
  1940. },
  1941. .freq_tbl = clk_tbl_usb,
  1942. .clkr = {
  1943. .enable_reg = 0x2968,
  1944. .enable_mask = BIT(11),
  1945. .hw.init = &(struct clk_init_data){
  1946. .name = "usb_hs1_xcvr_src",
  1947. .parent_names = gcc_pxo_pll8_pll0_map,
  1948. .num_parents = 3,
  1949. .ops = &clk_rcg_ops,
  1950. .flags = CLK_SET_RATE_GATE,
  1951. },
  1952. },
  1953. };
  1954. static struct clk_branch usb_hs1_xcvr_clk = {
  1955. .halt_reg = 0x2fcc,
  1956. .halt_bit = 17,
  1957. .clkr = {
  1958. .enable_reg = 0x290c,
  1959. .enable_mask = BIT(9),
  1960. .hw.init = &(struct clk_init_data){
  1961. .name = "usb_hs1_xcvr_clk",
  1962. .parent_names = (const char *[]){ "usb_hs1_xcvr_src" },
  1963. .num_parents = 1,
  1964. .ops = &clk_branch_ops,
  1965. .flags = CLK_SET_RATE_PARENT,
  1966. },
  1967. },
  1968. };
  1969. static struct clk_branch usb_hs1_h_clk = {
  1970. .hwcg_reg = 0x2900,
  1971. .hwcg_bit = 6,
  1972. .halt_reg = 0x2fc8,
  1973. .halt_bit = 1,
  1974. .clkr = {
  1975. .enable_reg = 0x2900,
  1976. .enable_mask = BIT(4),
  1977. .hw.init = &(struct clk_init_data){
  1978. .name = "usb_hs1_h_clk",
  1979. .ops = &clk_branch_ops,
  1980. },
  1981. },
  1982. };
  1983. static struct clk_rcg usb_fs1_xcvr_clk_src = {
  1984. .ns_reg = 0x2968,
  1985. .md_reg = 0x2964,
  1986. .mn = {
  1987. .mnctr_en_bit = 8,
  1988. .mnctr_reset_bit = 7,
  1989. .mnctr_mode_shift = 5,
  1990. .n_val_shift = 16,
  1991. .m_val_shift = 16,
  1992. .width = 8,
  1993. },
  1994. .p = {
  1995. .pre_div_shift = 3,
  1996. .pre_div_width = 2,
  1997. },
  1998. .s = {
  1999. .src_sel_shift = 0,
  2000. .parent_map = gcc_pxo_pll8_pll0,
  2001. },
  2002. .freq_tbl = clk_tbl_usb,
  2003. .clkr = {
  2004. .enable_reg = 0x2968,
  2005. .enable_mask = BIT(11),
  2006. .hw.init = &(struct clk_init_data){
  2007. .name = "usb_fs1_xcvr_src",
  2008. .parent_names = gcc_pxo_pll8_pll0_map,
  2009. .num_parents = 3,
  2010. .ops = &clk_rcg_ops,
  2011. .flags = CLK_SET_RATE_GATE,
  2012. },
  2013. },
  2014. };
  2015. static struct clk_branch usb_fs1_xcvr_clk = {
  2016. .halt_reg = 0x2fcc,
  2017. .halt_bit = 17,
  2018. .clkr = {
  2019. .enable_reg = 0x2968,
  2020. .enable_mask = BIT(9),
  2021. .hw.init = &(struct clk_init_data){
  2022. .name = "usb_fs1_xcvr_clk",
  2023. .parent_names = (const char *[]){ "usb_fs1_xcvr_src", },
  2024. .num_parents = 1,
  2025. .ops = &clk_branch_ops,
  2026. .flags = CLK_SET_RATE_PARENT,
  2027. },
  2028. },
  2029. };
  2030. static struct clk_branch usb_fs1_sys_clk = {
  2031. .halt_reg = 0x2fcc,
  2032. .halt_bit = 18,
  2033. .clkr = {
  2034. .enable_reg = 0x296c,
  2035. .enable_mask = BIT(4),
  2036. .hw.init = &(struct clk_init_data){
  2037. .name = "usb_fs1_sys_clk",
  2038. .parent_names = (const char *[]){ "usb_fs1_xcvr_src", },
  2039. .num_parents = 1,
  2040. .ops = &clk_branch_ops,
  2041. .flags = CLK_SET_RATE_PARENT,
  2042. },
  2043. },
  2044. };
  2045. static struct clk_branch usb_fs1_h_clk = {
  2046. .halt_reg = 0x2fcc,
  2047. .halt_bit = 19,
  2048. .clkr = {
  2049. .enable_reg = 0x2960,
  2050. .enable_mask = BIT(4),
  2051. .hw.init = &(struct clk_init_data){
  2052. .name = "usb_fs1_h_clk",
  2053. .ops = &clk_branch_ops,
  2054. },
  2055. },
  2056. };
  2057. static struct clk_branch ebi2_clk = {
  2058. .hwcg_reg = 0x3b00,
  2059. .hwcg_bit = 6,
  2060. .halt_reg = 0x2fcc,
  2061. .halt_bit = 1,
  2062. .clkr = {
  2063. .enable_reg = 0x3b00,
  2064. .enable_mask = BIT(4),
  2065. .hw.init = &(struct clk_init_data){
  2066. .name = "ebi2_clk",
  2067. .ops = &clk_branch_ops,
  2068. },
  2069. },
  2070. };
  2071. static struct clk_branch ebi2_aon_clk = {
  2072. .halt_reg = 0x2fcc,
  2073. .halt_bit = 0,
  2074. .clkr = {
  2075. .enable_reg = 0x3b00,
  2076. .enable_mask = BIT(8),
  2077. .hw.init = &(struct clk_init_data){
  2078. .name = "ebi2_always_on_clk",
  2079. .ops = &clk_branch_ops,
  2080. },
  2081. },
  2082. };
  2083. static const struct freq_tbl clk_tbl_gmac[] = {
  2084. { 133000000, P_PLL0, 1, 50, 301 },
  2085. { 266000000, P_PLL0, 1, 127, 382 },
  2086. { }
  2087. };
  2088. static struct clk_dyn_rcg gmac_core1_src = {
  2089. .ns_reg[0] = 0x3cac,
  2090. .ns_reg[1] = 0x3cb0,
  2091. .md_reg[0] = 0x3ca4,
  2092. .md_reg[1] = 0x3ca8,
  2093. .bank_reg = 0x3ca0,
  2094. .mn[0] = {
  2095. .mnctr_en_bit = 8,
  2096. .mnctr_reset_bit = 7,
  2097. .mnctr_mode_shift = 5,
  2098. .n_val_shift = 16,
  2099. .m_val_shift = 16,
  2100. .width = 8,
  2101. },
  2102. .mn[1] = {
  2103. .mnctr_en_bit = 8,
  2104. .mnctr_reset_bit = 7,
  2105. .mnctr_mode_shift = 5,
  2106. .n_val_shift = 16,
  2107. .m_val_shift = 16,
  2108. .width = 8,
  2109. },
  2110. .s[0] = {
  2111. .src_sel_shift = 0,
  2112. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2113. },
  2114. .s[1] = {
  2115. .src_sel_shift = 0,
  2116. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2117. },
  2118. .p[0] = {
  2119. .pre_div_shift = 3,
  2120. .pre_div_width = 2,
  2121. },
  2122. .p[1] = {
  2123. .pre_div_shift = 3,
  2124. .pre_div_width = 2,
  2125. },
  2126. .mux_sel_bit = 0,
  2127. .freq_tbl = clk_tbl_gmac,
  2128. .clkr = {
  2129. .enable_reg = 0x3ca0,
  2130. .enable_mask = BIT(1),
  2131. .hw.init = &(struct clk_init_data){
  2132. .name = "gmac_core1_src",
  2133. .parent_names = gcc_pxo_pll8_pll14_pll18_pll0,
  2134. .num_parents = 5,
  2135. .ops = &clk_dyn_rcg_ops,
  2136. },
  2137. },
  2138. };
  2139. static struct clk_branch gmac_core1_clk = {
  2140. .halt_reg = 0x3c20,
  2141. .halt_bit = 4,
  2142. .hwcg_reg = 0x3cb4,
  2143. .hwcg_bit = 6,
  2144. .clkr = {
  2145. .enable_reg = 0x3cb4,
  2146. .enable_mask = BIT(4),
  2147. .hw.init = &(struct clk_init_data){
  2148. .name = "gmac_core1_clk",
  2149. .parent_names = (const char *[]){
  2150. "gmac_core1_src",
  2151. },
  2152. .num_parents = 1,
  2153. .ops = &clk_branch_ops,
  2154. .flags = CLK_SET_RATE_PARENT,
  2155. },
  2156. },
  2157. };
  2158. static struct clk_dyn_rcg gmac_core2_src = {
  2159. .ns_reg[0] = 0x3ccc,
  2160. .ns_reg[1] = 0x3cd0,
  2161. .md_reg[0] = 0x3cc4,
  2162. .md_reg[1] = 0x3cc8,
  2163. .bank_reg = 0x3ca0,
  2164. .mn[0] = {
  2165. .mnctr_en_bit = 8,
  2166. .mnctr_reset_bit = 7,
  2167. .mnctr_mode_shift = 5,
  2168. .n_val_shift = 16,
  2169. .m_val_shift = 16,
  2170. .width = 8,
  2171. },
  2172. .mn[1] = {
  2173. .mnctr_en_bit = 8,
  2174. .mnctr_reset_bit = 7,
  2175. .mnctr_mode_shift = 5,
  2176. .n_val_shift = 16,
  2177. .m_val_shift = 16,
  2178. .width = 8,
  2179. },
  2180. .s[0] = {
  2181. .src_sel_shift = 0,
  2182. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2183. },
  2184. .s[1] = {
  2185. .src_sel_shift = 0,
  2186. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2187. },
  2188. .p[0] = {
  2189. .pre_div_shift = 3,
  2190. .pre_div_width = 2,
  2191. },
  2192. .p[1] = {
  2193. .pre_div_shift = 3,
  2194. .pre_div_width = 2,
  2195. },
  2196. .mux_sel_bit = 0,
  2197. .freq_tbl = clk_tbl_gmac,
  2198. .clkr = {
  2199. .enable_reg = 0x3cc0,
  2200. .enable_mask = BIT(1),
  2201. .hw.init = &(struct clk_init_data){
  2202. .name = "gmac_core2_src",
  2203. .parent_names = gcc_pxo_pll8_pll14_pll18_pll0,
  2204. .num_parents = 5,
  2205. .ops = &clk_dyn_rcg_ops,
  2206. },
  2207. },
  2208. };
  2209. static struct clk_branch gmac_core2_clk = {
  2210. .halt_reg = 0x3c20,
  2211. .halt_bit = 5,
  2212. .hwcg_reg = 0x3cd4,
  2213. .hwcg_bit = 6,
  2214. .clkr = {
  2215. .enable_reg = 0x3cd4,
  2216. .enable_mask = BIT(4),
  2217. .hw.init = &(struct clk_init_data){
  2218. .name = "gmac_core2_clk",
  2219. .parent_names = (const char *[]){
  2220. "gmac_core2_src",
  2221. },
  2222. .num_parents = 1,
  2223. .ops = &clk_branch_ops,
  2224. .flags = CLK_SET_RATE_PARENT,
  2225. },
  2226. },
  2227. };
  2228. static struct clk_dyn_rcg gmac_core3_src = {
  2229. .ns_reg[0] = 0x3cec,
  2230. .ns_reg[1] = 0x3cf0,
  2231. .md_reg[0] = 0x3ce4,
  2232. .md_reg[1] = 0x3ce8,
  2233. .bank_reg = 0x3ce0,
  2234. .mn[0] = {
  2235. .mnctr_en_bit = 8,
  2236. .mnctr_reset_bit = 7,
  2237. .mnctr_mode_shift = 5,
  2238. .n_val_shift = 16,
  2239. .m_val_shift = 16,
  2240. .width = 8,
  2241. },
  2242. .mn[1] = {
  2243. .mnctr_en_bit = 8,
  2244. .mnctr_reset_bit = 7,
  2245. .mnctr_mode_shift = 5,
  2246. .n_val_shift = 16,
  2247. .m_val_shift = 16,
  2248. .width = 8,
  2249. },
  2250. .s[0] = {
  2251. .src_sel_shift = 0,
  2252. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2253. },
  2254. .s[1] = {
  2255. .src_sel_shift = 0,
  2256. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2257. },
  2258. .p[0] = {
  2259. .pre_div_shift = 3,
  2260. .pre_div_width = 2,
  2261. },
  2262. .p[1] = {
  2263. .pre_div_shift = 3,
  2264. .pre_div_width = 2,
  2265. },
  2266. .mux_sel_bit = 0,
  2267. .freq_tbl = clk_tbl_gmac,
  2268. .clkr = {
  2269. .enable_reg = 0x3ce0,
  2270. .enable_mask = BIT(1),
  2271. .hw.init = &(struct clk_init_data){
  2272. .name = "gmac_core3_src",
  2273. .parent_names = gcc_pxo_pll8_pll14_pll18_pll0,
  2274. .num_parents = 5,
  2275. .ops = &clk_dyn_rcg_ops,
  2276. },
  2277. },
  2278. };
  2279. static struct clk_branch gmac_core3_clk = {
  2280. .halt_reg = 0x3c20,
  2281. .halt_bit = 6,
  2282. .hwcg_reg = 0x3cf4,
  2283. .hwcg_bit = 6,
  2284. .clkr = {
  2285. .enable_reg = 0x3cf4,
  2286. .enable_mask = BIT(4),
  2287. .hw.init = &(struct clk_init_data){
  2288. .name = "gmac_core3_clk",
  2289. .parent_names = (const char *[]){
  2290. "gmac_core3_src",
  2291. },
  2292. .num_parents = 1,
  2293. .ops = &clk_branch_ops,
  2294. .flags = CLK_SET_RATE_PARENT,
  2295. },
  2296. },
  2297. };
  2298. static struct clk_dyn_rcg gmac_core4_src = {
  2299. .ns_reg[0] = 0x3d0c,
  2300. .ns_reg[1] = 0x3d10,
  2301. .md_reg[0] = 0x3d04,
  2302. .md_reg[1] = 0x3d08,
  2303. .bank_reg = 0x3d00,
  2304. .mn[0] = {
  2305. .mnctr_en_bit = 8,
  2306. .mnctr_reset_bit = 7,
  2307. .mnctr_mode_shift = 5,
  2308. .n_val_shift = 16,
  2309. .m_val_shift = 16,
  2310. .width = 8,
  2311. },
  2312. .mn[1] = {
  2313. .mnctr_en_bit = 8,
  2314. .mnctr_reset_bit = 7,
  2315. .mnctr_mode_shift = 5,
  2316. .n_val_shift = 16,
  2317. .m_val_shift = 16,
  2318. .width = 8,
  2319. },
  2320. .s[0] = {
  2321. .src_sel_shift = 0,
  2322. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2323. },
  2324. .s[1] = {
  2325. .src_sel_shift = 0,
  2326. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2327. },
  2328. .p[0] = {
  2329. .pre_div_shift = 3,
  2330. .pre_div_width = 2,
  2331. },
  2332. .p[1] = {
  2333. .pre_div_shift = 3,
  2334. .pre_div_width = 2,
  2335. },
  2336. .mux_sel_bit = 0,
  2337. .freq_tbl = clk_tbl_gmac,
  2338. .clkr = {
  2339. .enable_reg = 0x3d00,
  2340. .enable_mask = BIT(1),
  2341. .hw.init = &(struct clk_init_data){
  2342. .name = "gmac_core4_src",
  2343. .parent_names = gcc_pxo_pll8_pll14_pll18_pll0,
  2344. .num_parents = 5,
  2345. .ops = &clk_dyn_rcg_ops,
  2346. },
  2347. },
  2348. };
  2349. static struct clk_branch gmac_core4_clk = {
  2350. .halt_reg = 0x3c20,
  2351. .halt_bit = 7,
  2352. .hwcg_reg = 0x3d14,
  2353. .hwcg_bit = 6,
  2354. .clkr = {
  2355. .enable_reg = 0x3d14,
  2356. .enable_mask = BIT(4),
  2357. .hw.init = &(struct clk_init_data){
  2358. .name = "gmac_core4_clk",
  2359. .parent_names = (const char *[]){
  2360. "gmac_core4_src",
  2361. },
  2362. .num_parents = 1,
  2363. .ops = &clk_branch_ops,
  2364. .flags = CLK_SET_RATE_PARENT,
  2365. },
  2366. },
  2367. };
  2368. static const struct freq_tbl clk_tbl_nss_tcm[] = {
  2369. { 266000000, P_PLL0, 3, 0, 0 },
  2370. { 400000000, P_PLL0, 2, 0, 0 },
  2371. { }
  2372. };
  2373. static struct clk_dyn_rcg nss_tcm_src = {
  2374. .ns_reg[0] = 0x3dc4,
  2375. .ns_reg[1] = 0x3dc8,
  2376. .bank_reg = 0x3dc0,
  2377. .s[0] = {
  2378. .src_sel_shift = 0,
  2379. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2380. },
  2381. .s[1] = {
  2382. .src_sel_shift = 0,
  2383. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2384. },
  2385. .p[0] = {
  2386. .pre_div_shift = 3,
  2387. .pre_div_width = 4,
  2388. },
  2389. .p[1] = {
  2390. .pre_div_shift = 3,
  2391. .pre_div_width = 4,
  2392. },
  2393. .mux_sel_bit = 0,
  2394. .freq_tbl = clk_tbl_nss_tcm,
  2395. .clkr = {
  2396. .enable_reg = 0x3dc0,
  2397. .enable_mask = BIT(1),
  2398. .hw.init = &(struct clk_init_data){
  2399. .name = "nss_tcm_src",
  2400. .parent_names = gcc_pxo_pll8_pll14_pll18_pll0,
  2401. .num_parents = 5,
  2402. .ops = &clk_dyn_rcg_ops,
  2403. },
  2404. },
  2405. };
  2406. static struct clk_branch nss_tcm_clk = {
  2407. .halt_reg = 0x3c20,
  2408. .halt_bit = 14,
  2409. .clkr = {
  2410. .enable_reg = 0x3dd0,
  2411. .enable_mask = BIT(6) | BIT(4),
  2412. .hw.init = &(struct clk_init_data){
  2413. .name = "nss_tcm_clk",
  2414. .parent_names = (const char *[]){
  2415. "nss_tcm_src",
  2416. },
  2417. .num_parents = 1,
  2418. .ops = &clk_branch_ops,
  2419. .flags = CLK_SET_RATE_PARENT,
  2420. },
  2421. },
  2422. };
  2423. static const struct freq_tbl clk_tbl_nss[] = {
  2424. { 110000000, P_PLL18, 1, 1, 5 },
  2425. { 275000000, P_PLL18, 2, 0, 0 },
  2426. { 550000000, P_PLL18, 1, 0, 0 },
  2427. { 733000000, P_PLL18, 1, 0, 0 },
  2428. { }
  2429. };
  2430. static struct clk_dyn_rcg ubi32_core1_src_clk = {
  2431. .ns_reg[0] = 0x3d2c,
  2432. .ns_reg[1] = 0x3d30,
  2433. .md_reg[0] = 0x3d24,
  2434. .md_reg[1] = 0x3d28,
  2435. .bank_reg = 0x3d20,
  2436. .mn[0] = {
  2437. .mnctr_en_bit = 8,
  2438. .mnctr_reset_bit = 7,
  2439. .mnctr_mode_shift = 5,
  2440. .n_val_shift = 16,
  2441. .m_val_shift = 16,
  2442. .width = 8,
  2443. },
  2444. .mn[1] = {
  2445. .mnctr_en_bit = 8,
  2446. .mnctr_reset_bit = 7,
  2447. .mnctr_mode_shift = 5,
  2448. .n_val_shift = 16,
  2449. .m_val_shift = 16,
  2450. .width = 8,
  2451. },
  2452. .s[0] = {
  2453. .src_sel_shift = 0,
  2454. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2455. },
  2456. .s[1] = {
  2457. .src_sel_shift = 0,
  2458. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2459. },
  2460. .p[0] = {
  2461. .pre_div_shift = 3,
  2462. .pre_div_width = 2,
  2463. },
  2464. .p[1] = {
  2465. .pre_div_shift = 3,
  2466. .pre_div_width = 2,
  2467. },
  2468. .mux_sel_bit = 0,
  2469. .freq_tbl = clk_tbl_nss,
  2470. .clkr = {
  2471. .enable_reg = 0x3d20,
  2472. .enable_mask = BIT(1),
  2473. .hw.init = &(struct clk_init_data){
  2474. .name = "ubi32_core1_src_clk",
  2475. .parent_names = gcc_pxo_pll8_pll14_pll18_pll0,
  2476. .num_parents = 5,
  2477. .ops = &clk_dyn_rcg_ops,
  2478. .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
  2479. },
  2480. },
  2481. };
  2482. static struct clk_dyn_rcg ubi32_core2_src_clk = {
  2483. .ns_reg[0] = 0x3d4c,
  2484. .ns_reg[1] = 0x3d50,
  2485. .md_reg[0] = 0x3d44,
  2486. .md_reg[1] = 0x3d48,
  2487. .bank_reg = 0x3d40,
  2488. .mn[0] = {
  2489. .mnctr_en_bit = 8,
  2490. .mnctr_reset_bit = 7,
  2491. .mnctr_mode_shift = 5,
  2492. .n_val_shift = 16,
  2493. .m_val_shift = 16,
  2494. .width = 8,
  2495. },
  2496. .mn[1] = {
  2497. .mnctr_en_bit = 8,
  2498. .mnctr_reset_bit = 7,
  2499. .mnctr_mode_shift = 5,
  2500. .n_val_shift = 16,
  2501. .m_val_shift = 16,
  2502. .width = 8,
  2503. },
  2504. .s[0] = {
  2505. .src_sel_shift = 0,
  2506. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2507. },
  2508. .s[1] = {
  2509. .src_sel_shift = 0,
  2510. .parent_map = gcc_pxo_pll8_pll14_pll18_pll0_map,
  2511. },
  2512. .p[0] = {
  2513. .pre_div_shift = 3,
  2514. .pre_div_width = 2,
  2515. },
  2516. .p[1] = {
  2517. .pre_div_shift = 3,
  2518. .pre_div_width = 2,
  2519. },
  2520. .mux_sel_bit = 0,
  2521. .freq_tbl = clk_tbl_nss,
  2522. .clkr = {
  2523. .enable_reg = 0x3d40,
  2524. .enable_mask = BIT(1),
  2525. .hw.init = &(struct clk_init_data){
  2526. .name = "ubi32_core2_src_clk",
  2527. .parent_names = gcc_pxo_pll8_pll14_pll18_pll0,
  2528. .num_parents = 5,
  2529. .ops = &clk_dyn_rcg_ops,
  2530. .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
  2531. },
  2532. },
  2533. };
  2534. static struct clk_regmap *gcc_ipq806x_clks[] = {
  2535. [PLL0] = &pll0.clkr,
  2536. [PLL0_VOTE] = &pll0_vote,
  2537. [PLL3] = &pll3.clkr,
  2538. [PLL4_VOTE] = &pll4_vote,
  2539. [PLL8] = &pll8.clkr,
  2540. [PLL8_VOTE] = &pll8_vote,
  2541. [PLL14] = &pll14.clkr,
  2542. [PLL14_VOTE] = &pll14_vote,
  2543. [PLL18] = &pll18.clkr,
  2544. [GSBI1_UART_SRC] = &gsbi1_uart_src.clkr,
  2545. [GSBI1_UART_CLK] = &gsbi1_uart_clk.clkr,
  2546. [GSBI2_UART_SRC] = &gsbi2_uart_src.clkr,
  2547. [GSBI2_UART_CLK] = &gsbi2_uart_clk.clkr,
  2548. [GSBI4_UART_SRC] = &gsbi4_uart_src.clkr,
  2549. [GSBI4_UART_CLK] = &gsbi4_uart_clk.clkr,
  2550. [GSBI5_UART_SRC] = &gsbi5_uart_src.clkr,
  2551. [GSBI5_UART_CLK] = &gsbi5_uart_clk.clkr,
  2552. [GSBI6_UART_SRC] = &gsbi6_uart_src.clkr,
  2553. [GSBI6_UART_CLK] = &gsbi6_uart_clk.clkr,
  2554. [GSBI7_UART_SRC] = &gsbi7_uart_src.clkr,
  2555. [GSBI7_UART_CLK] = &gsbi7_uart_clk.clkr,
  2556. [GSBI1_QUP_SRC] = &gsbi1_qup_src.clkr,
  2557. [GSBI1_QUP_CLK] = &gsbi1_qup_clk.clkr,
  2558. [GSBI2_QUP_SRC] = &gsbi2_qup_src.clkr,
  2559. [GSBI2_QUP_CLK] = &gsbi2_qup_clk.clkr,
  2560. [GSBI4_QUP_SRC] = &gsbi4_qup_src.clkr,
  2561. [GSBI4_QUP_CLK] = &gsbi4_qup_clk.clkr,
  2562. [GSBI5_QUP_SRC] = &gsbi5_qup_src.clkr,
  2563. [GSBI5_QUP_CLK] = &gsbi5_qup_clk.clkr,
  2564. [GSBI6_QUP_SRC] = &gsbi6_qup_src.clkr,
  2565. [GSBI6_QUP_CLK] = &gsbi6_qup_clk.clkr,
  2566. [GSBI7_QUP_SRC] = &gsbi7_qup_src.clkr,
  2567. [GSBI7_QUP_CLK] = &gsbi7_qup_clk.clkr,
  2568. [GP0_SRC] = &gp0_src.clkr,
  2569. [GP0_CLK] = &gp0_clk.clkr,
  2570. [GP1_SRC] = &gp1_src.clkr,
  2571. [GP1_CLK] = &gp1_clk.clkr,
  2572. [GP2_SRC] = &gp2_src.clkr,
  2573. [GP2_CLK] = &gp2_clk.clkr,
  2574. [PMEM_A_CLK] = &pmem_clk.clkr,
  2575. [PRNG_SRC] = &prng_src.clkr,
  2576. [PRNG_CLK] = &prng_clk.clkr,
  2577. [SDC1_SRC] = &sdc1_src.clkr,
  2578. [SDC1_CLK] = &sdc1_clk.clkr,
  2579. [SDC3_SRC] = &sdc3_src.clkr,
  2580. [SDC3_CLK] = &sdc3_clk.clkr,
  2581. [TSIF_REF_SRC] = &tsif_ref_src.clkr,
  2582. [TSIF_REF_CLK] = &tsif_ref_clk.clkr,
  2583. [DMA_BAM_H_CLK] = &dma_bam_h_clk.clkr,
  2584. [GSBI1_H_CLK] = &gsbi1_h_clk.clkr,
  2585. [GSBI2_H_CLK] = &gsbi2_h_clk.clkr,
  2586. [GSBI4_H_CLK] = &gsbi4_h_clk.clkr,
  2587. [GSBI5_H_CLK] = &gsbi5_h_clk.clkr,
  2588. [GSBI6_H_CLK] = &gsbi6_h_clk.clkr,
  2589. [GSBI7_H_CLK] = &gsbi7_h_clk.clkr,
  2590. [TSIF_H_CLK] = &tsif_h_clk.clkr,
  2591. [SDC1_H_CLK] = &sdc1_h_clk.clkr,
  2592. [SDC3_H_CLK] = &sdc3_h_clk.clkr,
  2593. [ADM0_CLK] = &adm0_clk.clkr,
  2594. [ADM0_PBUS_CLK] = &adm0_pbus_clk.clkr,
  2595. [PCIE_A_CLK] = &pcie_a_clk.clkr,
  2596. [PCIE_AUX_CLK] = &pcie_aux_clk.clkr,
  2597. [PCIE_H_CLK] = &pcie_h_clk.clkr,
  2598. [PCIE_PHY_CLK] = &pcie_phy_clk.clkr,
  2599. [SFAB_SATA_S_H_CLK] = &sfab_sata_s_h_clk.clkr,
  2600. [PMIC_ARB0_H_CLK] = &pmic_arb0_h_clk.clkr,
  2601. [PMIC_ARB1_H_CLK] = &pmic_arb1_h_clk.clkr,
  2602. [PMIC_SSBI2_CLK] = &pmic_ssbi2_clk.clkr,
  2603. [RPM_MSG_RAM_H_CLK] = &rpm_msg_ram_h_clk.clkr,
  2604. [SATA_H_CLK] = &sata_h_clk.clkr,
  2605. [SATA_CLK_SRC] = &sata_ref_src.clkr,
  2606. [SATA_RXOOB_CLK] = &sata_rxoob_clk.clkr,
  2607. [SATA_PMALIVE_CLK] = &sata_pmalive_clk.clkr,
  2608. [SATA_PHY_REF_CLK] = &sata_phy_ref_clk.clkr,
  2609. [SATA_A_CLK] = &sata_a_clk.clkr,
  2610. [SATA_PHY_CFG_CLK] = &sata_phy_cfg_clk.clkr,
  2611. [PCIE_ALT_REF_SRC] = &pcie_ref_src.clkr,
  2612. [PCIE_ALT_REF_CLK] = &pcie_ref_src_clk.clkr,
  2613. [PCIE_1_A_CLK] = &pcie1_a_clk.clkr,
  2614. [PCIE_1_AUX_CLK] = &pcie1_aux_clk.clkr,
  2615. [PCIE_1_H_CLK] = &pcie1_h_clk.clkr,
  2616. [PCIE_1_PHY_CLK] = &pcie1_phy_clk.clkr,
  2617. [PCIE_1_ALT_REF_SRC] = &pcie1_ref_src.clkr,
  2618. [PCIE_1_ALT_REF_CLK] = &pcie1_ref_src_clk.clkr,
  2619. [PCIE_2_A_CLK] = &pcie2_a_clk.clkr,
  2620. [PCIE_2_AUX_CLK] = &pcie2_aux_clk.clkr,
  2621. [PCIE_2_H_CLK] = &pcie2_h_clk.clkr,
  2622. [PCIE_2_PHY_CLK] = &pcie2_phy_clk.clkr,
  2623. [PCIE_2_ALT_REF_SRC] = &pcie2_ref_src.clkr,
  2624. [PCIE_2_ALT_REF_CLK] = &pcie2_ref_src_clk.clkr,
  2625. [USB30_MASTER_SRC] = &usb30_master_clk_src.clkr,
  2626. [USB30_0_MASTER_CLK] = &usb30_0_branch_clk.clkr,
  2627. [USB30_1_MASTER_CLK] = &usb30_1_branch_clk.clkr,
  2628. [USB30_UTMI_SRC] = &usb30_utmi_clk.clkr,
  2629. [USB30_0_UTMI_CLK] = &usb30_0_utmi_clk_ctl.clkr,
  2630. [USB30_1_UTMI_CLK] = &usb30_1_utmi_clk_ctl.clkr,
  2631. [USB_HS1_H_CLK] = &usb_hs1_h_clk.clkr,
  2632. [USB_HS1_XCVR_SRC] = &usb_hs1_xcvr_clk_src.clkr,
  2633. [USB_HS1_XCVR_CLK] = &usb_hs1_xcvr_clk.clkr,
  2634. [USB_FS1_H_CLK] = &usb_fs1_h_clk.clkr,
  2635. [USB_FS1_XCVR_SRC] = &usb_fs1_xcvr_clk_src.clkr,
  2636. [USB_FS1_XCVR_CLK] = &usb_fs1_xcvr_clk.clkr,
  2637. [USB_FS1_SYSTEM_CLK] = &usb_fs1_sys_clk.clkr,
  2638. [EBI2_CLK] = &ebi2_clk.clkr,
  2639. [EBI2_AON_CLK] = &ebi2_aon_clk.clkr,
  2640. [GMAC_CORE1_CLK_SRC] = &gmac_core1_src.clkr,
  2641. [GMAC_CORE1_CLK] = &gmac_core1_clk.clkr,
  2642. [GMAC_CORE2_CLK_SRC] = &gmac_core2_src.clkr,
  2643. [GMAC_CORE2_CLK] = &gmac_core2_clk.clkr,
  2644. [GMAC_CORE3_CLK_SRC] = &gmac_core3_src.clkr,
  2645. [GMAC_CORE3_CLK] = &gmac_core3_clk.clkr,
  2646. [GMAC_CORE4_CLK_SRC] = &gmac_core4_src.clkr,
  2647. [GMAC_CORE4_CLK] = &gmac_core4_clk.clkr,
  2648. [UBI32_CORE1_CLK_SRC] = &ubi32_core1_src_clk.clkr,
  2649. [UBI32_CORE2_CLK_SRC] = &ubi32_core2_src_clk.clkr,
  2650. [NSSTCM_CLK_SRC] = &nss_tcm_src.clkr,
  2651. [NSSTCM_CLK] = &nss_tcm_clk.clkr,
  2652. };
  2653. static const struct qcom_reset_map gcc_ipq806x_resets[] = {
  2654. [QDSS_STM_RESET] = { 0x2060, 6 },
  2655. [AFAB_SMPSS_S_RESET] = { 0x20b8, 2 },
  2656. [AFAB_SMPSS_M1_RESET] = { 0x20b8, 1 },
  2657. [AFAB_SMPSS_M0_RESET] = { 0x20b8, 0 },
  2658. [AFAB_EBI1_CH0_RESET] = { 0x20c0, 7 },
  2659. [AFAB_EBI1_CH1_RESET] = { 0x20c4, 7 },
  2660. [SFAB_ADM0_M0_RESET] = { 0x21e0, 7 },
  2661. [SFAB_ADM0_M1_RESET] = { 0x21e4, 7 },
  2662. [SFAB_ADM0_M2_RESET] = { 0x21e8, 7 },
  2663. [ADM0_C2_RESET] = { 0x220c, 4 },
  2664. [ADM0_C1_RESET] = { 0x220c, 3 },
  2665. [ADM0_C0_RESET] = { 0x220c, 2 },
  2666. [ADM0_PBUS_RESET] = { 0x220c, 1 },
  2667. [ADM0_RESET] = { 0x220c, 0 },
  2668. [QDSS_CLKS_SW_RESET] = { 0x2260, 5 },
  2669. [QDSS_POR_RESET] = { 0x2260, 4 },
  2670. [QDSS_TSCTR_RESET] = { 0x2260, 3 },
  2671. [QDSS_HRESET_RESET] = { 0x2260, 2 },
  2672. [QDSS_AXI_RESET] = { 0x2260, 1 },
  2673. [QDSS_DBG_RESET] = { 0x2260, 0 },
  2674. [SFAB_PCIE_M_RESET] = { 0x22d8, 1 },
  2675. [SFAB_PCIE_S_RESET] = { 0x22d8, 0 },
  2676. [PCIE_EXT_RESET] = { 0x22dc, 6 },
  2677. [PCIE_PHY_RESET] = { 0x22dc, 5 },
  2678. [PCIE_PCI_RESET] = { 0x22dc, 4 },
  2679. [PCIE_POR_RESET] = { 0x22dc, 3 },
  2680. [PCIE_HCLK_RESET] = { 0x22dc, 2 },
  2681. [PCIE_ACLK_RESET] = { 0x22dc, 0 },
  2682. [SFAB_LPASS_RESET] = { 0x23a0, 7 },
  2683. [SFAB_AFAB_M_RESET] = { 0x23e0, 7 },
  2684. [AFAB_SFAB_M0_RESET] = { 0x2420, 7 },
  2685. [AFAB_SFAB_M1_RESET] = { 0x2424, 7 },
  2686. [SFAB_SATA_S_RESET] = { 0x2480, 7 },
  2687. [SFAB_DFAB_M_RESET] = { 0x2500, 7 },
  2688. [DFAB_SFAB_M_RESET] = { 0x2520, 7 },
  2689. [DFAB_SWAY0_RESET] = { 0x2540, 7 },
  2690. [DFAB_SWAY1_RESET] = { 0x2544, 7 },
  2691. [DFAB_ARB0_RESET] = { 0x2560, 7 },
  2692. [DFAB_ARB1_RESET] = { 0x2564, 7 },
  2693. [PPSS_PROC_RESET] = { 0x2594, 1 },
  2694. [PPSS_RESET] = { 0x2594, 0 },
  2695. [DMA_BAM_RESET] = { 0x25c0, 7 },
  2696. [SPS_TIC_H_RESET] = { 0x2600, 7 },
  2697. [SFAB_CFPB_M_RESET] = { 0x2680, 7 },
  2698. [SFAB_CFPB_S_RESET] = { 0x26c0, 7 },
  2699. [TSIF_H_RESET] = { 0x2700, 7 },
  2700. [CE1_H_RESET] = { 0x2720, 7 },
  2701. [CE1_CORE_RESET] = { 0x2724, 7 },
  2702. [CE1_SLEEP_RESET] = { 0x2728, 7 },
  2703. [CE2_H_RESET] = { 0x2740, 7 },
  2704. [CE2_CORE_RESET] = { 0x2744, 7 },
  2705. [SFAB_SFPB_M_RESET] = { 0x2780, 7 },
  2706. [SFAB_SFPB_S_RESET] = { 0x27a0, 7 },
  2707. [RPM_PROC_RESET] = { 0x27c0, 7 },
  2708. [PMIC_SSBI2_RESET] = { 0x280c, 12 },
  2709. [SDC1_RESET] = { 0x2830, 0 },
  2710. [SDC2_RESET] = { 0x2850, 0 },
  2711. [SDC3_RESET] = { 0x2870, 0 },
  2712. [SDC4_RESET] = { 0x2890, 0 },
  2713. [USB_HS1_RESET] = { 0x2910, 0 },
  2714. [USB_HSIC_RESET] = { 0x2934, 0 },
  2715. [USB_FS1_XCVR_RESET] = { 0x2974, 1 },
  2716. [USB_FS1_RESET] = { 0x2974, 0 },
  2717. [GSBI1_RESET] = { 0x29dc, 0 },
  2718. [GSBI2_RESET] = { 0x29fc, 0 },
  2719. [GSBI3_RESET] = { 0x2a1c, 0 },
  2720. [GSBI4_RESET] = { 0x2a3c, 0 },
  2721. [GSBI5_RESET] = { 0x2a5c, 0 },
  2722. [GSBI6_RESET] = { 0x2a7c, 0 },
  2723. [GSBI7_RESET] = { 0x2a9c, 0 },
  2724. [SPDM_RESET] = { 0x2b6c, 0 },
  2725. [SEC_CTRL_RESET] = { 0x2b80, 7 },
  2726. [TLMM_H_RESET] = { 0x2ba0, 7 },
  2727. [SFAB_SATA_M_RESET] = { 0x2c18, 0 },
  2728. [SATA_RESET] = { 0x2c1c, 0 },
  2729. [TSSC_RESET] = { 0x2ca0, 7 },
  2730. [PDM_RESET] = { 0x2cc0, 12 },
  2731. [MPM_H_RESET] = { 0x2da0, 7 },
  2732. [MPM_RESET] = { 0x2da4, 0 },
  2733. [SFAB_SMPSS_S_RESET] = { 0x2e00, 7 },
  2734. [PRNG_RESET] = { 0x2e80, 12 },
  2735. [SFAB_CE3_M_RESET] = { 0x36c8, 1 },
  2736. [SFAB_CE3_S_RESET] = { 0x36c8, 0 },
  2737. [CE3_SLEEP_RESET] = { 0x36d0, 7 },
  2738. [PCIE_1_M_RESET] = { 0x3a98, 1 },
  2739. [PCIE_1_S_RESET] = { 0x3a98, 0 },
  2740. [PCIE_1_EXT_RESET] = { 0x3a9c, 6 },
  2741. [PCIE_1_PHY_RESET] = { 0x3a9c, 5 },
  2742. [PCIE_1_PCI_RESET] = { 0x3a9c, 4 },
  2743. [PCIE_1_POR_RESET] = { 0x3a9c, 3 },
  2744. [PCIE_1_HCLK_RESET] = { 0x3a9c, 2 },
  2745. [PCIE_1_ACLK_RESET] = { 0x3a9c, 0 },
  2746. [PCIE_2_M_RESET] = { 0x3ad8, 1 },
  2747. [PCIE_2_S_RESET] = { 0x3ad8, 0 },
  2748. [PCIE_2_EXT_RESET] = { 0x3adc, 6 },
  2749. [PCIE_2_PHY_RESET] = { 0x3adc, 5 },
  2750. [PCIE_2_PCI_RESET] = { 0x3adc, 4 },
  2751. [PCIE_2_POR_RESET] = { 0x3adc, 3 },
  2752. [PCIE_2_HCLK_RESET] = { 0x3adc, 2 },
  2753. [PCIE_2_ACLK_RESET] = { 0x3adc, 0 },
  2754. [SFAB_USB30_S_RESET] = { 0x3b54, 1 },
  2755. [SFAB_USB30_M_RESET] = { 0x3b54, 0 },
  2756. [USB30_0_PORT2_HS_PHY_RESET] = { 0x3b50, 5 },
  2757. [USB30_0_MASTER_RESET] = { 0x3b50, 4 },
  2758. [USB30_0_SLEEP_RESET] = { 0x3b50, 3 },
  2759. [USB30_0_UTMI_PHY_RESET] = { 0x3b50, 2 },
  2760. [USB30_0_POWERON_RESET] = { 0x3b50, 1 },
  2761. [USB30_0_PHY_RESET] = { 0x3b50, 0 },
  2762. [USB30_1_MASTER_RESET] = { 0x3b58, 4 },
  2763. [USB30_1_SLEEP_RESET] = { 0x3b58, 3 },
  2764. [USB30_1_UTMI_PHY_RESET] = { 0x3b58, 2 },
  2765. [USB30_1_POWERON_RESET] = { 0x3b58, 1 },
  2766. [USB30_1_PHY_RESET] = { 0x3b58, 0 },
  2767. [NSSFB0_RESET] = { 0x3b60, 6 },
  2768. [NSSFB1_RESET] = { 0x3b60, 7 },
  2769. [UBI32_CORE1_CLKRST_CLAMP_RESET] = { 0x3d3c, 3},
  2770. [UBI32_CORE1_CLAMP_RESET] = { 0x3d3c, 2 },
  2771. [UBI32_CORE1_AHB_RESET] = { 0x3d3c, 1 },
  2772. [UBI32_CORE1_AXI_RESET] = { 0x3d3c, 0 },
  2773. [UBI32_CORE2_CLKRST_CLAMP_RESET] = { 0x3d5c, 3 },
  2774. [UBI32_CORE2_CLAMP_RESET] = { 0x3d5c, 2 },
  2775. [UBI32_CORE2_AHB_RESET] = { 0x3d5c, 1 },
  2776. [UBI32_CORE2_AXI_RESET] = { 0x3d5c, 0 },
  2777. [GMAC_CORE1_RESET] = { 0x3cbc, 0 },
  2778. [GMAC_CORE2_RESET] = { 0x3cdc, 0 },
  2779. [GMAC_CORE3_RESET] = { 0x3cfc, 0 },
  2780. [GMAC_CORE4_RESET] = { 0x3d1c, 0 },
  2781. [GMAC_AHB_RESET] = { 0x3e24, 0 },
  2782. [NSS_CH0_RST_RX_CLK_N_RESET] = { 0x3b60, 0 },
  2783. [NSS_CH0_RST_TX_CLK_N_RESET] = { 0x3b60, 1 },
  2784. [NSS_CH0_RST_RX_125M_N_RESET] = { 0x3b60, 2 },
  2785. [NSS_CH0_HW_RST_RX_125M_N_RESET] = { 0x3b60, 3 },
  2786. [NSS_CH0_RST_TX_125M_N_RESET] = { 0x3b60, 4 },
  2787. [NSS_CH1_RST_RX_CLK_N_RESET] = { 0x3b60, 5 },
  2788. [NSS_CH1_RST_TX_CLK_N_RESET] = { 0x3b60, 6 },
  2789. [NSS_CH1_RST_RX_125M_N_RESET] = { 0x3b60, 7 },
  2790. [NSS_CH1_HW_RST_RX_125M_N_RESET] = { 0x3b60, 8 },
  2791. [NSS_CH1_RST_TX_125M_N_RESET] = { 0x3b60, 9 },
  2792. [NSS_CH2_RST_RX_CLK_N_RESET] = { 0x3b60, 10 },
  2793. [NSS_CH2_RST_TX_CLK_N_RESET] = { 0x3b60, 11 },
  2794. [NSS_CH2_RST_RX_125M_N_RESET] = { 0x3b60, 12 },
  2795. [NSS_CH2_HW_RST_RX_125M_N_RESET] = { 0x3b60, 13 },
  2796. [NSS_CH2_RST_TX_125M_N_RESET] = { 0x3b60, 14 },
  2797. [NSS_CH3_RST_RX_CLK_N_RESET] = { 0x3b60, 15 },
  2798. [NSS_CH3_RST_TX_CLK_N_RESET] = { 0x3b60, 16 },
  2799. [NSS_CH3_RST_RX_125M_N_RESET] = { 0x3b60, 17 },
  2800. [NSS_CH3_HW_RST_RX_125M_N_RESET] = { 0x3b60, 18 },
  2801. [NSS_CH3_RST_TX_125M_N_RESET] = { 0x3b60, 19 },
  2802. [NSS_RST_RX_250M_125M_N_RESET] = { 0x3b60, 20 },
  2803. [NSS_RST_TX_250M_125M_N_RESET] = { 0x3b60, 21 },
  2804. [NSS_QSGMII_TXPI_RST_N_RESET] = { 0x3b60, 22 },
  2805. [NSS_QSGMII_CDR_RST_N_RESET] = { 0x3b60, 23 },
  2806. [NSS_SGMII2_CDR_RST_N_RESET] = { 0x3b60, 24 },
  2807. [NSS_SGMII3_CDR_RST_N_RESET] = { 0x3b60, 25 },
  2808. [NSS_CAL_PRBS_RST_N_RESET] = { 0x3b60, 26 },
  2809. [NSS_LCKDT_RST_N_RESET] = { 0x3b60, 27 },
  2810. [NSS_SRDS_N_RESET] = { 0x3b60, 28 },
  2811. };
  2812. static const struct regmap_config gcc_ipq806x_regmap_config = {
  2813. .reg_bits = 32,
  2814. .reg_stride = 4,
  2815. .val_bits = 32,
  2816. .max_register = 0x3e40,
  2817. .fast_io = true,
  2818. };
  2819. static const struct qcom_cc_desc gcc_ipq806x_desc = {
  2820. .config = &gcc_ipq806x_regmap_config,
  2821. .clks = gcc_ipq806x_clks,
  2822. .num_clks = ARRAY_SIZE(gcc_ipq806x_clks),
  2823. .resets = gcc_ipq806x_resets,
  2824. .num_resets = ARRAY_SIZE(gcc_ipq806x_resets),
  2825. };
  2826. static const struct of_device_id gcc_ipq806x_match_table[] = {
  2827. { .compatible = "qcom,gcc-ipq8064" },
  2828. { }
  2829. };
  2830. MODULE_DEVICE_TABLE(of, gcc_ipq806x_match_table);
  2831. static int gcc_ipq806x_probe(struct platform_device *pdev)
  2832. {
  2833. struct device *dev = &pdev->dev;
  2834. struct regmap *regmap;
  2835. int ret;
  2836. ret = qcom_cc_register_board_clk(dev, "cxo_board", "cxo", 25000000);
  2837. if (ret)
  2838. return ret;
  2839. ret = qcom_cc_register_board_clk(dev, "pxo_board", "pxo", 25000000);
  2840. if (ret)
  2841. return ret;
  2842. ret = qcom_cc_probe(pdev, &gcc_ipq806x_desc);
  2843. if (ret)
  2844. return ret;
  2845. regmap = dev_get_regmap(dev, NULL);
  2846. if (!regmap)
  2847. return -ENODEV;
  2848. /* Setup PLL18 static bits */
  2849. regmap_update_bits(regmap, 0x31a4, 0xffffffc0, 0x40000400);
  2850. regmap_write(regmap, 0x31b0, 0x3080);
  2851. /* Set GMAC footswitch sleep/wakeup values */
  2852. regmap_write(regmap, 0x3cb8, 8);
  2853. regmap_write(regmap, 0x3cd8, 8);
  2854. regmap_write(regmap, 0x3cf8, 8);
  2855. regmap_write(regmap, 0x3d18, 8);
  2856. return 0;
  2857. }
  2858. static struct platform_driver gcc_ipq806x_driver = {
  2859. .probe = gcc_ipq806x_probe,
  2860. .driver = {
  2861. .name = "gcc-ipq806x",
  2862. .of_match_table = gcc_ipq806x_match_table,
  2863. },
  2864. };
  2865. static int __init gcc_ipq806x_init(void)
  2866. {
  2867. return platform_driver_register(&gcc_ipq806x_driver);
  2868. }
  2869. core_initcall(gcc_ipq806x_init);
  2870. static void __exit gcc_ipq806x_exit(void)
  2871. {
  2872. platform_driver_unregister(&gcc_ipq806x_driver);
  2873. }
  2874. module_exit(gcc_ipq806x_exit);
  2875. MODULE_DESCRIPTION("QCOM GCC IPQ806x Driver");
  2876. MODULE_LICENSE("GPL v2");
  2877. MODULE_ALIAS("platform:gcc-ipq806x");