Subject: Re: Using dmaengine on Freescale P2020 RDB

From: "Ira W. Snyder" <[email-masked]>
Date: Wed, 6 Apr 2011 13:10:30 -0700

On Wed, Apr 06, 2011 at 12:40:58PM -0700, Chuck Ketcham wrote:
> All,
> 
> I have a Freescale P2020 Reference Design Board.  I am investigating the possibility of using the dmaengine capability in the 2.6.32.13 kernel to transfer data from memory out onto the PCIe bus.  As a first step, I thought I would try the DMA test client (dmatest.ko) to make sure the dmaengine was functioning.  I know this doesn't transfer anything over PCIe but only transfers from one memory buffer to another, but I figured I need to get this working first.  Anyway I built dmatest.ko and ran it (with insmod), and discovered it didn't do anything.  I added some printk's to the kernel to investigate what was going on and I found that all attempts to find a channel within dma_request_channel were unsuccessful.  Three of the channels were not used because they were already publicly allocated.  One channel was not used because it didn't have DMA_MEMCPY capability.
> 
> Here are my questions then:
> 1. Is the dmaengine the appropriate method to use for transferring data from memory out onto the PCIe bus?
> 2. If dmaengine is correct, what can I do to free up a channel for my own use?
> 

I use the Freescale DMA engine to transfer lots of data out to PCI, on
an 8349EA chip. The P2020 DMA engine uses the same driver.

I hunch you have enabled CONFIG_NET_DMA, which will claim the channels.
You should disable it to use the devices for other uses.

If you want an example of using the DMA engine to transfer from DDR
memory to the PowerPC local bus, search the mailing list archives for
"CARMA Board Drivers" (RFCv7 was the latest posting). Transferring from
DDR to PCI works exactly the same way.

Hope it helps,
Ira