diff mbox series

sandbox: Fix pinmux warnings with non-test devicetrees

Message ID 20240810135249.4037082-1-seanga2@gmail.com
State Changes Requested
Delegated to: Tom Rini
Headers show
Series sandbox: Fix pinmux warnings with non-test devicetrees | expand

Commit Message

Sean Anderson Aug. 10, 2024, 1:52 p.m. UTC
The sandbox pinmux driver is used in the non-test devicetree as well as
the test one. I didn't realize this when I modified the driver for
tests, and so broke the regular use case (which only resulted in
warnings). First, making the pinmux and the UART group available in all
boot phases to avoid ENODEV errors. Then, convert the pin groups and
functions to the new style, adding onewire group as well.

Fixes: 7f0f1806e3a ("test: pinmux: Add test for pin muxing")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

 arch/sandbox/dts/sandbox.dtsi                | 14 ++++++++------
 drivers/pinctrl/pinctrl-sandbox.c            |  4 +++-
 include/dt-bindings/pinctrl/sandbox-pinmux.h |  1 +
 3 files changed, 12 insertions(+), 7 deletions(-)

Comments

Simon Glass Aug. 11, 2024, 2:50 p.m. UTC | #1
Hi Sean,

On Sat, 10 Aug 2024 at 07:52, Sean Anderson <seanga2@gmail.com> wrote:
>
> The sandbox pinmux driver is used in the non-test devicetree as well as
> the test one. I didn't realize this when I modified the driver for
> tests, and so broke the regular use case (which only resulted in
> warnings). First, making the pinmux and the UART group available in all
> boot phases to avoid ENODEV errors. Then, convert the pin groups and
> functions to the new style, adding onewire group as well.
>
> Fixes: 7f0f1806e3a ("test: pinmux: Add test for pin muxing")
> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> ---
>
>  arch/sandbox/dts/sandbox.dtsi                | 14 ++++++++------
>  drivers/pinctrl/pinctrl-sandbox.c            |  4 +++-
>  include/dt-bindings/pinctrl/sandbox-pinmux.h |  1 +
>  3 files changed, 12 insertions(+), 7 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Fixes: https://source.denx.de/u-boot/u-boot/-/issues/2

Please feel free to take over that issue if you can and add a
patchwork link to this.

Regards,
SImon
Tom Rini Aug. 15, 2024, 8:26 p.m. UTC | #2
On Sat, Aug 10, 2024 at 09:52:49AM -0400, Sean Anderson wrote:

> The sandbox pinmux driver is used in the non-test devicetree as well as
> the test one. I didn't realize this when I modified the driver for
> tests, and so broke the regular use case (which only resulted in
> warnings). First, making the pinmux and the UART group available in all
> boot phases to avoid ENODEV errors. Then, convert the pin groups and
> functions to the new style, adding onewire group as well.
> 
> Fixes: 7f0f1806e3a ("test: pinmux: Add test for pin muxing")
> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  arch/sandbox/dts/sandbox.dtsi                | 14 ++++++++------
>  drivers/pinctrl/pinctrl-sandbox.c            |  4 +++-
>  include/dt-bindings/pinctrl/sandbox-pinmux.h |  1 +
>  3 files changed, 12 insertions(+), 7 deletions(-)

This introduces failure to build on sandbox_spl and sandbox_vpl.
diff mbox series

Patch

diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi
index c93ce712894..06ba4f031fa 100644
--- a/arch/sandbox/dts/sandbox.dtsi
+++ b/arch/sandbox/dts/sandbox.dtsi
@@ -231,23 +231,25 @@ 
 	};
 
 	pinctrl {
+		bootph-all;
 		compatible = "sandbox,pinctrl";
 		status = "okay";
 
 		pinctrl_i2c0: i2c0 {
-			groups = "i2c";
-			function = "i2c";
+			groups = "I2C_UART";
+			function = "I2C";
 			bias-pull-up;
 		};
 
 		pinctrl_serial0: uart0 {
-			groups = "serial_a";
-			function = "serial";
+			bootph-all;
+			groups = "I2C_UART";
+			function = "UART";
 		};
 
 		pinctrl_onewire0: onewire0 {
-			groups = "w1";
-			function = "w1";
+			pins = "P8";
+			function = "ONEWIRE";
 			bias-pull-up;
 		};
 	};
diff --git a/drivers/pinctrl/pinctrl-sandbox.c b/drivers/pinctrl/pinctrl-sandbox.c
index a5d056643a0..f6921b56ceb 100644
--- a/drivers/pinctrl/pinctrl-sandbox.c
+++ b/drivers/pinctrl/pinctrl-sandbox.c
@@ -42,7 +42,7 @@  static const char * const sandbox_pins_muxing[][2] = {
 	{ "GPIO0", "SPI CS0" },
 	{ "GPIO1", "SPI CS1" },
 	{ "GPIO2", "PWM0" },
-	{ "GPIO3", "PWM1" },
+	{ "GPIO3", "ONEWIRE" },
 };
 
 #define SANDBOX_GROUP_I2C_UART 0
@@ -63,6 +63,7 @@  static const char * const sandbox_functions[] = {
 	FUNC(GPIO),
 	FUNC(CS),
 	FUNC(PWM),
+	FUNC(ONEWIRE),
 #undef FUNC
 };
 
@@ -166,6 +167,7 @@  static int sandbox_pinmux_set(struct udevice *dev, unsigned pin_selector,
 		break;
 	case SANDBOX_PINMUX_CS:
 	case SANDBOX_PINMUX_PWM:
+	case SANDBOX_PINMUX_ONEWIRE:
 		mux = BIT(pin_selector);
 		break;
 	default:
diff --git a/include/dt-bindings/pinctrl/sandbox-pinmux.h b/include/dt-bindings/pinctrl/sandbox-pinmux.h
index 891af072e52..21c5a1762ab 100644
--- a/include/dt-bindings/pinctrl/sandbox-pinmux.h
+++ b/include/dt-bindings/pinctrl/sandbox-pinmux.h
@@ -13,6 +13,7 @@ 
 #define SANDBOX_PINMUX_GPIO 4
 #define SANDBOX_PINMUX_CS   5
 #define SANDBOX_PINMUX_PWM  6
+#define SANDBOX_PINMUX_ONEWIRE 7
 
 #define SANDBOX_PINMUX(pin, func) ((func) << 16 | (pin))