Sorry, you need to enable JavaScript to visit this website.

Using USB DMA in Linux

Unsolved
3 posts / 0 new
sam.jaeschke's picture
sam.jaeschke
Junior(0)
Using USB DMA in Linux

I see in the Zynq 7000 diagrams that there is hardware DMA attached to the 2x SDIO, 2x USB, and 2x GigE ports. How do I use these in Linux? The first step is to get DMA working with the USB port. I'm struggling to find anywhere that gives examples or explains how to use this DMA from within Linux. Most articles talk about AXI DMA which interacts with the programmable logic. (Is PL330 the hardware DMA that I'm referring to? Or is that wrong?)

I have built up the Linux 3.9 kernel from my own config file. I've set the config as below:
grep -r DMA .config
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_HAVE_DMA_ATTRS=y
CONFIG_HAVE_DMA_CONTIGUOUS=y
CONFIG_HAVE_DMA_API_DEBUG=y
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
CONFIG_DMA_ENGINE=y
# CONFIG_XILINX_NWL_PCIE_DMA is not set
CONFIG_XILINX_NWL_PCIE_DMA_BASE=y
CONFIG_ARM_DMA_MEM_BUFFERABLE=y
CONFIG_ZONE_DMA_FLAG=0
# CONFIG_DMA_SHARED_BUFFER is not set
CONFIG_SCSI_DMA=y
# SFF controllers with custom DMA interface
# CONFIG_PDC_ADMA is not set
CONFIG_ATA_BMDMA=y
# SATA SFF controllers with BMDMA
# PATA SFF controllers with BMDMA
# CONFIG_PATA_OPTIDMA is not set
CONFIG_DMADEVICES=y
# CONFIG_DMADEVICES_DEBUG is not set
# DMA Devices
CONFIG_XILINX_DMA_ENGINES=y
CONFIG_XILINX_AXIDMA=y
# CONFIG_XILINX_DMATEST is not set
CONFIG_XILINX_AXIVDMA=y
# CONFIG_XILINX_VDMATEST is not set
CONFIG_XILINX_AXICDMA=y
# CONFIG_XILINX_CDMATEST is not set
# CONFIG_DW_DMAC is not set
# CONFIG_TIMB_DMA is not set
CONFIG_PL330_DMA=y
CONFIG_DMA_OF=y
# DMA Clients
CONFIG_NET_DMA=y
# CONFIG_ASYNC_TX_DMA is not set
# CONFIG_DMATEST is not set
# CONFIG_DMA_API_DEBUG is not set
CONFIG_HAS_DMA=y

I'm using libusb 1.0.19 in asynchronous mode with my program to interact with the USB port. (http://libusb.sourceforge.net/api-1.0/io.html)

Is DMA enabled by default for free? Do I have to specifically use a different method to use DMA? Similarly, how do I get DMA working with SDIO and ethernet? I would have thought these are common enough cases for people to have (wanting to use DMA for IO ports + Linux), but I can hardly find any info on it.

batukuru's picture
batukuru
Junior(0)
Hello,

Hello,
I know this post was from a long time ago, but I was wondering, have you ever found a solution for this? I'm also trying to use the DMA engine attached to the USB controller (in host mode) under Petalinux and the lack of examples is really frustrating. Thanks.

JFoster's picture
JFoster
Moderator(55)
Hello Batukuru,

Hello Batukuru,

The only example we have available using the DMA engine is in our Developing Zynq Hardware Speedway.

http://zedboard.org/course/developing-zynq%C2%AE-7000-all-programmable-s...

Please refer to chapter 7, lab 6

--Josh