[PATCH 1/2] gpio: gpio-uclass: add OPEN_DRAIN flag parsing
Artem Lapkin
email2tema at gmail.com
Fri Jan 15 06:15:57 CET 2021
add GPIOD_OPEN_DRAIN flag which cant parsed properly
Problem: for example cant power video system for sm1 g12a socs
because OPEN_DRAIN flag cant parsed
DTS examples:
```
$ grep GPIO_OPEN_DRAIN\> arch/arm/dts/meson-*.dt*
arch/arm/dts/meson-g12a-sei510.dts: gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
arch/arm/dts/meson-g12a-u200.dts: gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
arch/arm/dts/meson-gx-libretech-pc.dtsi: gpio = <&gpio GPIOH_3 GPIO_OPEN_DRAIN>;
arch/arm/dts/meson-khadas-vim3.dtsi: gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
arch/arm/dts/meson-sm1-sei610.dts: gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
```
Signed-off-by: Artem Lapkin <art at khadas.com>
---
drivers/gpio/gpio-uclass.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index bad6b71e0c..6225f32457 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -574,6 +574,15 @@ int dm_gpio_set_value(const struct gpio_desc *desc, int value)
if (ret)
return ret;
+ if (desc->flags & GPIOD_OPEN_DRAIN) {
+ if (value)
+ gpio_get_ops(desc->dev)->direction_input(desc->dev, desc->offset);
+ else
+ gpio_get_ops(desc->dev)->direction_output(desc->dev, desc->offset, 0);
+
+ return 0;
+ }
+
if (desc->flags & GPIOD_ACTIVE_LOW)
value = !value;
--
2.25.1
More information about the U-Boot
mailing list