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>
This commit is contained in:
parent
d72462d943
commit
75e9ce044f
1 changed files with 21 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue