[U-Boot] [PATCH] gpio: add gpio-hog support

Heiko Schocher hs at denx.de
Mon May 27 09:36:55 UTC 2019


Hello Michal,

Am 27.05.2019 um 09:13 schrieb Michal Simek:
> On 27. 05. 19 8:30, Heiko Schocher wrote:
>> add gpio-hog support. GPIO hogging is a mechanism
>> providing automatic GPIO request and configuration
>> as part of the gpio-controller's driver probe function.
>>
>> for more infos see:
>> doc/device-tree-bindings/gpio/gpio.txt
>>
>> Signed-off-by: Heiko Schocher <hs at denx.de>
> 
> I have tested it on zcu102 where I use gpio hogs for gt muxes.

Thanks!

> gpio hogs are handled and setup only when gpio controller is probed.

Yes, with my current approach ... If you need a gpio-hog in a gpio
device, wich is not used, you can add in board code:

gpio_hog_lookup_name("name_of_the_gpio_hog");

and gpio driver (and gpio hogs) get probed ... but not really nice...

> Do we have a way how to say that controllers with gpio hogs should be
> probed automatically?

No yet, but I am open for suggestions ;-)

> Right now you are calling it in post_probe which make sense but on the
> other hand if you find gpio hog in bind you should probe the whole
> driver without asking for request.

Yes, I also thought about this approach, but the problem is in

static int gpio_hog(struct udevice *dev)
{
         ofnode node;
         struct gpio_dev_priv *uc_priv = NULL;

         uc_priv = dev_get_uclass_priv(dev);
         if (!uc_priv) {
                 printf("%s: missing private data.\n", __func__);
                 return -EINVAL;
         }

uc_priv is not valid @bind stage ...

But I can think of a function which scans all gpio nodes for
gpio hog subnodes, and call device_probe() ?

But from where should this function be called?

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