0

I want to use PRU for running McSPI throw register programming on beaglebone black. Therefore, I need to disable spidev (of that spi module) to manipulate register of mcspi according to Technical Reference Manual AM335x. in other words, i want to take control of spi module from spidev and use register level programming. How i can disable spidev module?

Also below command in my BBB, show that spidev of both spi modules is active:

root@beaglebone:~# ls /dev/sp*
/dev/spidev1.0  /dev/spidev1.1  /dev/spidev2.0  /dev/spidev2.1
1

The answer will vary a bit based on what GNU/Linux distribution and kernel version you're using, but in general you'll have to use a Device Tree or a Device Tree Overlay.

There, you'll want to disable spi1 and spi2 and mark the pins as controlled by the PRUs.

For Linux 4.4.x a Device Tree would look somehow like this:

/dts-v1/;

#include "am33xx.dtsi"
#include "am335x-bone-common.dtsi"
#include "am33xx-pruss-rproc.dtsi"

&am33xx_pinmux {
    pru_cape_bone_pins: pru_cape_bone_pins {
        pinctrl-single,pins = <
            BONE_P9_22 ( PIN_INPUT_PULLUP | MUX_MODE0 ) // SCLK
            BONE_P9_21 ( PIN_INPUT_PULLUP | MUX_MODE0 ) // MISO
            BONE_P9_18 ( PIN_OUTPUT_PULLUP | MUX_MODE0 ) // MOSI
            BONE_P9_17 ( PIN_OUTPUT_PULLUP | MUX_MODE0 ) // CS0
        >;
    };
};

&pruss {
    pinctrl-names = "default";
    pinctrl-0 = <&pru_cape_bone_pins>;
};

&spi0 {
    status = "disabled";
};

&spi1 {
    status = "disabled";
};

However: don't use this code as-is!

I'm not sure about included .dtsi files, the exact pins nor section/device names, also for other kernel versions some minor modifications could be required.

This is just an example I've based on my more complete Device Tree that enabled spidev and both I2C buses, set up some PRU pins etc - available here. Keep in mind it targeted BeagleBone Green Wireless running Debian Stretch with kernel 4.4.x.

While this isn't the most complete answer, I hope it'll lead you in the right direction.

  • 1
    Thanks @MJBogusz, it show me the way to find my direction. In the link , the code that i write for beaglebone black is there. – Bashid Oct 19 '18 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.