hi,Radhika Somaiya:
First of all, thank you very much for your help.
I mainly modified the following places:
1、 ECSPIx_DMAREG (RX_THRESHOLD TX_THRESHOLD)
2、spi_imx->tx_config.dst_maxburst
3、spi_imx->rx_config.src_maxburst
4、The return value of the spi_imx_can_dma() function
first:
When I set RX_THRESHOLD to 0x00
TX_THRESHOLD is set to 0x3f
result:
When the transmitted data is less than 64 bytes, spi uses PIO for data transmission and the transmission is successful.
When the transmitted data is larger than 64 bytes, the kernel prints the following information::
can't send spi message: Connectiospi_master spi1: failed to transfer one message from queue
n timed out
Aborted
next:Next, I modified it again in the spi_imx_sdma_init function.
spi_imx->tx_config.dst_maxburst = 1;
spi_imx->rx_config.src_maxburst = 1;
result:
When the transmitted data is less than 64 bytes, spi uses PIO for data transmission and the transmission is successful.
When the transmitted data is larger than 64 bytes, the dma transmission is used and the transmission is successful.
Next, I made changes in the spi_imx_can_dma function. I forced the spi_imx_can_dma() function to return true even if transfer->len < spi_imx_get_fifosize(spi_imx)
result:
When the transmitted data is less than 64 bytes, spi uses dma for data transmission and the transmission is successful.
When the transmitted data is larger than 64 bytes, the dma transmission is used and the transmission is successful.
So I think it might be a problem with spi_imx->tx_config.dst_maxburst and spi_imx->rx_config.src_maxburst. But in the file dmaengine.h it says:
* @src_maxburst: the maximum number of words (note: words, as in
* units of the src_addr_width member, not bytes) that can be sent
* in one burst to the device. Typically something like half the
* FIFO depth on I/O peripherals so you don't overflow it. This
* may or may not be applicable on memory sources.
* @dst_maxburst: same as src_maxburst but for destination target
* mutatis mutandis.
I want to ask, why is there such a problem?
Attachment is my spi-imx.c source code。