Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 05 Apr 2020 14:33:12 +0400
From:      mishin@mh.net.ru
To:        freebsd-arm@freebsd.org
Subject:   pinctrl is not working for RPI2
Message-ID:  <db482bddfd5fd0c3ea7b000df623425d@mh.net.ru>

next in thread | raw e-mail | index | archive | help
Hi!
I write a character device driver for tm1637-display and want to 
initialize pins for it as output pins.
Now I do it by gpio_pin_setflags() from dev_attach(). But I wonder if I 
could do it from a fdt-overlay?
For OPI PC an overlay I wrote works fine (&pio instead &gpio) but RPI2 
seems to be ignoring its overlay:
/dts-v1/;
/plugin/;

/ {
   compatible = "brcm,bcm2836";
};

&gpio {
   tm1637_pins: tm1637_pins {
     brcm,pins = <20 21>; // GPIO20, GPIO21
     brcm,function = <0x1>; // out (initially)
     brcm,pull = <0x0>;
   };
};

&{/soc} {
   tm1637@0 {
     compatible = "tm1637";
     pinctrl-names = "default";
     pinctrl-0 = <&tm1637_pins>;
     gpios = <&gpio 20 0
              &gpio 21 0
             >;
     scl = <0>; // GPIO20 (38)
     sda = <1>; // GPIO21 (40)
     status = "okay";
   };
};

And after reboot "sysctl -b hw.fdt.dtb | dtc -O dts -I dtb" says:

soc {
.........
   tm1637@0 {

     status = "okay";
     sda = <0x1>;
     scl = <0x0>;
     gpios = <0x6 0x14 0x0 0x6 0x15 0x0>;
     pinctrl-0 = <0x67>;
     pinctrl-names = "default";
     compatible = "tm1637";
   };

.... skipped ....

   gpio@7e200000 {
.......
     tm1637_pins {

       phandle = <0x67>;
       brcm,pull = <0x0>;
       brcm,function = <0x1>;
       brcm,pins = <0x14 0x15>;
     };

But a "gpioctl -l" output reads:
....
pin 20:	1	pin 20<>
pin 21:	0	pin 21<>
.....

What have I done wrong?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?db482bddfd5fd0c3ea7b000df623425d>