Can't use ECSPI DMA function

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can't use ECSPI DMA function

968 Views
1282497337
Contributor II

Hi,

    I want to use the ECSPI DMA function to transfer large amounts of data ,But i tesed in linux V3.14.52,it's used PIO function to transfer data,cause the CPU usage over 30%.Then I find the the driver spi-imx.c in /driver/spi directory,Only one transfer data size bigger than spi FIFO size(64 Bytes) will use the DMA function to transfer.

static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi, struct spi_transfer *transfer)

{
      struct spi_imx_data *spi_imx = spi_master_get_devdata(master);

 if (spi_imx->dma_is_inited && (transfer->len > spi_imx_get_fifosize(spi_imx)))
      return true;
 return false;
}

Yeah, I used the spi_write to transfer one times  the data size less than 64Bytes(the size limited by our hardware).but I will transfer a lot of times,then my question is How to solve this contradiction.

our board is Imx6D7C and used the linux kernel is 3.14.52. 
could you give me some help !

best regards
Alee

Tags (3)
0 Kudos
2 Replies

628 Views
igorpadykov
NXP Employee
NXP Employee

Hi Alee

in general changing sdma behaviour may require modifying sdma scripts and

this can be supported only with NXP Professional Services:

NXP Professional Services|NXP 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

628 Views
1282497337
Contributor II

Hi igor

     Thank you for your reply,I tested the SPI Master, used driver spidev & app is spidev_test 

if i  transfer 80 byte at a time,spi master will use the DMA,and used the cpu 5.6% ,then transfer 60 bytes not use DMA , the cpu is 6.0%,but once transfer 2 bytes ,cpu more than 45%,I think is the system call  cause this problem . 

     when i communicate with SPI Slave device ,I must read or write the device register and will transfer 1 or 2 bytes at a time then resulting in high occupancy rate.do you have any idea to solve this problem