UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
9,984 Views
Registered: ‎01-29-2016

AXI DMA request channel problem

Jump to solution

Hello,

 

I am working a a simple (no SG) DMA loopback project on the zedboard.

I am trying to aquire the 2 AXIDMA channels using the following code (from a Xilinx slide presentation)

 

static bool xdma_filter(struct dma_chan *chan, void *param)
{
    if (*((int *)chan->private) == *(int *)param)
        return true;
    return false;
}

 

    dma_cap_zero(mask);
    dma_cap_set(DMA_SLAVE | DMA_PRIVATE, mask);
    match_tx = (DMA_MEM_TO_DEV & 0xFF) | XILINX_DMA_IP_DMA;
     tx_chan = dma_request_channel(mask, xdma_filter, (void *)&match_tx);

     match_rx = (DMA_DEV_TO_MEM & 0xFF) | XILINX_DMA_IP_DMA;
     rx_chan = dma_request_channel(mask, xdma_filter, (void *)&match_rx);

 

This code works fine for the 8 soc DMA channels but fails for my 2 AXIDMA channels. The xilinx_dma driver is probed correctly during boot and the two AXIDMA channels are listed by the linux. 

 

The (*((int *)chan->private) fails because of a NULL pointer dereference, only for the AXIDMA channels, not for the other soc dam channels.

 

The devicetree entree for the AXIDMA is as follows:

 

amba_pl: amba_pl {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "simple-bus";
        ranges ;
        axi_dma_0: dma@40400000 {
            compatible = "xlnx,axi-dma-1.00.a";
            interrupt-parent = <&intc>;
            interrupts = <0 29 4 0 30 4>;
            reg = <0x40400000 0x10000>;
            dma-channel@40400000 {
                compatible = "xlnx,axi-dma-mm2s-channel";
                interrupts = <0 29 4>;
                xlnx,datawidth = <0x20>;
                xlnx,device-id = <0x0>;
            };
            dma-channel@40400030 {
                compatible = "xlnx,axi-dma-s2mm-channel";
                interrupts = <0 30 4>;
                xlnx,datawidth = <0x20>;
                xlnx,device-id = <0x0>;
            };
        };
    };

0 Kudos
1 Solution

Accepted Solutions
18,496 Views
Registered: ‎01-29-2016

Re: AXI DMA request channel problem

Jump to solution

Thanks @fanat9 for the reply,

 

I am indeed running the xlnx kernel 4.0.

I did succeed in running the axidmatest example but this is a quite complex SG DMA example. That is why I started searching for a simple No SG DMA example. It seems that there are no simple No SG DMA examples provided that work with the xlnx kernel 4.0 DMA API. Al the examples I found are still using the previous API. That is where I got confused because I was unaware that the old API was not supported anymore in the xlnx kernel 4.0.

0 Kudos
5 Replies
Explorer
Explorer
9,967 Views
Registered: ‎02-16-2014

Re: AXI DMA request channel problem

Jump to solution

Kernel version 4.0 ?

 

This functionality was removed in Xlnx 4.0.

Now we supposed to use dma_request_slave_channel(&pdev->dev, "axidma0"), where second argument a name of channel in your device-tree node. Check axidmatest.c example.

 

Device node for which you requesting DMA channel must have nodes, dmas and dma-names. where 0 is mm2s and 1 is s2mm channels.

dmas = <&axi_dma_0 0 &axi_dma_0 1>;
dma-names = "axidma0", "axidma1";

 

18,497 Views
Registered: ‎01-29-2016

Re: AXI DMA request channel problem

Jump to solution

Thanks @fanat9 for the reply,

 

I am indeed running the xlnx kernel 4.0.

I did succeed in running the axidmatest example but this is a quite complex SG DMA example. That is why I started searching for a simple No SG DMA example. It seems that there are no simple No SG DMA examples provided that work with the xlnx kernel 4.0 DMA API. Al the examples I found are still using the previous API. That is where I got confused because I was unaware that the old API was not supported anymore in the xlnx kernel 4.0.

0 Kudos
Highlighted
Visitor rigoni
Visitor
6,758 Views
Registered: ‎05-27-2016

Re: AXI DMA request channel problem

Jump to solution

Hi Thanks for the post!

 

I had the same problem trying to setting up a simple non SG example.

I managed to meld the new request channel from axidmatest.c to the simple example axidma.c.gold reported in https://forums.xilinx.com/t5/Embedded-Linux/AXI-DMA-in-Linux-Timing-Out/td-p/555895

 

it seems now to be working smoothly with the following hw configuration:

axidmatest_pl.jpg

AXI DMA:

DMA_options.jpg

 

DTS NODES:

/ {
        amba_pl: amba_pl {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "simple-bus";
                ranges ;
                axi_dma_0: dma@40400000 {
                        #dma-cells = <1>;
                        compatible = "xlnx,axi-dma-1.00.a";
                        interrupt-parent = <&intc>;
                        interrupts = <0 29 4 0 30 4>;
                        reg = <0x40400000 0x10000>;
                        dma-channel@40400000 {
                                compatible = "xlnx,axi-dma-mm2s-channel";
                                interrupts = <0 29 4>;
                                xlnx,datawidth = <0x40>;
                                xlnx,device-id = <0x0>;
                        };
                        dma-channel@40400030 {
                                compatible = "xlnx,axi-dma-s2mm-channel";
                                interrupts = <0 30 4>;
                                xlnx,datawidth = <0x40>;
                                xlnx,device-id = <0x0>;
                        };
                };
                dmatest_0: dmatest@0 {
                        compatible ="xlnx,axi-dma-test-1.00.a";
                        dmas = <&axi_dma_0 0
                                &axi_dma_0 1>;
                        dma-names = "dma0", "dma1";
                } ;

        };
};

Please note that the platform registration needs the dmatest_0 node to trigger the probe function after the module has been initialized. In the node above the dma names "dma0" and "dma1" will correspond the the channel names that have to be specified requesting for a slave channel in the new code.

 

 

 

Visitor johnnymopo
Visitor
6,739 Views
Registered: ‎03-17-2012

Re: AXI DMA request channel problem

Jump to solution

can it be explained why in the 2016.1 tools (petalinux) get-hw-description fails to add this additional node to the device tree?

0 Kudos
Visitor johnnymopo
Visitor
6,738 Views
Registered: ‎03-17-2012

Re: AXI DMA request channel problem

Jump to solution

and how a char driver could get a platform in .probe?  thanks

0 Kudos