diff options
author | Chunyan Zhang <chunyan.zhang@unisoc.com> | 2020-05-27 08:36:35 +0300 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2020-05-27 09:41:14 +0300 |
commit | 8b4f6b8d59c614477ce65da15a4f5ddc31b2c398 (patch) | |
tree | 6ce63204cf6ca568ebbbf41c12cf746cbe009cdf /drivers/clk/sprd/gate.c | |
parent | c2f30986d418f26abefc2eec90ebf06716c970d2 (diff) | |
download | linux-8b4f6b8d59c614477ce65da15a4f5ddc31b2c398.tar.xz |
clk: sprd: check its parent status before reading gate clock
Some clocks only can be accessed if their parent is enabled. mipi_csi_xx
clocks on SC9863A are an examples. We have to ensure the parent clock is
enabled when reading those clocks.
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
Link: https://lkml.kernel.org/r/20200527053638.31439-2-zhang.lyra@gmail.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/sprd/gate.c')
-rw-r--r-- | drivers/clk/sprd/gate.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/clk/sprd/gate.c b/drivers/clk/sprd/gate.c index 574cfc116bbc..56e1714b541e 100644 --- a/drivers/clk/sprd/gate.c +++ b/drivers/clk/sprd/gate.c @@ -94,8 +94,15 @@ static int sprd_gate_is_enabled(struct clk_hw *hw) { struct sprd_gate *sg = hw_to_sprd_gate(hw); struct sprd_clk_common *common = &sg->common; + struct clk_hw *parent; unsigned int reg; + if (sg->flags & SPRD_GATE_NON_AON) { + parent = clk_hw_get_parent(hw); + if (!parent || !clk_hw_is_enabled(parent)) + return 0; + } + regmap_read(common->regmap, common->reg, ®); if (sg->flags & CLK_GATE_SET_TO_DISABLE) |