Skip to content

Commit d28b503

Browse files
fltobebarino
authored andcommitted
clk: qcom: clk-alpha-pll: use the right PCAL_DONE value for lucid pll
Lucid PCAL_DONE is different from trion. Signed-off-by: Jonathan Marek <[email protected]> Tested-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 0b01489 commit d28b503

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ EXPORT_SYMBOL_GPL(clk_alpha_pll_regs);
143143
#define TRION_PLL_CAL_VAL 0x44
144144
#define TRION_PCAL_DONE BIT(26)
145145

146+
/* LUCID PLL specific settings and offsets */
147+
#define LUCID_PCAL_DONE BIT(27)
148+
146149
#define pll_alpha_width(p) \
147150
((PLL_ALPHA_VAL_U(p) - PLL_ALPHA_VAL(p) == 4) ? \
148151
ALPHA_REG_BITWIDTH : ALPHA_REG_16BIT_WIDTH)
@@ -1447,15 +1450,15 @@ EXPORT_SYMBOL_GPL(clk_trion_pll_configure);
14471450
* The TRION PLL requires a power-on self-calibration which happens when the
14481451
* PLL comes out of reset. Calibrate in case it is not completed.
14491452
*/
1450-
static int alpha_pll_trion_prepare(struct clk_hw *hw)
1453+
static int __alpha_pll_trion_prepare(struct clk_hw *hw, u32 pcal_done)
14511454
{
14521455
struct clk_alpha_pll *pll = to_clk_alpha_pll(hw);
14531456
u32 regval;
14541457
int ret;
14551458

14561459
/* Return early if calibration is not needed. */
14571460
regmap_read(pll->clkr.regmap, PLL_STATUS(pll), &regval);
1458-
if (regval & TRION_PCAL_DONE)
1461+
if (regval & pcal_done)
14591462
return 0;
14601463

14611464
/* On/off to calibrate */
@@ -1466,6 +1469,16 @@ static int alpha_pll_trion_prepare(struct clk_hw *hw)
14661469
return ret;
14671470
}
14681471

1472+
static int alpha_pll_trion_prepare(struct clk_hw *hw)
1473+
{
1474+
return __alpha_pll_trion_prepare(hw, TRION_PCAL_DONE);
1475+
}
1476+
1477+
static int alpha_pll_lucid_prepare(struct clk_hw *hw)
1478+
{
1479+
return __alpha_pll_trion_prepare(hw, LUCID_PCAL_DONE);
1480+
}
1481+
14691482
static int alpha_pll_trion_set_rate(struct clk_hw *hw, unsigned long rate,
14701483
unsigned long prate)
14711484
{
@@ -1529,6 +1542,17 @@ const struct clk_ops clk_alpha_pll_trion_ops = {
15291542
.round_rate = clk_alpha_pll_round_rate,
15301543
.set_rate = alpha_pll_trion_set_rate,
15311544
};
1545+
EXPORT_SYMBOL_GPL(clk_alpha_pll_trion_ops);
1546+
1547+
const struct clk_ops clk_alpha_pll_lucid_ops = {
1548+
.prepare = alpha_pll_lucid_prepare,
1549+
.enable = clk_trion_pll_enable,
1550+
.disable = clk_trion_pll_disable,
1551+
.is_enabled = clk_trion_pll_is_enabled,
1552+
.recalc_rate = clk_trion_pll_recalc_rate,
1553+
.round_rate = clk_alpha_pll_round_rate,
1554+
.set_rate = alpha_pll_trion_set_rate,
1555+
};
15321556
EXPORT_SYMBOL_GPL(clk_alpha_pll_lucid_ops);
15331557

15341558
const struct clk_ops clk_alpha_pll_postdiv_lucid_ops = {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ extern const struct clk_ops clk_alpha_pll_trion_ops;
138138
extern const struct clk_ops clk_alpha_pll_fixed_trion_ops;
139139
extern const struct clk_ops clk_alpha_pll_postdiv_trion_ops;
140140

141-
#define clk_alpha_pll_lucid_ops clk_alpha_pll_trion_ops
141+
extern const struct clk_ops clk_alpha_pll_lucid_ops;
142142
#define clk_alpha_pll_fixed_lucid_ops clk_alpha_pll_fixed_trion_ops
143143
extern const struct clk_ops clk_alpha_pll_postdiv_lucid_ops;
144144

0 commit comments

Comments
 (0)