I'm writing a (mainline) SPI driver for de ads131 from TI which I would like to make use of DMA, on the orangePIzero H2, zero+ H3/H5 and nanopi NEO2+. On the 4.13.3-sunxi kernel (armbian 5.33), this works fine, the driver is automatically loaded when the associated devicetree overlay is loaded, and the DMA can be allocated. However, when I compile the same driver for newer kernels (4.14.17-sunxi, 4.14.39-sunxi, 4.14.67-sunxi armbian 5.59), the dma allocation no longer appears to work, while the SPI part of the devicetree is identical except for the phandle (checked with dtc -I fs /sys/firmware/devicetree/base on newest 4.14.67-sunxi kernel, since 4.14.65 headers were not available in newest 5.59 stretch mainline H3 image) and does specify the DMA addresses for the SPI controller:
Do I need to specify additional information in the devicetree for DMA to work in SPI drivers with newer kernels, or do I need to add something to my driver before trying to use DMA with newer kernels?
Question
Dennboy
Dear mainline developers,
I'm writing a (mainline) SPI driver for de ads131 from TI which I would like to make use of DMA, on the orangePIzero H2, zero+ H3/H5 and nanopi NEO2+. On the 4.13.3-sunxi kernel (armbian 5.33), this works fine, the driver is automatically loaded when the associated devicetree overlay is loaded, and the DMA can be allocated. However, when I compile the same driver for newer kernels (4.14.17-sunxi, 4.14.39-sunxi, 4.14.67-sunxi armbian 5.59), the dma allocation no longer appears to work, while the SPI part of the devicetree is identical except for the phandle (checked with dtc -I fs /sys/firmware/devicetree/base on newest 4.14.67-sunxi kernel, since 4.14.65 headers were not available in newest 5.59 stretch mainline H3 image) and does specify the DMA addresses for the SPI controller:
I use the following DMA calls that appear to fail in newer kernels, and the driver reverts to non-DMA spi transfers:
I get the following output from my driver in kernel 4.14.67-sunxi:
dennis@orangepizeroplus2:~$ dmesg |grep -i dma [ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool [ 0.091893] DMA: preallocated 2048 KiB pool for atomic coherent allocations [ 5.254126] ads131: spi->controller->can_dma=0x0 [ 5.255134] ads131a04 spi0.0: ads131: No suitable DMA available
I get the following with the older 4.13.3-sunxi kernel (armbian 5.33):
[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool [ 19.848567] ads131: spi->controller->can_dma=0x0 [ 19.849538] ads131: dma 64 bit [ 19.849544] ads131: dma_mask=18446744073709551615 [ 19.849564] xfer dma memory allocated with 16 buffers
Do I need to specify additional information in the devicetree for DMA to work in SPI drivers with newer kernels, or do I need to add something to my driver before trying to use DMA with newer kernels?
Kind regards,
Dennis
Link to comment
Share on other sites
3 answers to this question
Recommended Posts