Skip to contentSkip to conversation

How to include Xilinx DMA driver

meta-xilinx Fan Zhang 3 participants 5 messages Sep 8, 2017 – Sep 12, 2017

lore
Share & tools
lore

Fan Zhang

author
#0 lore raw

Hi All,

I have a design on Zynq that uses DMA, and I need to setup a driver to program the DMA controller, setup the data transfer and supply data to user space.

I searched around in the Xilinx forum, and found an dma_proxy driver. Xilinx also provides an xilinx_dma.c driver for the DMA. It is unclear to me how these all fit together. I have a few questions and I appreciate anyone to give me some pointer to moving things forward.

1. How to include xilinx_dma.c driver in to the poky image build?

Xilinx wiki says enable these options: CONFIG_DMADEVICES, CONFIG_XILINX_DMA. I did a search on my bitbake folder, and they are enabled in a number of cfg files. But checking the environment with bitbake -e , and these options didn't show up. I can't find any xilinx_dma.ko in the build either. So what am I missing, and how can I include the xilinx driver into my build? Xilinx wiki page is here:
http://www.wiki.xilinx.com/DMA+Drivers+-+Soft+IPs

2. I found a set of character device based dma driver, and it's user space application example. A number of people refer to this solution as an starting point for driver development. It's unclear to me whether this driver is built on top of the Xilinx_dma driver. When I tried this driver, it fails at requesting DMA channel. Anyone has experience with this driver, could you share your experience? Thank you so much.

Driver can be found here:
https://bitbucket.org/Schnegg/pa/src/b8f430a3ebd756f231e88e5dc8523737ed5db034/petalinux_project/components/modules/dma_proxy/dma_proxy.c?at=master&fileviewer=file-view-default

Best Regards,

Fan

begin:vcard
fn:Fan Zhang
n:Zhang;Fan
org:Sander Geophysics Ltd.
email;internet:[email protected]
title:Electronics Design Engineer
tel;work:(613)521-9626
version:2.1
end:vcard

#1 lore raw

Hi,

Quoted 3 lines · Fan Zhang

Hi All,

1. How to include xilinx_dma.c driver in to the poky image build?

In case you want to include out-of tree drivers it could work like this[1] in case you want in-tree it's just a kernel patch similar to[2].

Apparently you will need to turn on kernel config features. You might try something like this[3].

For Yocto/Xilinx specific questions you might want to ask on the Xilinx mailing list[4].

[1] https://github.com/RobertBerger/meta-mainline/tree/pyro-training-v4.9.x/multi-v7-ml/recipes-zedboard/xilinx-dma

[2] https://github.com/RobertBerger/meta-mainline/blob/pyro-training-v4.9.x/multi-v7-ml/recipes-kernel/linux/patch/4.9.x/patches/zedboard-zynq7/zynq-qspi/0001-zynq-zedboard-non-mainline-qspi-support.patch

[3] https://github.com/RobertBerger/meta-mainline/tree/pyro-training-v4.9.x/multi-v7-ml/recipes-kernel/linux/config/multi-v7-ml-base/features/zynq-qspi

[4] https://lists.yoctoproject.org/listinfo/meta-xilinx

Regards,

Robert

author
#2 lore raw

Hi all

Thank you Robert for the guide. I tried option [1] out of tree driver. Got it compiled, and loaded when image boot up. My understand of the dma driver is that Linux DMA engine depends on the Xilinx device driver (xilinx_cdma.c) and then dma_proxy.c driver depends on the Linux DMA engine. Am I correct?

It does seems Xilinx_cdma is loaded succefully, but dmatest didn't. Here is the message I've got:

root@microzed-zynq7:~# dmesg | grep dma
[    0.202348] dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330
[    0.202370] dma-pl330 f8003000.dmac:         DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
[    0.202654] xilinx-vdma 7e200000.dma: failed to get axi_clk (4294967294)
[    0.202679] xilinx-vdma: probe of 7e200000.dma failed with error -2
[    2.609417] xilinx-cdma 7e200000.dma: Xilinx AXI CDMA Engine driver Probed!!
[    2.635552] Modules linked in: axidmatest(O+) xilinx_cdma(O)
[    2.659271] PC is at xilinx_axidmatest_probe+0xd8/0x418 [axidmatest]
[    2.916646] [<bf00522c>] (xilinx_axidmatest_probe [axidmatest]) from [<c03905c8>] (platform_drv_probe+0x50/0xb0)
[    3.028812] udevd[674]: worker [687] failed while handling '/devices/soc0/dmatest@0'

From these message, I'm guessing there is an issue in configuration of the common clock framework. Is the clkc.c needs to be built as an out of tree module to be used in Yocto?

