Skip to content

Commit

Permalink
DMA: PL330: Add xlate function
Browse files Browse the repository at this point in the history
Add xlate to translate the device-tree binding information into
the appropriate format. The filter function requires the dma
controller device and dma channel number as filter_params.

Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
  • Loading branch information
Padmavathi Venna authored and Vinod Koul committed Feb 14, 2013
1 parent 34d1935 commit a80258f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions drivers/dma/pl330.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <linux/amba/pl330.h>
#include <linux/scatterlist.h>
#include <linux/of.h>
#include <linux/of_dma.h>

#include "dmaengine.h"
#define PL330_MAX_CHAN 8
Expand Down Expand Up @@ -2379,6 +2380,30 @@ bool pl330_filter(struct dma_chan *chan, void *param)
}
EXPORT_SYMBOL(pl330_filter);

static struct dma_chan *of_dma_pl330_xlate(struct of_phandle_args *dma_spec,
struct of_dma *ofdma)
{
int count = dma_spec->args_count;
struct dma_pl330_dmac *pdmac = ofdma->of_dma_data;
struct dma_pl330_filter_args fargs;
dma_cap_mask_t cap;

if (!pdmac)
return NULL;

if (count != 1)
return NULL;

fargs.pdmac = pdmac;
fargs.chan_id = dma_spec->args[0];

dma_cap_zero(cap);
dma_cap_set(DMA_SLAVE, cap);
dma_cap_set(DMA_CYCLIC, cap);

return dma_request_channel(cap, pl330_dt_filter, &fargs);
}

static int pl330_alloc_chan_resources(struct dma_chan *chan)
{
struct dma_pl330_chan *pch = to_pchan(chan);
Expand Down

0 comments on commit a80258f

Please sign in to comment.