[PATCH v3 2/3] gpio: search gpio-line-names property in dm_gpio_lookup_name
Heiko Schocher
hs at nabladev.com
Wed Nov 5 06:52:26 CET 2025
Hello Rasmus,
On 04.11.25 18:44, Rasmus Villemoes wrote:
> In scripts as well as interactively, it's much nicer to be able to
> refer to GPIOs via their names defined in the device tree property
> "gpio-line-names", instead of the rather opaque names derived from the
> bank name with a _xx suffix. E.g.
>
> gpio read factory_reset FACTORY_RESET
> if test $factory_reset = 1 ; then ...
>
> versus
>
> gpio read factory_reset gpio at 481ac000_16
> if test $factory_reset = 1 ; then ...
>
> This is also consistent with the move on the linux/userspace side towards
> using line names instead of legacy chip+offset or the even more legacy
> global gpio numbering in sysfs.
>
> As dev_read_stringlist_search() depends on both OF_CONTROL and
> OF_LIBFDT (which matters for the SPL case), we need some .config
> conditional. However, it only adds about ~50 bytes of code to U-Boot
> proper, and dm_gpio_lookup_name() most often ends up being GC'ed for
> SPL, thus adds no overhead there, so for now make it a hidden symbol
> which is merely a convenient shorthand for
> CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(OF_LIBFDT).
>
> Signed-off-by: Rasmus Villemoes <ravi at prevas.dk>
> ---
> drivers/gpio/Kconfig | 16 ++++++++++++++++
> drivers/gpio/gpio-uclass.c | 11 ++++++++++-
> 2 files changed, 26 insertions(+), 1 deletion(-)
I can remember, that I also experimented with such an approach.
Reviewed-by: Heiko Schocher <hs at nabladev.com>
bye,
Heiko
(Changed my EMail address)
--
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office at nabladev.com
Geschäftsführer : Stefano Babic
More information about the U-Boot
mailing list