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

Heiko Schocher hs at denx.de
Tue Jul 21 08:40:09 CEST 2020


Hi Michal,

Am 20.07.2020 um 10:30 schrieb Michal Simek:
> Hi Heiko,
> 
> pá 22. 5. 2020 v 11:10 odesílatel Heiko Schocher <hs at denx.de> napsal:
>>
>> 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>
>> Reviewed-by: Simon Glass <sjg at chromium.org>
>> ---
>>
>> 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
>> =>
> 
> I spotted this patch and I am curious if you have thought about also
> supporting gpio-line-names.

Yes, that would be a good extension!

searching for "gpio-line-names" in u-boot source shows only an entry in

./doc/device-tree-bindings/gpio/gpio.txt

and some DTS files in arch/arm

but no driver code, which handles the property, so there is some
work to do.

Currently I have no project (and time) to give this a chance...

But if the code, which handle "gpio-line-names" saves the name in
"struct gpio_dev_priv name", DM_GPIO_LOOKUP_LABEL based code should
work with it.

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