LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] Using the DMAEngine API for scatter/gather operations
@ 2009-05-14 16:13 Ira Snyder
  2009-05-14 16:27 ` Dan Williams
  0 siblings, 1 reply; 3+ messages in thread
From: Ira Snyder @ 2009-05-14 16:13 UTC (permalink / raw)
  To: Dan Williams, Li Yang, Zhang Wei, linuxppc-dev

Hello all.

I'm working on a driver for a custom board (based heavily on the
MPC8349EMDS board) to dump data out of onboard FPGA's. I need to use the
onboard DMA controller for this, mostly due to data transfer rate and
timing requirements.

Of course, I'd like to "play nice" with the existing Linux
infrastructure in my driver, even though I have no plans to submit the
driver upstream (since it is only useful for our custom board).

I have been using the DMAEngine API to interact with the DMA controller,
and it works without any problems. However it seems that it is missing
one of the major features that is supported by almost all DMA
controllers: scatter/gather support.

What I'd really like to do is give the controller a scatterlist and list
of hardware addresses, and have it set up the transfer. The Freescale
hardware can handle this, and I could program it by hand to do so, but I
don't want to invent my own DMA API.

I'm aware that the DMAEngine API was designed to offload memcpy, and
pretty much nothing else. Is there any chance that such a change would
be accepted into the mainline kernel? Any opinions on what such an API
should look like?

Thanks,
Ira

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] Using the DMAEngine API for scatter/gather operations
  2009-05-14 16:13 [RFC] Using the DMAEngine API for scatter/gather operations Ira Snyder
@ 2009-05-14 16:27 ` Dan Williams
  2009-05-14 16:55   ` Ira Snyder
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Williams @ 2009-05-14 16:27 UTC (permalink / raw)
  To: Ira Snyder; +Cc: linuxppc-dev@ozlabs.org, Li Yang, Zhang Wei

On Thu, 2009-05-14 at 09:13 -0700, Ira Snyder wrote:
> Hello all.
> 
> I'm working on a driver for a custom board (based heavily on the
> MPC8349EMDS board) to dump data out of onboard FPGA's. I need to use the
> onboard DMA controller for this, mostly due to data transfer rate and
> timing requirements.
> 
> Of course, I'd like to "play nice" with the existing Linux
> infrastructure in my driver, even though I have no plans to submit the
> driver upstream (since it is only useful for our custom board).
> 
> I have been using the DMAEngine API to interact with the DMA controller,
> and it works without any problems. However it seems that it is missing
> one of the major features that is supported by almost all DMA
> controllers: scatter/gather support.
> 
> What I'd really like to do is give the controller a scatterlist and list
> of hardware addresses, and have it set up the transfer. The Freescale
> hardware can handle this, and I could program it by hand to do so, but I
> don't want to invent my own DMA API.
> 
> I'm aware that the DMAEngine API was designed to offload memcpy, and
> pretty much nothing else. Is there any chance that such a change would
> be accepted into the mainline kernel? Any opinions on what such an API
> should look like?
> 

Have you taken a look at the 'slave' interface implemented by dw_dmac
and other drivers?  It has the following interface:

       struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
                struct dma_chan *chan, struct scatterlist *sgl,
                unsigned int sg_len, enum dma_data_direction direction,
                unsigned long flags);

Haavard uses this interface to do sgl transfers on behalf of the
atmel-mci driver (drivers/mmc/host/atmel-mci.c).

--
Dan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] Using the DMAEngine API for scatter/gather operations
  2009-05-14 16:27 ` Dan Williams
@ 2009-05-14 16:55   ` Ira Snyder
  0 siblings, 0 replies; 3+ messages in thread
From: Ira Snyder @ 2009-05-14 16:55 UTC (permalink / raw)
  To: Dan Williams; +Cc: linuxppc-dev@ozlabs.org, Li Yang, Zhang Wei

On Thu, May 14, 2009 at 09:27:17AM -0700, Dan Williams wrote:
> On Thu, 2009-05-14 at 09:13 -0700, Ira Snyder wrote:
> > Hello all.
> > 
> > I'm working on a driver for a custom board (based heavily on the
> > MPC8349EMDS board) to dump data out of onboard FPGA's. I need to use the
> > onboard DMA controller for this, mostly due to data transfer rate and
> > timing requirements.
> > 
> > Of course, I'd like to "play nice" with the existing Linux
> > infrastructure in my driver, even though I have no plans to submit the
> > driver upstream (since it is only useful for our custom board).
> > 
> > I have been using the DMAEngine API to interact with the DMA controller,
> > and it works without any problems. However it seems that it is missing
> > one of the major features that is supported by almost all DMA
> > controllers: scatter/gather support.
> > 
> > What I'd really like to do is give the controller a scatterlist and list
> > of hardware addresses, and have it set up the transfer. The Freescale
> > hardware can handle this, and I could program it by hand to do so, but I
> > don't want to invent my own DMA API.
> > 
> > I'm aware that the DMAEngine API was designed to offload memcpy, and
> > pretty much nothing else. Is there any chance that such a change would
> > be accepted into the mainline kernel? Any opinions on what such an API
> > should look like?
> > 
> 
> Have you taken a look at the 'slave' interface implemented by dw_dmac
> and other drivers?  It has the following interface:
> 
>        struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
>                 struct dma_chan *chan, struct scatterlist *sgl,
>                 unsigned int sg_len, enum dma_data_direction direction,
>                 unsigned long flags);
> 
> Haavard uses this interface to do sgl transfers on behalf of the
> atmel-mci driver (drivers/mmc/host/atmel-mci.c).
> 

I had started looking at it, though the Freescale device does not
implement DMA_SLAVE support. I was a bit discouraged by the changelog
for commit dc0ee643, which says that the interface is for "DMA with
hardware handshaking", which I do not have. There is not anything
special about accessing the FPGA's, they appear in the processor's
memory map and can be read from/written to just like RAM.

I'll try studying the dw_dmac implementation and atmel-mci example.

Thanks for the response,
Ira

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-05-14 16:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-14 16:13 [RFC] Using the DMAEngine API for scatter/gather operations Ira Snyder
2009-05-14 16:27 ` Dan Williams
2009-05-14 16:55   ` Ira Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox