GPIO configuartion in Device Tree Overlay and how to set a default value for an output pin

773 views
Skip to first unread message

Beagle Boner

unread,
Jul 7, 2017, 4:56:10 AM7/7/17
to BeagleBoard

Hi,

I´m currently getting more and more into the Device Tree and I have a basic overview how it works and how DTOs are written. I wrote an overlay to enable a GPIO as output. The Pinmux fragment works but I am not sure what is the "bone-pinmux-helper" (here in fragment@1) for. Some overlays I reviewed have this fragment and some not. So I´m not sure what it is doing and if I need this.

I created an little overlay here with this device tree overlay generator (http://www.kilobaser.com/blog/2014-07-28-beaglebone-black-devicetreeoverlay-generator) and commented my thoughts and question in blue.

/dts-v1/;
/plugin/;

/{
    compatible = "ti,beaglebone", "ti,beaglebone-black";
    part_number = "BS_PINMODE_P8_26_0xf";

    exclusive-use =
        "P8.26",
        "gpio1_29";

    fragment@0 {
        target = <&am33xx_pinmux>;
        __overlay__ {
            bs_pinmode_P8_26_0xf: pinmux_bs_pinmode_P8_26_0xf {
                pinctrl-single,pins = <0x07c 0xf>;
            };
        };
    };

    fragment@1 {
        target = <&ocp>;                               //targets the on-chip-peripherials (ocp) node in the Device Tree
        __overlay__ {
            bs_pinmode_P8_26_0xf_pinmux {              //creates a subnode with the name
"bs_pinmode_P8_26_0xf_pinmux"               
 compatible = "bone-pinmux-helper";     //what is the "bone-pinmux-helper" and where can i find more documentation on that?
                status = "okay";                       //what is actiaved here?
                pinctrl-names = "default";
                pinctrl-0 = <&bs_pinmode_P8_26_0xf>;   //refering to pincontroll settings from bs_pinmode_P8_26_0xf in fragment@0
            };
        };
    };
};

I want to drive an Enable Input of a display with that GPIO (don´t confuse with DE-Mode) which is active high. So my idea is that the display will be enabled when the DTO will be loaded through the cape manager. Is there a way to set 1 as a default value in the overlay for that output pin? (DTO is loaded > value is instantly 1?)

Cheers

Beagle Boner

unread,
Jul 11, 2017, 3:44:14 AM7/11/17
to BeagleBoard
Well I did a little workaround and made a script that will init the GPIO via sysfs in the way I want at system start. But I don´t need to set the pinmux via the overlay for that as far as i know.
echo "61" > /sys/class/gpio/export               #set gpio61 P8_26
echo "out" > /sys/class/gpio/gpio61/direction    #set gpio61 as output
echo "1" > /sys/class/gpio/gpio61/value          #set gpio61 to high

The fragment@1 I mentioned seems to affect
/sys/kernel/debug/pinctrl
But I still dont understand what it actually does.

fenc...@gmail.com

unread,
Apr 14, 2021, 1:10:18 PM4/14/21
to BeagleBoard
did you ever get to find a proper way to do this without this workaround?
Reply all
Reply to author
Forward
0 new messages