dma: ti: k3-udma: Fix rflow reservation for PKTDMA
Driver has a bug in that it uses rflow_in_use bitmap when setting up free rflow range from TISCI but use rflow_map for reservation in __udma_reserve_rflow() Fix this by dropping rflow_in_use bitmap array and use rflow_map for PKTDMA. BCDMA does not need rflow_in_use either. This fixes CPSW3g not able to get DMA channels at R5 SPL on AM64x Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
This commit is contained in:

committed by
Tom Rini

parent
584216315d
commit
4af5e5f6fd
@@ -165,7 +165,6 @@ struct udma_dev {
|
|||||||
unsigned long *rchan_map;
|
unsigned long *rchan_map;
|
||||||
unsigned long *rflow_map;
|
unsigned long *rflow_map;
|
||||||
unsigned long *rflow_map_reserved;
|
unsigned long *rflow_map_reserved;
|
||||||
unsigned long *rflow_in_use;
|
|
||||||
unsigned long *tflow_map;
|
unsigned long *tflow_map;
|
||||||
|
|
||||||
struct udma_bchan *bchans;
|
struct udma_bchan *bchans;
|
||||||
@@ -1448,15 +1447,11 @@ static int bcdma_setup_resources(struct udma_dev *ud)
|
|||||||
sizeof(unsigned long), GFP_KERNEL);
|
sizeof(unsigned long), GFP_KERNEL);
|
||||||
ud->rchans = devm_kcalloc(dev, ud->rchan_cnt, sizeof(*ud->rchans),
|
ud->rchans = devm_kcalloc(dev, ud->rchan_cnt, sizeof(*ud->rchans),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
/* BCDMA do not really have flows, but the driver expect it */
|
|
||||||
ud->rflow_in_use = devm_kcalloc(dev, BITS_TO_LONGS(ud->rchan_cnt),
|
|
||||||
sizeof(unsigned long),
|
|
||||||
GFP_KERNEL);
|
|
||||||
ud->rflows = devm_kcalloc(dev, ud->rchan_cnt, sizeof(*ud->rflows),
|
ud->rflows = devm_kcalloc(dev, ud->rchan_cnt, sizeof(*ud->rflows),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
|
||||||
if (!ud->bchan_map || !ud->tchan_map || !ud->rchan_map ||
|
if (!ud->bchan_map || !ud->tchan_map || !ud->rchan_map ||
|
||||||
!ud->rflow_in_use || !ud->bchans || !ud->tchans || !ud->rchans ||
|
!ud->bchans || !ud->tchans || !ud->rchans ||
|
||||||
!ud->rflows)
|
!ud->rflows)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@@ -1535,7 +1530,7 @@ static int pktdma_setup_resources(struct udma_dev *ud)
|
|||||||
sizeof(unsigned long), GFP_KERNEL);
|
sizeof(unsigned long), GFP_KERNEL);
|
||||||
ud->rchans = devm_kcalloc(dev, ud->rchan_cnt, sizeof(*ud->rchans),
|
ud->rchans = devm_kcalloc(dev, ud->rchan_cnt, sizeof(*ud->rchans),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
ud->rflow_in_use = devm_kcalloc(dev, BITS_TO_LONGS(ud->rflow_cnt),
|
ud->rflow_map = devm_kcalloc(dev, BITS_TO_LONGS(ud->rflow_cnt),
|
||||||
sizeof(unsigned long),
|
sizeof(unsigned long),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
ud->rflows = devm_kcalloc(dev, ud->rflow_cnt, sizeof(*ud->rflows),
|
ud->rflows = devm_kcalloc(dev, ud->rflow_cnt, sizeof(*ud->rflows),
|
||||||
@@ -1544,7 +1539,7 @@ static int pktdma_setup_resources(struct udma_dev *ud)
|
|||||||
sizeof(unsigned long), GFP_KERNEL);
|
sizeof(unsigned long), GFP_KERNEL);
|
||||||
|
|
||||||
if (!ud->tchan_map || !ud->rchan_map || !ud->tflow_map || !ud->tchans ||
|
if (!ud->tchan_map || !ud->rchan_map || !ud->tflow_map || !ud->tchans ||
|
||||||
!ud->rchans || !ud->rflows || !ud->rflow_in_use)
|
!ud->rchans || !ud->rflows || !ud->rflow_map)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* Get resource ranges from tisci */
|
/* Get resource ranges from tisci */
|
||||||
@@ -1592,12 +1587,12 @@ static int pktdma_setup_resources(struct udma_dev *ud)
|
|||||||
rm_res = tisci_rm->rm_ranges[RM_RANGE_RFLOW];
|
rm_res = tisci_rm->rm_ranges[RM_RANGE_RFLOW];
|
||||||
if (IS_ERR(rm_res)) {
|
if (IS_ERR(rm_res)) {
|
||||||
/* all rflows are assigned exclusively to Linux */
|
/* all rflows are assigned exclusively to Linux */
|
||||||
bitmap_zero(ud->rflow_in_use, ud->rflow_cnt);
|
bitmap_zero(ud->rflow_map, ud->rflow_cnt);
|
||||||
} else {
|
} else {
|
||||||
bitmap_fill(ud->rflow_in_use, ud->rflow_cnt);
|
bitmap_fill(ud->rflow_map, ud->rflow_cnt);
|
||||||
for (i = 0; i < rm_res->sets; i++) {
|
for (i = 0; i < rm_res->sets; i++) {
|
||||||
rm_desc = &rm_res->desc[i];
|
rm_desc = &rm_res->desc[i];
|
||||||
bitmap_clear(ud->rflow_in_use, rm_desc->start,
|
bitmap_clear(ud->rflow_map, rm_desc->start,
|
||||||
rm_desc->num);
|
rm_desc->num);
|
||||||
dev_dbg(dev, "ti-sci-res: rflow: %d:%d\n",
|
dev_dbg(dev, "ti-sci-res: rflow: %d:%d\n",
|
||||||
rm_desc->start, rm_desc->num);
|
rm_desc->start, rm_desc->num);
|
||||||
|
Reference in New Issue
Block a user