2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-25 05:34:00 +08:00

clk: qcom: gcc-msm8998: Fix Alpha PLL type for all GPLLs

All of the GPLLs in the MSM8998 Global Clock Controller are Fabia PLLs
and not generic alphas: this was producing bad effects over the entire
clock tree of MSM8998, where any GPLL child clock was declaring a false
clock rate, due to their parent also showing the same.

The issue resides in the calculation of the clock rate for the specific
Alpha PLL type, where Fabia has a different register layout; switching
the MSM8998 GPLLs to the correct Alpha Fabia PLL type fixes the rate
(calculation) reading. While at it, also make these PLLs fixed since
their rate is supposed to *never* be changed while the system runs, as
this would surely crash the entire SoC.

Now all the children of all the PLLs are also complying with their
specified clock table and system stability is improved.

Fixes: b5f5f525c5 ("clk: qcom: Add MSM8998 Global Clock Control (GCC) driver")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Link: https://lore.kernel.org/r/20210114221059.483390-7-angelogioacchino.delregno@somainline.org
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
AngeloGioacchino Del Regno 2021-01-14 23:10:54 +01:00 committed by Stephen Boyd
parent f861149130
commit 292f75ecff

View File

@ -135,7 +135,7 @@ static struct pll_vco fabia_vco[] = {
static struct clk_alpha_pll gpll0 = { static struct clk_alpha_pll gpll0 = {
.offset = 0x0, .offset = 0x0,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.vco_table = fabia_vco, .vco_table = fabia_vco,
.num_vco = ARRAY_SIZE(fabia_vco), .num_vco = ARRAY_SIZE(fabia_vco),
.clkr = { .clkr = {
@ -145,58 +145,58 @@ static struct clk_alpha_pll gpll0 = {
.name = "gpll0", .name = "gpll0",
.parent_names = (const char *[]){ "xo" }, .parent_names = (const char *[]){ "xo" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_ops, .ops = &clk_alpha_pll_fixed_fabia_ops,
} }
}, },
}; };
static struct clk_alpha_pll_postdiv gpll0_out_even = { static struct clk_alpha_pll_postdiv gpll0_out_even = {
.offset = 0x0, .offset = 0x0,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll0_out_even", .name = "gpll0_out_even",
.parent_names = (const char *[]){ "gpll0" }, .parent_names = (const char *[]){ "gpll0" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll0_out_main = { static struct clk_alpha_pll_postdiv gpll0_out_main = {
.offset = 0x0, .offset = 0x0,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll0_out_main", .name = "gpll0_out_main",
.parent_names = (const char *[]){ "gpll0" }, .parent_names = (const char *[]){ "gpll0" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll0_out_odd = { static struct clk_alpha_pll_postdiv gpll0_out_odd = {
.offset = 0x0, .offset = 0x0,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll0_out_odd", .name = "gpll0_out_odd",
.parent_names = (const char *[]){ "gpll0" }, .parent_names = (const char *[]){ "gpll0" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll0_out_test = { static struct clk_alpha_pll_postdiv gpll0_out_test = {
.offset = 0x0, .offset = 0x0,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll0_out_test", .name = "gpll0_out_test",
.parent_names = (const char *[]){ "gpll0" }, .parent_names = (const char *[]){ "gpll0" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll gpll1 = { static struct clk_alpha_pll gpll1 = {
.offset = 0x1000, .offset = 0x1000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.vco_table = fabia_vco, .vco_table = fabia_vco,
.num_vco = ARRAY_SIZE(fabia_vco), .num_vco = ARRAY_SIZE(fabia_vco),
.clkr = { .clkr = {
@ -206,58 +206,58 @@ static struct clk_alpha_pll gpll1 = {
.name = "gpll1", .name = "gpll1",
.parent_names = (const char *[]){ "xo" }, .parent_names = (const char *[]){ "xo" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_ops, .ops = &clk_alpha_pll_fixed_fabia_ops,
} }
}, },
}; };
static struct clk_alpha_pll_postdiv gpll1_out_even = { static struct clk_alpha_pll_postdiv gpll1_out_even = {
.offset = 0x1000, .offset = 0x1000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll1_out_even", .name = "gpll1_out_even",
.parent_names = (const char *[]){ "gpll1" }, .parent_names = (const char *[]){ "gpll1" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll1_out_main = { static struct clk_alpha_pll_postdiv gpll1_out_main = {
.offset = 0x1000, .offset = 0x1000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll1_out_main", .name = "gpll1_out_main",
.parent_names = (const char *[]){ "gpll1" }, .parent_names = (const char *[]){ "gpll1" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll1_out_odd = { static struct clk_alpha_pll_postdiv gpll1_out_odd = {
.offset = 0x1000, .offset = 0x1000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll1_out_odd", .name = "gpll1_out_odd",
.parent_names = (const char *[]){ "gpll1" }, .parent_names = (const char *[]){ "gpll1" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll1_out_test = { static struct clk_alpha_pll_postdiv gpll1_out_test = {
.offset = 0x1000, .offset = 0x1000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll1_out_test", .name = "gpll1_out_test",
.parent_names = (const char *[]){ "gpll1" }, .parent_names = (const char *[]){ "gpll1" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll gpll2 = { static struct clk_alpha_pll gpll2 = {
.offset = 0x2000, .offset = 0x2000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.vco_table = fabia_vco, .vco_table = fabia_vco,
.num_vco = ARRAY_SIZE(fabia_vco), .num_vco = ARRAY_SIZE(fabia_vco),
.clkr = { .clkr = {
@ -267,58 +267,58 @@ static struct clk_alpha_pll gpll2 = {
.name = "gpll2", .name = "gpll2",
.parent_names = (const char *[]){ "xo" }, .parent_names = (const char *[]){ "xo" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_ops, .ops = &clk_alpha_pll_fixed_fabia_ops,
} }
}, },
}; };
static struct clk_alpha_pll_postdiv gpll2_out_even = { static struct clk_alpha_pll_postdiv gpll2_out_even = {
.offset = 0x2000, .offset = 0x2000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll2_out_even", .name = "gpll2_out_even",
.parent_names = (const char *[]){ "gpll2" }, .parent_names = (const char *[]){ "gpll2" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll2_out_main = { static struct clk_alpha_pll_postdiv gpll2_out_main = {
.offset = 0x2000, .offset = 0x2000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll2_out_main", .name = "gpll2_out_main",
.parent_names = (const char *[]){ "gpll2" }, .parent_names = (const char *[]){ "gpll2" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll2_out_odd = { static struct clk_alpha_pll_postdiv gpll2_out_odd = {
.offset = 0x2000, .offset = 0x2000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll2_out_odd", .name = "gpll2_out_odd",
.parent_names = (const char *[]){ "gpll2" }, .parent_names = (const char *[]){ "gpll2" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll2_out_test = { static struct clk_alpha_pll_postdiv gpll2_out_test = {
.offset = 0x2000, .offset = 0x2000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll2_out_test", .name = "gpll2_out_test",
.parent_names = (const char *[]){ "gpll2" }, .parent_names = (const char *[]){ "gpll2" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll gpll3 = { static struct clk_alpha_pll gpll3 = {
.offset = 0x3000, .offset = 0x3000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.vco_table = fabia_vco, .vco_table = fabia_vco,
.num_vco = ARRAY_SIZE(fabia_vco), .num_vco = ARRAY_SIZE(fabia_vco),
.clkr = { .clkr = {
@ -328,58 +328,58 @@ static struct clk_alpha_pll gpll3 = {
.name = "gpll3", .name = "gpll3",
.parent_names = (const char *[]){ "xo" }, .parent_names = (const char *[]){ "xo" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_ops, .ops = &clk_alpha_pll_fixed_fabia_ops,
} }
}, },
}; };
static struct clk_alpha_pll_postdiv gpll3_out_even = { static struct clk_alpha_pll_postdiv gpll3_out_even = {
.offset = 0x3000, .offset = 0x3000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll3_out_even", .name = "gpll3_out_even",
.parent_names = (const char *[]){ "gpll3" }, .parent_names = (const char *[]){ "gpll3" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll3_out_main = { static struct clk_alpha_pll_postdiv gpll3_out_main = {
.offset = 0x3000, .offset = 0x3000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll3_out_main", .name = "gpll3_out_main",
.parent_names = (const char *[]){ "gpll3" }, .parent_names = (const char *[]){ "gpll3" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll3_out_odd = { static struct clk_alpha_pll_postdiv gpll3_out_odd = {
.offset = 0x3000, .offset = 0x3000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll3_out_odd", .name = "gpll3_out_odd",
.parent_names = (const char *[]){ "gpll3" }, .parent_names = (const char *[]){ "gpll3" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll3_out_test = { static struct clk_alpha_pll_postdiv gpll3_out_test = {
.offset = 0x3000, .offset = 0x3000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll3_out_test", .name = "gpll3_out_test",
.parent_names = (const char *[]){ "gpll3" }, .parent_names = (const char *[]){ "gpll3" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll gpll4 = { static struct clk_alpha_pll gpll4 = {
.offset = 0x77000, .offset = 0x77000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.vco_table = fabia_vco, .vco_table = fabia_vco,
.num_vco = ARRAY_SIZE(fabia_vco), .num_vco = ARRAY_SIZE(fabia_vco),
.clkr = { .clkr = {
@ -389,52 +389,52 @@ static struct clk_alpha_pll gpll4 = {
.name = "gpll4", .name = "gpll4",
.parent_names = (const char *[]){ "xo" }, .parent_names = (const char *[]){ "xo" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_ops, .ops = &clk_alpha_pll_fixed_fabia_ops,
} }
}, },
}; };
static struct clk_alpha_pll_postdiv gpll4_out_even = { static struct clk_alpha_pll_postdiv gpll4_out_even = {
.offset = 0x77000, .offset = 0x77000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll4_out_even", .name = "gpll4_out_even",
.parent_names = (const char *[]){ "gpll4" }, .parent_names = (const char *[]){ "gpll4" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll4_out_main = { static struct clk_alpha_pll_postdiv gpll4_out_main = {
.offset = 0x77000, .offset = 0x77000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll4_out_main", .name = "gpll4_out_main",
.parent_names = (const char *[]){ "gpll4" }, .parent_names = (const char *[]){ "gpll4" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll4_out_odd = { static struct clk_alpha_pll_postdiv gpll4_out_odd = {
.offset = 0x77000, .offset = 0x77000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll4_out_odd", .name = "gpll4_out_odd",
.parent_names = (const char *[]){ "gpll4" }, .parent_names = (const char *[]){ "gpll4" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };
static struct clk_alpha_pll_postdiv gpll4_out_test = { static struct clk_alpha_pll_postdiv gpll4_out_test = {
.offset = 0x77000, .offset = 0x77000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll4_out_test", .name = "gpll4_out_test",
.parent_names = (const char *[]){ "gpll4" }, .parent_names = (const char *[]){ "gpll4" },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
}, },
}; };