sandbox: Fix pinmux warnings with non-test devicetrees

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
pre-relocation to avoid ENODEV errors. Then, convert the pin groups and
functions to the new style, adding onewire group as well.

Fixes: 7f0f1806e3 ("test: pinmux: Add test for pin muxing")
Closes: https://source.denx.de/u-boot/u-boot/-/issues/2
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Sean Anderson 2024-08-15 22:38:22 -04:00 committed by Tom Rini
parent 101d9a6a53
commit 274e0c7299
3 changed files with 12 additions and 7 deletions

View file

@ -231,23 +231,25 @@
}; };
pinctrl { pinctrl {
bootph-some-ram;
compatible = "sandbox,pinctrl"; compatible = "sandbox,pinctrl";
status = "okay"; status = "okay";
pinctrl_i2c0: i2c0 { pinctrl_i2c0: i2c0 {
groups = "i2c"; groups = "I2C_UART";
function = "i2c"; function = "I2C";
bias-pull-up; bias-pull-up;
}; };
pinctrl_serial0: uart0 { pinctrl_serial0: uart0 {
groups = "serial_a"; bootph-some-ram;
function = "serial"; groups = "I2C_UART";
function = "UART";
}; };
pinctrl_onewire0: onewire0 { pinctrl_onewire0: onewire0 {
groups = "w1"; pins = "P8";
function = "w1"; function = "ONEWIRE";
bias-pull-up; bias-pull-up;
}; };
}; };

View file

@ -42,7 +42,7 @@ static const char * const sandbox_pins_muxing[][2] = {
{ "GPIO0", "SPI CS0" }, { "GPIO0", "SPI CS0" },
{ "GPIO1", "SPI CS1" }, { "GPIO1", "SPI CS1" },
{ "GPIO2", "PWM0" }, { "GPIO2", "PWM0" },
{ "GPIO3", "PWM1" }, { "GPIO3", "ONEWIRE" },
}; };
#define SANDBOX_GROUP_I2C_UART 0 #define SANDBOX_GROUP_I2C_UART 0
@ -63,6 +63,7 @@ static const char * const sandbox_functions[] = {
FUNC(GPIO), FUNC(GPIO),
FUNC(CS), FUNC(CS),
FUNC(PWM), FUNC(PWM),
FUNC(ONEWIRE),
#undef FUNC #undef FUNC
}; };
@ -166,6 +167,7 @@ static int sandbox_pinmux_set(struct udevice *dev, unsigned pin_selector,
break; break;
case SANDBOX_PINMUX_CS: case SANDBOX_PINMUX_CS:
case SANDBOX_PINMUX_PWM: case SANDBOX_PINMUX_PWM:
case SANDBOX_PINMUX_ONEWIRE:
mux = BIT(pin_selector); mux = BIT(pin_selector);
break; break;
default: default:

View file

@ -13,6 +13,7 @@
#define SANDBOX_PINMUX_GPIO 4 #define SANDBOX_PINMUX_GPIO 4
#define SANDBOX_PINMUX_CS 5 #define SANDBOX_PINMUX_CS 5
#define SANDBOX_PINMUX_PWM 6 #define SANDBOX_PINMUX_PWM 6
#define SANDBOX_PINMUX_ONEWIRE 7
#define SANDBOX_PINMUX(pin, func) ((func) << 16 | (pin)) #define SANDBOX_PINMUX(pin, func) ((func) << 16 | (pin))