[PATCH linux dev-5.3] clk: ast2600: Fix enabling of clocks

Joel Stanley joel at jms.id.au
Wed Oct 2 22:13:43 AEST 2019


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")
Signed-off-by: Joel Stanley <joel at jms.id.au>
---
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(-)

diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c
index 63558d5e9f36..9191bc3e78ee 100644
--- a/drivers/clk/clk-ast2600.c
+++ b/drivers/clk/clk-ast2600.c
@@ -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) {
-- 
2.23.0



More information about the openbmc mailing list