Skip to contentSkip to conversation

clk: ast2600: Fix enabling of clocks

PATCH In review Joel Stanley 2 participants 2 messages Oct 2, 2019 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: ast2600: Fix enabling of clocks

The struct clk_ops enable callback for the aspeed gates mixes up the set to clear and write to set registers.

Fixes d3d04f6c330a ("clk: Add support for AST2600 SoC")

---
This can be tested with Cedric's qemu as of 58b9c85302ad ("aspeed/scu:
Fix W1C behavior") by inspecting SCU090 after a booting the tacoma machine with the aspeed FSI enabled:

Before:

 $ devmem 0x1e6e2090
 0xFFFFFFF2

After:

 $ devmem 0x1e6e2090
 0xBFEFFFF2
---
 drivers/clk/clk-ast2600.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/clk/clk-ast2600.c +4 -3
index 63558d5e9f36..9191bc3e78ee 100644
@@ -269,10 +269,11 @@ static int aspeed_g6_clk_enable(struct clk_hw *hw)
 
 	/* Enable clock */
 	if (gate->flags & CLK_GATE_SET_TO_DISABLE) {
-		regmap_write(gate->map, get_clock_reg(gate), clk);
-	} else {
-		/* Use set to clear register */
+		/* Clock is clear to enable, so use set to clear register */
 		regmap_write(gate->map, get_clock_reg(gate) + 0x04, clk);
+	} else {
+		/* Clock is set to enable, so use write to set register */
+		regmap_write(gate->map, get_clock_reg(gate), clk);
 	}
 
 	if (gate->reset_idx >= 0) {
Signature · 1 line
2.23.0