How to use SPI FIFO in interrupt mode? or must use DMA+FIFO?
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.
How to use SPI FIFO in interrupt mode? or must use DMA+FIFO?
If you don't use DMA (by removing it from the spi device tree node), it should use interrupt mode automatically.
Regards, Andreas
Hi,Andreas,
Yes, that is for how to use or not use DMA. I want to check how to use FIFO in interrupt mode.
Customer checked the driver code, FIFO combined DMA mode together, so ask the question.
If you don't use DMA (by removing it from the spi device tree node), it should use interrupt mode automatically.
Actually in SDK v9.1, DMA is not used for `main_spi0`. Customers have been adding it as needed, but by default it's not included.
Regards, Andreas
Actually customer is asking how to use SPI FIFO with current driver in interrupt mode.
Hi Tony,
Actually customer is asking how to use SPI FIFO with current driver in interrupt mode.
I checked the spi-omap2-mcspi.c driver, and based on this I found that using FIFO requires enabling the DMA with that existing driver. There's only one place in the code that activates/configures the FIFO by calling omap2_mcspi_set_fifo(,,1), which is only done when DMA is enabled, see below:
drivers/spi/spi-omap2-mcspi.c
static int omap2_mcspi_transfer_one(struct spi_master *master,
struct spi_device *spi,
struct spi_transfer *t)
{
<...snip...>
if (t->len) {
unsigned count;
if ((mcspi_dma->dma_rx && mcspi_dma->dma_tx) &&
master->cur_msg_mapped &&
master->can_dma(master, spi, t))
omap2_mcspi_set_fifo(spi, t, 1);
omap2_mcspi_set_enable(spi, 1);
The same applies across SDK v8.x (Kernel v5.10) and SDK v9.x (Kernel v6.1).
Regards, Andreas
Tony,
while analyzing Kernel differences I found that there's actual an upstream commit that enables non-DMA FIFO mode, but then disables/removes it again, see related discussion here:
https://lore.kernel.org/linux-kernel/c398a28b-8fca-483c-ae1d-588c2c081190@sirena.org.uk/T/
Basically, it seems challenging to get this feature to work correctly, hence it is not available at the moment. I'm checking with the developer if there's a chance that it can be made work at all but from the description it sounds like that won't be possible. But I'll update this thread again should this perspective change.
Regards, Andreas
Hi Tony,
after checking with the development team I have some updates to share. Can you please try the attached patch that enables the use of FIFO without DMA in conjunction with the SDK v8.x you are using to see if this has any positive impact on your scenario. While this is an improved version of what I discussed in my last post, this attached patch/solution is still not considered "production" yet. An official/further-improved solution is planned for SDK v10.
I've done some bench testing today with this patch, and it seems to work well for what I tried. It can also see it shifting CPU loading some, so it does have some system/timing impact for sure.
Regards, Andreas
https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/0001_2D00_spi_2D00_omap2_2D00_mcspi_2D00_Add_2D00_FIFO_2D00_support_2D00_without_2D00_DMA.patch