Skip to content

Commit 9c76c5c

Browse files
konradybcioandersson
authored andcommitted
clk: qcom: gcc-msm8998: Control MMSS and GPUSS GPLL0 outputs properly
Up until now, we've been relying on some non-descript hardware magic to pinkypromise turn the clocks on for us. While new SoCs shine with that feature, MSM8998 can not always be fully trusted. Register the MMSS and GPUSS GPLL0 legs with the CCF to allow for manual enable voting. Reviewed-by: Jeffrey Hugo <[email protected]> Tested-by: Jeffrey Hugo <[email protected]> Signed-off-by: Konrad Dybcio <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 9127b37 commit 9c76c5c

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

drivers/clk/qcom/gcc-msm8998.c

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
#include "reset.h"
2626
#include "gdsc.h"
2727

28+
#define GCC_MMSS_MISC 0x0902C
29+
#define GCC_GPU_MISC 0x71028
30+
2831
static struct pll_vco fabia_vco[] = {
2932
{ 250000000, 2000000000, 0 },
3033
{ 125000000, 1000000000, 1 },
@@ -1367,6 +1370,22 @@ static struct clk_branch gcc_boot_rom_ahb_clk = {
13671370
},
13681371
};
13691372

1373+
static struct clk_branch gcc_mmss_gpll0_div_clk = {
1374+
.halt_check = BRANCH_HALT_DELAY,
1375+
.clkr = {
1376+
.enable_reg = 0x5200c,
1377+
.enable_mask = BIT(0),
1378+
.hw.init = &(struct clk_init_data){
1379+
.name = "gcc_mmss_gpll0_div_clk",
1380+
.parent_hws = (const struct clk_hw *[]) {
1381+
&gpll0_out_main.clkr.hw,
1382+
},
1383+
.num_parents = 1,
1384+
.ops = &clk_branch2_ops,
1385+
},
1386+
},
1387+
};
1388+
13701389
static struct clk_branch gcc_mmss_gpll0_clk = {
13711390
.halt_check = BRANCH_HALT_DELAY,
13721391
.clkr = {
@@ -1395,6 +1414,38 @@ static struct clk_branch gcc_mss_gpll0_div_clk_src = {
13951414
},
13961415
};
13971416

1417+
static struct clk_branch gcc_gpu_gpll0_div_clk = {
1418+
.halt_check = BRANCH_HALT_DELAY,
1419+
.clkr = {
1420+
.enable_reg = 0x5200c,
1421+
.enable_mask = BIT(3),
1422+
.hw.init = &(struct clk_init_data){
1423+
.name = "gcc_gpu_gpll0_div_clk",
1424+
.parent_hws = (const struct clk_hw *[]) {
1425+
&gpll0_out_main.clkr.hw,
1426+
},
1427+
.num_parents = 1,
1428+
.ops = &clk_branch2_ops,
1429+
},
1430+
},
1431+
};
1432+
1433+
static struct clk_branch gcc_gpu_gpll0_clk = {
1434+
.halt_check = BRANCH_HALT_DELAY,
1435+
.clkr = {
1436+
.enable_reg = 0x5200c,
1437+
.enable_mask = BIT(4),
1438+
.hw.init = &(struct clk_init_data){
1439+
.name = "gcc_gpu_gpll0_clk",
1440+
.parent_hws = (const struct clk_hw *[]) {
1441+
&gpll0_out_main.clkr.hw,
1442+
},
1443+
.num_parents = 1,
1444+
.ops = &clk_branch2_ops,
1445+
},
1446+
},
1447+
};
1448+
13981449
static struct clk_branch gcc_blsp1_ahb_clk = {
13991450
.halt_reg = 0x17004,
14001451
.halt_check = BRANCH_HALT_VOTED,
@@ -3080,6 +3131,9 @@ static struct clk_regmap *gcc_msm8998_clocks[] = {
30803131
[AGGRE2_SNOC_NORTH_AXI] = &aggre2_snoc_north_axi_clk.clkr,
30813132
[SSC_XO] = &ssc_xo_clk.clkr,
30823133
[SSC_CNOC_AHBS_CLK] = &ssc_cnoc_ahbs_clk.clkr,
3134+
[GCC_MMSS_GPLL0_DIV_CLK] = &gcc_mmss_gpll0_div_clk.clkr,
3135+
[GCC_GPU_GPLL0_DIV_CLK] = &gcc_gpu_gpll0_div_clk.clkr,
3136+
[GCC_GPU_GPLL0_CLK] = &gcc_gpu_gpll0_clk.clkr,
30833137
};
30843138

30853139
static struct gdsc *gcc_msm8998_gdscs[] = {
@@ -3235,6 +3289,10 @@ static int gcc_msm8998_probe(struct platform_device *pdev)
32353289
if (ret)
32363290
return ret;
32373291

3292+
/* Disable the GPLL0 active input to MMSS and GPU via MISC registers */
3293+
regmap_write(regmap, GCC_MMSS_MISC, 0x10003);
3294+
regmap_write(regmap, GCC_GPU_MISC, 0x10003);
3295+
32383296
return qcom_cc_really_probe(pdev, &gcc_msm8998_desc, regmap);
32393297
}
32403298

0 commit comments

Comments
 (0)