Skip to content

Commit 5016243

Browse files
konradybcioandersson
authored andcommitted
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. Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Reviewed-by: Iskren Chernev <me@iskren.info> Signed-off-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/20230601-topic-alpha_ctl-v1-1-b6a932dfcf68@linaro.org
1 parent 5ae7899 commit 5016243

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

drivers/clk/qcom/clk-alpha-pll.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,21 @@ void clk_alpha_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
384384

385385
regmap_update_bits(regmap, PLL_USER_CTL(pll), mask, val);
386386

387-
clk_alpha_pll_write_config(regmap, PLL_TEST_CTL(pll),
388-
config->test_ctl_val);
389-
clk_alpha_pll_write_config(regmap, PLL_TEST_CTL_U(pll),
390-
config->test_ctl_hi_val);
387+
if (config->test_ctl_mask)
388+
regmap_update_bits(regmap, PLL_TEST_CTL(pll),
389+
config->test_ctl_mask,
390+
config->test_ctl_val);
391+
else
392+
clk_alpha_pll_write_config(regmap, PLL_TEST_CTL(pll),
393+
config->test_ctl_val);
394+
395+
if (config->test_ctl_hi_mask)
396+
regmap_update_bits(regmap, PLL_TEST_CTL_U(pll),
397+
config->test_ctl_hi_mask,
398+
config->test_ctl_hi_val);
399+
else
400+
clk_alpha_pll_write_config(regmap, PLL_TEST_CTL_U(pll),
401+
config->test_ctl_hi_val);
391402

392403
if (pll->flags & SUPPORTS_FSM_MODE)
393404
qcom_pll_set_fsm_mode(regmap, PLL_MODE(pll), 6, 0);

drivers/clk/qcom/clk-alpha-pll.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ struct alpha_pll_config {
123123
u32 user_ctl_hi_val;
124124
u32 user_ctl_hi1_val;
125125
u32 test_ctl_val;
126+
u32 test_ctl_mask;
126127
u32 test_ctl_hi_val;
128+
u32 test_ctl_hi_mask;
127129
u32 test_ctl_hi1_val;
128130
u32 test_ctl_hi2_val;
129131
u32 main_output_mask;

0 commit comments

Comments
 (0)