Fan

Quoted 17 lines · Robert Berger

Hi,

Quoted 3 lines · Fan Zhang

Hi All,

1. How to include xilinx_dma.c driver in to the poky image build?

In case you want to include out-of tree drivers it could work like this[1] in case you want in-tree it's just a kernel patch similar to[2].

Apparently you will need to turn on kernel config features. You might try something like this[3].

For Yocto/Xilinx specific questions you might want to ask on the Xilinx mailing list[4].

[1] https://github.com/RobertBerger/meta-mainline/tree/pyro-training-v4.9.x/multi-v7-ml/recipes-zedboard/xilinx-dma

[2] https://github.com/RobertBerger/meta-mainline/blob/pyro-training-v4.9.x/multi-v7-ml/recipes-kernel/linux/patch/4.9.x/patches/zedboard-zynq7/zynq-qspi/0001-zynq-zedboard-non-mainline-qspi-support.patch

Quoted 9 lines

[3] https://github.com/RobertBerger/meta-mainline/tree/pyro-training-v4.9.x/multi-v7-ml/recipes-kernel/linux/config/multi-v7-ml-base/features/zynq-qspi

[4] https://lists.yoctoproject.org/listinfo/meta-xilinx

Regards,

Robert

begin:vcard
fn:Fan Zhang
n:Zhang;Fan
org:Sander Geophysics Ltd.
email;internet:[email protected]
title:Electronics Design Engineer
tel;work:(613)521-9626
version:2.1
end:vcard

#3 lore raw

Hi Fan,

Thanks,
Sandeep

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Fan Zhang
Sent: Monday, September 11, 2017 9:38 AM
To: Robert Berger <[email protected]>; [email protected]; [email protected]
Subject: Re: [meta-xilinx] [yocto] How to include Xilinx DMA driver

Hi all

Thank you Robert for the guide. I tried option [1] out of tree driver.
Got it compiled, and loaded when image boot up. My understand of the dma driver is that Linux DMA engine depends on the Xilinx device driver (xilinx_cdma.c) and then dma_proxy.c driver depends on the Linux DMA engine. Am I correct?
Yes
It does seems Xilinx_cdma is loaded succefully, but dmatest didn't. Here is the message I've got:

In order to use DMATEST IP assumes AXI_DMA IP streaming interfaces are connected back to back in the HW design. Refer http://www.wiki.xilinx.com/DMA+Drivers+-+Soft+IPs

root@microzed-zynq7:~# dmesg | grep dma
[    0.202348] dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330
[    0.202370] dma-pl330 f8003000.dmac:         DBUFF-128x8bytes 
Num_Chans-8 Num_Peri-4 Num_Events-16
[    0.202654] xilinx-vdma 7e200000.dma: failed to get axi_clk (4294967294)
[    0.202679] xilinx-vdma: probe of 7e200000.dma failed with error -2
[    2.609417] xilinx-cdma 7e200000.dma: Xilinx AXI CDMA Engine driver 
Probed!!
[    2.635552] Modules linked in: axidmatest(O+) xilinx_cdma(O)
[    2.659271] PC is at xilinx_axidmatest_probe+0xd8/0x418 [axidmatest]
[    2.916646] [<bf00522c>] (xilinx_axidmatest_probe [axidmatest]) from 
[<c03905c8>] (platform_drv_probe+0x50/0xb0)
[    3.028812] udevd[674]: worker [687] failed while handling 
'/devices/soc0/dmatest@0'

From these message, I'm guessing there is an issue in configuration of
the common clock framework. Is the clkc.c needs to be built as an out of tree module to be used in Yocto?

From 2017.1 onwards CCF is mandatory for all Xilinx drivers. Fan

Quoted 32 lines · Robert Berger

Hi,

Quoted 3 lines · Fan Zhang

Hi All,

1. How to include xilinx_dma.c driver in to the poky image build?

In case you want to include out-of tree drivers it could work like this[1] in case you want in-tree it's just a kernel patch similar to[2].

Apparently you will need to turn on kernel config features. You might try something like this[3].

For Yocto/Xilinx specific questions you might want to ask on the Xilinx mailing list[4].

[1]
https://github.com/RobertBerger/meta-mainline/tree/pyro-training-v4.9.x/multi-v7-ml/recipes-zedboard/xilinx-dma

[2]
https://github.com/RobertBerger/meta-mainline/blob/pyro-training-v4.9.x/multi-v7-ml/recipes-kernel/linux/patch/4.9.x/patches/zedboard-zynq7/zynq-qspi/0001-zynq-zedboard-non-mainline-qspi-support.patch

