gcc-mdm9615.c 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
  4. * Copyright (c) BayLibre, SAS.
  5. * Author : Neil Armstrong <[email protected]>
  6. */
  7. #include <linux/kernel.h>
  8. #include <linux/bitops.h>
  9. #include <linux/err.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/module.h>
  12. #include <linux/of.h>
  13. #include <linux/of_device.h>
  14. #include <linux/clk-provider.h>
  15. #include <linux/regmap.h>
  16. #include <linux/reset-controller.h>
  17. #include <dt-bindings/clock/qcom,gcc-mdm9615.h>
  18. #include <dt-bindings/reset/qcom,gcc-mdm9615.h>
  19. #include "common.h"
  20. #include "clk-regmap.h"
  21. #include "clk-pll.h"
  22. #include "clk-rcg.h"
  23. #include "clk-branch.h"
  24. #include "reset.h"
  25. static struct clk_fixed_factor cxo = {
  26. .mult = 1,
  27. .div = 1,
  28. .hw.init = &(struct clk_init_data){
  29. .name = "cxo",
  30. .parent_names = (const char *[]){ "cxo_board" },
  31. .num_parents = 1,
  32. .ops = &clk_fixed_factor_ops,
  33. },
  34. };
  35. static struct clk_pll pll0 = {
  36. .l_reg = 0x30c4,
  37. .m_reg = 0x30c8,
  38. .n_reg = 0x30cc,
  39. .config_reg = 0x30d4,
  40. .mode_reg = 0x30c0,
  41. .status_reg = 0x30d8,
  42. .status_bit = 16,
  43. .clkr.hw.init = &(struct clk_init_data){
  44. .name = "pll0",
  45. .parent_names = (const char *[]){ "cxo" },
  46. .num_parents = 1,
  47. .ops = &clk_pll_ops,
  48. },
  49. };
  50. static struct clk_regmap pll0_vote = {
  51. .enable_reg = 0x34c0,
  52. .enable_mask = BIT(0),
  53. .hw.init = &(struct clk_init_data){
  54. .name = "pll0_vote",
  55. .parent_names = (const char *[]){ "pll0" },
  56. .num_parents = 1,
  57. .ops = &clk_pll_vote_ops,
  58. },
  59. };
  60. static struct clk_regmap pll4_vote = {
  61. .enable_reg = 0x34c0,
  62. .enable_mask = BIT(4),
  63. .hw.init = &(struct clk_init_data){
  64. .name = "pll4_vote",
  65. .parent_names = (const char *[]){ "pll4" },
  66. .num_parents = 1,
  67. .ops = &clk_pll_vote_ops,
  68. },
  69. };
  70. static struct clk_pll pll8 = {
  71. .l_reg = 0x3144,
  72. .m_reg = 0x3148,
  73. .n_reg = 0x314c,
  74. .config_reg = 0x3154,
  75. .mode_reg = 0x3140,
  76. .status_reg = 0x3158,
  77. .status_bit = 16,
  78. .clkr.hw.init = &(struct clk_init_data){
  79. .name = "pll8",
  80. .parent_names = (const char *[]){ "cxo" },
  81. .num_parents = 1,
  82. .ops = &clk_pll_ops,
  83. },
  84. };
  85. static struct clk_regmap pll8_vote = {
  86. .enable_reg = 0x34c0,
  87. .enable_mask = BIT(8),
  88. .hw.init = &(struct clk_init_data){
  89. .name = "pll8_vote",
  90. .parent_names = (const char *[]){ "pll8" },
  91. .num_parents = 1,
  92. .ops = &clk_pll_vote_ops,
  93. },
  94. };
  95. static struct clk_pll pll14 = {
  96. .l_reg = 0x31c4,
  97. .m_reg = 0x31c8,
  98. .n_reg = 0x31cc,
  99. .config_reg = 0x31d4,
  100. .mode_reg = 0x31c0,
  101. .status_reg = 0x31d8,
  102. .status_bit = 16,
  103. .clkr.hw.init = &(struct clk_init_data){
  104. .name = "pll14",
  105. .parent_names = (const char *[]){ "cxo" },
  106. .num_parents = 1,
  107. .ops = &clk_pll_ops,
  108. },
  109. };
  110. static struct clk_regmap pll14_vote = {
  111. .enable_reg = 0x34c0,
  112. .enable_mask = BIT(11),
  113. .hw.init = &(struct clk_init_data){
  114. .name = "pll14_vote",
  115. .parent_names = (const char *[]){ "pll14" },
  116. .num_parents = 1,
  117. .ops = &clk_pll_vote_ops,
  118. },
  119. };
  120. enum {
  121. P_CXO,
  122. P_PLL8,
  123. P_PLL14,
  124. };
  125. static const struct parent_map gcc_cxo_pll8_map[] = {
  126. { P_CXO, 0 },
  127. { P_PLL8, 3 }
  128. };
  129. static const char * const gcc_cxo_pll8[] = {
  130. "cxo",
  131. "pll8_vote",
  132. };
  133. static const struct parent_map gcc_cxo_pll14_map[] = {
  134. { P_CXO, 0 },
  135. { P_PLL14, 4 }
  136. };
  137. static const char * const gcc_cxo_pll14[] = {
  138. "cxo",
  139. "pll14_vote",
  140. };
  141. static const struct parent_map gcc_cxo_map[] = {
  142. { P_CXO, 0 },
  143. };
  144. static const char * const gcc_cxo[] = {
  145. "cxo",
  146. };
  147. static struct freq_tbl clk_tbl_gsbi_uart[] = {
  148. { 1843200, P_PLL8, 2, 6, 625 },
  149. { 3686400, P_PLL8, 2, 12, 625 },
  150. { 7372800, P_PLL8, 2, 24, 625 },
  151. { 14745600, P_PLL8, 2, 48, 625 },
  152. { 16000000, P_PLL8, 4, 1, 6 },
  153. { 24000000, P_PLL8, 4, 1, 4 },
  154. { 32000000, P_PLL8, 4, 1, 3 },
  155. { 40000000, P_PLL8, 1, 5, 48 },
  156. { 46400000, P_PLL8, 1, 29, 240 },
  157. { 48000000, P_PLL8, 4, 1, 2 },
  158. { 51200000, P_PLL8, 1, 2, 15 },
  159. { 56000000, P_PLL8, 1, 7, 48 },
  160. { 58982400, P_PLL8, 1, 96, 625 },
  161. { 64000000, P_PLL8, 2, 1, 3 },
  162. { }
  163. };
  164. static struct clk_rcg gsbi1_uart_src = {
  165. .ns_reg = 0x29d4,
  166. .md_reg = 0x29d0,
  167. .mn = {
  168. .mnctr_en_bit = 8,
  169. .mnctr_reset_bit = 7,
  170. .mnctr_mode_shift = 5,
  171. .n_val_shift = 16,
  172. .m_val_shift = 16,
  173. .width = 16,
  174. },
  175. .p = {
  176. .pre_div_shift = 3,
  177. .pre_div_width = 2,
  178. },
  179. .s = {
  180. .src_sel_shift = 0,
  181. .parent_map = gcc_cxo_pll8_map,
  182. },
  183. .freq_tbl = clk_tbl_gsbi_uart,
  184. .clkr = {
  185. .enable_reg = 0x29d4,
  186. .enable_mask = BIT(11),
  187. .hw.init = &(struct clk_init_data){
  188. .name = "gsbi1_uart_src",
  189. .parent_names = gcc_cxo_pll8,
  190. .num_parents = 2,
  191. .ops = &clk_rcg_ops,
  192. .flags = CLK_SET_PARENT_GATE,
  193. },
  194. },
  195. };
  196. static struct clk_branch gsbi1_uart_clk = {
  197. .halt_reg = 0x2fcc,
  198. .halt_bit = 10,
  199. .clkr = {
  200. .enable_reg = 0x29d4,
  201. .enable_mask = BIT(9),
  202. .hw.init = &(struct clk_init_data){
  203. .name = "gsbi1_uart_clk",
  204. .parent_names = (const char *[]){
  205. "gsbi1_uart_src",
  206. },
  207. .num_parents = 1,
  208. .ops = &clk_branch_ops,
  209. .flags = CLK_SET_RATE_PARENT,
  210. },
  211. },
  212. };
  213. static struct clk_rcg gsbi2_uart_src = {
  214. .ns_reg = 0x29f4,
  215. .md_reg = 0x29f0,
  216. .mn = {
  217. .mnctr_en_bit = 8,
  218. .mnctr_reset_bit = 7,
  219. .mnctr_mode_shift = 5,
  220. .n_val_shift = 16,
  221. .m_val_shift = 16,
  222. .width = 16,
  223. },
  224. .p = {
  225. .pre_div_shift = 3,
  226. .pre_div_width = 2,
  227. },
  228. .s = {
  229. .src_sel_shift = 0,
  230. .parent_map = gcc_cxo_pll8_map,
  231. },
  232. .freq_tbl = clk_tbl_gsbi_uart,
  233. .clkr = {
  234. .enable_reg = 0x29f4,
  235. .enable_mask = BIT(11),
  236. .hw.init = &(struct clk_init_data){
  237. .name = "gsbi2_uart_src",
  238. .parent_names = gcc_cxo_pll8,
  239. .num_parents = 2,
  240. .ops = &clk_rcg_ops,
  241. .flags = CLK_SET_PARENT_GATE,
  242. },
  243. },
  244. };
  245. static struct clk_branch gsbi2_uart_clk = {
  246. .halt_reg = 0x2fcc,
  247. .halt_bit = 6,
  248. .clkr = {
  249. .enable_reg = 0x29f4,
  250. .enable_mask = BIT(9),
  251. .hw.init = &(struct clk_init_data){
  252. .name = "gsbi2_uart_clk",
  253. .parent_names = (const char *[]){
  254. "gsbi2_uart_src",
  255. },
  256. .num_parents = 1,
  257. .ops = &clk_branch_ops,
  258. .flags = CLK_SET_RATE_PARENT,
  259. },
  260. },
  261. };
  262. static struct clk_rcg gsbi3_uart_src = {
  263. .ns_reg = 0x2a14,
  264. .md_reg = 0x2a10,
  265. .mn = {
  266. .mnctr_en_bit = 8,
  267. .mnctr_reset_bit = 7,
  268. .mnctr_mode_shift = 5,
  269. .n_val_shift = 16,
  270. .m_val_shift = 16,
  271. .width = 16,
  272. },
  273. .p = {
  274. .pre_div_shift = 3,
  275. .pre_div_width = 2,
  276. },
  277. .s = {
  278. .src_sel_shift = 0,
  279. .parent_map = gcc_cxo_pll8_map,
  280. },
  281. .freq_tbl = clk_tbl_gsbi_uart,
  282. .clkr = {
  283. .enable_reg = 0x2a14,
  284. .enable_mask = BIT(11),
  285. .hw.init = &(struct clk_init_data){
  286. .name = "gsbi3_uart_src",
  287. .parent_names = gcc_cxo_pll8,
  288. .num_parents = 2,
  289. .ops = &clk_rcg_ops,
  290. .flags = CLK_SET_PARENT_GATE,
  291. },
  292. },
  293. };
  294. static struct clk_branch gsbi3_uart_clk = {
  295. .halt_reg = 0x2fcc,
  296. .halt_bit = 2,
  297. .clkr = {
  298. .enable_reg = 0x2a14,
  299. .enable_mask = BIT(9),
  300. .hw.init = &(struct clk_init_data){
  301. .name = "gsbi3_uart_clk",
  302. .parent_names = (const char *[]){
  303. "gsbi3_uart_src",
  304. },
  305. .num_parents = 1,
  306. .ops = &clk_branch_ops,
  307. .flags = CLK_SET_RATE_PARENT,
  308. },
  309. },
  310. };
  311. static struct clk_rcg gsbi4_uart_src = {
  312. .ns_reg = 0x2a34,
  313. .md_reg = 0x2a30,
  314. .mn = {
  315. .mnctr_en_bit = 8,
  316. .mnctr_reset_bit = 7,
  317. .mnctr_mode_shift = 5,
  318. .n_val_shift = 16,
  319. .m_val_shift = 16,
  320. .width = 16,
  321. },
  322. .p = {
  323. .pre_div_shift = 3,
  324. .pre_div_width = 2,
  325. },
  326. .s = {
  327. .src_sel_shift = 0,
  328. .parent_map = gcc_cxo_pll8_map,
  329. },
  330. .freq_tbl = clk_tbl_gsbi_uart,
  331. .clkr = {
  332. .enable_reg = 0x2a34,
  333. .enable_mask = BIT(11),
  334. .hw.init = &(struct clk_init_data){
  335. .name = "gsbi4_uart_src",
  336. .parent_names = gcc_cxo_pll8,
  337. .num_parents = 2,
  338. .ops = &clk_rcg_ops,
  339. .flags = CLK_SET_PARENT_GATE,
  340. },
  341. },
  342. };
  343. static struct clk_branch gsbi4_uart_clk = {
  344. .halt_reg = 0x2fd0,
  345. .halt_bit = 26,
  346. .clkr = {
  347. .enable_reg = 0x2a34,
  348. .enable_mask = BIT(9),
  349. .hw.init = &(struct clk_init_data){
  350. .name = "gsbi4_uart_clk",
  351. .parent_names = (const char *[]){
  352. "gsbi4_uart_src",
  353. },
  354. .num_parents = 1,
  355. .ops = &clk_branch_ops,
  356. .flags = CLK_SET_RATE_PARENT,
  357. },
  358. },
  359. };
  360. static struct clk_rcg gsbi5_uart_src = {
  361. .ns_reg = 0x2a54,
  362. .md_reg = 0x2a50,
  363. .mn = {
  364. .mnctr_en_bit = 8,
  365. .mnctr_reset_bit = 7,
  366. .mnctr_mode_shift = 5,
  367. .n_val_shift = 16,
  368. .m_val_shift = 16,
  369. .width = 16,
  370. },
  371. .p = {
  372. .pre_div_shift = 3,
  373. .pre_div_width = 2,
  374. },
  375. .s = {
  376. .src_sel_shift = 0,
  377. .parent_map = gcc_cxo_pll8_map,
  378. },
  379. .freq_tbl = clk_tbl_gsbi_uart,
  380. .clkr = {
  381. .enable_reg = 0x2a54,
  382. .enable_mask = BIT(11),
  383. .hw.init = &(struct clk_init_data){
  384. .name = "gsbi5_uart_src",
  385. .parent_names = gcc_cxo_pll8,
  386. .num_parents = 2,
  387. .ops = &clk_rcg_ops,
  388. .flags = CLK_SET_PARENT_GATE,
  389. },
  390. },
  391. };
  392. static struct clk_branch gsbi5_uart_clk = {
  393. .halt_reg = 0x2fd0,
  394. .halt_bit = 22,
  395. .clkr = {
  396. .enable_reg = 0x2a54,
  397. .enable_mask = BIT(9),
  398. .hw.init = &(struct clk_init_data){
  399. .name = "gsbi5_uart_clk",
  400. .parent_names = (const char *[]){
  401. "gsbi5_uart_src",
  402. },
  403. .num_parents = 1,
  404. .ops = &clk_branch_ops,
  405. .flags = CLK_SET_RATE_PARENT,
  406. },
  407. },
  408. };
  409. static struct freq_tbl clk_tbl_gsbi_qup[] = {
  410. { 960000, P_CXO, 4, 1, 5 },
  411. { 4800000, P_CXO, 4, 0, 1 },
  412. { 9600000, P_CXO, 2, 0, 1 },
  413. { 15060000, P_PLL8, 1, 2, 51 },
  414. { 24000000, P_PLL8, 4, 1, 4 },
  415. { 25600000, P_PLL8, 1, 1, 15 },
  416. { 48000000, P_PLL8, 4, 1, 2 },
  417. { 51200000, P_PLL8, 1, 2, 15 },
  418. { }
  419. };
  420. static struct clk_rcg gsbi1_qup_src = {
  421. .ns_reg = 0x29cc,
  422. .md_reg = 0x29c8,
  423. .mn = {
  424. .mnctr_en_bit = 8,
  425. .mnctr_reset_bit = 7,
  426. .mnctr_mode_shift = 5,
  427. .n_val_shift = 16,
  428. .m_val_shift = 16,
  429. .width = 8,
  430. },
  431. .p = {
  432. .pre_div_shift = 3,
  433. .pre_div_width = 2,
  434. },
  435. .s = {
  436. .src_sel_shift = 0,
  437. .parent_map = gcc_cxo_pll8_map,
  438. },
  439. .freq_tbl = clk_tbl_gsbi_qup,
  440. .clkr = {
  441. .enable_reg = 0x29cc,
  442. .enable_mask = BIT(11),
  443. .hw.init = &(struct clk_init_data){
  444. .name = "gsbi1_qup_src",
  445. .parent_names = gcc_cxo_pll8,
  446. .num_parents = 2,
  447. .ops = &clk_rcg_ops,
  448. .flags = CLK_SET_PARENT_GATE,
  449. },
  450. },
  451. };
  452. static struct clk_branch gsbi1_qup_clk = {
  453. .halt_reg = 0x2fcc,
  454. .halt_bit = 9,
  455. .clkr = {
  456. .enable_reg = 0x29cc,
  457. .enable_mask = BIT(9),
  458. .hw.init = &(struct clk_init_data){
  459. .name = "gsbi1_qup_clk",
  460. .parent_names = (const char *[]){ "gsbi1_qup_src" },
  461. .num_parents = 1,
  462. .ops = &clk_branch_ops,
  463. .flags = CLK_SET_RATE_PARENT,
  464. },
  465. },
  466. };
  467. static struct clk_rcg gsbi2_qup_src = {
  468. .ns_reg = 0x29ec,
  469. .md_reg = 0x29e8,
  470. .mn = {
  471. .mnctr_en_bit = 8,
  472. .mnctr_reset_bit = 7,
  473. .mnctr_mode_shift = 5,
  474. .n_val_shift = 16,
  475. .m_val_shift = 16,
  476. .width = 8,
  477. },
  478. .p = {
  479. .pre_div_shift = 3,
  480. .pre_div_width = 2,
  481. },
  482. .s = {
  483. .src_sel_shift = 0,
  484. .parent_map = gcc_cxo_pll8_map,
  485. },
  486. .freq_tbl = clk_tbl_gsbi_qup,
  487. .clkr = {
  488. .enable_reg = 0x29ec,
  489. .enable_mask = BIT(11),
  490. .hw.init = &(struct clk_init_data){
  491. .name = "gsbi2_qup_src",
  492. .parent_names = gcc_cxo_pll8,
  493. .num_parents = 2,
  494. .ops = &clk_rcg_ops,
  495. .flags = CLK_SET_PARENT_GATE,
  496. },
  497. },
  498. };
  499. static struct clk_branch gsbi2_qup_clk = {
  500. .halt_reg = 0x2fcc,
  501. .halt_bit = 4,
  502. .clkr = {
  503. .enable_reg = 0x29ec,
  504. .enable_mask = BIT(9),
  505. .hw.init = &(struct clk_init_data){
  506. .name = "gsbi2_qup_clk",
  507. .parent_names = (const char *[]){ "gsbi2_qup_src" },
  508. .num_parents = 1,
  509. .ops = &clk_branch_ops,
  510. .flags = CLK_SET_RATE_PARENT,
  511. },
  512. },
  513. };
  514. static struct clk_rcg gsbi3_qup_src = {
  515. .ns_reg = 0x2a0c,
  516. .md_reg = 0x2a08,
  517. .mn = {
  518. .mnctr_en_bit = 8,
  519. .mnctr_reset_bit = 7,
  520. .mnctr_mode_shift = 5,
  521. .n_val_shift = 16,
  522. .m_val_shift = 16,
  523. .width = 8,
  524. },
  525. .p = {
  526. .pre_div_shift = 3,
  527. .pre_div_width = 2,
  528. },
  529. .s = {
  530. .src_sel_shift = 0,
  531. .parent_map = gcc_cxo_pll8_map,
  532. },
  533. .freq_tbl = clk_tbl_gsbi_qup,
  534. .clkr = {
  535. .enable_reg = 0x2a0c,
  536. .enable_mask = BIT(11),
  537. .hw.init = &(struct clk_init_data){
  538. .name = "gsbi3_qup_src",
  539. .parent_names = gcc_cxo_pll8,
  540. .num_parents = 2,
  541. .ops = &clk_rcg_ops,
  542. .flags = CLK_SET_PARENT_GATE,
  543. },
  544. },
  545. };
  546. static struct clk_branch gsbi3_qup_clk = {
  547. .halt_reg = 0x2fcc,
  548. .halt_bit = 0,
  549. .clkr = {
  550. .enable_reg = 0x2a0c,
  551. .enable_mask = BIT(9),
  552. .hw.init = &(struct clk_init_data){
  553. .name = "gsbi3_qup_clk",
  554. .parent_names = (const char *[]){ "gsbi3_qup_src" },
  555. .num_parents = 1,
  556. .ops = &clk_branch_ops,
  557. .flags = CLK_SET_RATE_PARENT,
  558. },
  559. },
  560. };
  561. static struct clk_rcg gsbi4_qup_src = {
  562. .ns_reg = 0x2a2c,
  563. .md_reg = 0x2a28,
  564. .mn = {
  565. .mnctr_en_bit = 8,
  566. .mnctr_reset_bit = 7,
  567. .mnctr_mode_shift = 5,
  568. .n_val_shift = 16,
  569. .m_val_shift = 16,
  570. .width = 8,
  571. },
  572. .p = {
  573. .pre_div_shift = 3,
  574. .pre_div_width = 2,
  575. },
  576. .s = {
  577. .src_sel_shift = 0,
  578. .parent_map = gcc_cxo_pll8_map,
  579. },
  580. .freq_tbl = clk_tbl_gsbi_qup,
  581. .clkr = {
  582. .enable_reg = 0x2a2c,
  583. .enable_mask = BIT(11),
  584. .hw.init = &(struct clk_init_data){
  585. .name = "gsbi4_qup_src",
  586. .parent_names = gcc_cxo_pll8,
  587. .num_parents = 2,
  588. .ops = &clk_rcg_ops,
  589. .flags = CLK_SET_PARENT_GATE,
  590. },
  591. },
  592. };
  593. static struct clk_branch gsbi4_qup_clk = {
  594. .halt_reg = 0x2fd0,
  595. .halt_bit = 24,
  596. .clkr = {
  597. .enable_reg = 0x2a2c,
  598. .enable_mask = BIT(9),
  599. .hw.init = &(struct clk_init_data){
  600. .name = "gsbi4_qup_clk",
  601. .parent_names = (const char *[]){ "gsbi4_qup_src" },
  602. .num_parents = 1,
  603. .ops = &clk_branch_ops,
  604. .flags = CLK_SET_RATE_PARENT,
  605. },
  606. },
  607. };
  608. static struct clk_rcg gsbi5_qup_src = {
  609. .ns_reg = 0x2a4c,
  610. .md_reg = 0x2a48,
  611. .mn = {
  612. .mnctr_en_bit = 8,
  613. .mnctr_reset_bit = 7,
  614. .mnctr_mode_shift = 5,
  615. .n_val_shift = 16,
  616. .m_val_shift = 16,
  617. .width = 8,
  618. },
  619. .p = {
  620. .pre_div_shift = 3,
  621. .pre_div_width = 2,
  622. },
  623. .s = {
  624. .src_sel_shift = 0,
  625. .parent_map = gcc_cxo_pll8_map,
  626. },
  627. .freq_tbl = clk_tbl_gsbi_qup,
  628. .clkr = {
  629. .enable_reg = 0x2a4c,
  630. .enable_mask = BIT(11),
  631. .hw.init = &(struct clk_init_data){
  632. .name = "gsbi5_qup_src",
  633. .parent_names = gcc_cxo_pll8,
  634. .num_parents = 2,
  635. .ops = &clk_rcg_ops,
  636. .flags = CLK_SET_PARENT_GATE,
  637. },
  638. },
  639. };
  640. static struct clk_branch gsbi5_qup_clk = {
  641. .halt_reg = 0x2fd0,
  642. .halt_bit = 20,
  643. .clkr = {
  644. .enable_reg = 0x2a4c,
  645. .enable_mask = BIT(9),
  646. .hw.init = &(struct clk_init_data){
  647. .name = "gsbi5_qup_clk",
  648. .parent_names = (const char *[]){ "gsbi5_qup_src" },
  649. .num_parents = 1,
  650. .ops = &clk_branch_ops,
  651. .flags = CLK_SET_RATE_PARENT,
  652. },
  653. },
  654. };
  655. static const struct freq_tbl clk_tbl_gp[] = {
  656. { 9600000, P_CXO, 2, 0, 0 },
  657. { 19200000, P_CXO, 1, 0, 0 },
  658. { }
  659. };
  660. static struct clk_rcg gp0_src = {
  661. .ns_reg = 0x2d24,
  662. .md_reg = 0x2d00,
  663. .mn = {
  664. .mnctr_en_bit = 8,
  665. .mnctr_reset_bit = 7,
  666. .mnctr_mode_shift = 5,
  667. .n_val_shift = 16,
  668. .m_val_shift = 16,
  669. .width = 8,
  670. },
  671. .p = {
  672. .pre_div_shift = 3,
  673. .pre_div_width = 2,
  674. },
  675. .s = {
  676. .src_sel_shift = 0,
  677. .parent_map = gcc_cxo_map,
  678. },
  679. .freq_tbl = clk_tbl_gp,
  680. .clkr = {
  681. .enable_reg = 0x2d24,
  682. .enable_mask = BIT(11),
  683. .hw.init = &(struct clk_init_data){
  684. .name = "gp0_src",
  685. .parent_names = gcc_cxo,
  686. .num_parents = 1,
  687. .ops = &clk_rcg_ops,
  688. .flags = CLK_SET_PARENT_GATE,
  689. },
  690. }
  691. };
  692. static struct clk_branch gp0_clk = {
  693. .halt_reg = 0x2fd8,
  694. .halt_bit = 7,
  695. .clkr = {
  696. .enable_reg = 0x2d24,
  697. .enable_mask = BIT(9),
  698. .hw.init = &(struct clk_init_data){
  699. .name = "gp0_clk",
  700. .parent_names = (const char *[]){ "gp0_src" },
  701. .num_parents = 1,
  702. .ops = &clk_branch_ops,
  703. .flags = CLK_SET_RATE_PARENT,
  704. },
  705. },
  706. };
  707. static struct clk_rcg gp1_src = {
  708. .ns_reg = 0x2d44,
  709. .md_reg = 0x2d40,
  710. .mn = {
  711. .mnctr_en_bit = 8,
  712. .mnctr_reset_bit = 7,
  713. .mnctr_mode_shift = 5,
  714. .n_val_shift = 16,
  715. .m_val_shift = 16,
  716. .width = 8,
  717. },
  718. .p = {
  719. .pre_div_shift = 3,
  720. .pre_div_width = 2,
  721. },
  722. .s = {
  723. .src_sel_shift = 0,
  724. .parent_map = gcc_cxo_map,
  725. },
  726. .freq_tbl = clk_tbl_gp,
  727. .clkr = {
  728. .enable_reg = 0x2d44,
  729. .enable_mask = BIT(11),
  730. .hw.init = &(struct clk_init_data){
  731. .name = "gp1_src",
  732. .parent_names = gcc_cxo,
  733. .num_parents = 1,
  734. .ops = &clk_rcg_ops,
  735. .flags = CLK_SET_RATE_GATE,
  736. },
  737. }
  738. };
  739. static struct clk_branch gp1_clk = {
  740. .halt_reg = 0x2fd8,
  741. .halt_bit = 6,
  742. .clkr = {
  743. .enable_reg = 0x2d44,
  744. .enable_mask = BIT(9),
  745. .hw.init = &(struct clk_init_data){
  746. .name = "gp1_clk",
  747. .parent_names = (const char *[]){ "gp1_src" },
  748. .num_parents = 1,
  749. .ops = &clk_branch_ops,
  750. .flags = CLK_SET_RATE_PARENT,
  751. },
  752. },
  753. };
  754. static struct clk_rcg gp2_src = {
  755. .ns_reg = 0x2d64,
  756. .md_reg = 0x2d60,
  757. .mn = {
  758. .mnctr_en_bit = 8,
  759. .mnctr_reset_bit = 7,
  760. .mnctr_mode_shift = 5,
  761. .n_val_shift = 16,
  762. .m_val_shift = 16,
  763. .width = 8,
  764. },
  765. .p = {
  766. .pre_div_shift = 3,
  767. .pre_div_width = 2,
  768. },
  769. .s = {
  770. .src_sel_shift = 0,
  771. .parent_map = gcc_cxo_map,
  772. },
  773. .freq_tbl = clk_tbl_gp,
  774. .clkr = {
  775. .enable_reg = 0x2d64,
  776. .enable_mask = BIT(11),
  777. .hw.init = &(struct clk_init_data){
  778. .name = "gp2_src",
  779. .parent_names = gcc_cxo,
  780. .num_parents = 1,
  781. .ops = &clk_rcg_ops,
  782. .flags = CLK_SET_RATE_GATE,
  783. },
  784. }
  785. };
  786. static struct clk_branch gp2_clk = {
  787. .halt_reg = 0x2fd8,
  788. .halt_bit = 5,
  789. .clkr = {
  790. .enable_reg = 0x2d64,
  791. .enable_mask = BIT(9),
  792. .hw.init = &(struct clk_init_data){
  793. .name = "gp2_clk",
  794. .parent_names = (const char *[]){ "gp2_src" },
  795. .num_parents = 1,
  796. .ops = &clk_branch_ops,
  797. .flags = CLK_SET_RATE_PARENT,
  798. },
  799. },
  800. };
  801. static struct clk_branch pmem_clk = {
  802. .hwcg_reg = 0x25a0,
  803. .hwcg_bit = 6,
  804. .halt_reg = 0x2fc8,
  805. .halt_bit = 20,
  806. .clkr = {
  807. .enable_reg = 0x25a0,
  808. .enable_mask = BIT(4),
  809. .hw.init = &(struct clk_init_data){
  810. .name = "pmem_clk",
  811. .ops = &clk_branch_ops,
  812. },
  813. },
  814. };
  815. static struct clk_rcg prng_src = {
  816. .ns_reg = 0x2e80,
  817. .p = {
  818. .pre_div_shift = 3,
  819. .pre_div_width = 4,
  820. },
  821. .s = {
  822. .src_sel_shift = 0,
  823. .parent_map = gcc_cxo_pll8_map,
  824. },
  825. .clkr = {
  826. .hw.init = &(struct clk_init_data){
  827. .name = "prng_src",
  828. .parent_names = gcc_cxo_pll8,
  829. .num_parents = 2,
  830. .ops = &clk_rcg_ops,
  831. },
  832. },
  833. };
  834. static struct clk_branch prng_clk = {
  835. .halt_reg = 0x2fd8,
  836. .halt_check = BRANCH_HALT_VOTED,
  837. .halt_bit = 10,
  838. .clkr = {
  839. .enable_reg = 0x3080,
  840. .enable_mask = BIT(10),
  841. .hw.init = &(struct clk_init_data){
  842. .name = "prng_clk",
  843. .parent_names = (const char *[]){ "prng_src" },
  844. .num_parents = 1,
  845. .ops = &clk_branch_ops,
  846. },
  847. },
  848. };
  849. static const struct freq_tbl clk_tbl_sdc[] = {
  850. { 144000, P_CXO, 1, 1, 133 },
  851. { 400000, P_PLL8, 4, 1, 240 },
  852. { 16000000, P_PLL8, 4, 1, 6 },
  853. { 17070000, P_PLL8, 1, 2, 45 },
  854. { 20210000, P_PLL8, 1, 1, 19 },
  855. { 24000000, P_PLL8, 4, 1, 4 },
  856. { 38400000, P_PLL8, 2, 1, 5 },
  857. { 48000000, P_PLL8, 4, 1, 2 },
  858. { 64000000, P_PLL8, 3, 1, 2 },
  859. { 76800000, P_PLL8, 1, 1, 5 },
  860. { }
  861. };
  862. static struct clk_rcg sdc1_src = {
  863. .ns_reg = 0x282c,
  864. .md_reg = 0x2828,
  865. .mn = {
  866. .mnctr_en_bit = 8,
  867. .mnctr_reset_bit = 7,
  868. .mnctr_mode_shift = 5,
  869. .n_val_shift = 16,
  870. .m_val_shift = 16,
  871. .width = 8,
  872. },
  873. .p = {
  874. .pre_div_shift = 3,
  875. .pre_div_width = 2,
  876. },
  877. .s = {
  878. .src_sel_shift = 0,
  879. .parent_map = gcc_cxo_pll8_map,
  880. },
  881. .freq_tbl = clk_tbl_sdc,
  882. .clkr = {
  883. .enable_reg = 0x282c,
  884. .enable_mask = BIT(11),
  885. .hw.init = &(struct clk_init_data){
  886. .name = "sdc1_src",
  887. .parent_names = gcc_cxo_pll8,
  888. .num_parents = 2,
  889. .ops = &clk_rcg_ops,
  890. },
  891. }
  892. };
  893. static struct clk_branch sdc1_clk = {
  894. .halt_reg = 0x2fc8,
  895. .halt_bit = 6,
  896. .clkr = {
  897. .enable_reg = 0x282c,
  898. .enable_mask = BIT(9),
  899. .hw.init = &(struct clk_init_data){
  900. .name = "sdc1_clk",
  901. .parent_names = (const char *[]){ "sdc1_src" },
  902. .num_parents = 1,
  903. .ops = &clk_branch_ops,
  904. .flags = CLK_SET_RATE_PARENT,
  905. },
  906. },
  907. };
  908. static struct clk_rcg sdc2_src = {
  909. .ns_reg = 0x284c,
  910. .md_reg = 0x2848,
  911. .mn = {
  912. .mnctr_en_bit = 8,
  913. .mnctr_reset_bit = 7,
  914. .mnctr_mode_shift = 5,
  915. .n_val_shift = 16,
  916. .m_val_shift = 16,
  917. .width = 8,
  918. },
  919. .p = {
  920. .pre_div_shift = 3,
  921. .pre_div_width = 2,
  922. },
  923. .s = {
  924. .src_sel_shift = 0,
  925. .parent_map = gcc_cxo_pll8_map,
  926. },
  927. .freq_tbl = clk_tbl_sdc,
  928. .clkr = {
  929. .enable_reg = 0x284c,
  930. .enable_mask = BIT(11),
  931. .hw.init = &(struct clk_init_data){
  932. .name = "sdc2_src",
  933. .parent_names = gcc_cxo_pll8,
  934. .num_parents = 2,
  935. .ops = &clk_rcg_ops,
  936. },
  937. }
  938. };
  939. static struct clk_branch sdc2_clk = {
  940. .halt_reg = 0x2fc8,
  941. .halt_bit = 5,
  942. .clkr = {
  943. .enable_reg = 0x284c,
  944. .enable_mask = BIT(9),
  945. .hw.init = &(struct clk_init_data){
  946. .name = "sdc2_clk",
  947. .parent_names = (const char *[]){ "sdc2_src" },
  948. .num_parents = 1,
  949. .ops = &clk_branch_ops,
  950. .flags = CLK_SET_RATE_PARENT,
  951. },
  952. },
  953. };
  954. static const struct freq_tbl clk_tbl_usb[] = {
  955. { 60000000, P_PLL8, 1, 5, 32 },
  956. { }
  957. };
  958. static struct clk_rcg usb_hs1_xcvr_src = {
  959. .ns_reg = 0x290c,
  960. .md_reg = 0x2908,
  961. .mn = {
  962. .mnctr_en_bit = 8,
  963. .mnctr_reset_bit = 7,
  964. .mnctr_mode_shift = 5,
  965. .n_val_shift = 16,
  966. .m_val_shift = 16,
  967. .width = 8,
  968. },
  969. .p = {
  970. .pre_div_shift = 3,
  971. .pre_div_width = 2,
  972. },
  973. .s = {
  974. .src_sel_shift = 0,
  975. .parent_map = gcc_cxo_pll8_map,
  976. },
  977. .freq_tbl = clk_tbl_usb,
  978. .clkr = {
  979. .enable_reg = 0x290c,
  980. .enable_mask = BIT(11),
  981. .hw.init = &(struct clk_init_data){
  982. .name = "usb_hs1_xcvr_src",
  983. .parent_names = gcc_cxo_pll8,
  984. .num_parents = 2,
  985. .ops = &clk_rcg_ops,
  986. .flags = CLK_SET_RATE_GATE,
  987. },
  988. }
  989. };
  990. static struct clk_branch usb_hs1_xcvr_clk = {
  991. .halt_reg = 0x2fc8,
  992. .halt_bit = 0,
  993. .clkr = {
  994. .enable_reg = 0x290c,
  995. .enable_mask = BIT(9),
  996. .hw.init = &(struct clk_init_data){
  997. .name = "usb_hs1_xcvr_clk",
  998. .parent_names = (const char *[]){ "usb_hs1_xcvr_src" },
  999. .num_parents = 1,
  1000. .ops = &clk_branch_ops,
  1001. .flags = CLK_SET_RATE_PARENT,
  1002. },
  1003. },
  1004. };
  1005. static struct clk_rcg usb_hsic_xcvr_fs_src = {
  1006. .ns_reg = 0x2928,
  1007. .md_reg = 0x2924,
  1008. .mn = {
  1009. .mnctr_en_bit = 8,
  1010. .mnctr_reset_bit = 7,
  1011. .mnctr_mode_shift = 5,
  1012. .n_val_shift = 16,
  1013. .m_val_shift = 16,
  1014. .width = 8,
  1015. },
  1016. .p = {
  1017. .pre_div_shift = 3,
  1018. .pre_div_width = 2,
  1019. },
  1020. .s = {
  1021. .src_sel_shift = 0,
  1022. .parent_map = gcc_cxo_pll8_map,
  1023. },
  1024. .freq_tbl = clk_tbl_usb,
  1025. .clkr = {
  1026. .enable_reg = 0x2928,
  1027. .enable_mask = BIT(11),
  1028. .hw.init = &(struct clk_init_data){
  1029. .name = "usb_hsic_xcvr_fs_src",
  1030. .parent_names = gcc_cxo_pll8,
  1031. .num_parents = 2,
  1032. .ops = &clk_rcg_ops,
  1033. .flags = CLK_SET_RATE_GATE,
  1034. },
  1035. }
  1036. };
  1037. static struct clk_branch usb_hsic_xcvr_fs_clk = {
  1038. .halt_reg = 0x2fc8,
  1039. .halt_bit = 9,
  1040. .clkr = {
  1041. .enable_reg = 0x2928,
  1042. .enable_mask = BIT(9),
  1043. .hw.init = &(struct clk_init_data){
  1044. .name = "usb_hsic_xcvr_fs_clk",
  1045. .parent_names =
  1046. (const char *[]){ "usb_hsic_xcvr_fs_src" },
  1047. .num_parents = 1,
  1048. .ops = &clk_branch_ops,
  1049. .flags = CLK_SET_RATE_PARENT,
  1050. },
  1051. },
  1052. };
  1053. static const struct freq_tbl clk_tbl_usb_hs1_system[] = {
  1054. { 60000000, P_PLL8, 1, 5, 32 },
  1055. { }
  1056. };
  1057. static struct clk_rcg usb_hs1_system_src = {
  1058. .ns_reg = 0x36a4,
  1059. .md_reg = 0x36a0,
  1060. .mn = {
  1061. .mnctr_en_bit = 8,
  1062. .mnctr_reset_bit = 7,
  1063. .mnctr_mode_shift = 5,
  1064. .n_val_shift = 16,
  1065. .m_val_shift = 16,
  1066. .width = 8,
  1067. },
  1068. .p = {
  1069. .pre_div_shift = 3,
  1070. .pre_div_width = 2,
  1071. },
  1072. .s = {
  1073. .src_sel_shift = 0,
  1074. .parent_map = gcc_cxo_pll8_map,
  1075. },
  1076. .freq_tbl = clk_tbl_usb_hs1_system,
  1077. .clkr = {
  1078. .enable_reg = 0x36a4,
  1079. .enable_mask = BIT(11),
  1080. .hw.init = &(struct clk_init_data){
  1081. .name = "usb_hs1_system_src",
  1082. .parent_names = gcc_cxo_pll8,
  1083. .num_parents = 2,
  1084. .ops = &clk_rcg_ops,
  1085. .flags = CLK_SET_RATE_GATE,
  1086. },
  1087. }
  1088. };
  1089. static struct clk_branch usb_hs1_system_clk = {
  1090. .halt_reg = 0x2fc8,
  1091. .halt_bit = 4,
  1092. .clkr = {
  1093. .enable_reg = 0x36a4,
  1094. .enable_mask = BIT(9),
  1095. .hw.init = &(struct clk_init_data){
  1096. .parent_names =
  1097. (const char *[]){ "usb_hs1_system_src" },
  1098. .num_parents = 1,
  1099. .name = "usb_hs1_system_clk",
  1100. .ops = &clk_branch_ops,
  1101. .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
  1102. },
  1103. },
  1104. };
  1105. static const struct freq_tbl clk_tbl_usb_hsic_system[] = {
  1106. { 64000000, P_PLL8, 1, 1, 6 },
  1107. { }
  1108. };
  1109. static struct clk_rcg usb_hsic_system_src = {
  1110. .ns_reg = 0x2b58,
  1111. .md_reg = 0x2b54,
  1112. .mn = {
  1113. .mnctr_en_bit = 8,
  1114. .mnctr_reset_bit = 7,
  1115. .mnctr_mode_shift = 5,
  1116. .n_val_shift = 16,
  1117. .m_val_shift = 16,
  1118. .width = 8,
  1119. },
  1120. .p = {
  1121. .pre_div_shift = 3,
  1122. .pre_div_width = 2,
  1123. },
  1124. .s = {
  1125. .src_sel_shift = 0,
  1126. .parent_map = gcc_cxo_pll8_map,
  1127. },
  1128. .freq_tbl = clk_tbl_usb_hsic_system,
  1129. .clkr = {
  1130. .enable_reg = 0x2b58,
  1131. .enable_mask = BIT(11),
  1132. .hw.init = &(struct clk_init_data){
  1133. .name = "usb_hsic_system_src",
  1134. .parent_names = gcc_cxo_pll8,
  1135. .num_parents = 2,
  1136. .ops = &clk_rcg_ops,
  1137. .flags = CLK_SET_RATE_GATE,
  1138. },
  1139. }
  1140. };
  1141. static struct clk_branch usb_hsic_system_clk = {
  1142. .halt_reg = 0x2fc8,
  1143. .halt_bit = 7,
  1144. .clkr = {
  1145. .enable_reg = 0x2b58,
  1146. .enable_mask = BIT(9),
  1147. .hw.init = &(struct clk_init_data){
  1148. .parent_names =
  1149. (const char *[]){ "usb_hsic_system_src" },
  1150. .num_parents = 1,
  1151. .name = "usb_hsic_system_clk",
  1152. .ops = &clk_branch_ops,
  1153. .flags = CLK_SET_RATE_PARENT,
  1154. },
  1155. },
  1156. };
  1157. static const struct freq_tbl clk_tbl_usb_hsic_hsic[] = {
  1158. { 48000000, P_PLL14, 1, 0, 0 },
  1159. { }
  1160. };
  1161. static struct clk_rcg usb_hsic_hsic_src = {
  1162. .ns_reg = 0x2b50,
  1163. .md_reg = 0x2b4c,
  1164. .mn = {
  1165. .mnctr_en_bit = 8,
  1166. .mnctr_reset_bit = 7,
  1167. .mnctr_mode_shift = 5,
  1168. .n_val_shift = 16,
  1169. .m_val_shift = 16,
  1170. .width = 8,
  1171. },
  1172. .p = {
  1173. .pre_div_shift = 3,
  1174. .pre_div_width = 2,
  1175. },
  1176. .s = {
  1177. .src_sel_shift = 0,
  1178. .parent_map = gcc_cxo_pll14_map,
  1179. },
  1180. .freq_tbl = clk_tbl_usb_hsic_hsic,
  1181. .clkr = {
  1182. .enable_reg = 0x2b50,
  1183. .enable_mask = BIT(11),
  1184. .hw.init = &(struct clk_init_data){
  1185. .name = "usb_hsic_hsic_src",
  1186. .parent_names = gcc_cxo_pll14,
  1187. .num_parents = 2,
  1188. .ops = &clk_rcg_ops,
  1189. .flags = CLK_SET_RATE_GATE,
  1190. },
  1191. }
  1192. };
  1193. static struct clk_branch usb_hsic_hsic_clk = {
  1194. .halt_check = BRANCH_HALT_DELAY,
  1195. .clkr = {
  1196. .enable_reg = 0x2b50,
  1197. .enable_mask = BIT(9),
  1198. .hw.init = &(struct clk_init_data){
  1199. .parent_names = (const char *[]){ "usb_hsic_hsic_src" },
  1200. .num_parents = 1,
  1201. .name = "usb_hsic_hsic_clk",
  1202. .ops = &clk_branch_ops,
  1203. .flags = CLK_SET_RATE_PARENT,
  1204. },
  1205. },
  1206. };
  1207. static struct clk_branch usb_hsic_hsio_cal_clk = {
  1208. .halt_reg = 0x2fc8,
  1209. .halt_bit = 8,
  1210. .clkr = {
  1211. .enable_reg = 0x2b48,
  1212. .enable_mask = BIT(0),
  1213. .hw.init = &(struct clk_init_data){
  1214. .parent_names = (const char *[]){ "cxo" },
  1215. .num_parents = 1,
  1216. .name = "usb_hsic_hsio_cal_clk",
  1217. .ops = &clk_branch_ops,
  1218. },
  1219. },
  1220. };
  1221. static struct clk_branch ce1_core_clk = {
  1222. .hwcg_reg = 0x2724,
  1223. .hwcg_bit = 6,
  1224. .halt_reg = 0x2fd4,
  1225. .halt_bit = 27,
  1226. .clkr = {
  1227. .enable_reg = 0x2724,
  1228. .enable_mask = BIT(4),
  1229. .hw.init = &(struct clk_init_data){
  1230. .name = "ce1_core_clk",
  1231. .ops = &clk_branch_ops,
  1232. },
  1233. },
  1234. };
  1235. static struct clk_branch ce1_h_clk = {
  1236. .halt_reg = 0x2fd4,
  1237. .halt_bit = 1,
  1238. .clkr = {
  1239. .enable_reg = 0x2720,
  1240. .enable_mask = BIT(4),
  1241. .hw.init = &(struct clk_init_data){
  1242. .name = "ce1_h_clk",
  1243. .ops = &clk_branch_ops,
  1244. },
  1245. },
  1246. };
  1247. static struct clk_branch dma_bam_h_clk = {
  1248. .hwcg_reg = 0x25c0,
  1249. .hwcg_bit = 6,
  1250. .halt_reg = 0x2fc8,
  1251. .halt_bit = 12,
  1252. .clkr = {
  1253. .enable_reg = 0x25c0,
  1254. .enable_mask = BIT(4),
  1255. .hw.init = &(struct clk_init_data){
  1256. .name = "dma_bam_h_clk",
  1257. .ops = &clk_branch_ops,
  1258. },
  1259. },
  1260. };
  1261. static struct clk_branch gsbi1_h_clk = {
  1262. .hwcg_reg = 0x29c0,
  1263. .hwcg_bit = 6,
  1264. .halt_reg = 0x2fcc,
  1265. .halt_bit = 11,
  1266. .clkr = {
  1267. .enable_reg = 0x29c0,
  1268. .enable_mask = BIT(4),
  1269. .hw.init = &(struct clk_init_data){
  1270. .name = "gsbi1_h_clk",
  1271. .ops = &clk_branch_ops,
  1272. },
  1273. },
  1274. };
  1275. static struct clk_branch gsbi2_h_clk = {
  1276. .hwcg_reg = 0x29e0,
  1277. .hwcg_bit = 6,
  1278. .halt_reg = 0x2fcc,
  1279. .halt_bit = 7,
  1280. .clkr = {
  1281. .enable_reg = 0x29e0,
  1282. .enable_mask = BIT(4),
  1283. .hw.init = &(struct clk_init_data){
  1284. .name = "gsbi2_h_clk",
  1285. .ops = &clk_branch_ops,
  1286. },
  1287. },
  1288. };
  1289. static struct clk_branch gsbi3_h_clk = {
  1290. .hwcg_reg = 0x2a00,
  1291. .hwcg_bit = 6,
  1292. .halt_reg = 0x2fcc,
  1293. .halt_bit = 3,
  1294. .clkr = {
  1295. .enable_reg = 0x2a00,
  1296. .enable_mask = BIT(4),
  1297. .hw.init = &(struct clk_init_data){
  1298. .name = "gsbi3_h_clk",
  1299. .ops = &clk_branch_ops,
  1300. },
  1301. },
  1302. };
  1303. static struct clk_branch gsbi4_h_clk = {
  1304. .hwcg_reg = 0x2a20,
  1305. .hwcg_bit = 6,
  1306. .halt_reg = 0x2fd0,
  1307. .halt_bit = 27,
  1308. .clkr = {
  1309. .enable_reg = 0x2a20,
  1310. .enable_mask = BIT(4),
  1311. .hw.init = &(struct clk_init_data){
  1312. .name = "gsbi4_h_clk",
  1313. .ops = &clk_branch_ops,
  1314. },
  1315. },
  1316. };
  1317. static struct clk_branch gsbi5_h_clk = {
  1318. .hwcg_reg = 0x2a40,
  1319. .hwcg_bit = 6,
  1320. .halt_reg = 0x2fd0,
  1321. .halt_bit = 23,
  1322. .clkr = {
  1323. .enable_reg = 0x2a40,
  1324. .enable_mask = BIT(4),
  1325. .hw.init = &(struct clk_init_data){
  1326. .name = "gsbi5_h_clk",
  1327. .ops = &clk_branch_ops,
  1328. },
  1329. },
  1330. };
  1331. static struct clk_branch usb_hs1_h_clk = {
  1332. .hwcg_reg = 0x2900,
  1333. .hwcg_bit = 6,
  1334. .halt_reg = 0x2fc8,
  1335. .halt_bit = 1,
  1336. .clkr = {
  1337. .enable_reg = 0x2900,
  1338. .enable_mask = BIT(4),
  1339. .hw.init = &(struct clk_init_data){
  1340. .name = "usb_hs1_h_clk",
  1341. .ops = &clk_branch_ops,
  1342. },
  1343. },
  1344. };
  1345. static struct clk_branch usb_hsic_h_clk = {
  1346. .halt_reg = 0x2fcc,
  1347. .halt_bit = 28,
  1348. .clkr = {
  1349. .enable_reg = 0x2920,
  1350. .enable_mask = BIT(4),
  1351. .hw.init = &(struct clk_init_data){
  1352. .name = "usb_hsic_h_clk",
  1353. .ops = &clk_branch_ops,
  1354. },
  1355. },
  1356. };
  1357. static struct clk_branch sdc1_h_clk = {
  1358. .hwcg_reg = 0x2820,
  1359. .hwcg_bit = 6,
  1360. .halt_reg = 0x2fc8,
  1361. .halt_bit = 11,
  1362. .clkr = {
  1363. .enable_reg = 0x2820,
  1364. .enable_mask = BIT(4),
  1365. .hw.init = &(struct clk_init_data){
  1366. .name = "sdc1_h_clk",
  1367. .ops = &clk_branch_ops,
  1368. },
  1369. },
  1370. };
  1371. static struct clk_branch sdc2_h_clk = {
  1372. .hwcg_reg = 0x2840,
  1373. .hwcg_bit = 6,
  1374. .halt_reg = 0x2fc8,
  1375. .halt_bit = 10,
  1376. .clkr = {
  1377. .enable_reg = 0x2840,
  1378. .enable_mask = BIT(4),
  1379. .hw.init = &(struct clk_init_data){
  1380. .name = "sdc2_h_clk",
  1381. .ops = &clk_branch_ops,
  1382. },
  1383. },
  1384. };
  1385. static struct clk_branch adm0_clk = {
  1386. .halt_reg = 0x2fdc,
  1387. .halt_check = BRANCH_HALT_VOTED,
  1388. .halt_bit = 14,
  1389. .clkr = {
  1390. .enable_reg = 0x3080,
  1391. .enable_mask = BIT(2),
  1392. .hw.init = &(struct clk_init_data){
  1393. .name = "adm0_clk",
  1394. .ops = &clk_branch_ops,
  1395. },
  1396. },
  1397. };
  1398. static struct clk_branch adm0_pbus_clk = {
  1399. .hwcg_reg = 0x2208,
  1400. .hwcg_bit = 6,
  1401. .halt_reg = 0x2fdc,
  1402. .halt_check = BRANCH_HALT_VOTED,
  1403. .halt_bit = 13,
  1404. .clkr = {
  1405. .enable_reg = 0x3080,
  1406. .enable_mask = BIT(3),
  1407. .hw.init = &(struct clk_init_data){
  1408. .name = "adm0_pbus_clk",
  1409. .ops = &clk_branch_ops,
  1410. },
  1411. },
  1412. };
  1413. static struct clk_branch pmic_arb0_h_clk = {
  1414. .halt_reg = 0x2fd8,
  1415. .halt_check = BRANCH_HALT_VOTED,
  1416. .halt_bit = 22,
  1417. .clkr = {
  1418. .enable_reg = 0x3080,
  1419. .enable_mask = BIT(8),
  1420. .hw.init = &(struct clk_init_data){
  1421. .name = "pmic_arb0_h_clk",
  1422. .ops = &clk_branch_ops,
  1423. },
  1424. },
  1425. };
  1426. static struct clk_branch pmic_arb1_h_clk = {
  1427. .halt_reg = 0x2fd8,
  1428. .halt_check = BRANCH_HALT_VOTED,
  1429. .halt_bit = 21,
  1430. .clkr = {
  1431. .enable_reg = 0x3080,
  1432. .enable_mask = BIT(9),
  1433. .hw.init = &(struct clk_init_data){
  1434. .name = "pmic_arb1_h_clk",
  1435. .ops = &clk_branch_ops,
  1436. },
  1437. },
  1438. };
  1439. static struct clk_branch pmic_ssbi2_clk = {
  1440. .halt_reg = 0x2fd8,
  1441. .halt_check = BRANCH_HALT_VOTED,
  1442. .halt_bit = 23,
  1443. .clkr = {
  1444. .enable_reg = 0x3080,
  1445. .enable_mask = BIT(7),
  1446. .hw.init = &(struct clk_init_data){
  1447. .name = "pmic_ssbi2_clk",
  1448. .ops = &clk_branch_ops,
  1449. },
  1450. },
  1451. };
  1452. static struct clk_branch rpm_msg_ram_h_clk = {
  1453. .hwcg_reg = 0x27e0,
  1454. .hwcg_bit = 6,
  1455. .halt_reg = 0x2fd8,
  1456. .halt_check = BRANCH_HALT_VOTED,
  1457. .halt_bit = 12,
  1458. .clkr = {
  1459. .enable_reg = 0x3080,
  1460. .enable_mask = BIT(6),
  1461. .hw.init = &(struct clk_init_data){
  1462. .name = "rpm_msg_ram_h_clk",
  1463. .ops = &clk_branch_ops,
  1464. },
  1465. },
  1466. };
  1467. static struct clk_branch ebi2_clk = {
  1468. .hwcg_reg = 0x2664,
  1469. .hwcg_bit = 6,
  1470. .halt_reg = 0x2fcc,
  1471. .halt_bit = 24,
  1472. .clkr = {
  1473. .enable_reg = 0x2664,
  1474. .enable_mask = BIT(6) | BIT(4),
  1475. .hw.init = &(struct clk_init_data){
  1476. .name = "ebi2_clk",
  1477. .ops = &clk_branch_ops,
  1478. },
  1479. },
  1480. };
  1481. static struct clk_branch ebi2_aon_clk = {
  1482. .halt_reg = 0x2fcc,
  1483. .halt_bit = 23,
  1484. .clkr = {
  1485. .enable_reg = 0x2664,
  1486. .enable_mask = BIT(8),
  1487. .hw.init = &(struct clk_init_data){
  1488. .name = "ebi2_aon_clk",
  1489. .ops = &clk_branch_ops,
  1490. },
  1491. },
  1492. };
  1493. static struct clk_hw *gcc_mdm9615_hws[] = {
  1494. &cxo.hw,
  1495. };
  1496. static struct clk_regmap *gcc_mdm9615_clks[] = {
  1497. [PLL0] = &pll0.clkr,
  1498. [PLL0_VOTE] = &pll0_vote,
  1499. [PLL4_VOTE] = &pll4_vote,
  1500. [PLL8] = &pll8.clkr,
  1501. [PLL8_VOTE] = &pll8_vote,
  1502. [PLL14] = &pll14.clkr,
  1503. [PLL14_VOTE] = &pll14_vote,
  1504. [GSBI1_UART_SRC] = &gsbi1_uart_src.clkr,
  1505. [GSBI1_UART_CLK] = &gsbi1_uart_clk.clkr,
  1506. [GSBI2_UART_SRC] = &gsbi2_uart_src.clkr,
  1507. [GSBI2_UART_CLK] = &gsbi2_uart_clk.clkr,
  1508. [GSBI3_UART_SRC] = &gsbi3_uart_src.clkr,
  1509. [GSBI3_UART_CLK] = &gsbi3_uart_clk.clkr,
  1510. [GSBI4_UART_SRC] = &gsbi4_uart_src.clkr,
  1511. [GSBI4_UART_CLK] = &gsbi4_uart_clk.clkr,
  1512. [GSBI5_UART_SRC] = &gsbi5_uart_src.clkr,
  1513. [GSBI5_UART_CLK] = &gsbi5_uart_clk.clkr,
  1514. [GSBI1_QUP_SRC] = &gsbi1_qup_src.clkr,
  1515. [GSBI1_QUP_CLK] = &gsbi1_qup_clk.clkr,
  1516. [GSBI2_QUP_SRC] = &gsbi2_qup_src.clkr,
  1517. [GSBI2_QUP_CLK] = &gsbi2_qup_clk.clkr,
  1518. [GSBI3_QUP_SRC] = &gsbi3_qup_src.clkr,
  1519. [GSBI3_QUP_CLK] = &gsbi3_qup_clk.clkr,
  1520. [GSBI4_QUP_SRC] = &gsbi4_qup_src.clkr,
  1521. [GSBI4_QUP_CLK] = &gsbi4_qup_clk.clkr,
  1522. [GSBI5_QUP_SRC] = &gsbi5_qup_src.clkr,
  1523. [GSBI5_QUP_CLK] = &gsbi5_qup_clk.clkr,
  1524. [GP0_SRC] = &gp0_src.clkr,
  1525. [GP0_CLK] = &gp0_clk.clkr,
  1526. [GP1_SRC] = &gp1_src.clkr,
  1527. [GP1_CLK] = &gp1_clk.clkr,
  1528. [GP2_SRC] = &gp2_src.clkr,
  1529. [GP2_CLK] = &gp2_clk.clkr,
  1530. [PMEM_A_CLK] = &pmem_clk.clkr,
  1531. [PRNG_SRC] = &prng_src.clkr,
  1532. [PRNG_CLK] = &prng_clk.clkr,
  1533. [SDC1_SRC] = &sdc1_src.clkr,
  1534. [SDC1_CLK] = &sdc1_clk.clkr,
  1535. [SDC2_SRC] = &sdc2_src.clkr,
  1536. [SDC2_CLK] = &sdc2_clk.clkr,
  1537. [USB_HS1_XCVR_SRC] = &usb_hs1_xcvr_src.clkr,
  1538. [USB_HS1_XCVR_CLK] = &usb_hs1_xcvr_clk.clkr,
  1539. [USB_HS1_SYSTEM_CLK_SRC] = &usb_hs1_system_src.clkr,
  1540. [USB_HS1_SYSTEM_CLK] = &usb_hs1_system_clk.clkr,
  1541. [USB_HSIC_XCVR_FS_SRC] = &usb_hsic_xcvr_fs_src.clkr,
  1542. [USB_HSIC_XCVR_FS_CLK] = &usb_hsic_xcvr_fs_clk.clkr,
  1543. [USB_HSIC_SYSTEM_CLK_SRC] = &usb_hsic_system_src.clkr,
  1544. [USB_HSIC_SYSTEM_CLK] = &usb_hsic_system_clk.clkr,
  1545. [USB_HSIC_HSIC_CLK_SRC] = &usb_hsic_hsic_src.clkr,
  1546. [USB_HSIC_HSIC_CLK] = &usb_hsic_hsic_clk.clkr,
  1547. [USB_HSIC_HSIO_CAL_CLK] = &usb_hsic_hsio_cal_clk.clkr,
  1548. [CE1_CORE_CLK] = &ce1_core_clk.clkr,
  1549. [CE1_H_CLK] = &ce1_h_clk.clkr,
  1550. [DMA_BAM_H_CLK] = &dma_bam_h_clk.clkr,
  1551. [GSBI1_H_CLK] = &gsbi1_h_clk.clkr,
  1552. [GSBI2_H_CLK] = &gsbi2_h_clk.clkr,
  1553. [GSBI3_H_CLK] = &gsbi3_h_clk.clkr,
  1554. [GSBI4_H_CLK] = &gsbi4_h_clk.clkr,
  1555. [GSBI5_H_CLK] = &gsbi5_h_clk.clkr,
  1556. [USB_HS1_H_CLK] = &usb_hs1_h_clk.clkr,
  1557. [USB_HSIC_H_CLK] = &usb_hsic_h_clk.clkr,
  1558. [SDC1_H_CLK] = &sdc1_h_clk.clkr,
  1559. [SDC2_H_CLK] = &sdc2_h_clk.clkr,
  1560. [ADM0_CLK] = &adm0_clk.clkr,
  1561. [ADM0_PBUS_CLK] = &adm0_pbus_clk.clkr,
  1562. [PMIC_ARB0_H_CLK] = &pmic_arb0_h_clk.clkr,
  1563. [PMIC_ARB1_H_CLK] = &pmic_arb1_h_clk.clkr,
  1564. [PMIC_SSBI2_CLK] = &pmic_ssbi2_clk.clkr,
  1565. [RPM_MSG_RAM_H_CLK] = &rpm_msg_ram_h_clk.clkr,
  1566. [EBI2_CLK] = &ebi2_clk.clkr,
  1567. [EBI2_AON_CLK] = &ebi2_aon_clk.clkr,
  1568. };
  1569. static const struct qcom_reset_map gcc_mdm9615_resets[] = {
  1570. [DMA_BAM_RESET] = { 0x25c0, 7 },
  1571. [CE1_H_RESET] = { 0x2720, 7 },
  1572. [CE1_CORE_RESET] = { 0x2724, 7 },
  1573. [SDC1_RESET] = { 0x2830 },
  1574. [SDC2_RESET] = { 0x2850 },
  1575. [ADM0_C2_RESET] = { 0x220c, 4 },
  1576. [ADM0_C1_RESET] = { 0x220c, 3 },
  1577. [ADM0_C0_RESET] = { 0x220c, 2 },
  1578. [ADM0_PBUS_RESET] = { 0x220c, 1 },
  1579. [ADM0_RESET] = { 0x220c },
  1580. [USB_HS1_RESET] = { 0x2910 },
  1581. [USB_HSIC_RESET] = { 0x2934 },
  1582. [GSBI1_RESET] = { 0x29dc },
  1583. [GSBI2_RESET] = { 0x29fc },
  1584. [GSBI3_RESET] = { 0x2a1c },
  1585. [GSBI4_RESET] = { 0x2a3c },
  1586. [GSBI5_RESET] = { 0x2a5c },
  1587. [PDM_RESET] = { 0x2CC0, 12 },
  1588. };
  1589. static const struct regmap_config gcc_mdm9615_regmap_config = {
  1590. .reg_bits = 32,
  1591. .reg_stride = 4,
  1592. .val_bits = 32,
  1593. .max_register = 0x3660,
  1594. .fast_io = true,
  1595. };
  1596. static const struct qcom_cc_desc gcc_mdm9615_desc = {
  1597. .config = &gcc_mdm9615_regmap_config,
  1598. .clks = gcc_mdm9615_clks,
  1599. .num_clks = ARRAY_SIZE(gcc_mdm9615_clks),
  1600. .resets = gcc_mdm9615_resets,
  1601. .num_resets = ARRAY_SIZE(gcc_mdm9615_resets),
  1602. .clk_hws = gcc_mdm9615_hws,
  1603. .num_clk_hws = ARRAY_SIZE(gcc_mdm9615_hws),
  1604. };
  1605. static const struct of_device_id gcc_mdm9615_match_table[] = {
  1606. { .compatible = "qcom,gcc-mdm9615" },
  1607. { }
  1608. };
  1609. MODULE_DEVICE_TABLE(of, gcc_mdm9615_match_table);
  1610. static int gcc_mdm9615_probe(struct platform_device *pdev)
  1611. {
  1612. struct regmap *regmap;
  1613. regmap = qcom_cc_map(pdev, &gcc_mdm9615_desc);
  1614. if (IS_ERR(regmap))
  1615. return PTR_ERR(regmap);
  1616. return qcom_cc_really_probe(pdev, &gcc_mdm9615_desc, regmap);
  1617. }
  1618. static struct platform_driver gcc_mdm9615_driver = {
  1619. .probe = gcc_mdm9615_probe,
  1620. .driver = {
  1621. .name = "gcc-mdm9615",
  1622. .of_match_table = gcc_mdm9615_match_table,
  1623. },
  1624. };
  1625. static int __init gcc_mdm9615_init(void)
  1626. {
  1627. return platform_driver_register(&gcc_mdm9615_driver);
  1628. }
  1629. core_initcall(gcc_mdm9615_init);
  1630. static void __exit gcc_mdm9615_exit(void)
  1631. {
  1632. platform_driver_unregister(&gcc_mdm9615_driver);
  1633. }
  1634. module_exit(gcc_mdm9615_exit);
  1635. MODULE_DESCRIPTION("QCOM GCC MDM9615 Driver");
  1636. MODULE_LICENSE("GPL v2");
  1637. MODULE_ALIAS("platform:gcc-mdm9615");