aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2015-10-14 07:42:50 -0400
committerVinod Koul <vinod.koul@intel.com>2015-10-14 10:27:11 -0400
commitb2c843a196b8f5aca74ebabd16c60d59480d6721 (patch)
tree33db82cbaece2e8123fb8a96b15ba33202e9fb30
parentca304fa9bb762f091e851d48de43f623c975d47a (diff)
ARM/dmaengine: edma: Remove limitation on the number of eDMA controllers
Since the driver stack no longer depends on lookup with id number in a global array of pointers, the limitation for the number of eDMAs are no longer needed. We can handle as many eDMAs in legacy and DT boot as we have memory for them to allocate the needed structures. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r--arch/arm/common/edma.c22
-rw-r--r--drivers/dma/edma.c17
2 files changed, 13 insertions, 26 deletions
diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
index 03692520812a..5b747f1bc8b5 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -1227,24 +1227,7 @@ static int edma_probe(struct platform_device *pdev)
1227 .parent = &pdev->dev, 1227 .parent = &pdev->dev,
1228 }; 1228 };
1229 1229
1230 /* When booting with DT the pdev->id is -1 */
1231 if (dev_id < 0)
1232 dev_id = arch_num_cc;
1233
1234 if (dev_id >= EDMA_MAX_CC) {
1235 dev_err(dev,
1236 "eDMA3 with device id 0 and 1 is supported (id: %d)\n",
1237 dev_id);
1238 return -EINVAL;
1239 }
1240
1241 if (node) { 1230 if (node) {
1242 /* Check if this is a second instance registered */
1243 if (arch_num_cc) {
1244 dev_err(dev, "only one EDMA instance is supported via DT\n");
1245 return -ENODEV;
1246 }
1247
1248 info = edma_setup_info_from_dt(dev, node); 1231 info = edma_setup_info_from_dt(dev, node);
1249 if (IS_ERR(info)) { 1232 if (IS_ERR(info)) {
1250 dev_err(dev, "failed to get DT data\n"); 1233 dev_err(dev, "failed to get DT data\n");
@@ -1278,6 +1261,11 @@ static int edma_probe(struct platform_device *pdev)
1278 1261
1279 cc->dev = dev; 1262 cc->dev = dev;
1280 cc->id = dev_id; 1263 cc->id = dev_id;
1264 /* When booting with DT the pdev->id is -1 */
1265 if (dev_id < 0) {
1266 cc->id = 0;
1267 dev_id = arch_num_cc;
1268 }
1281 dev_set_drvdata(dev, cc); 1269 dev_set_drvdata(dev, cc);
1282 1270
1283 cc->base = devm_ioremap_resource(dev, mem); 1271 cc->base = devm_ioremap_resource(dev, mem);
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 53d48b2a700d..fc91ab9dd1bb 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -991,14 +991,12 @@ static void edma_dma_init(struct edma_cc *ecc, struct dma_device *dma,
991 INIT_LIST_HEAD(&dma->channels); 991 INIT_LIST_HEAD(&dma->channels);
992} 992}
993 993
994static struct of_dma_filter_info edma_filter_info = {
995 .filter_fn = edma_filter_fn,
996};
997
998static int edma_probe(struct platform_device *pdev) 994static int edma_probe(struct platform_device *pdev)
999{ 995{
1000 struct edma_cc *ecc; 996 struct edma_cc *ecc;
1001 struct device_node *parent_node = pdev->dev.parent->of_node; 997 struct device_node *parent_node = pdev->dev.parent->of_node;
998 struct platform_device *parent_pdev =
999 to_platform_device(pdev->dev.parent);
1002 int ret; 1000 int ret;
1003 1001
1004 ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 1002 ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
@@ -1015,7 +1013,10 @@ static int edma_probe(struct platform_device *pdev)
1015 if (!ecc->cc) 1013 if (!ecc->cc)
1016 return -ENODEV; 1014 return -ENODEV;
1017 1015
1018 ecc->ctlr = pdev->id; 1016 ecc->ctlr = parent_pdev->id;
1017 if (ecc->ctlr < 0)
1018 ecc->ctlr = 0;
1019
1019 ecc->dummy_slot = edma_alloc_slot(ecc->cc, EDMA_SLOT_ANY); 1020 ecc->dummy_slot = edma_alloc_slot(ecc->cc, EDMA_SLOT_ANY);
1020 if (ecc->dummy_slot < 0) { 1021 if (ecc->dummy_slot < 0) {
1021 dev_err(&pdev->dev, "Can't allocate PaRAM dummy slot\n"); 1022 dev_err(&pdev->dev, "Can't allocate PaRAM dummy slot\n");
@@ -1038,10 +1039,8 @@ static int edma_probe(struct platform_device *pdev)
1038 platform_set_drvdata(pdev, ecc); 1039 platform_set_drvdata(pdev, ecc);
1039 1040
1040 if (parent_node) { 1041 if (parent_node) {
1041 dma_cap_set(DMA_SLAVE, edma_filter_info.dma_cap); 1042 of_dma_controller_register(parent_node, of_dma_xlate_by_chan_id,
1042 dma_cap_set(DMA_CYCLIC, edma_filter_info.dma_cap); 1043 &ecc->dma_slave);
1043 of_dma_controller_register(parent_node, of_dma_simple_xlate,
1044 &edma_filter_info);
1045 } 1044 }
1046 1045
1047 dev_info(&pdev->dev, "TI EDMA DMA engine driver\n"); 1046 dev_info(&pdev->dev, "TI EDMA DMA engine driver\n");