[PATCH] gpio: search for gpio label if gpio is not found through bank name

Simon Glass sjg at chromium.org
Tue Dec 10 13:39:43 CET 2019


Hi Heiko,

On Wed, 30 Oct 2019 at 04:29, Heiko Schocher <hs at denx.de> wrote:
>
> dm_gpio_lookup_name() searches for a gpio through
> the bank name. But we have also gpio labels, and it
> makes sense to search for a gpio also in the labels
> we have defined, if no gpio is found through the
> bank name definition.
>
> This is useful for example if you have a wp pin on
> different gpios on different board versions.
>
> If dm_gpio_lookup_name() searches also for the gpio labels,
> you can give the gpio an unique label name and search
> for this label, and do not need to differ between
> board revisions.
>
> Signed-off-by: Heiko Schocher <hs at denx.de>
> ---
>
> Example on the aristainetos board:
>
> => gpio clear wp_spi_nor.gpio-hog
> gpio: pin wp_spi_nor.gpio-hog (gpio 47) value is 0
> =>
>
> before this patch, you need to know where your
> pin is:
>
> => gpio clear GPIO2_15
> gpio: pin GPIO2_15 (gpio 47) value is 0
> =>
>
> travis build:
> https://travis-ci.org/hsdenx/u-boot-test/builds/604290746
>
>  drivers/gpio/gpio-uclass.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)

Thanks for making this so clear.

I have been wondering whether this should be enabled by a CONFIG but
in fact it doesn't add much and the lookup function is only called by
those who are not using the device-tree phandle mechanism.

But I think it needs two changes:
- Move code into a separate function called from dm_gpio_lookup_name()
- Add a sandbox test for both cases

Regards,
Simon


More information about the U-Boot mailing list