[PATCH v3] gpio: Use separate bitfield array to indicate GPIO is claimed
Simon Glass
sjg at chromium.org
Wed Aug 2 15:34:21 CEST 2023
On Tue, 1 Aug 2023 at 17:26, Marek Vasut <marex at denx.de> wrote:
>
> The current gpio-uclass design uses name field in struct gpio_dev_priv as
> an indicator that GPIO is claimed by consumer. This overloads the function
> of name field and does not work well for named pins not configured as GPIO
> pins.
>
> Introduce separate bitfield array as the claim indicator.
>
> This unbreaks dual-purpose AF and GPIO operation on STM32MP since commit
> 2c38f7c31806 ("pinctrl: pinctrl_stm32: Populate uc_priv->name[] with pinmux node's name")
> where any pin which has already been configured as AF could no longer be
> claimed as dual-purpose GPIO. This is important for pins like STM32 MMCI
> st,cmd-gpios .
>
> Signed-off-by: Marek Vasut <marex at denx.de>
> ---
> Cc: Michal Suchanek <msuchanek at suse.de>
> Cc: Patrice Chotard <patrice.chotard at foss.st.com>
> Cc: Patrick Delaunay <patrick.delaunay at foss.st.com>
> Cc: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> Cc: Samuel Holland <samuel at sholland.org>
> Cc: Simon Glass <sjg at chromium.org>
> ---
> V2: Add set/clear helpers
> V3: Define GPIO_ALLOC_BITS, update calloc() invocation accordingly
> ---
> drivers/gpio/gpio-uclass.c | 64 +++++++++++++++++++++++++++++++++++---
> include/asm-generic/gpio.h | 2 ++
> 2 files changed, 61 insertions(+), 5 deletions(-)
Reviewed-by: Simon Glass <sjg at chromium.org>
The GPIO tests should already provide coverage for this so I don't
believe this needs any more tests.
More information about the U-Boot
mailing list