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

Heiko Schocher hs at denx.de
Mon May 27 12:06:03 UTC 2019


Hello Michal,

Am 27.05.2019 um 13:34 schrieb Michal Simek:
> On 27. 05. 19 12:49, 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>
>>
>> ---
>> not yet started clean travis build, see result:
>> https://travis-ci.org/hsdenx/u-boot-test/builds/537732421
>>
>> Changes in v2:
>> - move gpio_hog() call from post_probe() to post_bind()
>>    call. Check if current gpio device has gpio-hog
>>    definitions, if so, probe it.
> 
> I am using i2c to gpio chip and with v2 this chip is not listed via dm
> completely. It means something is wrong for sure.

What do you mean with "this chip is not listed via dm completely" ?

> It looks like that parent is not probed that's why it is failing.

I use this on the aristainetos board, work currently on rework for DM/DT
usage in U-Boot, dts not yet in u-boot but in linux, see:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi#n286

and added for u-boot now gpio hog definitons:

&i2c3 {
         pinctrl-names = "default";
         pinctrl-0 = <&pinctrl_i2c3>;
         status = "okay";

         expander: tca6416 at 20 {
                 compatible = "ti,tca6416";
                 reg = <0x20>;
                 #gpio-cells = <2>;
                 gpio-controller;

                 env_reset {
                         gpio-hog;
                         input;
                         gpios = <6 GPIO_ACTIVE_LOW>;
                 };
                 boot_rescue {
                         gpio-hog;
                         input;
                         gpios = <7 GPIO_ACTIVE_LOW>;
                 };
         };
};

works fine for me ...

=> dm tree
  Class     Index  Probed  Driver                Name
-----------------------------------------------------------
  root         0  [ + ]   root_driver           root_driver
[...]
  i2c          2  [ + ]   i2c_mxc               |   |   |-- i2c at 21a8000
  gpio         7  [ + ]   pca953x               |   |   |   |-- tca6416 at 20

=> gpio status
[...]
Bank gpio at 20_:
gpio at 20_6: input: 0 [x] env_reset.gpio-hog
gpio at 20_7: input: 1 [x] boot_rescue.gpio-hog
=>

Hmm.. how can I reproduce your problem?

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