[3]
https://github.com/RobertBerger/meta-mainline/tree/pyro-training-v4.9.x/multi-v7-ml/recipes-kernel/linux/config/multi-v7-ml-base/features/zynq-qspi

[4] https://lists.yoctoproject.org/listinfo/meta-xilinx

Regards,

Robert

author
#4 lore raw

Hi Sandeep,

Thank you for your answer.

Can you give some more info on how to get the CCF working in Yocto Linux? I can't find much online. I tried building clkc.c and pll.c as out of tree driver by copy over content in the folder kernel-source\drivers\clk\zynq, change the makefile and add the .bb file for build.

The module compiled but fail to load. Giving me message "Unknown symbol in module or unknown parameter"

On a semi-related issue. Is it recommended to use Yocto Linux for new development? or PetaLinux following the  "Workflow Tutorial 6 UG1156 (v2017.1) April 5, 2017" documentation?

Many thanks,

Fan

Quoted 37 lines · Sandeep Gundlupet Raju

Hi Fan,

Thanks,
Sandeep

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Fan Zhang
Sent: Monday, September 11, 2017 9:38 AM
To: Robert Berger <[email protected]>; [email protected]; [email protected]
Subject: Re: [meta-xilinx] [yocto] How to include Xilinx DMA driver

Hi all

Thank you Robert for the guide. I tried option [1] out of tree driver.
Got it compiled, and loaded when image boot up. My understand of the dma driver is that Linux DMA engine depends on the Xilinx device driver (xilinx_cdma.c) and then dma_proxy.c driver depends on the Linux DMA engine. Am I correct?
Yes
It does seems Xilinx_cdma is loaded succefully, but dmatest didn't. Here is the message I've got:

In order to use DMATEST IP assumes AXI_DMA IP streaming interfaces are connected back to back in the HW design. Refer http://www.wiki.xilinx.com/DMA+Drivers+-+Soft+IPs

root@microzed-zynq7:~# dmesg | grep dma
[    0.202348] dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330
[    0.202370] dma-pl330 f8003000.dmac:         DBUFF-128x8bytes
Num_Chans-8 Num_Peri-4 Num_Events-16
[    0.202654] xilinx-vdma 7e200000.dma: failed to get axi_clk (4294967294)
[    0.202679] xilinx-vdma: probe of 7e200000.dma failed with error -2
[    2.609417] xilinx-cdma 7e200000.dma: Xilinx AXI CDMA Engine driver
Probed!!
[    2.635552] Modules linked in: axidmatest(O+) xilinx_cdma(O)
[    2.659271] PC is at xilinx_axidmatest_probe+0xd8/0x418 [axidmatest]
[    2.916646] [<bf00522c>] (xilinx_axidmatest_probe [axidmatest]) from
[<c03905c8>] (platform_drv_probe+0x50/0xb0)
[    3.028812] udevd[674]: worker [687] failed while handling
'/devices/soc0/dmatest@0'
Quoted 39 lines

From these message, I'm guessing there is an issue in configuration of
the common clock framework. Is the clkc.c needs to be built as an out of tree module to be used in Yocto?

From 2017.1 onwards CCF is mandatory for all Xilinx drivers.
Fan

Quoted 31 lines · Robert Berger

Hi,

Quoted 3 lines · Fan Zhang

Hi All,

1. How to include xilinx_dma.c driver in to the poky image build?

In case you want to include out-of tree drivers it could work like this[1] in case you want in-tree it's just a kernel patch similar to[2].

Apparently you will need to turn on kernel config features. You might try something like this[3].

For Yocto/Xilinx specific questions you might want to ask on the Xilinx mailing list[4].

[1]
https://github.com/RobertBerger/meta-mainline/tree/pyro-training-v4.9.x/multi-v7-ml/recipes-zedboard/xilinx-dma

[2]
https://github.com/RobertBerger/meta-mainline/blob/pyro-training-v4.9.x/multi-v7-ml/recipes-kernel/linux/patch/4.9.x/patches/zedboard-zynq7/zynq-qspi/0001-zynq-zedboard-non-mainline-qspi-support.patch

[3]
https://github.com/RobertBerger/meta-mainline/tree/pyro-training-v4.9.x/multi-v7-ml/recipes-kernel/linux/config/multi-v7-ml-base/features/zynq-qspi

[4] https://lists.yoctoproject.org/listinfo/meta-xilinx

Regards,

Robert

begin:vcard
fn:Fan Zhang
n:Zhang;Fan
org:Sander Geophysics Ltd.
email;internet:[email protected]
title:Electronics Design Engineer
tel;work:(613)521-9626
version:2.1
end:vcard