diff options
author | Deepak Katragadda <dkatraga@codeaurora.org> | 2017-02-01 14:25:01 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-02-22 20:06:24 -0800 |
commit | 75e9ce044f64a4261c23006ac0486678a93bb815 (patch) | |
tree | db7dc5faba4baeb3cced6dbb5a5af7af8425f390 /drivers/clk | |
parent | d72462d943ee499ac17a485bdacca60c0db31c04 (diff) |
clk: qcom: clk-rcg2: Correct the erroneous RCG configuration during enable
If the RCG frequency table does not have CXO as one of its supported
frequencies, and if a client calls clk_enable on it prior to setting
its rate, the current RCG code would configure it to the lowest
supported frequency instead which would then lead the subsequent
call to update the configuration to fail because the parent PLLs are
not active. Correct this behavior. Also update the index in case cxo_f
frequency table is used for rcg configure.
Change-Id: Ib2c09f9f503724bafd32b963b5b0ea84da7c4b7b
Signed-off-by: Deepak Katragadda <dkatraga@codeaurora.org>
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/qcom/clk-rcg2.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index a07deb902577..9e5c0b6f7a0e 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -307,7 +307,18 @@ static int clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f) { u32 cfg, mask, old_cfg; struct clk_hw *hw = &rcg->clkr.hw; - int ret, index = qcom_find_src_index(hw, rcg->parent_map, f->src); + int ret, index; + + /* + * In case the frequency table of cxo_f is used, the src in parent_map + * and the source in cxo_f.src could be different. Update the index to + * '0' since it's assumed that CXO is always fed to port 0 of RCGs HLOS + * controls. + */ + if (f == &cxo_f) + index = 0; + else + index = qcom_find_src_index(hw, rcg->parent_map, f->src); if (index < 0) return index; @@ -507,6 +518,15 @@ static int clk_rcg2_enable(struct clk_hw *hw) if (!f) return -EINVAL; + /* + * If CXO is not listed as a supported frequency in the frequency + * table, the above API would return the lowest supported frequency + * instead. This will lead to incorrect configuration of the RCG. + * Check if the RCG rate is CXO and configure it accordingly. + */ + if (rate == cxo_f.freq) + f = &cxo_f; + clk_rcg_set_force_enable(hw); clk_rcg2_configure(rcg, f); clk_rcg_clear_force_enable(hw); |