I’m looking for help understanding the device tree overlay syntax. As an example, let’s say I’m trying to configure P8.12 to be a PRU input with a pull up.
This overlay configures P8.12 as a PRU input, but doesn’t have the pull up:
I see the definition for P8_12_pruin_pin
PIN_INPUT could easily be changed to PIN_INPUT_PULLUP in the P8_12_pruin_pin definition, but I’d like to only make changes my own overlay. I can’t figure out how to do that, though. What change to BBAI-PRUIN_PRU1_0.dts would configure P8_12 to be a PRU input pull up?
Right, and I have that going, but I’d prefer not to change the global am5729-beagleboneai.dtb. Instead, I’d like to only change my individual overlay. Is there a way to achieve that? I’m not familiar enough with the device tree syntax to know.
I would guess something like this in the overlay, but I can’t figure out the right syntax:
Turns out I had a couple things wrong. First, I wasn’t including the proper headers to get the P8_12, PIN_INPUT_PULLUP, and MUX_MODE12 macros. dtc was helpful enough to report something was wrong exactly at those macros, but it took me a while to make the connection that it was because they weren’t defined.
Next, defining a new P8_12_pruin_pu_pin entry under &dra7_pmx_core worked from my overlay (rather than trying to stick the definition into the ocp pinctrl-0 entry some how.
So, the particular modifications for the initial example would result in:
/dts-v1/;
/plugin/;
// Add this to get PIN_INPUT_PULLUP and MUX_MODE12 macros
#include <dt-bindings/pinctrl/dra.h>
// Add this to get P8_12 macro
#include <dt-bindings/board/am572x-bone-pins.h>
&{/chosen} {
overlays {
BBAI-PRUIN_PRU1_0 = __TIMESTAMP__;
};
};
// Add a new pin mode for PRU input pullup
&dra7_pmx_core {
P8_12_pruin_pu_pin: pinmux_P8_12_pruin_pu_pin { pinctrl-single,pins = <
P8_12( PIN_INPUT_PULLUP | MUX_MODE12) >; };
}
&ocp {
P8_11_pinmux { pinctrl-0 = <&P8_11_pruin_pin>; }; /* pr1_pru0_gpi4 */
// Use the new 8.12 PRU input pullup definition from above
P8_12_pinmux { pinctrl-0 = <&P8_12_pruin_pu_pin>; }; /* pr1_pru0_gpi3 */
P9_15_pinmux { pinctrl-0 = <&P9_15_pruin_pin>; }; /* pr1_pru0_gpi5 */
P9_26_pinmux { pinctrl-0 = <&P9_26_pruin_pin>; }; /* pr1_pru0_gpi17 */
};