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.

AM3352: AM3352 SPI slave support for linux 5.10

Part Number: AM3352

Hello,

I am working on am3352 board with kernel ti-linux-kernel 5.10. I want add support for SPI Slave for SPI1 Interface

So, I changed the device tree with below configuration.

&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&am335x_spi1_pins>;
ti,pindir-d0-out-d1-in;
status = "okay";

#address-cells = <0>;
spi-slave;

spislave {
compatible = "spi-slave-system-control";
};

};

After sucessfully build i got this path /sys/class/spi_slave/spi2/ as result but as device refresh of spidev for master as /dev/spidev for the slave did not get anything in /dev/.

the kernel log for this one is: 

[ 2.387087] spi_slave spi2: /ocp/interconnect@48000000/segment@100000/target-module@a0000/spi@0/spislave is not called 'slave'
[ 2.398724] spi_slave spi2: Failed to create SPI device for /ocp/interconnect@48000000/segment@100000/target-module@a0000/spi@0/spislave

is anyone help me regarding this.

Thank You So Much in Advance

  • Hello,

    Please note that TI has not released a version of Linux 5.10 for AM335x, so we are limited in the assistance we can offer there.

    As of Linux SDK 6.3 (Linux kernel 4.19) the TI Linux SPI driver does not have support for running in slave mode. See my reply in this post for more details:
    (+) AM3356: AM3356 SPI Slave Treiber for Linux - Processors forum - Processors - TI E2E support forums

    We do not support custom driver development on the forums. However, there is a non-TI SPI slave driver mentioned in this thread:
    (+) AM3354: SPI Slave register read - Processors forum - Processors - TI E2E support forums

    Regards,

    Nick

  • Thank you Nick Saulnier

    but FYI, we clone the kernel from ti git repo and its latest version. we check the spi-omap2-mcspi.c and spi.c file and may be both have slave related configuration. 

    Also, After i changed belowed configuration in DTS file and spi driver using make menuconfig

    &spi1 {
    pinctrl-names = "default";
    pinctrl-0 = <&am335x_spi1_pins>;
    ti,pindir-d0-out-d1-in;
    status = "okay";
    spi-slave;

    slave {
    compatible = "linux,spidev,spi-slave-time";
    spi-max-frequency = <24000000>;
    };
    };

    then it build successfully,  and got the /sys/class/spi_slave/spi2/slave successfully. but did not communicate trough it. becuase of there is no interface at /dev/ for spi slave.

    root@arm:~# echo spi-slave-system-control > /sys/class/spi_slave/spi2/slave
    [ 182.011080] spi-slave-time spi2.0: SPI transfer failed: -5
    [ 182.022725] spi_slave spi2: failed to transfer one message from queue
    root@arm:~# echo spi-slave-system-control > /sys/class/spi_slave/spi2/slave
    [ 196.996568] spi-slave-system-control spi2.0: SPI transfer failed: -5
    [ 197.007951] spi_slave spi2: failed to transfer one message from queue

    is any one help regarding this?

    Thanks Again,

    Darpan

  • Hello Darpan,

    Note that ti-linux-kernel 5.10 is a development repo. So you are welcome to use it, but there will still be limited support on the forums since it has not undergone SDK testing.

    I am reaching out to the developer for comment. Please ping me if I have not replied within a couple of days.

    Regards,

    Nick

  • Hello Darpan,

    I checked with the developer. SPI slave code exists upstream as a part of kernel v5.4 and v5.10 branches. HOWEVER: the SPI slave mode has not been tested, and is not officially supported by TI. So it may or may not work.

    If you do get SPI slave working, note that it puts some very hard real-time processing requirements on Linux (SPI slave needs to behave per timelines set by SPI master). So it would probably make more sense to run SPI slave on RT Linux than regular Linux. In both cases, you would want to build appropriate protocols at a higher level to deal with potential data loss.

    Regards,

    Nick

  • Thank You Nick for responding. Please let me know if anything more related spi slave from your team.

    Thanks Again,

    Darpan

  • The only other information I got is that there are not currently plans to test the SPI slave mode. We will put out an AM335x Linux 5.4 SDK release in the next month or so, but SPI slave mode will continue to be unsupported.

    Regards,

    Nick