gpucc-sm8550.c 15 KB

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