LKML Archive on
help / color / mirror / Atom feed
From: Haavard Skinnemoen <>
To: David Brownell <>
Cc: Dan Williams <>,,
	Shannon Nelson <>,, "Francis Moreau" <>,
	"Paul Mundt" <>,
	"Vladimir A. Barinov" <>,
	Pierre Ossman <>
Subject: Re: [RFC v2 2/5] dmaengine: Add slave DMA interface
Date: Thu, 31 Jan 2008 14:52:14 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Thu, 31 Jan 2008 00:27:24 -0800
David Brownell <> wrote:
> On Wednesday 30 January 2008, Haavard Skinnemoen wrote:
> > So basically, you're asking for maximum flexibility with minimum
> > overhead.
> That's always a goal, but that's not what I said.  I was pointing out
> one scenario I ran into ... where starting with the simple solution
> ran into product issues which were unfixable without using some of the
> more advanced (and nonportable!!) hardware mechanisms.

Right. I'm just having a bit of trouble understanding what you're
really asking for. I think it's something along the lines of:
  * A light-weight interface for doing DMA transfers
  * Still, this interface must be able to handle all kinds of controller-
    specific bells and whistles
  * Those bells and whistles should be configurable per-transfer, not
    only per-channel.

So how about we provide:
  * A hook for changing the default channel settings (many of which may
    really be per-transfer; this depends on the specific controller)
  * A hook for changing the settings of a descriptor after it has been
    prepared with the default settings.

Both of these hooks may take a controller-specific struct, or possibly
a standard struct that can be extended by the controller. This would
ensure that transfers using default settings are still reasonably fast,
while clients with controller-specific knowledge can still tweak things.

We could also let the controller extend the dma_device struct to add
such hooks on its own.

How does that sound?

> > I agree that should be the ultimate goal, but wouldn't it be 
> > better to start with something more basic?
> Where you start is often NOT where you end up!  You should make sure
> that a wants-to-be-generic slave interface can accomodate a variety of
> non-basic mechanisms, without getting bloated.  :)


> > > That particular hardware has enough of the "logical" channels that each
> > > driver gets its own; one level of arbitration involves assigning those
> > > to underlying "physical" channels.
> > 
> > Yeah, there doesn't necessarily have to be a 1:1 mapping between
> > channels exported by the driver and actual physical channels.
> You probably missed the point that both "logical" and "physical"
> channels in that case have hardware support.  Drivers didn't really
> need to worry about not being able to allocate a (logical) channel.

Ok, maybe I did. But I'm not sure if it actually matters to my
argument. A device supporting "logical" channels in hardware could
still have a driver that pretends it has even more "logical" channels.

> Yes, I also had the half-thought that maybe that notion could show
> up in the "dmaengine" framework...  ;)

Yes, I think this may allow us to move quite a few settings from
"per-transfer" to "per-channel" territory, which would simplify things
and reduce the transfer setup overhead.

> > > I wouldn't assume that systems have that much overcapacity on
> > > their critical I/O paths.  I've certainly seen systems tune those
> > > busses down in speed ... you might describe the "why" as "tweaking
> > > battery performance", which wasn't at all an optional stage of the
> > > system development process.
> > 
> > But devices that do flow control should work just fine with scaled-down
> > bus speeds.
> Modulo the little glitches the hardware people always throw at us.
> Like little synchronization races when the various signals don't
> cross the same clock domains, and errata that creep in ... and the
> fact that "just fine" can still have performance requirements, ones
> that get harder to satisfy when the overcapacity gets shaved.

Right, but such quirks tend to be very chip-specific, or even specific
to a certain chip revision. So I really think this information
ultimately needs to come from the platform code, but we should perhaps
think about how to pass this information through the client driver and
into the DMA engine driver.

> > > > We already have something along those lines through the capabilities
> > > > mask, taking care of the "standard subclasses" part. How about we add
> > > > some kind of type ID to struct dma_device so that a driver can use
> > > > container_of() to get at the extended bits if it recognizes the type?
> > > 
> > > That would seem to be needed if the interface isn't going to become
> > > a least-common-denominator approach -- or a kitchen-sink.
> > 
> > Right. I'll add a "unsigned int engine_type" field so that engine
> > drivers can go ahead and extend the standard dma_device structure.
> Better to have some sort of "struct engine_type" and include a pointer
> to it.  That way there's no global enum in a header to maintain and
> evolve over time.

