BBB - Yocto - Kirkstone - GPIO successful dts patch but gpio is not working

Hello,
I have problem making the gpios on BBB work. I prepare patch for the dts and apply it .
I think I have apply it successfully because when I check the “pins” file I get this.

$ cat /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pins
pin 36 (PIN36) 2:gpio-32-63 44e10890 0000000f pinctrl-single 
pin 37 (PIN37) 3:gpio-32-63 44e10894 0000000f pinctrl-single 

(it used to be 00000037 now its 0000000f)

I also added “gpioinfo” to my image by adding CORE_IMAGE_EXTRA_INSTALL += “libgpiod libgpiod-dev libgpiod-tools” to the recipe and now gpioinfo shows:

$ gpioinfo
gpiochip1 - 32 lines:
        line   2:       "P8_7"       unused  output  active-high 
        line   3:       "P8_8"       unused  output  active-high

I tried to control the pins in two ways

  1. using gpioset
    $ gpioset gpiochip1 2=1
  2. with /sys/clas/gpio
$ echo 66 > /sys/class/gpio/export
$ echo out > /sys/class/gpio/gpio66/direction
$ echo 0 > /sys/class/gpio/gpio66/value

However, neither one works.

These are details about my dts patch:

  1. linux-yocto/arch/arm/boot/dts/am335x-boneblack.dts - inside the file added
&am33xx_pinmux {
    pinctrl-names = "default";
    pinctrl-0 = <&gpio_pins>;

    status = "okay";  
};
  1. linux-yocto/arch/arm/boot/dts/am335x-bone-common.dtsi - inside the &am33xx_pinmux added
&am33xx_pinmux {
	pinctrl-names = "default";
	pinctrl-0 = <&clkout2_pin>;
.
.
	gpio_pins: pinmux_gpio_pins {
        pinctrl-single,pins = <
			AM33XX_PADCONF(AM335X_PIN_GPMC_ADVN_ALE, PIN_OUTPUT, MUX_MODE7)	/* gpio2_2 */
			AM33XX_PADCONF(AM335X_PIN_GPMC_OEN_REN, PIN_OUTPUT, MUX_MODE7)	/* gpio2_3 */			
        >;
    };
.
.
};

It seems that at some way the dts change that I patch is working. But this gpioinfo status “unused” bothers me.
I think that I’m missing something. Something else to enable the pgio pins.
Please help me.

Solution!

It turns out the the pins are mapped in wrong order.
instead of GPIO 66 i need to export GPIO 34.
I saw that in gpioinfo the gpiochips are swaped, but it turns out now that the
$gpioset gpiochip 12=0
command is not working at all.
Anyway I will investigate little bit more and will try to work in this way.

Note: This is he default way the pins are mapped when you download yocto, kirkstone and select beaglebone-yocto machine! I haven’t change nothing to get this problem!