[PATCH v4 10/16] dm: gpio: Add a way to update flags

Köry Maincent kory.maincent at bootlin.com
Mon Feb 8 10:00:03 CET 2021


On Thu,  4 Feb 2021 21:22:03 -0700
Simon Glass <sjg at chromium.org> wrote:

> It is convenient to be able to adjust some of the flags for a GPIO while
> leaving others alone. Add a function for this.
> 
> Update dm_gpio_set_dir_flags() to make use of this.
> 
> Also update dm_gpio_set_value() to use this also, since this allows the
> open-drain / open-source features to be implemented directly in the
> driver, rather than using the uclass workaround.
> 
> Update the sandbox tests accordingly. This involves a lot of changes to
> dm_test_gpio_opendrain_opensource() since we no-longer have the direciion
> being reported differently depending on the open drain/open source flags.
> 
> Also update the STM32 drivers to let the uclass handle the active low/high
> logic.
> 
> Drop the GPIOD_FLAGS_OUTPUT() macro which is no-longer used.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
> Changes in v4:
> - Update dm_gpio_set_dir_flags() to clear direction flags first
> 
> Changes in v3:
> - Incorporate GPIOD_FLAGS_OUTPUT() changes from Patrick Delaunay
> 
>  drivers/gpio/gpio-uclass.c      |  75 ++++++++++++++----
>  drivers/gpio/stm32_gpio.c       |   3 +-
>  drivers/pinctrl/pinctrl-stmfx.c |   5 +-
>  include/asm-generic/gpio.h      |  31 ++++++--
>  test/dm/gpio.c                  | 132 ++++++++++++++++++++++++++++----
>  5 files changed, 203 insertions(+), 43 deletions(-)
> 

Tested-by: Kory Maincent <kory.maincent at bootlin.com>


More information about the U-Boot mailing list