gcc-mdm9615.c 36 KB

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