Post Go back to editing

Trouble setting up libiio dma buffer and xilinx dma

Category: Software

I'm trying to use libiio in my platform driver to facilitate data egress from the PL to the process subsystem via Xilinx AXI DMA, but I am getting an error with devm_iio_dmaengine_buffer_setup()

I followed some of the examples in the adi-linux project and in my tree. It seems fairly straightforward? My procedure is as follows:

1. get dma name from a device tree property of with my device, in my case it is 'axi_dma_psd'
2. allocate iio device
3. allocate iio channel specification (1 channel)
4. populate iio channel spec
5. setup dmaengine buffer, returns errno -19 (ENODEV)
6. register iio device

Here's my DMA symbol definition in the dts:

axi_dma_psd = "/amba_pl@0/dma@20180000000";

here's the Xilinx DMA node:

               dma@20180000000 {                          
                        xlnx,include-sg;                
                        clock-names = "s_axi_lite_aclk\0m_axi_sg_aclk\0m_axi_s2mm_aclk";
                        interrupts = <0x00 0x5e 0x04>;
                        clocks = <0x10 0x11 0x11>;                      
                        interrupt-parent = <0x05>;
                        xlnx,addrwidth = <0x20>;
                        compatible = "xlnx,axi-dma-7.1\0xlnx,axi-dma-1.00.a";       
                        interrupt-names = "s2mm_introut";
                        xlnx,sg-length-width = <0x16>;    
                        reg = <0x201 0x80000000 0x00 0x10000>;
                        phandle = <0x58>;           
                        #dma-cells = <0x01>;
                                                              
                        dma-channel@20180000030 {
                                xlnx,device-id = <0x00>;
                                interrupts = <0x00 0x5e 0x04>;
                                compatible = "xlnx,axi-dma-s2mm-channel";
                                dma-channels = <0x01>;
                                xlnx,datawidth = <0x20>;
                        };                        
                };   

If I disable the buffer setup I can register the iio device and the channel appears in sysfs with the name I gave it: psd_magsq0:

root@xilinx-vck190-20221:/sys/bus/iio/devices# ls -latr
total 0
lrwxrwxrwx 1 root root 0 Sep 23 20:37 iio:device1 -> ../../../devices/platform/amba_pl@0/20200000000.psd_wrapper/iio:device1
drwxr-xr-x 4 root root 0 Jan 19 2038 ..
lrwxrwxrwx 1 root root 0 Jan 19 2038 iio:device0 -> ../../../devices/platform/axi/f1270000.sysmon/iio:device0
drwxr-xr-x 2 root root 0 Jan 19 2038 .

fwiw looks like this kernel (xilinx fork) has libiio 0.21:

root@xilinx-vck190-20221:~# ls /usr/lib/libiio.so.0* -la
lrwxrwxrwx 1 root root 14 Mar 9 2018 /usr/lib/libiio.so.0 -> libiio.so.0.21
-rwxr-xr-x 1 root root 137112 Mar 9 2018 /usr/lib/libiio.so.0.21


I suspect IIO or the dmaengine can't find the dma device or I need to modify my dts somehow. I'm not sure how to troubleshoot from here. Any advice is much appreciated.



format
[edited by: bjasionowski at 6:23 PM (GMT -4) on 21 Oct 2024]