Solved - H3 SPI with DMA using mainline kernel


Recommended Posts

Using the dev build of Armbian for the OrangePi One, does the SPI driver in the mainline kernel support DMA?

According to the mainline status page the work on SPI is done, and DMA has been supported since 4.2

 

I have enabled the spi interface in the device tree and my driver initialises properly with the master.  But in my kernel driver I attempt to allocate some memory with dma_alloc_coherent and it fails.  The driver works fine with the legacy kernel and with alternative hardware (raspberry pi). 

 

Is there some additional configuration needed or does anyone have any pointers to information on this that I look at?

 

--edit

Solved it - the mainline driver doesn't like the GFP_DMA flag being present on the dma_alloc_coherent call.

Edited by robert@axium.co.nz
solved
Link to post
Share on other sites
Armbian is a community driven open source project. Do you like to contribute your code?

Hi Robert,

 

I recently looked at the spi controller driver and discovered that the DMA configuration is not used by the SPI controller. It found that dma_set_mask_and_coherent only gives a result until kernel version 4.13.3 (and maybe a bit later), and fails after kernel version 4.14.39 and later).

 

The result is that the DMA configured for SPI is silently ignored, and regular SPI transfers are done instead.

 

Can you confirm that you don't see any performance improvement with DMA enabled?
 

Kind regards,

Dennis

 

Link to post
Share on other sites
Guest
This topic is now closed to further replies.