we are trying to achieve a stable >=20 MHz communication to a SPI slave device.
When looking at SPI signals with a logic analyzer, we are able to get 25MHz transfer speeds but there are some gaps after every three 8-bit words. We tried both spidev's read/write interface (which is the same used by MRAA), spidev's ioctl for full-duplex messages and a dedicated kernel module. After investigating a little more in kernel space, it appears that the spi-pxa2xx driver is defaulting to PIO and not using DMA, which explains why we are getting gaps during the transfer. In our kernel module both the tx and rx buffers are 8-bytes aligned, which is the requirement for streaming DMA transfers.
Our application needs to reliably send burst of 1-2 kbytes at steady transfer rate. We will be using a kernel module for that, but without DMA it's impossible to achieve full bandwidth usage, besides performance issues as well.
I see that there are a bunch of relevant commits in recent kernels (>4.4 provided on the board) regarding DMA on spi-pxa2xx. Do you think they could solve the issue and eventually be backported to 4.4?
Thanks for your interest in the Intel® Joule platform.
I appreciate all the information provided. I'm not sure if those commits in recent kernels could solve the issue, however, you could try them and share your results. Moreover, I would like to investigate a little bit more and as soon as I have relevant information I'll let you know.
Thanks for your patience.
thanks for the answer.
We actually figured out that we were not filling out the spi_board_info.controller_data struct before initializing our protocol driver.
If this is not set, spi-pxa2xx relies on a ACPI definition for enabling the DMA, and it seems that the relevant definition is not present in the current DSDT.
However, in recent kernels the driver is robust to this info missing from ACPI and DMA is always used. We were able to backport these changes to the 4.4 Kernel in Ostro XT, and we are also properly setting the controller_data in our protocol driver.
Still, for other people that rely on spidev and might benefit from DMA, you might want to investigate if with a new BIOS release it's possible to provide spi-pxa2xx the info that it's looking for enabling DMA
Great to know that you solved the issue! Also, thank you very much for your feedback, it is very appreciated, I'll inform the proper team about that, so they can consider that for new BIOS releases, any updates I'll share them in the thread.
Have a nice day!