Device tree overlay for slave spi in verdin imx8mp

Hi,

I would like to convert the ECSPI1 form master to slave.
Module: Verdin iMX8M Plus
I’ve read this post:
verdin-imx8mp-spi-slave
and it looks like this can be done with modifications on the
verdin-imx8mp_spidev_overlay.dts file.
Could you please tell me where to find the original file? I could not find it in the git repository device-trees

Thank you

https://git.toradex.com/cgit/device-tree-overlays.git/tree/overlays/verdin-imx8mp_spidev_overlay.dts?h=toradex_5.15-2.1.x-imx

Hi @VMB !

Regarding using Verdin iMX8MP’s SPI as slave, there is the Using ECSPI as Slave in Linux for i.MX 8M Series application note from NXP which is certainly useful:

Also, this documentation about SPI slave support on Linux:

https://elinux.org/Tests:MSIOF-SPI-Slave

From the link above, we read from the “SPI Slave Support” section:

Due to the nature of SPI slave (simultaneous transmit and receive, while everything runs at the pace of the master), it has hard real-time requirements: once an SPI transfer is started by the SPI master, a software SPI slave must have prepared all data to be sent back to the SPI master. Hence without additional hardware support, an SPI slave response can never be a reply to a command being simultaneously transmitted, and SPI slave replies must be received by the SPI master in a subsequent SPI transfer.

But, anyway, the application note from NXP shares some nice inputs about SPI slave and you will find there a link to a set of patches, device tree, and C source code example to test SPI slave.

I hope this information is helpful to you :slight_smile:

Btw, thanks @brute for pointing out that link, but it doesn’t show how to set SPI slave.

Best regards,

Hi,

Thank you @brute for the link and @henrique.tx for the clarification.

Concerning the SPI slave in real time, the intention is to use the SPI interface to transfer data from an SPI master device (FPGA) to the SPI SLAVE (verdin module). It is not supposed that the SPI slave device processes this data and provides a reply. We would like to use the driver to perform this task through DMA. I hope the driver patches described in the AN13633 will allow to implement this feature.

  • Could you please confirmed that the driver described by NXP in the AN13633 and available for download here AN13633SW.zip is the one that is currently used in torizon?

  • Just for my personal knowledge, where can I find the code of the driver spi-imx.c that is actually used in my device, just to check if it is different from the one described in the patch? I apologize if this question makes no sense (I’m not really a software guru) .

Best Regards

Hi,

I think I found the file in the kernel source code at
http://git.toradex.com/linux-toradex.git

/drivers/spi/spi-imx.c

Best Regards

Hi @VMB !

As you already found, this is indeed the driver for ECSPI interfaces of Verdin iMX8MP.

We can find this out from Verdin iMX8MP’s device tree (imx8mp.dtsi « freescale « dts « boot « arm64 « arch - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules) and find out the driver that has one of the compatibles of the node. In this case, the compatible is fsl,imx8mp-ecspi or fsl,imx6ul-ecspi.

The spi-imx.c you found has the compatible fsl,imx6ul-ecspi.

If your questions were answered, please mark the most suitable question as the Solution :slight_smile:

Best regards,