clk: qcom: Add QCOM_CLK_IS_CRITICAL flag

Add QCOM_CLK_IS_CRITICAL, which can be used to enable a clock by default
in HW and to skip registering it with the framework.

Change-Id: I803a447fae742ca2e20973046090d2b8331ab598
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
This commit is contained in:
Mike Tipton 2020-11-04 16:40:22 -08:00 committed by Mike Tipton
parent f7f04fbfc6
commit 9102085a93
4 changed files with 20 additions and 1 deletions

View File

@ -70,7 +70,7 @@ static int clk_branch_wait(const struct clk_branch *br, bool enabling,
bool (check_halt)(const struct clk_branch *, bool))
{
bool voted = br->halt_check & BRANCH_VOTED;
const char *name = clk_hw_get_name(&br->clkr.hw);
const char *name = qcom_clk_hw_get_name(&br->clkr.hw);
/*
* Skip checking halt bit if we're explicitly ignoring the bit or the

View File

@ -270,6 +270,7 @@ EXPORT_SYMBOL(clk_is_regmap_clk);
*/
int devm_clk_register_regmap(struct device *dev, struct clk_regmap *rclk)
{
const struct clk_ops *ops;
int ret;
rclk->dev = dev;
@ -279,6 +280,14 @@ int devm_clk_register_regmap(struct device *dev, struct clk_regmap *rclk)
else if (dev && dev->parent)
rclk->regmap = dev_get_regmap(dev->parent, NULL);
if (rclk->flags & QCOM_CLK_IS_CRITICAL) {
ops = rclk->hw.init->ops;
if (ops && ops->enable)
ops->enable(&rclk->hw);
return 0;
}
ret = devm_clk_hw_register(dev, &rclk->hw);
if (!ret)
list_add(&rclk->list_node, &clk_regmap_list);

View File

@ -48,6 +48,8 @@ struct clk_regmap {
struct clk_regmap_ops *ops;
struct list_head list_node;
struct device *dev;
#define QCOM_CLK_IS_CRITICAL BIT(0)
unsigned long flags;
};
static inline struct clk_regmap *to_clk_regmap(struct clk_hw *hw)

View File

@ -327,6 +327,14 @@ int qcom_cc_really_probe(struct platform_device *pdev,
return ret;
clk_hw_populate_clock_opp_table(dev->of_node, &rclks[i]->hw);
/*
* Critical clocks are enabled by devm_clk_register_regmap()
* and registration skipped. So remove from rclks so that the
* get() callback returns NULL and client requests are stubbed.
*/
if (rclks[i]->flags & QCOM_CLK_IS_CRITICAL)
rclks[i] = NULL;
}
ret = devm_of_clk_add_hw_provider(dev, qcom_cc_clk_hw_get, cc);