aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddie James <eajames@linux.vnet.ibm.com>2018-03-08 15:57:19 -0500
committerStephen Boyd <sboyd@kernel.org>2018-03-15 14:11:43 -0400
commitd90c76bb61128ed9022b9418c31c4749764b6cd9 (patch)
tree4805e03a5d45838fdae9f51132781a8cfe7f23fd
parent55c19eee3b471e7ca7e38783836f7b7137c9d14f (diff)
clk: aspeed: Fix is_enabled for certain clocks
Some of the Aspeed clocks are disabled by setting the relevant bit in the "clock stop control" register to one, while others are disabled by setting their bit to zero. The driver already uses a flag per gate to identify this behavior, but doesn't apply it in the clock is_enabled function. Use the existing gate flag to correctly return whether or not a clock is enabled in the aspeed_clk_is_enabled function. Signed-off-by: Eddie James <eajames@linux.vnet.ibm.com> Fixes: 6671507f0fbd ("clk: aspeed: Handle inverse polarity of USB port 1 clock gate") Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
-rw-r--r--drivers/clk/clk-aspeed.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/clk/clk-aspeed.c b/drivers/clk/clk-aspeed.c
index 9f7f931d6b2f..168777175cd1 100644
--- a/drivers/clk/clk-aspeed.c
+++ b/drivers/clk/clk-aspeed.c
@@ -259,11 +259,12 @@ static int aspeed_clk_is_enabled(struct clk_hw *hw)
259{ 259{
260 struct aspeed_clk_gate *gate = to_aspeed_clk_gate(hw); 260 struct aspeed_clk_gate *gate = to_aspeed_clk_gate(hw);
261 u32 clk = BIT(gate->clock_idx); 261 u32 clk = BIT(gate->clock_idx);
262 u32 enval = (gate->flags & CLK_GATE_SET_TO_DISABLE) ? 0 : clk;
262 u32 reg; 263 u32 reg;
263 264
264 regmap_read(gate->map, ASPEED_CLK_STOP_CTRL, &reg); 265 regmap_read(gate->map, ASPEED_CLK_STOP_CTRL, &reg);
265 266
266 return (reg & clk) ? 0 : 1; 267 return ((reg & clk) == enval) ? 1 : 0;
267} 268}
268 269
269static const struct clk_ops aspeed_clk_gate_ops = { 270static const struct clk_ops aspeed_clk_gate_ops = {