element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Achievement Levels
    • Benefits of Membership
    • Feedback and Support
    • Members Area
    • Personal Blogs
    • What's New on element14
  • Learn
    Learn
    • eBooks
    • Learning Center
    • Learning Groups
    • STEM Academy
    • Webinars, Training and Events
  • Technologies
    Technologies
    • 3D Printing
    • Experts & Guidance
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Arduino Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Project Groups
    • Raspberry Pi Projects
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Or choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Software Application Development AXI DMA driver for Linux
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Avnet Boards Forums requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 11 replies
  • Subscribers 176 subscribers
  • Views 1185 views
  • Users 0 members are here
Related

AXI DMA driver for Linux

Former Member
Former Member over 10 years ago

I am trying to write a driver to send data to the PL using the AXI DMA Engine on Linux. I have gone through probably a couple hundred websites and there is always conflicting information on those.

The xilinx_axidma.c driver on Xilinx's linux git repo is supposed to be an API. However, the axidmatest.c which is supposed to test the dma engine always fails with

dmatest: Did not find tx device
dmatest: Did not find rx device

These are Xilinx's own files. We haven't touched them. If those fail, how are we supposed to start working? Xilinx forums are either completely useless or completely clueless. Either ways, it is a very big disappointment.

Our primary question is should we be making a platform device or using the APIs that Xilinx's drivers provide us with? There is a pl330 test driver on Xilinx's wiki but that creates a platform device and from what I understand, a platform device is its own standalone thing. It doesn't use the APIs in the pl330.c file. If so, then what is the point of writing pl330.c?

Secondly, has anyone solved the channel not found errors? Or is there some config option we are getting wrong? We set the TX async channel in the config.

