PRU and device tree for linux 3.8 (pinmux)


I’ve done some applications for the PRU using linux kernel 3.2. Now I’m in the procedure of moving on to 3.8, and there seem to be some changes in drivers/uio/uio_pruss.c

What I’m interested in, specifically, is the code in this driver that seems to fetch information about pin-configuration from the device tree, and after that doing the pinmux config (I’m not 100 % sure that is what the code does, but it seems so).

This would be a very nice soulution since it is then very easy to get around the problem with random values in the R30 register, causing random output data on GPIO’s from PRU’s. (it would be easy to add a reset of the R30 register before the pinmux config)

Does anybody have an example of a devicetree which specifies the pinmux config for PRU’s ? Seems that it should be done in a child node to the pru-node in the device tree. Would be nice to have an example.

br Håkan E.


I know this is not right, but I’ve put mine in am335x-bone-common.dtsi - I know these should all be in a separate file (fragment/overlay?) but I haven’t had the time to figure out the syntax, so this is working for now.

am33xx_pinmux: pinmux@44e10800 {
pinctrl-names = “default”;
pinctrl-0 = <&userleds_pins>;
pruss_pins: pruss_pins {
pinctrl-single,pins = <
/* Page 754 of am335x TRM */

/* PRU Pins /
0x30 0x16 /
gpmc_ad12.pr1_pru0_pru_r30[14], OUTPUT_PULLUP | MODE6 /
0x34 0x16 /
gpmc_ad13.pr1_pru0_pru_r30[15], OUTPUT_PULLUP | MODE6 /
0x38 0x36 /
gpmc_ad14.pr1_pru0_pru_r31[14], INPUT_PULLUP | MODE6 /
0x3C 0x36 /
gpmc_ad15.pr1_pru0_pru_r31[15], INPUT_PULLUP | MODE6 /
0x190 0x15 /
conf_mcasp0_aclkx.pr1_pru0_pru_r30[0], OUTPUT_PULLUP | MODE5 /
0x194 0x15 /
conf_mcasp0_fsx.pr1_pru0_pru_r30[1], OUTPUT_PULLUP | MODE5 /
0x198 0x15 /
conf_mcasp0_axr0.pr1_pru0_pru_r30[2], OUTPUT_PULLUP | MODE5 /
0x19C 0x36 /
conf_mcasp0_ahclkr.pr1_pru0_pru_r31[3], INPUT_PULLUP | MODE6 /
0x1A4 0x15 /
conf_mcasp0_fsr.pr1_pru0_pru_r30[5], OUTPUT_PULLUP | MODE5 /
0x1AC 0x15 /
conf_mcasp0_ahclkx.pr1_pru0_pru_r30[7], OUTPUT_PULLUP | MODE5 */


Then in am335x-bone.dts I have the following block:

&pruss {

status = “okay”;

pinctrl-names = “default”;

pinctrl-0 = <&pruss_pins>;



Hi Chris,


Yes, I did something similar, though I did not have a separate block for refering to the “pruss_pins block”. I set the reference to the “pruss_pins block” directly in the ordinary pruss-block.

As you said, this is probably not the way it is supposed to be done, but it works. I’ll look into this when I’ve learned more about how to deal with the device tree

br Håkan E