diff options
author | Tom Rini <trini@konsulko.com> | 2020-05-12 09:23:15 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-05-12 09:23:15 -0400 |
commit | 1e6d9f515dfa6dbaf33095bf1e04d733da9fc41b (patch) | |
tree | 533fb609ba98d94946300e9170b92b6f4dae0a47 /drivers | |
parent | 2a38d2239d0bb4d128b00886bf097ab247a0b1a7 (diff) | |
parent | 9bf87e256c26246fa6d8df491617e40cb7df89c2 (diff) | |
download | u-boot-1e6d9f515dfa6dbaf33095bf1e04d733da9fc41b.tar.gz |
Merge tag 'u-boot-amlogic-20200511' of https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic
- Enable USB Host for Odroid-C2 board
- Add Open-Drain/Open-Source emulation in GPIO uclass
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpio/gpio-uclass.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 757ab7106e..d3cea11f76 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -526,6 +526,21 @@ int dm_gpio_set_value(const struct gpio_desc *desc, int value) if (desc->flags & GPIOD_ACTIVE_LOW) value = !value; + + /* + * Emulate open drain by not actively driving the line high or + * Emulate open source by not actively driving the line low + */ + if ((desc->flags & GPIOD_OPEN_DRAIN && value) || + (desc->flags & GPIOD_OPEN_SOURCE && !value)) + return gpio_get_ops(desc->dev)->direction_input(desc->dev, + desc->offset); + else if (desc->flags & GPIOD_OPEN_DRAIN || + desc->flags & GPIOD_OPEN_SOURCE) + return gpio_get_ops(desc->dev)->direction_output(desc->dev, + desc->offset, + value); + gpio_get_ops(desc->dev)->set_value(desc->dev, desc->offset, value); return 0; } |