[PATCH 2/4] gpio: rockchip: Add request() ops
Jonas Karlman
jonas at kwiboo.se
Sat May 11 13:28:13 CEST 2024
Some boards use pinctrl to set a non-gpio pinmux on a pin that is later
requested to be used for gpio output.
Add a request() ops that call pinctrl_gpio_request() when the required
gpio-ranges prop has been defined to signal pinctrl driver to use gpio
pinmux.
Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
---
PX30, RK3066, RK3188, RK356x and RK3588 are the only SoCs affected,
gpio-ranges props for remaining RK SoCs will be added in a follow up
series adding support for the pinmux status cmd.
---
drivers/gpio/rk_gpio.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/gpio/rk_gpio.c b/drivers/gpio/rk_gpio.c
index 2e901ac5c734..956894501633 100644
--- a/drivers/gpio/rk_gpio.c
+++ b/drivers/gpio/rk_gpio.c
@@ -126,6 +126,15 @@ static int rockchip_gpio_get_function(struct udevice *dev, unsigned offset)
return (data & mask) ? GPIOF_OUTPUT : GPIOF_INPUT;
}
+static int rockchip_gpio_request(struct udevice *dev, unsigned offset,
+ const char *label)
+{
+ if (CONFIG_IS_ENABLED(PINCTRL) && dev_read_bool(dev, "gpio-ranges"))
+ return pinctrl_gpio_request(dev, offset, label);
+
+ return 0;
+}
+
/* Simple SPL interface to GPIOs */
#ifdef CONFIG_SPL_BUILD
@@ -216,6 +225,7 @@ static int rockchip_gpio_probe(struct udevice *dev)
}
static const struct dm_gpio_ops gpio_rockchip_ops = {
+ .request = rockchip_gpio_request,
.direction_input = rockchip_gpio_direction_input,
.direction_output = rockchip_gpio_direction_output,
.get_value = rockchip_gpio_get_value,
--
2.43.2
More information about the U-Boot
mailing list