gpucc-x1e80100.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #include <linux/clk-provider.h>
  6. #include <linux/mod_devicetable.h>
  7. #include <linux/module.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/regmap.h>
  10. #include <dt-bindings/clock/qcom,x1e80100-gpucc.h>
  11. #include <dt-bindings/reset/qcom,x1e80100-gpucc.h>
  12. #include "clk-alpha-pll.h"
  13. #include "clk-branch.h"
  14. #include "clk-rcg.h"
  15. #include "clk-regmap.h"
  16. #include "clk-regmap-divider.h"
  17. #include "clk-regmap-mux.h"
  18. #include "gdsc.h"
  19. #include "reset.h"
  20. enum {
  21. DT_BI_TCXO,
  22. DT_GPLL0_OUT_MAIN,
  23. DT_GPLL0_OUT_MAIN_DIV,
  24. };
  25. enum {
  26. P_BI_TCXO,
  27. P_GPLL0_OUT_MAIN,
  28. P_GPLL0_OUT_MAIN_DIV,
  29. P_GPU_CC_PLL0_OUT_MAIN,
  30. P_GPU_CC_PLL1_OUT_MAIN,
  31. };
  32. static const struct pll_vco lucid_ole_vco[] = {
  33. { 249600000, 2300000000, 0 },
  34. };
  35. static const struct pll_vco zonda_ole_vco[] = {
  36. { 700000000, 3600000000, 0 },
  37. };
  38. static const struct alpha_pll_config gpu_cc_pll0_config = {
  39. .l = 0x29,
  40. .alpha = 0xa000,
  41. .config_ctl_val = 0x08240800,
  42. .config_ctl_hi_val = 0x05008001,
  43. .config_ctl_hi1_val = 0x00000000,
  44. .config_ctl_hi2_val = 0x00000000,
  45. .user_ctl_val = 0x00000000,
  46. .user_ctl_hi_val = 0x02000000,
  47. };
  48. static struct clk_alpha_pll gpu_cc_pll0 = {
  49. .offset = 0x0,
  50. .vco_table = zonda_ole_vco,
  51. .num_vco = ARRAY_SIZE(zonda_ole_vco),
  52. .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_ZONDA_OLE],
  53. .clkr = {
  54. .hw.init = &(const struct clk_init_data) {
  55. .name = "gpu_cc_pll0",
  56. .parent_data = &(const struct clk_parent_data) {
  57. .index = DT_BI_TCXO,
  58. },
  59. .num_parents = 1,
  60. .ops = &clk_alpha_pll_zonda_ole_ops,
  61. },
  62. },
  63. };
  64. static const struct alpha_pll_config gpu_cc_pll1_config = {
  65. .l = 0x16,
  66. .alpha = 0xeaaa,
  67. .config_ctl_val = 0x20485699,
  68. .config_ctl_hi_val = 0x00182261,
  69. .config_ctl_hi1_val = 0x82aa299c,
  70. .test_ctl_val = 0x00000000,
  71. .test_ctl_hi_val = 0x00000003,
  72. .test_ctl_hi1_val = 0x00009000,
  73. .test_ctl_hi2_val = 0x00000034,
  74. .user_ctl_val = 0x00000000,
  75. .user_ctl_hi_val = 0x00000005,
  76. };
  77. static struct clk_alpha_pll gpu_cc_pll1 = {
  78. .offset = 0x1000,
  79. .vco_table = lucid_ole_vco,
  80. .num_vco = ARRAY_SIZE(lucid_ole_vco),
  81. .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE],
  82. .clkr = {
  83. .hw.init = &(const struct clk_init_data) {
  84. .name = "gpu_cc_pll1",
  85. .parent_data = &(const struct clk_parent_data) {
  86. .index = DT_BI_TCXO,
  87. },
  88. .num_parents = 1,
  89. .ops = &clk_alpha_pll_lucid_evo_ops,
  90. },
  91. },
  92. };
  93. static const struct parent_map gpu_cc_parent_map_0[] = {
  94. { P_BI_TCXO, 0 },
  95. { P_GPLL0_OUT_MAIN, 5 },
  96. { P_GPLL0_OUT_MAIN_DIV, 6 },
  97. };
  98. static const struct clk_parent_data gpu_cc_parent_data_0[] = {
  99. { .index = DT_BI_TCXO },
  100. { .index = DT_GPLL0_OUT_MAIN },
  101. { .index = DT_GPLL0_OUT_MAIN_DIV },
  102. };
  103. static const struct parent_map gpu_cc_parent_map_1[] = {
  104. { P_BI_TCXO, 0 },
  105. { P_GPU_CC_PLL0_OUT_MAIN, 1 },
  106. { P_GPU_CC_PLL1_OUT_MAIN, 3 },
  107. { P_GPLL0_OUT_MAIN, 5 },
  108. { P_GPLL0_OUT_MAIN_DIV, 6 },
  109. };
  110. static const struct clk_parent_data gpu_cc_parent_data_1[] = {
  111. { .index = DT_BI_TCXO },
  112. { .hw = &gpu_cc_pll0.clkr.hw },
  113. { .hw = &gpu_cc_pll1.clkr.hw },
  114. { .index = DT_GPLL0_OUT_MAIN },
  115. { .index = DT_GPLL0_OUT_MAIN_DIV },
  116. };
  117. static const struct parent_map gpu_cc_parent_map_2[] = {
  118. { P_BI_TCXO, 0 },
  119. { P_GPU_CC_PLL1_OUT_MAIN, 3 },
  120. { P_GPLL0_OUT_MAIN, 5 },
  121. { P_GPLL0_OUT_MAIN_DIV, 6 },
  122. };
  123. static const struct clk_parent_data gpu_cc_parent_data_2[] = {
  124. { .index = DT_BI_TCXO },
  125. { .hw = &gpu_cc_pll1.clkr.hw },
  126. { .index = DT_GPLL0_OUT_MAIN },
  127. { .index = DT_GPLL0_OUT_MAIN_DIV },
  128. };
  129. static const struct parent_map gpu_cc_parent_map_3[] = {
  130. { P_BI_TCXO, 0 },
  131. };
  132. static const struct clk_parent_data gpu_cc_parent_data_3[] = {
  133. { .index = DT_BI_TCXO },
  134. };
  135. static const struct freq_tbl ftbl_gpu_cc_ff_clk_src[] = {
  136. F(200000000, P_GPLL0_OUT_MAIN, 3, 0, 0),
  137. { }
  138. };
  139. static struct clk_rcg2 gpu_cc_ff_clk_src = {
  140. .cmd_rcgr = 0x9474,
  141. .mnd_width = 0,
  142. .hid_width = 5,
  143. .parent_map = gpu_cc_parent_map_0,
  144. .freq_tbl = ftbl_gpu_cc_ff_clk_src,
  145. .clkr.hw.init = &(const struct clk_init_data) {
  146. .name = "gpu_cc_ff_clk_src",
  147. .parent_data = gpu_cc_parent_data_0,
  148. .num_parents = ARRAY_SIZE(gpu_cc_parent_data_0),
  149. .flags = CLK_SET_RATE_PARENT,
  150. .ops = &clk_rcg2_ops,
  151. },
  152. };
  153. static const struct freq_tbl ftbl_gpu_cc_gmu_clk_src[] = {
  154. F(19200000, P_BI_TCXO, 1, 0, 0),
  155. F(220000000, P_GPU_CC_PLL1_OUT_MAIN, 2, 0, 0),
  156. F(550000000, P_GPU_CC_PLL1_OUT_MAIN, 2, 0, 0),
  157. { }
  158. };
  159. static struct clk_rcg2 gpu_cc_gmu_clk_src = {
  160. .cmd_rcgr = 0x9318,
  161. .mnd_width = 0,
  162. .hid_width = 5,
  163. .parent_map = gpu_cc_parent_map_1,
  164. .freq_tbl = ftbl_gpu_cc_gmu_clk_src,
  165. .clkr.hw.init = &(const struct clk_init_data) {
  166. .name = "gpu_cc_gmu_clk_src",
  167. .parent_data = gpu_cc_parent_data_1,
  168. .num_parents = ARRAY_SIZE(gpu_cc_parent_data_1),
  169. .flags = CLK_SET_RATE_PARENT,
  170. .ops = &clk_rcg2_shared_ops,
  171. },
  172. };
  173. static struct clk_rcg2 gpu_cc_hub_clk_src = {
  174. .cmd_rcgr = 0x93ec,
  175. .mnd_width = 0,
  176. .hid_width = 5,
  177. .parent_map = gpu_cc_parent_map_2,
  178. .freq_tbl = ftbl_gpu_cc_ff_clk_src,
  179. .clkr.hw.init = &(const struct clk_init_data) {
  180. .name = "gpu_cc_hub_clk_src",
  181. .parent_data = gpu_cc_parent_data_2,
  182. .num_parents = ARRAY_SIZE(gpu_cc_parent_data_2),
  183. .flags = CLK_SET_RATE_PARENT,
  184. .ops = &clk_rcg2_ops,
  185. },
  186. };
  187. static struct clk_rcg2 gpu_cc_xo_clk_src = {
  188. .cmd_rcgr = 0x9010,
  189. .mnd_width = 0,
  190. .hid_width = 5,
  191. .parent_map = gpu_cc_parent_map_3,
  192. .freq_tbl = NULL,
  193. .clkr.hw.init = &(const struct clk_init_data) {
  194. .name = "gpu_cc_xo_clk_src",
  195. .parent_data = gpu_cc_parent_data_3,
  196. .num_parents = ARRAY_SIZE(gpu_cc_parent_data_3),
  197. .flags = CLK_SET_RATE_PARENT,
  198. .ops = &clk_rcg2_ops,
  199. },
  200. };
  201. static struct clk_regmap_div gpu_cc_demet_div_clk_src = {
  202. .reg = 0x9054,
  203. .shift = 0,
  204. .width = 4,
  205. .clkr.hw.init = &(const struct clk_init_data) {
  206. .name = "gpu_cc_demet_div_clk_src",
  207. .parent_hws = (const struct clk_hw*[]) {
  208. &gpu_cc_xo_clk_src.clkr.hw,
  209. },
  210. .num_parents = 1,
  211. .flags = CLK_SET_RATE_PARENT,
  212. .ops = &clk_regmap_div_ro_ops,
  213. },
  214. };
  215. static struct clk_regmap_div gpu_cc_xo_div_clk_src = {
  216. .reg = 0x9050,
  217. .shift = 0,
  218. .width = 4,
  219. .clkr.hw.init = &(const struct clk_init_data) {
  220. .name = "gpu_cc_xo_div_clk_src",
  221. .parent_hws = (const struct clk_hw*[]) {
  222. &gpu_cc_xo_clk_src.clkr.hw,
  223. },
  224. .num_parents = 1,
  225. .flags = CLK_SET_RATE_PARENT,
  226. .ops = &clk_regmap_div_ro_ops,
  227. },
  228. };
  229. static struct clk_branch gpu_cc_ahb_clk = {
  230. .halt_reg = 0x911c,
  231. .halt_check = BRANCH_HALT_VOTED,
  232. .clkr = {
  233. .enable_reg = 0x911c,
  234. .enable_mask = BIT(0),
  235. .hw.init = &(const struct clk_init_data) {
  236. .name = "gpu_cc_ahb_clk",
  237. .parent_hws = (const struct clk_hw*[]) {
  238. &gpu_cc_hub_clk_src.clkr.hw,
  239. },
  240. .num_parents = 1,
  241. .flags = CLK_SET_RATE_PARENT,
  242. .ops = &clk_branch2_ops,
  243. },
  244. },
  245. };
  246. static struct clk_branch gpu_cc_crc_ahb_clk = {
  247. .halt_reg = 0x9120,
  248. .halt_check = BRANCH_HALT_VOTED,
  249. .clkr = {
  250. .enable_reg = 0x9120,
  251. .enable_mask = BIT(0),
  252. .hw.init = &(const struct clk_init_data) {
  253. .name = "gpu_cc_crc_ahb_clk",
  254. .parent_hws = (const struct clk_hw*[]) {
  255. &gpu_cc_hub_clk_src.clkr.hw,
  256. },
  257. .num_parents = 1,
  258. .flags = CLK_SET_RATE_PARENT,
  259. .ops = &clk_branch2_ops,
  260. },
  261. },
  262. };
  263. static struct clk_branch gpu_cc_cx_ff_clk = {
  264. .halt_reg = 0x914c,
  265. .halt_check = BRANCH_HALT,
  266. .clkr = {
  267. .enable_reg = 0x914c,
  268. .enable_mask = BIT(0),
  269. .hw.init = &(const struct clk_init_data) {
  270. .name = "gpu_cc_cx_ff_clk",
  271. .parent_hws = (const struct clk_hw*[]) {
  272. &gpu_cc_ff_clk_src.clkr.hw,
  273. },
  274. .num_parents = 1,
  275. .flags = CLK_SET_RATE_PARENT,
  276. .ops = &clk_branch2_ops,
  277. },
  278. },
  279. };
  280. static struct clk_branch gpu_cc_cx_gmu_clk = {
  281. .halt_reg = 0x913c,
  282. .halt_check = BRANCH_HALT_VOTED,
  283. .clkr = {
  284. .enable_reg = 0x913c,
  285. .enable_mask = BIT(0),
  286. .hw.init = &(const struct clk_init_data) {
  287. .name = "gpu_cc_cx_gmu_clk",
  288. .parent_hws = (const struct clk_hw*[]) {
  289. &gpu_cc_gmu_clk_src.clkr.hw,
  290. },
  291. .num_parents = 1,
  292. .flags = CLK_SET_RATE_PARENT,
  293. .ops = &clk_branch2_aon_ops,
  294. },
  295. },
  296. };
  297. static struct clk_branch gpu_cc_cxo_aon_clk = {
  298. .halt_reg = 0x9004,
  299. .halt_check = BRANCH_HALT_VOTED,
  300. .clkr = {
  301. .enable_reg = 0x9004,
  302. .enable_mask = BIT(0),
  303. .hw.init = &(const struct clk_init_data) {
  304. .name = "gpu_cc_cxo_aon_clk",
  305. .parent_hws = (const struct clk_hw*[]) {
  306. &gpu_cc_xo_clk_src.clkr.hw,
  307. },
  308. .num_parents = 1,
  309. .flags = CLK_SET_RATE_PARENT,
  310. .ops = &clk_branch2_ops,
  311. },
  312. },
  313. };
  314. static struct clk_branch gpu_cc_cxo_clk = {
  315. .halt_reg = 0x9144,
  316. .halt_check = BRANCH_HALT,
  317. .clkr = {
  318. .enable_reg = 0x9144,
  319. .enable_mask = BIT(0),
  320. .hw.init = &(const struct clk_init_data) {
  321. .name = "gpu_cc_cxo_clk",
  322. .parent_hws = (const struct clk_hw*[]) {
  323. &gpu_cc_xo_clk_src.clkr.hw,
  324. },
  325. .num_parents = 1,
  326. .flags = CLK_SET_RATE_PARENT,
  327. .ops = &clk_branch2_ops,
  328. },
  329. },
  330. };
  331. static struct clk_branch gpu_cc_demet_clk = {
  332. .halt_reg = 0x900c,
  333. .halt_check = BRANCH_HALT,
  334. .clkr = {
  335. .enable_reg = 0x900c,
  336. .enable_mask = BIT(0),
  337. .hw.init = &(const struct clk_init_data) {
  338. .name = "gpu_cc_demet_clk",
  339. .parent_hws = (const struct clk_hw*[]) {
  340. &gpu_cc_demet_div_clk_src.clkr.hw,
  341. },
  342. .num_parents = 1,
  343. .flags = CLK_SET_RATE_PARENT,
  344. .ops = &clk_branch2_aon_ops,
  345. },
  346. },
  347. };
  348. static struct clk_branch gpu_cc_freq_measure_clk = {
  349. .halt_reg = 0x9008,
  350. .halt_check = BRANCH_HALT,
  351. .clkr = {
  352. .enable_reg = 0x9008,
  353. .enable_mask = BIT(0),
  354. .hw.init = &(const struct clk_init_data) {
  355. .name = "gpu_cc_freq_measure_clk",
  356. .parent_hws = (const struct clk_hw*[]) {
  357. &gpu_cc_xo_div_clk_src.clkr.hw,
  358. },
  359. .num_parents = 1,
  360. .flags = CLK_SET_RATE_PARENT,
  361. .ops = &clk_branch2_ops,
  362. },
  363. },
  364. };
  365. static struct clk_branch gpu_cc_hlos1_vote_gpu_smmu_clk = {
  366. .halt_reg = 0x7000,
  367. .halt_check = BRANCH_HALT_VOTED,
  368. .clkr = {
  369. .enable_reg = 0x7000,
  370. .enable_mask = BIT(0),
  371. .hw.init = &(const struct clk_init_data) {
  372. .name = "gpu_cc_hlos1_vote_gpu_smmu_clk",
  373. .ops = &clk_branch2_ops,
  374. },
  375. },
  376. };
  377. static struct clk_branch gpu_cc_gx_gmu_clk = {
  378. .halt_reg = 0x90bc,
  379. .halt_check = BRANCH_HALT,
  380. .clkr = {
  381. .enable_reg = 0x90bc,
  382. .enable_mask = BIT(0),
  383. .hw.init = &(const struct clk_init_data) {
  384. .name = "gpu_cc_gx_gmu_clk",
  385. .parent_hws = (const struct clk_hw*[]) {
  386. &gpu_cc_gmu_clk_src.clkr.hw,
  387. },
  388. .num_parents = 1,
  389. .flags = CLK_SET_RATE_PARENT,
  390. .ops = &clk_branch2_ops,
  391. },
  392. },
  393. };
  394. static struct clk_branch gpu_cc_gx_vsense_clk = {
  395. .halt_reg = 0x90b0,
  396. .halt_check = BRANCH_HALT_VOTED,
  397. .clkr = {
  398. .enable_reg = 0x90b0,
  399. .enable_mask = BIT(0),
  400. .hw.init = &(const struct clk_init_data) {
  401. .name = "gpu_cc_gx_vsense_clk",
  402. .ops = &clk_branch2_ops,
  403. },
  404. },
  405. };
  406. static struct clk_branch gpu_cc_hub_aon_clk = {
  407. .halt_reg = 0x93e8,
  408. .halt_check = BRANCH_HALT,
  409. .clkr = {
  410. .enable_reg = 0x93e8,
  411. .enable_mask = BIT(0),
  412. .hw.init = &(const struct clk_init_data) {
  413. .name = "gpu_cc_hub_aon_clk",
  414. .parent_hws = (const struct clk_hw*[]) {
  415. &gpu_cc_hub_clk_src.clkr.hw,
  416. },
  417. .num_parents = 1,
  418. .flags = CLK_SET_RATE_PARENT,
  419. .ops = &clk_branch2_aon_ops,
  420. },
  421. },
  422. };
  423. static struct clk_branch gpu_cc_hub_cx_int_clk = {
  424. .halt_reg = 0x9148,
  425. .halt_check = BRANCH_HALT_VOTED,
  426. .clkr = {
  427. .enable_reg = 0x9148,
  428. .enable_mask = BIT(0),
  429. .hw.init = &(const struct clk_init_data) {
  430. .name = "gpu_cc_hub_cx_int_clk",
  431. .parent_hws = (const struct clk_hw*[]) {
  432. &gpu_cc_hub_clk_src.clkr.hw,
  433. },
  434. .num_parents = 1,
  435. .flags = CLK_SET_RATE_PARENT,
  436. .ops = &clk_branch2_aon_ops,
  437. },
  438. },
  439. };
  440. static struct clk_branch gpu_cc_memnoc_gfx_clk = {
  441. .halt_reg = 0x9150,
  442. .halt_check = BRANCH_HALT_VOTED,
  443. .clkr = {
  444. .enable_reg = 0x9150,
  445. .enable_mask = BIT(0),
  446. .hw.init = &(const struct clk_init_data) {
  447. .name = "gpu_cc_memnoc_gfx_clk",
  448. .ops = &clk_branch2_ops,
  449. },
  450. },
  451. };
  452. static struct clk_branch gpu_cc_mnd1x_0_gfx3d_clk = {
  453. .halt_reg = 0x9288,
  454. .halt_check = BRANCH_HALT,
  455. .clkr = {
  456. .enable_reg = 0x9288,
  457. .enable_mask = BIT(0),
  458. .hw.init = &(const struct clk_init_data) {
  459. .name = "gpu_cc_mnd1x_0_gfx3d_clk",
  460. .ops = &clk_branch2_ops,
  461. },
  462. },
  463. };
  464. static struct clk_branch gpu_cc_mnd1x_1_gfx3d_clk = {
  465. .halt_reg = 0x928c,
  466. .halt_check = BRANCH_HALT,
  467. .clkr = {
  468. .enable_reg = 0x928c,
  469. .enable_mask = BIT(0),
  470. .hw.init = &(const struct clk_init_data) {
  471. .name = "gpu_cc_mnd1x_1_gfx3d_clk",
  472. .ops = &clk_branch2_ops,
  473. },
  474. },
  475. };
  476. static struct clk_branch gpu_cc_sleep_clk = {
  477. .halt_reg = 0x9134,
  478. .halt_check = BRANCH_HALT_VOTED,
  479. .clkr = {
  480. .enable_reg = 0x9134,
  481. .enable_mask = BIT(0),
  482. .hw.init = &(const struct clk_init_data) {
  483. .name = "gpu_cc_sleep_clk",
  484. .ops = &clk_branch2_ops,
  485. },
  486. },
  487. };
  488. static struct gdsc gpu_cx_gdsc = {
  489. .gdscr = 0x9108,
  490. .gds_hw_ctrl = 0x953c,
  491. .en_rest_wait_val = 0x2,
  492. .en_few_wait_val = 0x2,
  493. .clk_dis_wait_val = 0xf,
  494. .pd = {
  495. .name = "gpu_cx_gdsc",
  496. },
  497. .pwrsts = PWRSTS_OFF_ON,
  498. .flags = VOTABLE | RETAIN_FF_ENABLE,
  499. };
  500. static struct gdsc gpu_gx_gdsc = {
  501. .gdscr = 0x905c,
  502. .clamp_io_ctrl = 0x9504,
  503. .en_rest_wait_val = 0x2,
  504. .en_few_wait_val = 0x2,
  505. .clk_dis_wait_val = 0xf,
  506. .pd = {
  507. .name = "gpu_gx_gdsc",
  508. .power_on = gdsc_gx_do_nothing_enable,
  509. },
  510. .pwrsts = PWRSTS_OFF_ON,
  511. .flags = CLAMP_IO | AON_RESET | SW_RESET | POLL_CFG_GDSCR,
  512. };
  513. static struct clk_regmap *gpu_cc_x1e80100_clocks[] = {
  514. [GPU_CC_AHB_CLK] = &gpu_cc_ahb_clk.clkr,
  515. [GPU_CC_CRC_AHB_CLK] = &gpu_cc_crc_ahb_clk.clkr,
  516. [GPU_CC_CX_FF_CLK] = &gpu_cc_cx_ff_clk.clkr,
  517. [GPU_CC_CX_GMU_CLK] = &gpu_cc_cx_gmu_clk.clkr,
  518. [GPU_CC_CXO_AON_CLK] = &gpu_cc_cxo_aon_clk.clkr,
  519. [GPU_CC_CXO_CLK] = &gpu_cc_cxo_clk.clkr,
  520. [GPU_CC_DEMET_CLK] = &gpu_cc_demet_clk.clkr,
  521. [GPU_CC_DEMET_DIV_CLK_SRC] = &gpu_cc_demet_div_clk_src.clkr,
  522. [GPU_CC_FF_CLK_SRC] = &gpu_cc_ff_clk_src.clkr,
  523. [GPU_CC_FREQ_MEASURE_CLK] = &gpu_cc_freq_measure_clk.clkr,
  524. [GPU_CC_GMU_CLK_SRC] = &gpu_cc_gmu_clk_src.clkr,
  525. [GPU_CC_GX_GMU_CLK] = &gpu_cc_gx_gmu_clk.clkr,
  526. [GPU_CC_HLOS1_VOTE_GPU_SMMU_CLK] = &gpu_cc_hlos1_vote_gpu_smmu_clk.clkr,
  527. [GPU_CC_GX_VSENSE_CLK] = &gpu_cc_gx_vsense_clk.clkr,
  528. [GPU_CC_HUB_AON_CLK] = &gpu_cc_hub_aon_clk.clkr,
  529. [GPU_CC_HUB_CLK_SRC] = &gpu_cc_hub_clk_src.clkr,
  530. [GPU_CC_HUB_CX_INT_CLK] = &gpu_cc_hub_cx_int_clk.clkr,
  531. [GPU_CC_MEMNOC_GFX_CLK] = &gpu_cc_memnoc_gfx_clk.clkr,
  532. [GPU_CC_MND1X_0_GFX3D_CLK] = &gpu_cc_mnd1x_0_gfx3d_clk.clkr,
  533. [GPU_CC_MND1X_1_GFX3D_CLK] = &gpu_cc_mnd1x_1_gfx3d_clk.clkr,
  534. [GPU_CC_PLL0] = &gpu_cc_pll0.clkr,
  535. [GPU_CC_PLL1] = &gpu_cc_pll1.clkr,
  536. [GPU_CC_SLEEP_CLK] = &gpu_cc_sleep_clk.clkr,
  537. [GPU_CC_XO_CLK_SRC] = &gpu_cc_xo_clk_src.clkr,
  538. [GPU_CC_XO_DIV_CLK_SRC] = &gpu_cc_xo_div_clk_src.clkr,
  539. };
  540. static const struct qcom_reset_map gpu_cc_x1e80100_resets[] = {
  541. [GPUCC_GPU_CC_XO_BCR] = { 0x9000 },
  542. [GPUCC_GPU_CC_GX_BCR] = { 0x9058 },
  543. [GPUCC_GPU_CC_CX_BCR] = { 0x9104 },
  544. [GPUCC_GPU_CC_GFX3D_AON_BCR] = { 0x9198 },
  545. [GPUCC_GPU_CC_ACD_BCR] = { 0x9358 },
  546. [GPUCC_GPU_CC_FAST_HUB_BCR] = { 0x93e4 },
  547. [GPUCC_GPU_CC_FF_BCR] = { 0x9470 },
  548. [GPUCC_GPU_CC_GMU_BCR] = { 0x9314 },
  549. [GPUCC_GPU_CC_CB_BCR] = { 0x93a0 },
  550. };
  551. static struct gdsc *gpu_cc_x1e80100_gdscs[] = {
  552. [GPU_CX_GDSC] = &gpu_cx_gdsc,
  553. [GPU_GX_GDSC] = &gpu_gx_gdsc,
  554. };
  555. static const struct regmap_config gpu_cc_x1e80100_regmap_config = {
  556. .reg_bits = 32,
  557. .reg_stride = 4,
  558. .val_bits = 32,
  559. .max_register = 0x9988,
  560. .fast_io = true,
  561. };
  562. static const struct qcom_cc_desc gpu_cc_x1e80100_desc = {
  563. .config = &gpu_cc_x1e80100_regmap_config,
  564. .clks = gpu_cc_x1e80100_clocks,
  565. .num_clks = ARRAY_SIZE(gpu_cc_x1e80100_clocks),
  566. .resets = gpu_cc_x1e80100_resets,
  567. .num_resets = ARRAY_SIZE(gpu_cc_x1e80100_resets),
  568. .gdscs = gpu_cc_x1e80100_gdscs,
  569. .num_gdscs = ARRAY_SIZE(gpu_cc_x1e80100_gdscs),
  570. };
  571. static const struct of_device_id gpu_cc_x1e80100_match_table[] = {
  572. { .compatible = "qcom,x1e80100-gpucc" },
  573. { }
  574. };
  575. MODULE_DEVICE_TABLE(of, gpu_cc_x1e80100_match_table);
  576. static int gpu_cc_x1e80100_probe(struct platform_device *pdev)
  577. {
  578. struct regmap *regmap;
  579. regmap = qcom_cc_map(pdev, &gpu_cc_x1e80100_desc);
  580. if (IS_ERR(regmap))
  581. return PTR_ERR(regmap);
  582. clk_zonda_pll_configure(&gpu_cc_pll0, regmap, &gpu_cc_pll0_config);
  583. clk_lucid_evo_pll_configure(&gpu_cc_pll1, regmap, &gpu_cc_pll1_config);
  584. /* Keep clocks always enabled */
  585. qcom_branch_set_clk_en(regmap, 0x93a4); /* GPU_CC_CB_CLK */
  586. return qcom_cc_really_probe(&pdev->dev, &gpu_cc_x1e80100_desc, regmap);
  587. }
  588. static struct platform_driver gpu_cc_x1e80100_driver = {
  589. .probe = gpu_cc_x1e80100_probe,
  590. .driver = {
  591. .name = "gpucc-x1e80100",
  592. .of_match_table = gpu_cc_x1e80100_match_table,
  593. },
  594. };
  595. module_platform_driver(gpu_cc_x1e80100_driver);
  596. MODULE_DESCRIPTION("QTI GPU Clock Controller X1E80100 Driver");
  597. MODULE_LICENSE("GPL");