Re: [PATCH 1/2] dma: of: Add generic xlate function for matching by channel id

From: Arnd Bergmann
Date: Tue Apr 09 2013 - 09:06:23 EST


On Tuesday 09 April 2013, Lars-Peter Clausen wrote:
> On 04/09/2013 01:28 PM, Vinod Koul wrote:
> > On Sat, Mar 30, 2013 at 09:38:54AM +0100, Lars-Peter Clausen wrote:
> >> On 03/29/2013 10:49 PM, Vinod Koul wrote:
> >>> On Mon, Mar 25, 2013 at 02:16:51PM +0100, Lars-Peter Clausen wrote:
> >>>> This patch adds a new generic of dma xlate callback function which will match a
> >>>> channel by its id.
> >>> how will the client know which "id" to request?
> >>
> >> The devicetree tells it, or what exactly do you mean?
> > Is this global id? Anrd, what does the id mean in DT?
>
> It's more or less a device specific cookie. And in this case we are using a
> 1 to 1 mapping to the channel number.

To clarify this some more: The slave driver uses a name that is defined in the
binding of for the slave device to request a specific channel. This is typically
something trivial like "rx" or "data" that defines how the slave driver knows
its channel.

This gets passed to the dmaengine core, which looks up a dmaengine driver specific
description of a channel, using the name and the slave device pointer as keys.
Normally this is just a request number, sometimes it can be a combinattion
of request number with some other data like a master number or the DMA direction,
if the dmaengine driver requires that information in order to allocate the channel.

In this specific case, it is the chan_id number, which is correct for any driver
that uses the same number for slave_id and chan_id. It may be an exaggeration
to call it "generic", since this only works for a few dmaengine drivers, but
it's reasonable to have this kind of helper in common code since there are
multiple drivers with the same characteristic.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/