lkml.org 
[lkml]   [2015]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC v02 04/15] dmaengine: edma: Add support for DMA filter mapping to slave devices
Date
On Tuesday 01 December 2015 11:58:53 Peter Ujfalusi wrote:
> On 11/30/2015 04:11 PM, Arnd Bergmann wrote:
> > On Monday 30 November 2015 15:45:34 Peter Ujfalusi wrote:
> >> @@ -2428,6 +2436,22 @@ bool edma_filter_fn(struct dma_chan *chan, void *param)
> >> }
> >> EXPORT_SYMBOL(edma_filter_fn);
> >>
> >> +static bool edma_filter_for_map(struct dma_chan *chan, void *param)
> >> +{
> >> + bool match = false;
> >> +
> >> + if (chan->device->dev->driver == &edma_driver.driver) {
> >> + struct edma_chan *echan = to_edma_chan(chan);
> >> + unsigned ch_req = (unsigned)param;
> >> + if (ch_req == echan->ch_num) {
> >> + /* The channel is going to be used as HW synchronized */
> >> + echan->hw_triggered = true;
> >> + match = true;
> >> + }
> >> + }
> >> + return match;
> >> +}
> >> +
> >> static int edma_init(void)
> >>
> >
> > I don't see the difference between edma_filter_fn and edma_filter_for_map.
> > Why do you need both?
>
> edma_filter_fn:
> unsigned ch_req = *(unsigned *)param;
>
> edma_filter_for_map:
> unsigned ch_req = (unsigned)param;

I see.

> If I want to reuse the edma_filter_fn, I would need an unsigned array for the
> eDMA event numbers in the board files to be able to provide the pointer to
> each of them.

How about this:

#define EDMA_CTLR_CHANP(ctlr, chan) ((const int[]){ [0] = ((ctlr) << 16) | (chan)})

static struct dma_filter_map da830_edma_map[] = {
{ "davinci-mcasp.0", "rx", EDMA_CTLR_CHANP(0, 0)},
{ "davinci-mcasp.0", "tx", EDMA_CTLR_CHANP(0, 1)},
{ "davinci-mcasp.1", "rx", EDMA_CTLR_CHANP(0, 2)},
...
};

That way, you create an anonymous constant integer expression and the data
points to that.

Arnd


\
 
 \ /
  Last update: 2015-12-01 11:41    [W:0.047 / U:1.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site