diff options
| author | Padmavathi Venna <padma.v@samsung.com> | 2013-02-13 22:40:05 -0500 |
|---|---|---|
| committer | Vinod Koul <vinod.koul@intel.com> | 2013-02-14 09:34:27 -0500 |
| commit | 34d19355b84adde9eebc1d6771231c15dff891e6 (patch) | |
| tree | a1de3edb01cc8591032833ed934bcd4a1e16ce64 | |
| parent | a72208733f7866972bcba7995f7e598ad07f1158 (diff) | |
DMA: PL330: Add new pl330 filter for DT case.
This patch adds a new pl330_dt_filter for DT case to filter the
required channel based on the new filter params and modifies the
old filter only for non-DT case as suggested by Arnd Bergmann.
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>
| -rw-r--r-- | drivers/dma/pl330.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index f7edb6f0ee87..40e97528244b 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
| @@ -606,6 +606,11 @@ struct dma_pl330_desc { | |||
| 606 | struct dma_pl330_chan *pchan; | 606 | struct dma_pl330_chan *pchan; |
| 607 | }; | 607 | }; |
| 608 | 608 | ||
| 609 | struct dma_pl330_filter_args { | ||
| 610 | struct dma_pl330_dmac *pdmac; | ||
| 611 | unsigned int chan_id; | ||
| 612 | }; | ||
| 613 | |||
| 609 | static inline void _callback(struct pl330_req *r, enum pl330_op_err err) | 614 | static inline void _callback(struct pl330_req *r, enum pl330_op_err err) |
| 610 | { | 615 | { |
| 611 | if (r && r->xfer_cb) | 616 | if (r && r->xfer_cb) |
| @@ -2352,6 +2357,16 @@ static void dma_pl330_rqcb(void *token, enum pl330_op_err err) | |||
| 2352 | tasklet_schedule(&pch->task); | 2357 | tasklet_schedule(&pch->task); |
| 2353 | } | 2358 | } |
| 2354 | 2359 | ||
| 2360 | static bool pl330_dt_filter(struct dma_chan *chan, void *param) | ||
| 2361 | { | ||
| 2362 | struct dma_pl330_filter_args *fargs = param; | ||
| 2363 | |||
| 2364 | if (chan->device != &fargs->pdmac->ddma) | ||
| 2365 | return false; | ||
| 2366 | |||
| 2367 | return (chan->chan_id == fargs->chan_id); | ||
| 2368 | } | ||
| 2369 | |||
| 2355 | bool pl330_filter(struct dma_chan *chan, void *param) | 2370 | bool pl330_filter(struct dma_chan *chan, void *param) |
| 2356 | { | 2371 | { |
| 2357 | u8 *peri_id; | 2372 | u8 *peri_id; |
| @@ -2359,20 +2374,6 @@ bool pl330_filter(struct dma_chan *chan, void *param) | |||
| 2359 | if (chan->device->dev->driver != &pl330_driver.drv) | 2374 | if (chan->device->dev->driver != &pl330_driver.drv) |
| 2360 | return false; | 2375 | return false; |
| 2361 | 2376 | ||
| 2362 | #ifdef CONFIG_OF | ||
| 2363 | if (chan->device->dev->of_node) { | ||
| 2364 | const __be32 *prop_value; | ||
| 2365 | phandle phandle; | ||
| 2366 | struct device_node *node; | ||
| 2367 | |||
| 2368 | prop_value = ((struct property *)param)->value; | ||
| 2369 | phandle = be32_to_cpup(prop_value++); | ||
| 2370 | node = of_find_node_by_phandle(phandle); | ||
| 2371 | return ((chan->private == node) && | ||
| 2372 | (chan->chan_id == be32_to_cpup(prop_value))); | ||
| 2373 | } | ||
| 2374 | #endif | ||
| 2375 | |||
| 2376 | peri_id = chan->private; | 2377 | peri_id = chan->private; |
| 2377 | return *peri_id == (unsigned)param; | 2378 | return *peri_id == (unsigned)param; |
| 2378 | } | 2379 | } |
