clk: qcom: Add support for multiple PLL software instances

There could be use cases where the PLL could support various software
instances for various peripherals or for cpu. In those cases PLL need to
support aggregation logic for the voting and devoting on the PLL.

Change-Id: Ie5148a75452dccc555989a454996b945956f94e5
Signed-off-by: Taniya Das <tdas@codeaurora.org>
This commit is contained in:
Taniya Das 2018-03-12 15:12:54 +05:30 committed by Chetan C R
parent 1925916d7b
commit 7249c775a9
2 changed files with 23 additions and 2 deletions

View file

@ -406,7 +406,11 @@ static int clk_alpha_pll_enable(struct clk_hw *hw)
ret = clk_enable_regmap(hw);
if (ret)
return ret;
return wait_for_pll_enable_active(pll);
ret = wait_for_pll_enable_active(pll);
if (ret == 0)
if (pll->flags & SUPPORTS_FSM_VOTE)
*pll->soft_vote |= (pll->soft_vote_mask);
return ret;
}
/* Skip if already enabled */
@ -454,7 +458,12 @@ static void clk_alpha_pll_disable(struct clk_hw *hw)
/* If in FSM mode, just unvote it */
if (val & PLL_VOTE_FSM_ENA) {
clk_disable_regmap(hw);
if (pll->flags & SUPPORTS_FSM_VOTE) {
*pll->soft_vote &= ~(pll->soft_vote_mask);
if (!*pll->soft_vote)
clk_disable_regmap(hw);
} else
clk_disable_regmap(hw);
return;
}

View file

@ -51,6 +51,8 @@ struct pll_vco {
/**
* struct clk_alpha_pll - phase locked loop (PLL)
* @offset: base address of registers
* @soft_vote: soft voting variable for multiple PLL software instances
* @soft_vote_mask: soft voting mask for multiple PLL software instances
* @vco_table: array of VCO settings
* @regs: alpha pll register map (see @clk_alpha_pll_regs)
* @clkr: regmap clock handle
@ -59,11 +61,21 @@ struct clk_alpha_pll {
u32 offset;
const u8 *regs;
struct alpha_pll_config *config;
u32 *soft_vote;
u32 soft_vote_mask;
/* Soft voting values */
#define PLL_SOFT_VOTE_PRIMARY BIT(0)
#define PLL_SOFT_VOTE_CPU BIT(1)
#define PLL_SOFT_VOTE_AUX BIT(2)
const struct pll_vco *vco_table;
size_t num_vco;
#define SUPPORTS_OFFLINE_REQ BIT(0)
#define SUPPORTS_FSM_MODE BIT(2)
#define SUPPORTS_DYNAMIC_UPDATE BIT(3)
/* Associated with soft_vote for multiple PLL software instances */
#define SUPPORTS_FSM_VOTE BIT(5)
u8 flags;
struct clk_regmap clkr;