This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BEAGLEBK: GPIO device tree settings

Part Number: BEAGLEBK

Hi,

I have a customized design that is based on Beaglebone Black, but some of GPIOs are changed for other purposes. For example, GPIO2_30 is used as a GPIO input. I modified the device tree in-place in dts/am335x-bone-common.dtsi like below:

mmc1_pins: pinmux_mmc1_pins {
                pinctrl-single,pins = <
                        AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7)              /* spio0_cs1.gpio0_6 */

                        ...
                        AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE7)       /* mmc0_clk.gpio2_30 */
                        AM33XX_IOPAD(0x9a0, PIN_INPUT | MUX_MODE4)              /* mcasp0_aclkr.mmc0_sdwp */
                >;
        };

Question: I know this works, but I wonder what is the typical way (best practice) to modify default device tree for customized GPIOs? The software is built from meta-ti Rocko branch tag "ti2018.03" using Yocto build system.

Thank you for your help.

  • Hi Matt,

    If this gpio2_30 pin is used by MMC1 (i.e. card detect), then it is correct to make its pinmux under pinmux_mmc1_pins.

    But if this gpio2_30 pin is NOT related to MMC1 at all, then I would recommend you to make its pinmux in the node it is related to.

    For example, in am335x-moxa-uc-8100-me-t.dts file, gpio3_21 is used for push button, as is configured in push_button node:

    &am33xx_pinmux {

    push_button_pins: pinmux_push_button {
            pinctrl-single,pins = <
                AM33XX_IOPAD(0x9ac, PIN_INPUT_PULLDOWN | MUX_MODE7)    /* mcasp0_ahcklx.gpio3_21 */
            >;
        };

    }

    &buttons {
        pinctrl-names = "default";
        pinctrl-0 = <&push_button_pins>;
        #address-cells = <1>;
        #size-cells = <0>;

        button@0 {
            label = "push_button";
            linux,code = <0x100>;
            gpios = <&gpio3 21 GPIO_ACTIVE_LOW>;
        };
    };

    buttons: push_button {
            compatible = "gpio-keys";
        };



  • Hi Pavel,

    This gives me a good guideline of modifying GPIO device tree. Specifically, I followed this post - https://e2e.ti.com/support/processors/f/791/t/547425 and that solves the problem.

    Thank you.