pinctrl is not working for RPI2
    mishin at mh.net.ru 
    mishin at mh.net.ru
       
    Sun Apr  5 10:33:40 UTC 2020
    
    
  
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 at 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 at 0 {
     status = "okay";
     sda = <0x1>;
     scl = <0x0>;
     gpios = <0x6 0x14 0x0 0x6 0x15 0x0>;
     pinctrl-0 = <0x67>;
     pinctrl-names = "default";
     compatible = "tm1637";
   };
.... skipped ....
   gpio at 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?
    
    
More information about the freebsd-arm
mailing list