Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Peter Ujfalusi and committed by
Vinod Koul
b2c843a1 ca304fa9

+13 -26
+5 -17
arch/arm/common/edma.c
··· 1227 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 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 1231 info = edma_setup_info_from_dt(dev, node); 1249 1232 if (IS_ERR(info)) { 1250 1233 dev_err(dev, "failed to get DT data\n"); ··· 1261 1278 1262 1279 cc->dev = dev; 1263 1280 cc->id = dev_id; 1281 + /* When booting with DT the pdev->id is -1 */ 1282 + if (dev_id < 0) { 1283 + cc->id = 0; 1284 + dev_id = arch_num_cc; 1285 + } 1264 1286 dev_set_drvdata(dev, cc); 1265 1287 1266 1288 cc->base = devm_ioremap_resource(dev, mem);
+8 -9
drivers/dma/edma.c
··· 991 991 INIT_LIST_HEAD(&dma->channels); 992 992 } 993 993 994 - static struct of_dma_filter_info edma_filter_info = { 995 - .filter_fn = edma_filter_fn, 996 - }; 997 - 998 994 static int edma_probe(struct platform_device *pdev) 999 995 { 1000 996 struct edma_cc *ecc; 1001 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 1000 int ret; 1003 1001 1004 1002 ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); ··· 1013 1015 if (!ecc->cc) 1014 1016 return -ENODEV; 1015 1017 1016 - ecc->ctlr = pdev->id; 1018 + ecc->ctlr = parent_pdev->id; 1019 + if (ecc->ctlr < 0) 1020 + ecc->ctlr = 0; 1021 + 1017 1022 ecc->dummy_slot = edma_alloc_slot(ecc->cc, EDMA_SLOT_ANY); 1018 1023 if (ecc->dummy_slot < 0) { 1019 1024 dev_err(&pdev->dev, "Can't allocate PaRAM dummy slot\n"); ··· 1039 1038 platform_set_drvdata(pdev, ecc); 1040 1039 1041 1040 if (parent_node) { 1042 - dma_cap_set(DMA_SLAVE, edma_filter_info.dma_cap); 1043 - dma_cap_set(DMA_CYCLIC, edma_filter_info.dma_cap); 1044 - of_dma_controller_register(parent_node, of_dma_simple_xlate, 1045 - &edma_filter_info); 1041 + of_dma_controller_register(parent_node, of_dma_xlate_by_chan_id, 1042 + &ecc->dma_slave); 1046 1043 } 1047 1044 1048 1045 dev_info(&pdev->dev, "TI EDMA DMA engine driver\n");