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

Heiko Schocher hs at denx.de
Mon Feb 3 06:25:58 CET 2020


Hello Simon,

Am 03.02.2020 um 01:04 schrieb Simon Glass:
> On Sat, 1 Feb 2020 at 01:03, 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:
>>
>> Changes in v2:
>> - add comment from Simon Glass
>>    move code into seperate function dm_gpio_lookup_label()
>>    add test if dm_gpio_lookup_label() works
>>
>>   drivers/gpio/gpio-uclass.c | 38 ++++++++++++++++++++++++++++++++++++++
>>   test/dm/gpio.c             |  7 +++++++
>>   2 files changed, 45 insertions(+)
> 
> Reviewed-by: Simon Glass <sjg at chromium.org>
> 
> I wonder if this should be a Kconfig so we can disable it by default in SPL?

Hmm.. maybe a good idea for boards which have code size restrictions.
On the other hand, on such boards DM/DTS is most likely no option?

But it should be easy to add this into a Kconfig option, proposal

DM_GPIO_LOOKUP_LABEL ?

default: n for SPL and U-Boot ?

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list