Commit 03681d06 authored by Abel Vesa's avatar Abel Vesa Committed by Shawn Guo
Browse files

clk: imx: gate2: Check if clock is enabled against cgr_val



Seems the logic here was wrong all along. For example, if
the cgr_val is 2 (0b10), the clk_gate2_reg_is_enabled would
report the clock as disabled. So check against cgr_val instead.

Signed-off-by: default avatarAbel Vesa <abel.vesa@nxp.com>
Reviewed-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
parent 040adb5f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -86,11 +86,11 @@ out:
	spin_unlock_irqrestore(gate->lock, flags);
}

static int clk_gate2_reg_is_enabled(void __iomem *reg, u8 bit_idx)
static int clk_gate2_reg_is_enabled(void __iomem *reg, u8 bit_idx, u8 cgr_val)
{
	u32 val = readl(reg);

	if (((val >> bit_idx) & 1) == 1)
	if (((val >> bit_idx) & 3) == cgr_val)
		return 1;

	return 0;
@@ -100,7 +100,7 @@ static int clk_gate2_is_enabled(struct clk_hw *hw)
{
	struct clk_gate2 *gate = to_clk_gate2(hw);

	return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx);
	return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx, gate->cgr_val);
}

static void clk_gate2_disable_unused(struct clk_hw *hw)