Search code examples
linux-kernelbeagleboneblackdevice-treepwm

Linux Kernel - Beagle Bone - PWM Pin Muxing - Device Tree


I'm trying to mux gpmc_ad9 pin in PWM mode through the device tree

file: arch/arm/boot/dts/am335x-boneblack.dts

&am33xx_pinmux {
    hw_pins: hw_pins {
        pinctrl-single,pins = <
             AM33XX_IOPAD(0x824, PIN_OUTPUT | MUX_MODE4)    /* gpmc_ad9.ehrpwm2B  */
        >;
     };
};

/ {
    soc {
        pinctrl-names = "default";
        pinctrl-0 = <&hw_pins>;
    };
};

However the debugfs still shows mode 7 for the pin

/sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single # cat pins | grep 824
pin 9 (PIN9) 44e10824 00000027 pinctrl-single

I don't see in the device tree that this pin get's redefined

What I'm doing wrong here?


Solution

  • I've found the solution, I had to put pinctrl properties inside another node. I guess that's because soc node already has pinctrl properties defined.

    &am33xx_pinmux {
        hw_pins: hw_pins {
            pinctrl-single,pins = <
                 AM33XX_IOPAD(0x824, PIN_OUTPUT | MUX_MODE4)    /* gpmc_ad9.ehrpwm2B  */
            >;
         };
    };
    
    / {
        soc {
            mydriver {
                  compatible = "mydriver";
    
                  pinctrl-names = "default";
                  pinctrl-0 = <&hw_pins>;
            };
           
        };
    };