[PATCH 2/4] DMA: PL330: Register the DMA controller with the generic DMA helpers
Padmavathi Venna
padma.v at samsung.com
Fri Jan 18 22:33:42 EST 2013
This patch registers the pl330 dma controller driver with the generic
device tree dma helper functions.
Signed-off-by: Padmavathi Venna <padma.v at samsung.com>
---
drivers/dma/pl330.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index b0a9080..b80ef97 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2874,6 +2874,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
struct dma_pl330_platdata *pdat;
struct dma_pl330_dmac *pdmac;
struct dma_pl330_chan *pch;
+ struct of_dma_filter_info *pfi;
struct pl330_info *pi;
struct dma_device *pd;
struct resource *res;
@@ -2990,6 +2991,23 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
pi->pcfg.data_bus_width / 8, pi->pcfg.num_chan,
pi->pcfg.num_peri, pi->pcfg.num_events);
+ pfi = devm_kzalloc(&adev->dev, sizeof(*pfi), GFP_KERNEL);
+ if (!pfi) {
+ dev_err(&adev->dev, "unable to allocate mem\n");
+ return -ENOMEM;
+ }
+
+ pfi->dma_cap = pd->cap_mask;
+ pfi->filter_fn = pl330_filter;
+
+ ret = of_dma_controller_register(adev->dev.of_node,
+ of_dma_pl330_xlate, pfi);
+ if (ret) {
+ dev_err(&adev->dev, "unable to register DMA to the\
+ generic DT DMA helpers\n");
+ goto probe_err2;
+ }
+
return 0;
probe_err4:
@@ -3016,6 +3034,8 @@ static int pl330_remove(struct amba_device *adev)
if (!pdmac)
return 0;
+ of_dma_controller_free(adev->dev.of_node);
+
amba_set_drvdata(adev, NULL);
/* Idle the DMAC */
--
1.7.4.4
More information about the devicetree-discuss
mailing list