Thank you.

  • Sign in to reply
  • Cancel
  • Former Member
    0 Former Member over 10 years ago

    I'm working on getting an AXI DMA setup working, too. I'll throw up what I've learned so far and maybe it'll help. I'm hopeful to have a working system in the next few days.

    One note: I'm using a memory-map-to-stream (MM2S) and stream-to-memory-map (MM2S) setup.

    The first thing to know is that the PL330 is the ARM DMA controller-- it is exposed to the PL but is different than an AXI DMA controller. If you look at the "Zynq" tab in XPS, the PL330 is the box labeled "DMA 8 Channel," whereas your AXI DMA controller will be connected over the blocks along the perimeter that say "AXI Slave/Master/High Peformance/ACP slave" depending on how you configure it. So the PL330 drivers won't help for your AXI DMA.

    *This is only a guess:* I think the device tree for the AXI DMA controller is generated incorrectly. I *think* that it should have dma-channel sub-nodes (see the DTS here: http://forums.xilinx.com/t5/Embedded-Linux/Linux-DMA-Simple-Mode/td-p/326369).

    Once you make that change, start with copies of linux-xlnx/drivers/dma/xilinx/xilinx_axidma.c and axidmatest.c. I'm not using scatter-gather, and the probe function in the xilinx_axidma.c driver is using "xlnx,sg-include-stscntrl-strm" to test for the SG engine (line 1115), which I think is wrong; so I changed that to check for "xlnx,include-sg" instead.

    Then, the driver should loop through the child nodes in the device tree (the "dma-channel" nodes) on line 1140, and correctly enumerate the dma-channel nodes, checking for "xlnx,axi-dma-mm2s-channel" and "xlnx,axi-dma-s2mm-channel" parameters roundabout line 1007.

    At this point, you can start working with axidmatest.c if you want and getting that to work with xilinx_axidma.c.

    That was kinda painful when I tried it, so I'm going straight to the hardware and trying to do what it says in the section "AXI DMA Simple DMA Operations" in this document: http://www.xilinx.com/support/documentation/ip_documentation/axi_dma/v6_00_a/pg021_axi_dma.pdf.

    This requires ioremap-ing the memory addresses of the DMA channels and reading/writing directly to the hardware, as part of the driver for our custom logic on the other end. It's not as generic and won't work with the DMA API subsystem in linux, but I don't need it to.

    Short recap of what I'm trying:
    - Fix the device tree and use it to get the addresses of the DMA channels for portability.
    - ioremap those addresses
    - Use either custom code or code based on the standalone AXI DMA drivers to access those addresses directly rather than using xilinx_axidma.c.

    It would be nice to get the actual driver working so that the full DMA API is available, but it's probably unnecessary.

    Hope that helps at all.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago

    Hey thanks a ton. That helped a lot.

    We are actually trying to get the axidmatest.c to pass first. We already have a kernel driver but we are using the axidmatest.c test to see if the AXI DMA is actually configured and then we will use our driver.

    We actually fixed the device tree yesterday after which we were getting the channels. However, while we could get the channels, we couldn't actually send any data and all tests would fail with "TX test timed out".
    This morning we implemented your suggestion about changing the SG node property in the xilinx_axidma.c driver to sg-include and it passes beyond the timed out phase but doesn't actually finish.

    We get this error -

    "tx got completion callback,
    but status is 'in progress'"

    Which is basically what the axidmatest.c prints when it doesn't get a DMA_SUCCESS returned from the dma_async_is_tx_complete function.

    Are you able to get past that in your custom driver? I'm assuming you are using it right?

    Also, I think we are trying to do very similar things. We are also using S2MM and MM2S channels.

    Thanks again for your help!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago

    We have been able to make the DMA transfer work to stream data to cores created with Vivado HLS.

    We wrote the driver on our own and we made it work supporting multiple DMAs at the same time. No Scatter/Gather support at the moment.

    Basically we rewrote xilinx_axidma.c which we weren't able to make work.

    We are planning to release the working project in the next weeks, if you are still interested in the driver please ping me and I can send it to you asap.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago

    Hi,

    I'm very interested too. Especially if it supports receiving packets shorter than requested (using TLAST) and has reasonable throughput.

    Maarten

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago

    I'm preparing the material to be distributed.
    I will include the driver, a simple benchmark we use and the complete project files for Vivado 2013.3.

    I think I will do that during this weekend.

    Gianluca

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago

    Ok I am uploading everything now.

    This is the link to the GIT repository.
    https://github.com/durellinux/ZedBoard_Linux_DMA_driver.git

    Let me know if you have any questions.

    Gianluca

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 8 years ago

    Hi all,
    While going through this thread, I felt that you all can help me. I am trying to make one linux application(linaro on ARM of Zedboard) where my custom IP (matrix multiplier with streaming interface) is connected to ACP of PS through AXI DMA IP. I will send input data to custom IP from PS and will get the output to PS from custom IP. I am not a person with kernel background knowledge and so I am stuck in this problem. Please suggest me how to proceed for it. If anyone among you has done work in this field then I earnestly request you to help me out. Should I write driver for AXI DMA as well as my custom IP. My bare-metal application was successful. Please please help me with valuable suggestions and references.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 8 years ago in reply to Former Member

    find the block diuagram: https://drive.google.com/file/d/0B0t2YNoHXPf2Zjl5OEtGLUU1cTA/view?usp=sharing

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 8 years ago

    Please find the block diagram: https://drive.google.com/file/d/0B0t2YNoHXPf2Zjl5OEtGLUU1cTA/view?usp=sharing

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 8 years ago

    Hi guys,

    I got a similar Problem here. I build my system from the xilinx sources except of the device tree. I build the devicetree from the analog devices git and inserted an enty for the dma in the devicetree. Now my linux detects the dma and i can see both channels wehen i hit "cat /proc/interrupts". If i run the axidmatest.ko i get the these messages in my dmesg:

    dmatest: match is 100001
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: Private is 100001
    dmatest: Found tx device
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: Private is 100002
    dmatest: Found rx device
    dmatest: Started 1 threads using dma1chan0 dma1chan1
    dma1chan0-dma1c: #0: tx test timed out
    dma1chan0-dma1c: #1: tx test timed out
    dma1chan0-dma1c: #2: tx test timed out
    dma1chan0-dma1c: #3: tx test timed out
    dma1chan0-dma1c: #4: tx test timed out
    dma1chan0-dma1c: terminating after 5 tests, 5 failures (status 0)
    dmatest: match is 10100001
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: No more tx channels available
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: Private is 5efe8cc0
    dmatest: No more rx channels available

    Maybe some of u can help me solving this Problem.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube