[PATCH v3 13/21] gpio: add support of new GPIO direction flag

Simon Glass sjg at chromium.org
Thu Jan 30 03:18:11 CET 2020


On Mon, 13 Jan 2020 at 03:35, Patrick Delaunay <patrick.delaunay at st.com> wrote:
>
> This commit manages the new dir flags that can be used in gpio
> specifiers to indicate the pull-up or pull-down resistor
> configuration for output gpio (GPIO_PULL_UP, GPIO_PULL_DOWN)
> or the Open Drain/Open Source configuration for input gpio
> (GPIO_OPEN_DRAIN, GPIO_OPEN_SOURCE).
>
> These flags are already supported in Linux kernel in gpio lib.
>
> This patch only parse and save the direction flags in GPIO
> descriptor (desc->flags), it prepares the introduction of new ops
> to manage them.
> The GPIO uclass supports new GPIO flags from device-tree
> (GPIO_XXX define in include/dt-bindings/gpio/gpio.h)
> and translate them in the dir flags (GPIOD_XXX):
> - GPIO_PULL_UP     => GPIOD_PULL_UP
> - GPIO_PULL_DOWN   => GPIOD_PULL_DOWN
> - GPIO_OPEN_DRAIN  => GPIOD_OPEN_DRAIN
> - GPIO_OPEN_SOURCE => GPIOD_OPEN_SOURCE
>
> This patch also adds protection in the check_dir_flags function for
> new invalid configuration of the dir flags.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
> ---
>
> This patch was part of v2 08/14
> = gpio: add ops for configuration with dir flags
>
>
> Changes in v3:
> - Split the previous patch [PATCH v2 08/14] to help review
>
> Changes in v2: None
>
>  drivers/gpio/gpio-uclass.c | 30 ++++++++++++++++++++++++++++++
>  include/asm-generic/gpio.h |  6 +++++-
>  2 files changed, 35 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list