0001
0002
0003
0004
0005
0006
0007 #include <linux/clk.h>
0008 #include <linux/err.h>
0009 #include <linux/kernel.h>
0010 #include <linux/module.h>
0011 #include <linux/of_device.h>
0012 #include <linux/of.h>
0013 #include <linux/regmap.h>
0014
0015 #include <dt-bindings/clock/qcom,gpucc-sm8350.h>
0016
0017 #include "clk-alpha-pll.h"
0018 #include "clk-branch.h"
0019 #include "clk-pll.h"
0020 #include "clk-rcg.h"
0021 #include "clk-regmap.h"
0022 #include "common.h"
0023 #include "clk-regmap-mux.h"
0024 #include "clk-regmap-divider.h"
0025 #include "gdsc.h"
0026 #include "reset.h"
0027
0028 enum {
0029 P_BI_TCXO,
0030 P_GPLL0_OUT_MAIN,
0031 P_GPLL0_OUT_MAIN_DIV,
0032 P_GPU_CC_PLL0_OUT_MAIN,
0033 P_GPU_CC_PLL1_OUT_MAIN,
0034 };
0035
0036 static struct pll_vco lucid_5lpe_vco[] = {
0037 { 249600000, 1750000000, 0 },
0038 };
0039
0040 static const struct alpha_pll_config gpu_cc_pll0_config = {
0041 .l = 0x18,
0042 .alpha = 0x6000,
0043 .config_ctl_val = 0x20485699,
0044 .config_ctl_hi_val = 0x00002261,
0045 .config_ctl_hi1_val = 0x2a9a699c,
0046 .test_ctl_val = 0x00000000,
0047 .test_ctl_hi_val = 0x00000000,
0048 .test_ctl_hi1_val = 0x01800000,
0049 .user_ctl_val = 0x00000000,
0050 .user_ctl_hi_val = 0x00000805,
0051 .user_ctl_hi1_val = 0x00000000,
0052 };
0053
0054 static const struct clk_parent_data gpu_cc_parent = {
0055 .fw_name = "bi_tcxo",
0056 };
0057
0058 static struct clk_alpha_pll gpu_cc_pll0 = {
0059 .offset = 0x0,
0060 .vco_table = lucid_5lpe_vco,
0061 .num_vco = ARRAY_SIZE(lucid_5lpe_vco),
0062 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID],
0063 .clkr = {
0064 .hw.init = &(const struct clk_init_data){
0065 .name = "gpu_cc_pll0",
0066 .parent_data = &gpu_cc_parent,
0067 .num_parents = 1,
0068 .ops = &clk_alpha_pll_lucid_5lpe_ops,
0069 },
0070 },
0071 };
0072
0073 static const struct alpha_pll_config gpu_cc_pll1_config = {
0074 .l = 0x1a,
0075 .alpha = 0xaaa,
0076 .config_ctl_val = 0x20485699,
0077 .config_ctl_hi_val = 0x00002261,
0078 .config_ctl_hi1_val = 0x2a9a699c,
0079 .test_ctl_val = 0x00000000,
0080 .test_ctl_hi_val = 0x00000000,
0081 .test_ctl_hi1_val = 0x01800000,
0082 .user_ctl_val = 0x00000000,
0083 .user_ctl_hi_val = 0x00000805,
0084 .user_ctl_hi1_val = 0x00000000,
0085 };
0086
0087 static struct clk_alpha_pll gpu_cc_pll1 = {
0088 .offset = 0x100,
0089 .vco_table = lucid_5lpe_vco,
0090 .num_vco = ARRAY_SIZE(lucid_5lpe_vco),
0091 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID],
0092 .clkr = {
0093 .hw.init = &(struct clk_init_data){
0094 .name = "gpu_cc_pll1",
0095 .parent_data = &gpu_cc_parent,
0096 .num_parents = 1,
0097 .ops = &clk_alpha_pll_lucid_5lpe_ops,
0098 },
0099 },
0100 };
0101
0102 static const struct parent_map gpu_cc_parent_map_0[] = {
0103 { P_BI_TCXO, 0 },
0104 { P_GPU_CC_PLL0_OUT_MAIN, 1 },
0105 { P_GPU_CC_PLL1_OUT_MAIN, 3 },
0106 { P_GPLL0_OUT_MAIN, 5 },
0107 { P_GPLL0_OUT_MAIN_DIV, 6 },
0108 };
0109
0110 static const struct clk_parent_data gpu_cc_parent_data_0[] = {
0111 { .fw_name = "bi_tcxo" },
0112 { .hw = &gpu_cc_pll0.clkr.hw },
0113 { .hw = &gpu_cc_pll1.clkr.hw },
0114 { .fw_name = "gcc_gpu_gpll0_clk_src" },
0115 { .fw_name = "gcc_gpu_gpll0_div_clk_src" },
0116 };
0117
0118 static const struct parent_map gpu_cc_parent_map_1[] = {
0119 { P_BI_TCXO, 0 },
0120 { P_GPU_CC_PLL1_OUT_MAIN, 3 },
0121 { P_GPLL0_OUT_MAIN, 5 },
0122 { P_GPLL0_OUT_MAIN_DIV, 6 },
0123 };
0124
0125 static const struct clk_parent_data gpu_cc_parent_data_1[] = {
0126 { .fw_name = "bi_tcxo" },
0127 { .hw = &gpu_cc_pll1.clkr.hw },
0128 { .fw_name = "gcc_gpu_gpll0_clk_src" },
0129 { .fw_name = "gcc_gpu_gpll0_div_clk_src" },
0130 };
0131
0132 static const struct freq_tbl ftbl_gpu_cc_gmu_clk_src[] = {
0133 F(19200000, P_BI_TCXO, 1, 0, 0),
0134 F(200000000, P_GPLL0_OUT_MAIN_DIV, 1.5, 0, 0),
0135 F(500000000, P_GPU_CC_PLL1_OUT_MAIN, 1, 0, 0),
0136 { }
0137 };
0138
0139 static struct clk_rcg2 gpu_cc_gmu_clk_src = {
0140 .cmd_rcgr = 0x1120,
0141 .mnd_width = 0,
0142 .hid_width = 5,
0143 .parent_map = gpu_cc_parent_map_0,
0144 .freq_tbl = ftbl_gpu_cc_gmu_clk_src,
0145 .clkr.hw.init = &(struct clk_init_data){
0146 .name = "gpu_cc_gmu_clk_src",
0147 .parent_data = gpu_cc_parent_data_0,
0148 .num_parents = ARRAY_SIZE(gpu_cc_parent_data_0),
0149 .flags = CLK_SET_RATE_PARENT,
0150 .ops = &clk_rcg2_ops,
0151 },
0152 };
0153
0154 static const struct freq_tbl ftbl_gpu_cc_hub_clk_src[] = {
0155 F(150000000, P_GPLL0_OUT_MAIN_DIV, 2, 0, 0),
0156 F(240000000, P_GPLL0_OUT_MAIN, 2.5, 0, 0),
0157 F(300000000, P_GPLL0_OUT_MAIN, 2, 0, 0),
0158 { }
0159 };
0160
0161 static struct clk_rcg2 gpu_cc_hub_clk_src = {
0162 .cmd_rcgr = 0x117c,
0163 .mnd_width = 0,
0164 .hid_width = 5,
0165 .parent_map = gpu_cc_parent_map_1,
0166 .freq_tbl = ftbl_gpu_cc_hub_clk_src,
0167 .clkr.hw.init = &(struct clk_init_data){
0168 .name = "gpu_cc_hub_clk_src",
0169 .parent_data = gpu_cc_parent_data_1,
0170 .num_parents = ARRAY_SIZE(gpu_cc_parent_data_1),
0171 .flags = CLK_SET_RATE_PARENT,
0172 .ops = &clk_rcg2_ops,
0173 },
0174 };
0175
0176 static struct clk_regmap_div gpu_cc_hub_ahb_div_clk_src = {
0177 .reg = 0x11c0,
0178 .shift = 0,
0179 .width = 4,
0180 .clkr.hw.init = &(struct clk_init_data) {
0181 .name = "gpu_cc_hub_ahb_div_clk_src",
0182 .parent_hws = (const struct clk_hw*[]){
0183 &gpu_cc_hub_clk_src.clkr.hw,
0184 },
0185 .num_parents = 1,
0186 .flags = CLK_SET_RATE_PARENT,
0187 .ops = &clk_regmap_div_ro_ops,
0188 },
0189 };
0190
0191 static struct clk_regmap_div gpu_cc_hub_cx_int_div_clk_src = {
0192 .reg = 0x11bc,
0193 .shift = 0,
0194 .width = 4,
0195 .clkr.hw.init = &(struct clk_init_data) {
0196 .name = "gpu_cc_hub_cx_int_div_clk_src",
0197 .parent_hws = (const struct clk_hw*[]){
0198 &gpu_cc_hub_clk_src.clkr.hw,
0199 },
0200 .num_parents = 1,
0201 .flags = CLK_SET_RATE_PARENT,
0202 .ops = &clk_regmap_div_ro_ops,
0203 },
0204 };
0205
0206 static struct clk_branch gpu_cc_ahb_clk = {
0207 .halt_reg = 0x1078,
0208 .halt_check = BRANCH_HALT_DELAY,
0209 .clkr = {
0210 .enable_reg = 0x1078,
0211 .enable_mask = BIT(0),
0212 .hw.init = &(struct clk_init_data){
0213 .name = "gpu_cc_ahb_clk",
0214 .parent_hws = (const struct clk_hw*[]){
0215 &gpu_cc_hub_ahb_div_clk_src.clkr.hw,
0216 },
0217 .num_parents = 1,
0218 .flags = CLK_SET_RATE_PARENT,
0219 .ops = &clk_branch2_ops,
0220 },
0221 },
0222 };
0223
0224 static struct clk_branch gpu_cc_cb_clk = {
0225 .halt_reg = 0x1170,
0226 .halt_check = BRANCH_HALT,
0227 .clkr = {
0228 .enable_reg = 0x1170,
0229 .enable_mask = BIT(0),
0230 .hw.init = &(struct clk_init_data){
0231 .name = "gpu_cc_cb_clk",
0232 .ops = &clk_branch2_ops,
0233 },
0234 },
0235 };
0236
0237 static struct clk_branch gpu_cc_crc_ahb_clk = {
0238 .halt_reg = 0x107c,
0239 .halt_check = BRANCH_HALT_VOTED,
0240 .clkr = {
0241 .enable_reg = 0x107c,
0242 .enable_mask = BIT(0),
0243 .hw.init = &(struct clk_init_data){
0244 .name = "gpu_cc_crc_ahb_clk",
0245 .parent_hws = (const struct clk_hw*[]){
0246 &gpu_cc_hub_ahb_div_clk_src.clkr.hw,
0247 },
0248 .num_parents = 1,
0249 .flags = CLK_SET_RATE_PARENT,
0250 .ops = &clk_branch2_ops,
0251 },
0252 },
0253 };
0254
0255 static struct clk_branch gpu_cc_cx_apb_clk = {
0256 .halt_reg = 0x1088,
0257 .halt_check = BRANCH_HALT_VOTED,
0258 .clkr = {
0259 .enable_reg = 0x1088,
0260 .enable_mask = BIT(0),
0261 .hw.init = &(struct clk_init_data){
0262 .name = "gpu_cc_cx_apb_clk",
0263 .ops = &clk_branch2_ops,
0264 },
0265 },
0266 };
0267
0268 static struct clk_branch gpu_cc_cx_gmu_clk = {
0269 .halt_reg = 0x1098,
0270 .halt_check = BRANCH_HALT,
0271 .clkr = {
0272 .enable_reg = 0x1098,
0273 .enable_mask = BIT(0),
0274 .hw.init = &(struct clk_init_data){
0275 .name = "gpu_cc_cx_gmu_clk",
0276 .parent_hws = (const struct clk_hw*[]){
0277 &gpu_cc_gmu_clk_src.clkr.hw,
0278 },
0279 .num_parents = 1,
0280 .flags = CLK_SET_RATE_PARENT,
0281 .ops = &clk_branch2_aon_ops,
0282 },
0283 },
0284 };
0285
0286 static struct clk_branch gpu_cc_cx_qdss_at_clk = {
0287 .halt_reg = 0x1080,
0288 .halt_check = BRANCH_HALT_VOTED,
0289 .clkr = {
0290 .enable_reg = 0x1080,
0291 .enable_mask = BIT(0),
0292 .hw.init = &(struct clk_init_data){
0293 .name = "gpu_cc_cx_qdss_at_clk",
0294 .ops = &clk_branch2_ops,
0295 },
0296 },
0297 };
0298
0299 static struct clk_branch gpu_cc_cx_qdss_trig_clk = {
0300 .halt_reg = 0x1094,
0301 .halt_check = BRANCH_HALT_VOTED,
0302 .clkr = {
0303 .enable_reg = 0x1094,
0304 .enable_mask = BIT(0),
0305 .hw.init = &(struct clk_init_data){
0306 .name = "gpu_cc_cx_qdss_trig_clk",
0307 .ops = &clk_branch2_ops,
0308 },
0309 },
0310 };
0311
0312 static struct clk_branch gpu_cc_cx_qdss_tsctr_clk = {
0313 .halt_reg = 0x1084,
0314 .halt_check = BRANCH_HALT_VOTED,
0315 .clkr = {
0316 .enable_reg = 0x1084,
0317 .enable_mask = BIT(0),
0318 .hw.init = &(struct clk_init_data){
0319 .name = "gpu_cc_cx_qdss_tsctr_clk",
0320 .ops = &clk_branch2_ops,
0321 },
0322 },
0323 };
0324
0325 static struct clk_branch gpu_cc_cx_snoc_dvm_clk = {
0326 .halt_reg = 0x108c,
0327 .halt_check = BRANCH_HALT_VOTED,
0328 .clkr = {
0329 .enable_reg = 0x108c,
0330 .enable_mask = BIT(0),
0331 .hw.init = &(struct clk_init_data){
0332 .name = "gpu_cc_cx_snoc_dvm_clk",
0333 .ops = &clk_branch2_ops,
0334 },
0335 },
0336 };
0337
0338 static struct clk_branch gpu_cc_cxo_aon_clk = {
0339 .halt_reg = 0x1004,
0340 .halt_check = BRANCH_HALT_VOTED,
0341 .clkr = {
0342 .enable_reg = 0x1004,
0343 .enable_mask = BIT(0),
0344 .hw.init = &(struct clk_init_data){
0345 .name = "gpu_cc_cxo_aon_clk",
0346 .ops = &clk_branch2_ops,
0347 },
0348 },
0349 };
0350
0351 static struct clk_branch gpu_cc_cxo_clk = {
0352 .halt_reg = 0x109c,
0353 .halt_check = BRANCH_HALT,
0354 .clkr = {
0355 .enable_reg = 0x109c,
0356 .enable_mask = BIT(0),
0357 .hw.init = &(struct clk_init_data){
0358 .name = "gpu_cc_cxo_clk",
0359 .ops = &clk_branch2_ops,
0360 },
0361 },
0362 };
0363
0364 static struct clk_branch gpu_cc_freq_measure_clk = {
0365 .halt_reg = 0x120c,
0366 .halt_check = BRANCH_HALT,
0367 .clkr = {
0368 .enable_reg = 0x120c,
0369 .enable_mask = BIT(0),
0370 .hw.init = &(struct clk_init_data){
0371 .name = "gpu_cc_freq_measure_clk",
0372 .ops = &clk_branch2_ops,
0373 },
0374 },
0375 };
0376
0377 static struct clk_branch gpu_cc_gx_gmu_clk = {
0378 .halt_reg = 0x1064,
0379 .halt_check = BRANCH_HALT,
0380 .clkr = {
0381 .enable_reg = 0x1064,
0382 .enable_mask = BIT(0),
0383 .hw.init = &(struct clk_init_data){
0384 .name = "gpu_cc_gx_gmu_clk",
0385 .parent_hws = (const struct clk_hw*[]){
0386 &gpu_cc_gmu_clk_src.clkr.hw,
0387 },
0388 .num_parents = 1,
0389 .flags = CLK_SET_RATE_PARENT,
0390 .ops = &clk_branch2_ops,
0391 },
0392 },
0393 };
0394
0395 static struct clk_branch gpu_cc_gx_qdss_tsctr_clk = {
0396 .halt_reg = 0x105c,
0397 .halt_check = BRANCH_HALT_VOTED,
0398 .clkr = {
0399 .enable_reg = 0x105c,
0400 .enable_mask = BIT(0),
0401 .hw.init = &(struct clk_init_data){
0402 .name = "gpu_cc_gx_qdss_tsctr_clk",
0403 .ops = &clk_branch2_ops,
0404 },
0405 },
0406 };
0407
0408 static struct clk_branch gpu_cc_gx_vsense_clk = {
0409 .halt_reg = 0x1058,
0410 .halt_check = BRANCH_HALT_VOTED,
0411 .clkr = {
0412 .enable_reg = 0x1058,
0413 .enable_mask = BIT(0),
0414 .hw.init = &(struct clk_init_data){
0415 .name = "gpu_cc_gx_vsense_clk",
0416 .ops = &clk_branch2_ops,
0417 },
0418 },
0419 };
0420
0421 static struct clk_branch gpu_cc_hlos1_vote_gpu_smmu_clk = {
0422 .halt_reg = 0x5000,
0423 .halt_check = BRANCH_HALT_VOTED,
0424 .clkr = {
0425 .enable_reg = 0x5000,
0426 .enable_mask = BIT(0),
0427 .hw.init = &(struct clk_init_data){
0428 .name = "gpu_cc_hlos1_vote_gpu_smmu_clk",
0429 .ops = &clk_branch2_ops,
0430 },
0431 },
0432 };
0433
0434 static struct clk_branch gpu_cc_hub_aon_clk = {
0435 .halt_reg = 0x1178,
0436 .halt_check = BRANCH_HALT,
0437 .clkr = {
0438 .enable_reg = 0x1178,
0439 .enable_mask = BIT(0),
0440 .hw.init = &(struct clk_init_data){
0441 .name = "gpu_cc_hub_aon_clk",
0442 .parent_hws = (const struct clk_hw*[]){
0443 &gpu_cc_hub_clk_src.clkr.hw,
0444 },
0445 .num_parents = 1,
0446 .flags = CLK_SET_RATE_PARENT,
0447 .ops = &clk_branch2_aon_ops,
0448 },
0449 },
0450 };
0451
0452 static struct clk_branch gpu_cc_hub_cx_int_clk = {
0453 .halt_reg = 0x1204,
0454 .halt_check = BRANCH_HALT,
0455 .clkr = {
0456 .enable_reg = 0x1204,
0457 .enable_mask = BIT(0),
0458 .hw.init = &(struct clk_init_data){
0459 .name = "gpu_cc_hub_cx_int_clk",
0460 .parent_hws = (const struct clk_hw*[]){
0461 &gpu_cc_hub_cx_int_div_clk_src.clkr.hw,
0462 },
0463 .num_parents = 1,
0464 .flags = CLK_SET_RATE_PARENT,
0465 .ops = &clk_branch2_aon_ops,
0466 },
0467 },
0468 };
0469
0470 static struct clk_branch gpu_cc_mnd1x_0_gfx3d_clk = {
0471 .halt_reg = 0x802c,
0472 .halt_check = BRANCH_HALT,
0473 .clkr = {
0474 .enable_reg = 0x802c,
0475 .enable_mask = BIT(0),
0476 .hw.init = &(struct clk_init_data){
0477 .name = "gpu_cc_mnd1x_0_gfx3d_clk",
0478 .ops = &clk_branch2_ops,
0479 },
0480 },
0481 };
0482
0483 static struct clk_branch gpu_cc_mnd1x_1_gfx3d_clk = {
0484 .halt_reg = 0x8030,
0485 .halt_check = BRANCH_HALT,
0486 .clkr = {
0487 .enable_reg = 0x8030,
0488 .enable_mask = BIT(0),
0489 .hw.init = &(struct clk_init_data){
0490 .name = "gpu_cc_mnd1x_1_gfx3d_clk",
0491 .ops = &clk_branch2_ops,
0492 },
0493 },
0494 };
0495
0496 static struct clk_branch gpu_cc_sleep_clk = {
0497 .halt_reg = 0x1090,
0498 .halt_check = BRANCH_HALT_VOTED,
0499 .clkr = {
0500 .enable_reg = 0x1090,
0501 .enable_mask = BIT(0),
0502 .hw.init = &(struct clk_init_data){
0503 .name = "gpu_cc_sleep_clk",
0504 .ops = &clk_branch2_ops,
0505 },
0506 },
0507 };
0508
0509 static struct gdsc gpu_cx_gdsc = {
0510 .gdscr = 0x106c,
0511 .gds_hw_ctrl = 0x1540,
0512 .pd = {
0513 .name = "gpu_cx_gdsc",
0514 },
0515 .pwrsts = PWRSTS_OFF_ON,
0516 .flags = VOTABLE,
0517 };
0518
0519 static struct gdsc gpu_gx_gdsc = {
0520 .gdscr = 0x100c,
0521 .clamp_io_ctrl = 0x1508,
0522 .pd = {
0523 .name = "gpu_gx_gdsc",
0524 .power_on = gdsc_gx_do_nothing_enable,
0525 },
0526 .pwrsts = PWRSTS_OFF_ON,
0527 .flags = CLAMP_IO | AON_RESET | POLL_CFG_GDSCR,
0528 };
0529
0530 static struct clk_regmap *gpu_cc_sm8350_clocks[] = {
0531 [GPU_CC_AHB_CLK] = &gpu_cc_ahb_clk.clkr,
0532 [GPU_CC_CB_CLK] = &gpu_cc_cb_clk.clkr,
0533 [GPU_CC_CRC_AHB_CLK] = &gpu_cc_crc_ahb_clk.clkr,
0534 [GPU_CC_CX_APB_CLK] = &gpu_cc_cx_apb_clk.clkr,
0535 [GPU_CC_CX_GMU_CLK] = &gpu_cc_cx_gmu_clk.clkr,
0536 [GPU_CC_CX_QDSS_AT_CLK] = &gpu_cc_cx_qdss_at_clk.clkr,
0537 [GPU_CC_CX_QDSS_TRIG_CLK] = &gpu_cc_cx_qdss_trig_clk.clkr,
0538 [GPU_CC_CX_QDSS_TSCTR_CLK] = &gpu_cc_cx_qdss_tsctr_clk.clkr,
0539 [GPU_CC_CX_SNOC_DVM_CLK] = &gpu_cc_cx_snoc_dvm_clk.clkr,
0540 [GPU_CC_CXO_AON_CLK] = &gpu_cc_cxo_aon_clk.clkr,
0541 [GPU_CC_CXO_CLK] = &gpu_cc_cxo_clk.clkr,
0542 [GPU_CC_FREQ_MEASURE_CLK] = &gpu_cc_freq_measure_clk.clkr,
0543 [GPU_CC_GMU_CLK_SRC] = &gpu_cc_gmu_clk_src.clkr,
0544 [GPU_CC_GX_GMU_CLK] = &gpu_cc_gx_gmu_clk.clkr,
0545 [GPU_CC_GX_QDSS_TSCTR_CLK] = &gpu_cc_gx_qdss_tsctr_clk.clkr,
0546 [GPU_CC_GX_VSENSE_CLK] = &gpu_cc_gx_vsense_clk.clkr,
0547 [GPU_CC_HLOS1_VOTE_GPU_SMMU_CLK] = &gpu_cc_hlos1_vote_gpu_smmu_clk.clkr,
0548 [GPU_CC_HUB_AHB_DIV_CLK_SRC] = &gpu_cc_hub_ahb_div_clk_src.clkr,
0549 [GPU_CC_HUB_AON_CLK] = &gpu_cc_hub_aon_clk.clkr,
0550 [GPU_CC_HUB_CLK_SRC] = &gpu_cc_hub_clk_src.clkr,
0551 [GPU_CC_HUB_CX_INT_CLK] = &gpu_cc_hub_cx_int_clk.clkr,
0552 [GPU_CC_HUB_CX_INT_DIV_CLK_SRC] = &gpu_cc_hub_cx_int_div_clk_src.clkr,
0553 [GPU_CC_MND1X_0_GFX3D_CLK] = &gpu_cc_mnd1x_0_gfx3d_clk.clkr,
0554 [GPU_CC_MND1X_1_GFX3D_CLK] = &gpu_cc_mnd1x_1_gfx3d_clk.clkr,
0555 [GPU_CC_PLL0] = &gpu_cc_pll0.clkr,
0556 [GPU_CC_PLL1] = &gpu_cc_pll1.clkr,
0557 [GPU_CC_SLEEP_CLK] = &gpu_cc_sleep_clk.clkr,
0558 };
0559
0560 static const struct qcom_reset_map gpu_cc_sm8350_resets[] = {
0561 [GPUCC_GPU_CC_ACD_BCR] = { 0x1160 },
0562 [GPUCC_GPU_CC_CB_BCR] = { 0x116c },
0563 [GPUCC_GPU_CC_CX_BCR] = { 0x1068 },
0564 [GPUCC_GPU_CC_FAST_HUB_BCR] = { 0x1174 },
0565 [GPUCC_GPU_CC_GFX3D_AON_BCR] = { 0x10a0 },
0566 [GPUCC_GPU_CC_GMU_BCR] = { 0x111c },
0567 [GPUCC_GPU_CC_GX_BCR] = { 0x1008 },
0568 [GPUCC_GPU_CC_XO_BCR] = { 0x1000 },
0569 };
0570
0571 static struct gdsc *gpu_cc_sm8350_gdscs[] = {
0572 [GPU_CX_GDSC] = &gpu_cx_gdsc,
0573 [GPU_GX_GDSC] = &gpu_gx_gdsc,
0574 };
0575
0576 static const struct regmap_config gpu_cc_sm8350_regmap_config = {
0577 .reg_bits = 32,
0578 .reg_stride = 4,
0579 .val_bits = 32,
0580 .max_register = 0x8030,
0581 .fast_io = true,
0582 };
0583
0584 static const struct qcom_cc_desc gpu_cc_sm8350_desc = {
0585 .config = &gpu_cc_sm8350_regmap_config,
0586 .clks = gpu_cc_sm8350_clocks,
0587 .num_clks = ARRAY_SIZE(gpu_cc_sm8350_clocks),
0588 .resets = gpu_cc_sm8350_resets,
0589 .num_resets = ARRAY_SIZE(gpu_cc_sm8350_resets),
0590 .gdscs = gpu_cc_sm8350_gdscs,
0591 .num_gdscs = ARRAY_SIZE(gpu_cc_sm8350_gdscs),
0592 };
0593
0594 static int gpu_cc_sm8350_probe(struct platform_device *pdev)
0595 {
0596 struct regmap *regmap;
0597
0598 regmap = qcom_cc_map(pdev, &gpu_cc_sm8350_desc);
0599 if (IS_ERR(regmap)) {
0600 dev_err(&pdev->dev, "Failed to map gpu cc registers\n");
0601 return PTR_ERR(regmap);
0602 }
0603
0604 clk_lucid_pll_configure(&gpu_cc_pll0, regmap, &gpu_cc_pll0_config);
0605 clk_lucid_pll_configure(&gpu_cc_pll1, regmap, &gpu_cc_pll1_config);
0606
0607 return qcom_cc_really_probe(pdev, &gpu_cc_sm8350_desc, regmap);
0608 }
0609
0610 static const struct of_device_id gpu_cc_sm8350_match_table[] = {
0611 { .compatible = "qcom,sm8350-gpucc" },
0612 { }
0613 };
0614 MODULE_DEVICE_TABLE(of, gpu_cc_sm8350_match_table);
0615
0616 static struct platform_driver gpu_cc_sm8350_driver = {
0617 .probe = gpu_cc_sm8350_probe,
0618 .driver = {
0619 .name = "sm8350-gpucc",
0620 .of_match_table = gpu_cc_sm8350_match_table,
0621 },
0622 };
0623
0624 static int __init gpu_cc_sm8350_init(void)
0625 {
0626 return platform_driver_register(&gpu_cc_sm8350_driver);
0627 }
0628 subsys_initcall(gpu_cc_sm8350_init);
0629
0630 static void __exit gpu_cc_sm8350_exit(void)
0631 {
0632 platform_driver_unregister(&gpu_cc_sm8350_driver);
0633 }
0634 module_exit(gpu_cc_sm8350_exit);
0635
0636 MODULE_DESCRIPTION("QTI GPU_CC SM8350 Driver");
0637 MODULE_LICENSE("GPL v2");