aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbhishek Sahu <absahu@codeaurora.org>2017-09-28 13:50:50 -0400
committerStephen Boyd <sboyd@codeaurora.org>2017-12-13 19:54:10 -0500
commit23c68cc9683efbd08457f06fb5eacd7c8616dfae (patch)
treefd63be0d44de15676c292916bec38352fec19049
parent1c3541145cbfd1cf631602bd7494dd03260e8533 (diff)
clk: qcom: add read-only alpha pll post divider operations
Some of the divider settings are preconfigured and should not be changed by the clock framework during frequency change. This patch adds the read-only divider operation for QCOM alpha pll post divider which is equivalent to generic divider operations in 'commit 79c6ab509558 ("clk: divider: add CLK_DIVIDER_READ_ONLY flag")'. Signed-off-by: Abhishek Sahu <absahu@codeaurora.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r--drivers/clk/qcom/clk-alpha-pll.c25
-rw-r--r--drivers/clk/qcom/clk-alpha-pll.h1
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/clk/qcom/clk-alpha-pll.c b/drivers/clk/qcom/clk-alpha-pll.c
index 2de66b98e997..6d04cd96482a 100644
--- a/drivers/clk/qcom/clk-alpha-pll.c
+++ b/drivers/clk/qcom/clk-alpha-pll.c
@@ -787,6 +787,25 @@ clk_alpha_pll_postdiv_round_rate(struct clk_hw *hw, unsigned long rate,
787 pll->width, CLK_DIVIDER_POWER_OF_TWO); 787 pll->width, CLK_DIVIDER_POWER_OF_TWO);
788} 788}
789 789
790static long
791clk_alpha_pll_postdiv_round_ro_rate(struct clk_hw *hw, unsigned long rate,
792 unsigned long *prate)
793{
794 struct clk_alpha_pll_postdiv *pll = to_clk_alpha_pll_postdiv(hw);
795 u32 ctl, div;
796
797 regmap_read(pll->clkr.regmap, PLL_USER_CTL(pll), &ctl);
798
799 ctl >>= PLL_POST_DIV_SHIFT;
800 ctl &= BIT(pll->width) - 1;
801 div = 1 << fls(ctl);
802
803 if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT)
804 *prate = clk_hw_round_rate(clk_hw_get_parent(hw), div * rate);
805
806 return DIV_ROUND_UP_ULL((u64)*prate, div);
807}
808
790static int clk_alpha_pll_postdiv_set_rate(struct clk_hw *hw, unsigned long rate, 809static int clk_alpha_pll_postdiv_set_rate(struct clk_hw *hw, unsigned long rate,
791 unsigned long parent_rate) 810 unsigned long parent_rate)
792{ 811{
@@ -807,3 +826,9 @@ const struct clk_ops clk_alpha_pll_postdiv_ops = {
807 .set_rate = clk_alpha_pll_postdiv_set_rate, 826 .set_rate = clk_alpha_pll_postdiv_set_rate,
808}; 827};
809EXPORT_SYMBOL_GPL(clk_alpha_pll_postdiv_ops); 828EXPORT_SYMBOL_GPL(clk_alpha_pll_postdiv_ops);
829
830const struct clk_ops clk_alpha_pll_postdiv_ro_ops = {
831 .round_rate = clk_alpha_pll_postdiv_round_ro_rate,
832 .recalc_rate = clk_alpha_pll_postdiv_recalc_rate,
833};
834EXPORT_SYMBOL_GPL(clk_alpha_pll_postdiv_ro_ops);
diff --git a/drivers/clk/qcom/clk-alpha-pll.h b/drivers/clk/qcom/clk-alpha-pll.h
index bcc6676a8e7a..7593e8a56cf2 100644
--- a/drivers/clk/qcom/clk-alpha-pll.h
+++ b/drivers/clk/qcom/clk-alpha-pll.h
@@ -107,6 +107,7 @@ extern const struct clk_ops clk_alpha_pll_ops;
107extern const struct clk_ops clk_alpha_pll_hwfsm_ops; 107extern const struct clk_ops clk_alpha_pll_hwfsm_ops;
108extern const struct clk_ops clk_alpha_pll_postdiv_ops; 108extern const struct clk_ops clk_alpha_pll_postdiv_ops;
109extern const struct clk_ops clk_alpha_pll_huayra_ops; 109extern const struct clk_ops clk_alpha_pll_huayra_ops;
110extern const struct clk_ops clk_alpha_pll_postdiv_ro_ops;
110 111
111void clk_alpha_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap, 112void clk_alpha_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
112 const struct alpha_pll_config *config); 113 const struct alpha_pll_config *config);