Skip to content

Commit

Permalink
clk: aspeed: Fix is_enabled for certain clocks
Browse files Browse the repository at this point in the history
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: 6671507 ("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>
  • Loading branch information
Eddie James authored and Stephen Boyd committed Mar 15, 2018
1 parent 55c19ee commit d90c76b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/clk/clk-aspeed.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,12 @@ static int aspeed_clk_is_enabled(struct clk_hw *hw)
{
struct aspeed_clk_gate *gate = to_aspeed_clk_gate(hw);
u32 clk = BIT(gate->clock_idx);
u32 enval = (gate->flags & CLK_GATE_SET_TO_DISABLE) ? 0 : clk;
u32 reg;

regmap_read(gate->map, ASPEED_CLK_STOP_CTRL, &reg);

return (reg & clk) ? 0 : 1;
return ((reg & clk) == enval) ? 1 : 0;
}

static const struct clk_ops aspeed_clk_gate_ops = {
Expand Down

0 comments on commit d90c76b

Please sign in to comment.