What do we put in it though? The only thing we really need is some sort
of type id so that clients can know what type to throw at container_of.

If you mean "struct engine_type" should be controller-specific, we
still need a type ID to determine what kind of type it really is.

> > Maybe we should add a "void *platform_data" field to the dma_slave
> > struct as well so that platforms can pass arbitrary platform-specific
> > information to the DMA controller driver?
> Why not just use container_of() wrappers?

Not all drivers may need any platform data. The engine driver must be
able to distinguish between the dma_slave structs that have additional
data attached to them and those that don't.

But if container_of() turns out to make things cleaner, and these
issues can be solved some other way, sure.


  parent reply	other threads:[~2008-01-31 13:52 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-29 18:10 [RFC v2 0/5] dmaengine: Slave DMA interface and example users Haavard Skinnemoen
2008-01-29 18:10 ` [RFC v2 1/5] dmaengine: Add dma_client parameter to device_alloc_chan_resources Haavard Skinnemoen
2008-01-29 18:10   ` [RFC v2 2/5] dmaengine: Add slave DMA interface Haavard Skinnemoen
2008-01-29 18:10     ` [RFC v2 3/5] dmaengine: Make DMA Engine menu visible for AVR32 users Haavard Skinnemoen
2008-01-29 18:10       ` [RFC v2 4/5] dmaengine: Driver for the Synopsys DesignWare DMA controller Haavard Skinnemoen
2008-01-29 18:10         ` [RFC v2 5/5] Atmel MCI: Driver for Atmel on-chip MMC controllers Haavard Skinnemoen
2008-02-13 18:30           ` Pierre Ossman
2008-02-13 18:47             ` Haavard Skinnemoen
2008-02-14 14:00             ` MMC core debugfs support (was Re: [RFC v2 5/5] Atmel MCI: Driver for Atmel on-chip MMC controllers) Haavard Skinnemoen
2008-02-25 17:12               ` Pierre Ossman
2008-02-13 19:11           ` [RFC v2 5/5] Atmel MCI: Driver for Atmel on-chip MMC controllers Dan Williams
2008-02-13 21:06             ` Haavard Skinnemoen
2008-02-13 23:55               ` Dan Williams
2008-02-14  8:36                 ` Haavard Skinnemoen
2008-02-14 18:34                   ` Dan Williams
2008-02-14 19:21                     ` Haavard Skinnemoen
2008-01-30 18:53         ` [RFC v2 4/5] dmaengine: Driver for the Synopsys DesignWare DMA controller Dan Williams
2008-01-30  7:30     ` [RFC v2 2/5] dmaengine: Add slave DMA interface David Brownell
2008-01-30  9:27       ` Haavard Skinnemoen
2008-01-30 10:52         ` David Brownell
2008-01-30 12:26           ` Haavard Skinnemoen
2008-01-31  8:27             ` David Brownell
2008-01-31  8:44               ` Paul Mundt
2008-01-31 12:51                 ` David Brownell
2008-01-31 14:12                   ` Haavard Skinnemoen
2008-01-31 13:52               ` Haavard Skinnemoen [this message]
2008-02-06 21:08             ` Dan Williams
2008-02-07 17:56               ` Haavard Skinnemoen
2008-01-30 18:28           ` Dan Williams
2008-01-30 20:45             ` David Brownell
2008-01-31  6:35     ` SDIO driver not receiving responses Farbod Nejati
2008-02-07 19:51       ` Pierre Ossman
2008-01-29 20:54 ` [RFC v2 0/5] dmaengine: Slave DMA interface and example users Haavard Skinnemoen
2008-01-30  6:56   ` David Brownell
2008-01-30  8:56     ` Haavard Skinnemoen
2008-01-30 17:39       ` Dan Williams
2008-02-04 15:32         ` Haavard Skinnemoen
2008-02-06 18:46           ` Dan Williams
2008-02-07 17:52             ` Haavard Skinnemoen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [RFC v2 2/5] dmaengine: Add slave DMA interface' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).