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.

AM5718: SPI slave support in Ti AM5718 linux SDK

Part Number: AM5718

I am using customized board using AM5718 SoC. I am trying to test SPI master to slave loopback (SPI1 being master and SPI2 being slave). I already made changes in dts and now i can see the spidev2.0 inside spi_slave. But no data is reaching at SPI slave interface. I tested earlier with PDK (Ti RTOS) and it was working. Do we have SPI slave support in Ti AM5718 linux SDK??

  • Hi Ashish,

    What is the Linux SDK version that you are using ? Also can you please share the changes done in the dts ?

  • Hi Dwarakesh,

    Thanks for quick reply. I am using SDK version: ti-processor-sdk-linux-am57xx-evm-06.02.00.81 and linux version: linux-4.19.79

    DTS change:

    &mcspi1 {
    status="okay";
    ti,pindir-d0-out-d1-in;
    ti,spi-num-cs= <0x00000002>;
    spidev1@0 {
    compatible = "linux,spidev";
    reg = <0x00000000>;
    spi-max-frequency = <0x02dc6c00>;
    };
    };

    &mcspi2{
    status="okay";
    ti,pindir-d0-out-d1-in;
    spi-slave;
    ti,spi-num-cs= <0x00000001>;
    spidev2@0 {
    compatible = "linux,spidev";
    reg = <0x00000000>;
    spi-max-frequency = <0x02dc6c00>;
    };
    };

    or i am also sharing the dts converted from final dtb:

    spi@48098000 {
    compatible = "ti,omap4-mcspi";
    reg = <0x48098000 0x200>;
    interrupts = <0x0 0x3c 0x4>;
    #address-cells = <0x1>;
    #size-cells = <0x0>;
    ti,hwmods = "mcspi1";
    ti,spi-num-cs = <0x2>;
    dmas = <0x92 0x23 0x92 0x24 0x92 0x25 0x92 0x26 0x92 0x27 0x92 0x28 0x92 0x29 0x92 0x2a>;
    dma-names = "tx0", "rx0", "tx1", "rx1", "tx2", "rx2", "tx3", "rx3";
    status = "okay";
    ti,pindir-d0-out-d1-in;

    spidev1@0 {
    compatible = "linux,spidev";
    reg = <0x0>;
    spi-max-frequency = <0x2dc6c00>;
    };
    };

    spi@4809a000 {
    compatible = "ti,omap4-mcspi";
    reg = <0x4809a000 0x200>;
    interrupts = <0x0 0x3d 0x4>;
    #address-cells = <0x1>;
    #size-cells = <0x0>;
    ti,hwmods = "mcspi2";
    ti,spi-num-cs = <0x1>;
    dmas = <0x92 0x2b 0x92 0x2c 0x92 0x2d 0x92 0x2e>;
    dma-names = "tx0", "rx0", "tx1", "rx1";
    status = "okay";
    ti,pindir-d0-out-d1-in;
    spi-slave;

    spidev2@0 {
    compatible = "linux,spidev";
    reg = <0x0>;

    In kernel config i have enabled SPIDEV and SPI_SLAVE

    For slave device i run below command:

    echo spidev > /sys/class/spi_slave/spi2/slave

    Then after making connections (CLK-CLK, DIN-DOUT, CS-CS) between spi1 (master) and spi2(slave) i am running data, but it is not reaching slave.

  • Hi Ashish,

    I just checked that SPI slave is not supported : https://software-dl.ti.com/processor-sdk-linux/esd/docs/06_02_00_81/linux/Foundational_Components/Kernel/Kernel_Drivers/SPI.html

    But since there is some code already in the mcspi omap2 driver, you could spend time to check if it can be made to work

    Here are few questions and pointers:

    1. Were you able to see data by sniffing or in scope from SPI1 master coming out ?

    2. Can you please check TRM here : https://www.ti.com/lit/ug/spruhz7i/spruhz7i.pdf . I would request you to dump the registers using devmem2 and check these registers MCSPI_CHxCONF, MCSPI_CHxCTRL and MCSPI_CHxSTAT to see if SPI1 and SP2 are configured correctly

    Example for spi2 channel 0, CHCONF

    e.g. devmem2 0x4809A140