diff options
author | Joachim Eastwood <manabian@gmail.com> | 2015-10-24 18:55:23 +0200 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2015-10-26 12:36:56 -0700 |
commit | 2a9a06f98f26654d3b07482319ea0be276689f0b (patch) | |
tree | 72a89b76df2c69c926c7421a4794d41da8b7786f /drivers/clk | |
parent | be68bf883170b3e4123fc4ff3745e38fb45a573e (diff) | |
download | linux-2a9a06f98f26654d3b07482319ea0be276689f0b.tar.bz2 |
clk: lpc18xx-ccu: fix potential system hang when disabling unused clocks
CCU branch clock register must only be accessed while the base
(parent) clock is running. Access with a disabled base clock
will cause the system to hang. Fix this issue by adding code
that check if the parent clock is running in the is_enabled
clk_ops callback.
This hang would occur when disabling unused clocks after AMBA
runtime pm had already disabled some of the clocks.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/nxp/clk-lpc18xx-ccu.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/clk/nxp/clk-lpc18xx-ccu.c b/drivers/clk/nxp/clk-lpc18xx-ccu.c index eeaee97da110..13aabbb3acbe 100644 --- a/drivers/clk/nxp/clk-lpc18xx-ccu.c +++ b/drivers/clk/nxp/clk-lpc18xx-ccu.c @@ -179,9 +179,22 @@ static void lpc18xx_ccu_gate_disable(struct clk_hw *hw) static int lpc18xx_ccu_gate_is_enabled(struct clk_hw *hw) { - struct clk_gate *gate = to_clk_gate(hw); + const struct clk_hw *parent; + + /* + * The branch clock registers are only accessible + * if the base (parent) clock is enabled. Register + * access with a disabled base clock will hang the + * system. + */ + parent = clk_hw_get_parent(hw); + if (!parent) + return 0; + + if (!clk_hw_is_enabled(parent)) + return 0; - return clk_readl(gate->reg) & LPC18XX_CCU_RUN; + return clk_gate_ops.is_enabled(hw); } static const struct clk_ops lpc18xx_ccu_gate_ops = { |