Skip to contentSkip to conversation

pinctrl: aspeed: Revert "Force to disable the function's signal"

PATCH New Joel Stanley 2 participants 3 messages Jan 30, 2023

Subsystems (4)
lore
Share & tools
lore

Joel Stanley

author maintainer
#0 lore raw

PATCH 1/1 pinctrl: aspeed: Revert "Force to disable the function's signal"

This reverts commit cf517fef601b9dde151f0afc27164d13bf1fd907.

The commit cf517fef601b ("pinctrl: aspeed: Force to disable the function's signal") exposed a problem with fetching the regmap for reading the GFX register.

The Romulus machine the device tree contains a gpio hog for GPIO S7. With the patch applied:

Muxing pin 151 for GPIO
Disabling signal VPOB9 for VPO
aspeed-g5-pinctrl 1e6e2080.pinctrl: Failed to acquire regmap for IP block 1 aspeed-g5-pinctrl 1e6e2080.pinctrl: request() failed for pin 151

The code path is aspeed-gpio -> pinmux-g5 -> regmap -> clk, and the of_clock code returns an error as it doesn't have a valid struct clk_hw pointer. The regmap call happens because pinmux wants to check the GFX node (IP block 1) to query bits there.

For reference, before the offending patch:

Muxing pin 151 for GPIO
Disabling signal VPOB9 for VPO
Want SCU8C[0x00000080]=0x1, got 0x0 from 0x00000000 Disabling signal VPOB9 for VPOOFF1
Want SCU8C[0x00000080]=0x1, got 0x0 from 0x00000000 Disabling signal VPOB9 for VPOOFF2
Want SCU8C[0x00000080]=0x1, got 0x0 from 0x00000000 Enabling signal GPIOS7 for GPIOS7
Muxed pin 151 as GPIOS7
gpio-943 (seq_cont): hogged as output/low

We can't skip the clock check to allow pinmux to proceed, because the write to disable VPOB9 will try to set a bit in the GFX register space which will not stick when the IP is in reset. However, we do not want to enable the IP just so pinmux can do a disable-enable dance for the pin.

For now, revert the offending patch while a correct solution is found.

Fixes cf517fef601b ("pinctrl: aspeed: Force to disable the function's signal")
---
 drivers/pinctrl/aspeed/pinctrl-aspeed.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/pinctrl/aspeed/pinctrl-aspeed.c +10 -1
index f93d6959cee9..5a12fc7cf91f 100644
@@ -92,10 +92,19 @@ static int aspeed_sig_expr_enable(struct aspeed_pinmux_data *ctx,
 static int aspeed_sig_expr_disable(struct aspeed_pinmux_data *ctx,
 				   const struct aspeed_sig_expr *expr)
 {
+	int ret;
+
 	pr_debug("Disabling signal %s for %s\n", expr->signal,
 		 expr->function);
 
-	return aspeed_sig_expr_set(ctx, expr, false);
+	ret = aspeed_sig_expr_eval(ctx, expr, true);
+	if (ret < 0)
+		return ret;
+
+	if (ret)
+		return aspeed_sig_expr_set(ctx, expr, false);
+
+	return 0;
 }
 
 /**
Signature · 1 line
2.39.0
#1 lore raw

PATCH 1/1 pinctrl: aspeed: Revert "Force to disable the function's signal"

Quoted 37 lines · Joel Stanley

This reverts commit cf517fef601b9dde151f0afc27164d13bf1fd907.

The commit cf517fef601b ("pinctrl: aspeed: Force to disable the function's signal") exposed a problem with fetching the regmap for reading the GFX register.

The Romulus machine the device tree contains a gpio hog for GPIO S7. With the patch applied:

Muxing pin 151 for GPIO
Disabling signal VPOB9 for VPO
aspeed-g5-pinctrl 1e6e2080.pinctrl: Failed to acquire regmap for IP block 1 aspeed-g5-pinctrl 1e6e2080.pinctrl: request() failed for pin 151

The code path is aspeed-gpio -> pinmux-g5 -> regmap -> clk, and the of_clock code returns an error as it doesn't have a valid struct clk_hw pointer. The regmap call happens because pinmux wants to check the GFX node (IP block 1) to query bits there.

For reference, before the offending patch:

Muxing pin 151 for GPIO
Disabling signal VPOB9 for VPO
Want SCU8C[0x00000080]=0x1, got 0x0 from 0x00000000 Disabling signal VPOB9 for VPOOFF1
Want SCU8C[0x00000080]=0x1, got 0x0 from 0x00000000 Disabling signal VPOB9 for VPOOFF2
Want SCU8C[0x00000080]=0x1, got 0x0 from 0x00000000 Enabling signal GPIOS7 for GPIOS7
Muxed pin 151 as GPIOS7
gpio-943 (seq_cont): hogged as output/low

We can't skip the clock check to allow pinmux to proceed, because the write to disable VPOB9 will try to set a bit in the GFX register space which will not stick when the IP is in reset. However, we do not want to enable the IP just so pinmux can do a disable-enable dance for the pin.

Quoted 5 lines

For now, revert the offending patch while a correct solution is found.

Fixes cf517fef601b ("pinctrl: aspeed: Force to disable the function's signal")

Patch applied for fixes, sorry for not getting around to reverting it myself, but the commit message got really nice in the meantime :)

Yours,
Linus Walleij

author maintainer
#2 lore raw

PATCH 1/1 pinctrl: aspeed: Revert "Force to disable the function's signal"

Quoted 11 lines · Linus Walleij
Quoted 5 lines · Joel Stanley

For now, revert the offending patch while a correct solution is found.

Fixes cf517fef601b ("pinctrl: aspeed: Force to disable the function's signal")

Patch applied for fixes, sorry for not getting around to reverting it myself, but the commit message got really nice in the meantime :)

:D

Thank you!