cancel
Showing results for 
Search instead for 
Did you mean: 

Setting GPIO_PUSH_PULL | GPIO_PULL_UP in the DTS

JSamo.2
Associate II

I am using an STM32MP151 in linux (5.4.56) and therefore using the DTS to setup some GPIOs i need.

I have difficulties setting up PUSH_PULL | PULL_UP configuration in the DTS for my GPIO, while, after linux has booted, using devmem i am successfull in altering the PUPDR for this GPIO and read the new config.

  • In my DTS:

main_ss_en-gpios = <&gpiod 13 (GPIO_ACTIVE_HIGH | GPIO_PUSH_PULL | GPIO_PULL_UP)>;

Howver, when i read the PUPDR register with devmem, this is all zero.

In my board, this gpiobank is at 0x50005000.

After Linux started up, using devmem, i can see:

# devmem 0x5000500c 

0x00001000

while it should read 0x08001000 or 0x04001000, depending if i set PU or PD.

If now i set one of those values, devmem should it correctly.

I tried to look at the gpio driver, pinctrl driver, etc ... i cannot see a reason why this is not applied upon parsing the dts.

Am i missing something here ?

THanks,

Jacques

3 REPLIES 3
Eldam
Senior

Jacques,

I've got similar issue, (need pull up for push button) solved by this kind of things in the dts:

you can check pullup/dn by using gpioinfo command line tool:

something like: gpioinfo gpiochip0

DTS PART:

&pinctrl {

   u-boot,dm-pre-reloc;   

   /*23/06/21: pullup sur bouton*/

   foo_pins_a: foo@0 {

           pins {

              pinmux =<STM32_PINMUX('F', 10, GPIO)>,<STM32_PINMUX('F', 11, GPIO)>,<STM32_PINMUX('F', 12, GPIO)>;

              bias-pull-up;

           };

   };

Elsewhere in the dts

   /*23/06/21: gestion bouton*/   

buttonkeys {

     compatible = "gpio-keys";

   status = "okay";

   pinctrl-names = "default";

   pinctrl-0 = <&foo_pins_a>;

   top-key-0 {

        label="top key";

   linux,code=<103>;        

       };

   bot-key-1 {

        label="bot key";

   linux,code=<108>;        

     };

   ok-key-2 {

        label="ok key";

   linux,code=<28>;        

     };

hopes it help a bit

JSamo.2
Associate II

Hi,

nice suggestion !

I will try it and keep the results posted here.

Thanks

Jacques

bgate.1
Associate II

got same problem, and Eldam's solution does not work on my machine.

[  4.103903] gpio-keys buttonkeys: Found button without gpio or irq

[  4.113005] gpio-keys: probe of buttonkeys failed with error -22