Update parts of PLL_TEST_CTL(_U) if required
Subsystems (3)
cover Update parts of PLL_TEST_CTL(_U) if required
Some recent-ish clock drivers touching on the "standard" Alpha PLLs have been specifying the values that should be written into the CTL registers as mask-value combos, but that wasn't always reflected properly (or at all). This series tries to fix that without affecitng the drivers that actually provide the full register values.
---
Konrad Dybcio (2):
clk: qcom: clk-alpha-pll: Add a way to update some bits of test_ctl(_hi)
clk: qcom: gcc-sm6115: Add missing PLL config properties
drivers/clk/qcom/clk-alpha-pll.c | 19 +++++++++++++++---- drivers/clk/qcom/clk-alpha-pll.h | 2 ++ drivers/clk/qcom/gcc-sm6115.c | 8 ++++++++ 3 files changed, 25 insertions(+), 4 deletions(-)
---
base-commit: 571d71e886a5edc89b4ea6d0fe6f445282938320
change-id: 20230601-topic-alpha_ctl-ab0dc0ad3654
Best regards,
Signature · 1 line
Konrad Dybcio <[email protected]>
PATCH 1/2 clk: qcom: clk-alpha-pll: Add a way to update some bits of test_ctl(_hi)
The "vanilla" Alpha PLL configs are sometimes provided with an intention to only update certain bits of th register.
Do so if a mask is found.
--- drivers/clk/qcom/clk-alpha-pll.c | 19 +++++++++++++++---- drivers/clk/qcom/clk-alpha-pll.h | 2 ++ 2 files changed, 17 insertions(+), 4 deletions(-)
drivers/clk/qcom/clk-alpha-pll.c +15 -4
@@ -384,10 +384,21 @@ void clk_alpha_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,regmap_update_bits (regmap,PLL_USER_CTL (pll), mask, val); -clk_alpha_pll_write_config (regmap,PLL_TEST_CTL (pll), - config->test_ctl_val); -clk_alpha_pll_write_config (regmap,PLL_TEST_CTL_U (pll), - config->test_ctl_hi_val); +if (config->test_ctl_mask) +regmap_update_bits (regmap,PLL_TEST_CTL (pll), + config->test_ctl_mask, + config->test_ctl_val); +else +clk_alpha_pll_write_config (regmap,PLL_TEST_CTL (pll), + config->test_ctl_val); + +if (config->test_ctl_hi_mask) +regmap_update_bits (regmap,PLL_TEST_CTL_U (pll), + config->test_ctl_hi_mask, + config->test_ctl_hi_val); +else +clk_alpha_pll_write_config (regmap,PLL_TEST_CTL_U (pll), + config->test_ctl_hi_val);if (pll->flags &SUPPORTS_FSM_MODE )qcom_pll_set_fsm_mode (regmap,PLL_MODE (pll),6 ,0 );
drivers/clk/qcom/clk-alpha-pll.h +2 -0
@@ -123,7 +123,9 @@ struct alpha_pll_config {u32 user_ctl_hi_val;u32 user_ctl_hi1_val;u32 test_ctl_val; +u32 test_ctl_mask;u32 test_ctl_hi_val; +u32 test_ctl_hi_mask;u32 test_ctl_hi1_val;u32 test_ctl_hi2_val;u32 main_output_mask;
Signature · 1 line
2.40.1
PATCH 2/2 clk: qcom: gcc-sm6115: Add missing PLL config properties
In reply to Konrad DybcioWhen the driver was ported upstream, PLL ctl register values were omitted. Add them to ensure the PLLs are fully configured like we expect them to.
--- drivers/clk/qcom/gcc-sm6115.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/clk/qcom/gcc-sm6115.c +8 -0
@@ -119,6 +119,8 @@ static const struct alpha_pll_config gpll10_config = { .vco_mask = GENMASK(21, 20), .main_output_mask = BIT(0), .config_ctl_val = 0x4001055b, + .test_ctl_hi1_val = 0x1, + .test_ctl_hi_mask = 0x1, };static struct clk_alpha_pll gpll10 = {
@@ -170,6 +172,8 @@ static const struct alpha_pll_config gpll11_config = { .vco_val = 0x2 << 20, .vco_mask = GENMASK(21, 20), .config_ctl_val = 0x4001055b, + .test_ctl_hi1_val = 0x1, + .test_ctl_hi_mask = 0x1, };static struct clk_alpha_pll gpll11 = {
@@ -362,6 +366,8 @@ static const struct alpha_pll_config gpll8_config = { .post_div_val = 0x1 << 8, .post_div_mask = GENMASK(11, 8), .config_ctl_val = 0x4001055b, + .test_ctl_hi1_val = 0x1, + .test_ctl_hi_mask = 0x1, };static struct clk_alpha_pll gpll8 = {
@@ -413,6 +419,8 @@ static const struct alpha_pll_config gpll9_config = { .post_div_mask = GENMASK(9, 8), .main_output_mask = BIT(0), .config_ctl_val = 0x00004289, + .test_ctl_mask = GENMASK(31, 0), + .test_ctl_val = 0x08000000, };static struct clk_alpha_pll gpll9 = {
Signature · 1 line
2.40.1
Quoted 4 lines · Konrad Dybcio
Some recent-ish clock drivers touching on the "standard" Alpha PLLs have been specifying the values that should be written into the CTL registers as mask-value combos, but that wasn't always reflected properly (or at all).
Yeah, that would be me. I didn't feel confident enough to add the mask parameter, but it seems very reasonable.
Quoted 4 lines
This series tries to fix that without affecitng the drivers that actually provide the full register values.
Signed-off-by Konrad Dybcio <[email protected]>
Quoted 14 lines
---
Konrad Dybcio (2):
clk: qcom: clk-alpha-pll: Add a way to update some bits oftest_ctl(_hi)
clk: qcom: gcc-sm6115: Add missing PLL config propertiesdrivers/clk/qcom/clk-alpha-pll.c | 19 +++++++++++++++---- drivers/clk/qcom/clk-alpha-pll.h | 2 ++ drivers/clk/qcom/gcc-sm6115.c | 8 ++++++++ 3 files changed, 25 insertions(+), 4 deletions(-)---
base-commit:571d71e886a5edc89b4ea6d0fe6f445282938320
change-id: 20230601-topic-alpha_ctl-ab0dc0ad3654Best regards,
Quoted 8 lines · Konrad Dybcio
Some recent-ish clock drivers touching on the "standard" Alpha PLLs have been specifying the values that should be written into the CTL registers as mask-value combos, but that wasn't always reflected properly (or at all). This series tries to fix that without affecitng the drivers that actually provide the full register values.
[...]
Applied, thanks!
[1/2] clk: qcom: clk-alpha-pll: Add a way to update some bits of test_ctl(_hi)
commit: 501624339466a7896bb8a1f048cf8dcfd54b174e
[2/2] clk: qcom: gcc-sm6115: Add missing PLL config properties
commit: e88c533d8a2a0fe84bb54cff1569bd079ad3512cBest regards,
Signature · 1 line
Bjorn Andersson <[email protected]>