mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-30 08:07:59 +00:00
dma: ti: k3-udma: Move DMA channel[0] allocation to probe and add udma_remove()
Currently, the allocation of DMA channel[0] for memcpy is happening in udma_transfer() for every transfer, which leads to a huge overhead for each transfer, especially in case of nand page reads. So, move this allocation to udma_probe(), as a result, the allocation is done once during probe. Introduce udma_remove() for the cleanup of allocated channel during probe. Signed-off-by: Santhosh Kumar K <s-k6@ti.com> Signed-off-by: Prasanth Babu Mantena <p-mantena@ti.com>
This commit is contained in:
parent
7f069cc9fa
commit
f83076add0
1 changed files with 38 additions and 25 deletions
|
@ -2190,37 +2190,12 @@ static int udma_transfer(struct udevice *dev, int direction,
|
||||||
/* Channel0 is reserved for memcpy */
|
/* Channel0 is reserved for memcpy */
|
||||||
struct udma_chan *uc = &ud->channels[0];
|
struct udma_chan *uc = &ud->channels[0];
|
||||||
dma_addr_t paddr = 0;
|
dma_addr_t paddr = 0;
|
||||||
int ret;
|
|
||||||
|
|
||||||
switch (ud->match_data->type) {
|
|
||||||
case DMA_TYPE_UDMA:
|
|
||||||
ret = udma_alloc_chan_resources(uc);
|
|
||||||
break;
|
|
||||||
case DMA_TYPE_BCDMA:
|
|
||||||
ret = bcdma_alloc_chan_resources(uc);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
};
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
udma_prep_dma_memcpy(uc, dst, src, len);
|
udma_prep_dma_memcpy(uc, dst, src, len);
|
||||||
udma_start(uc);
|
udma_start(uc);
|
||||||
udma_poll_completion(uc, &paddr);
|
udma_poll_completion(uc, &paddr);
|
||||||
udma_stop(uc);
|
udma_stop(uc);
|
||||||
|
|
||||||
switch (ud->match_data->type) {
|
|
||||||
case DMA_TYPE_UDMA:
|
|
||||||
udma_free_chan_resources(uc);
|
|
||||||
break;
|
|
||||||
case DMA_TYPE_BCDMA:
|
|
||||||
bcdma_free_bchan_resources(uc);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
};
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2590,6 +2565,7 @@ static int udma_probe(struct udevice *dev)
|
||||||
struct udevice *tmp;
|
struct udevice *tmp;
|
||||||
struct udevice *tisci_dev = NULL;
|
struct udevice *tisci_dev = NULL;
|
||||||
struct udma_tisci_rm *tisci_rm = &ud->tisci_rm;
|
struct udma_tisci_rm *tisci_rm = &ud->tisci_rm;
|
||||||
|
struct udma_chan *uc;
|
||||||
ofnode navss_ofnode = ofnode_get_parent(dev_ofnode(dev));
|
ofnode navss_ofnode = ofnode_get_parent(dev_ofnode(dev));
|
||||||
|
|
||||||
ud->match_data = (void *)dev_get_driver_data(dev);
|
ud->match_data = (void *)dev_get_driver_data(dev);
|
||||||
|
@ -2714,6 +2690,41 @@ static int udma_probe(struct udevice *dev)
|
||||||
|
|
||||||
uc_priv->supported = DMA_SUPPORTS_MEM_TO_MEM | DMA_SUPPORTS_MEM_TO_DEV;
|
uc_priv->supported = DMA_SUPPORTS_MEM_TO_MEM | DMA_SUPPORTS_MEM_TO_DEV;
|
||||||
|
|
||||||
|
uc = &ud->channels[0];
|
||||||
|
ret = 0;
|
||||||
|
switch (ud->match_data->type) {
|
||||||
|
case DMA_TYPE_UDMA:
|
||||||
|
ret = udma_alloc_chan_resources(uc);
|
||||||
|
break;
|
||||||
|
case DMA_TYPE_BCDMA:
|
||||||
|
ret = bcdma_alloc_chan_resources(uc);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break; /* Do nothing in any other case */
|
||||||
|
};
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
dev_err(dev, " Channel 0 allocation failure %d\n", ret);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int udma_remove(struct udevice *dev)
|
||||||
|
{
|
||||||
|
struct udma_dev *ud = dev_get_priv(dev);
|
||||||
|
struct udma_chan *uc = &ud->channels[0];
|
||||||
|
|
||||||
|
switch (ud->match_data->type) {
|
||||||
|
case DMA_TYPE_UDMA:
|
||||||
|
udma_free_chan_resources(uc);
|
||||||
|
break;
|
||||||
|
case DMA_TYPE_BCDMA:
|
||||||
|
bcdma_free_bchan_resources(uc);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2855,5 +2866,7 @@ U_BOOT_DRIVER(ti_edma3) = {
|
||||||
.of_match = udma_ids,
|
.of_match = udma_ids,
|
||||||
.ops = &udma_ops,
|
.ops = &udma_ops,
|
||||||
.probe = udma_probe,
|
.probe = udma_probe,
|
||||||
|
.remove = udma_remove,
|
||||||
.priv_auto = sizeof(struct udma_dev),
|
.priv_auto = sizeof(struct udma_dev),
|
||||||
|
.flags = DM_FLAG_OS_PREPARE,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue