drivers/dma/ti/k3-udma.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
The SoC DMA resources for UDMA, BCDMA and PKTDMA can be described via a
combination of up to two resource ranges. The first resource range handles
the default partitioning wherein all resources belonging to that range are
allocated to a single entity and form a continuous range. For use-cases
where the resources are shared across multiple entities and require to be
described via discontinuous ranges, a second resource range is required.
Currently, udma_setup_resources() supports handling resources that belong
to the second range. Extend bcdma_setup_resources() and
pktdma_setup_resources() to support the same.
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
---
drivers/dma/ti/k3-udma.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index 7ed1956b4642..b223a7aacb0c 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -4886,6 +4886,12 @@ static int bcdma_setup_resources(struct udma_dev *ud)
irq_res.desc[i].start = rm_res->desc[i].start +
oes->bcdma_bchan_ring;
irq_res.desc[i].num = rm_res->desc[i].num;
+
+ if (rm_res->desc[i].num_sec) {
+ irq_res.desc[i].start_sec = rm_res->desc[i].start_sec +
+ oes->bcdma_bchan_ring;
+ irq_res.desc[i].num_sec = rm_res->desc[i].num_sec;
+ }
}
}
} else {
@@ -4909,6 +4915,15 @@ static int bcdma_setup_resources(struct udma_dev *ud)
irq_res.desc[i + 1].start = rm_res->desc[j].start +
oes->bcdma_tchan_ring;
irq_res.desc[i + 1].num = rm_res->desc[j].num;
+
+ if (rm_res->desc[j].num_sec) {
+ irq_res.desc[i].start_sec = rm_res->desc[j].start_sec +
+ oes->bcdma_tchan_data;
+ irq_res.desc[i].num_sec = rm_res->desc[j].num_sec;
+ irq_res.desc[i + 1].start_sec = rm_res->desc[j].start_sec +
+ oes->bcdma_tchan_ring;
+ irq_res.desc[i + 1].num_sec = rm_res->desc[j].num_sec;
+ }
}
}
}
@@ -4929,6 +4944,15 @@ static int bcdma_setup_resources(struct udma_dev *ud)
irq_res.desc[i + 1].start = rm_res->desc[j].start +
oes->bcdma_rchan_ring;
irq_res.desc[i + 1].num = rm_res->desc[j].num;
+
+ if (rm_res->desc[j].num_sec) {
+ irq_res.desc[i].start_sec = rm_res->desc[j].start_sec +
+ oes->bcdma_rchan_data;
+ irq_res.desc[i].num_sec = rm_res->desc[j].num_sec;
+ irq_res.desc[i + 1].start_sec = rm_res->desc[j].start_sec +
+ oes->bcdma_rchan_ring;
+ irq_res.desc[i + 1].num_sec = rm_res->desc[j].num_sec;
+ }
}
}
}
@@ -5063,6 +5087,12 @@ static int pktdma_setup_resources(struct udma_dev *ud)
irq_res.desc[i].start = rm_res->desc[i].start +
oes->pktdma_tchan_flow;
irq_res.desc[i].num = rm_res->desc[i].num;
+
+ if (rm_res->desc[i].num_sec) {
+ irq_res.desc[i].start_sec = rm_res->desc[i].start_sec +
+ oes->pktdma_tchan_flow;
+ irq_res.desc[i].num_sec = rm_res->desc[i].num_sec;
+ }
}
}
rm_res = tisci_rm->rm_ranges[RM_RANGE_RFLOW];
@@ -5074,6 +5104,12 @@ static int pktdma_setup_resources(struct udma_dev *ud)
irq_res.desc[i].start = rm_res->desc[j].start +
oes->pktdma_rchan_flow;
irq_res.desc[i].num = rm_res->desc[j].num;
+
+ if (rm_res->desc[j].num_sec) {
+ irq_res.desc[i].start_sec = rm_res->desc[j].start_sec +
+ oes->pktdma_rchan_flow;
+ irq_res.desc[i].num_sec = rm_res->desc[j].num_sec;
+ }
}
}
ret = ti_sci_inta_msi_domain_alloc_irqs(ud->dev, &irq_res);
--
2.43.0
On Wed, 05 Feb 2025 17:48:01 +0530, Siddharth Vadapalli wrote:
> The SoC DMA resources for UDMA, BCDMA and PKTDMA can be described via a
> combination of up to two resource ranges. The first resource range handles
> the default partitioning wherein all resources belonging to that range are
> allocated to a single entity and form a continuous range. For use-cases
> where the resources are shared across multiple entities and require to be
> described via discontinuous ranges, a second resource range is required.
>
> [...]
Applied, thanks!
[1/1] dmaengine: ti: k3-udma: Enable second resource range for BCDMA and PKTDMA
commit: 566beb347eded7a860511164a7a163bc882dc4d0
Best regards,
--
~Vinod
On 05/02/2025 14:18, Siddharth Vadapalli wrote:
> The SoC DMA resources for UDMA, BCDMA and PKTDMA can be described via a
> combination of up to two resource ranges. The first resource range handles
> the default partitioning wherein all resources belonging to that range are
> allocated to a single entity and form a continuous range. For use-cases
> where the resources are shared across multiple entities and require to be
> described via discontinuous ranges, a second resource range is required.
>
> Currently, udma_setup_resources() supports handling resources that belong
> to the second range. Extend bcdma_setup_resources() and
> pktdma_setup_resources() to support the same.
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
>
> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
> ---
> drivers/dma/ti/k3-udma.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index 7ed1956b4642..b223a7aacb0c 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -4886,6 +4886,12 @@ static int bcdma_setup_resources(struct udma_dev *ud)
> irq_res.desc[i].start = rm_res->desc[i].start +
> oes->bcdma_bchan_ring;
> irq_res.desc[i].num = rm_res->desc[i].num;
> +
> + if (rm_res->desc[i].num_sec) {
> + irq_res.desc[i].start_sec = rm_res->desc[i].start_sec +
> + oes->bcdma_bchan_ring;
> + irq_res.desc[i].num_sec = rm_res->desc[i].num_sec;
> + }
> }
> }
> } else {
> @@ -4909,6 +4915,15 @@ static int bcdma_setup_resources(struct udma_dev *ud)
> irq_res.desc[i + 1].start = rm_res->desc[j].start +
> oes->bcdma_tchan_ring;
> irq_res.desc[i + 1].num = rm_res->desc[j].num;
> +
> + if (rm_res->desc[j].num_sec) {
> + irq_res.desc[i].start_sec = rm_res->desc[j].start_sec +
> + oes->bcdma_tchan_data;
> + irq_res.desc[i].num_sec = rm_res->desc[j].num_sec;
> + irq_res.desc[i + 1].start_sec = rm_res->desc[j].start_sec +
> + oes->bcdma_tchan_ring;
> + irq_res.desc[i + 1].num_sec = rm_res->desc[j].num_sec;
> + }
> }
> }
> }
> @@ -4929,6 +4944,15 @@ static int bcdma_setup_resources(struct udma_dev *ud)
> irq_res.desc[i + 1].start = rm_res->desc[j].start +
> oes->bcdma_rchan_ring;
> irq_res.desc[i + 1].num = rm_res->desc[j].num;
> +
> + if (rm_res->desc[j].num_sec) {
> + irq_res.desc[i].start_sec = rm_res->desc[j].start_sec +
> + oes->bcdma_rchan_data;
> + irq_res.desc[i].num_sec = rm_res->desc[j].num_sec;
> + irq_res.desc[i + 1].start_sec = rm_res->desc[j].start_sec +
> + oes->bcdma_rchan_ring;
> + irq_res.desc[i + 1].num_sec = rm_res->desc[j].num_sec;
> + }
> }
> }
> }
> @@ -5063,6 +5087,12 @@ static int pktdma_setup_resources(struct udma_dev *ud)
> irq_res.desc[i].start = rm_res->desc[i].start +
> oes->pktdma_tchan_flow;
> irq_res.desc[i].num = rm_res->desc[i].num;
> +
> + if (rm_res->desc[i].num_sec) {
> + irq_res.desc[i].start_sec = rm_res->desc[i].start_sec +
> + oes->pktdma_tchan_flow;
> + irq_res.desc[i].num_sec = rm_res->desc[i].num_sec;
> + }
> }
> }
> rm_res = tisci_rm->rm_ranges[RM_RANGE_RFLOW];
> @@ -5074,6 +5104,12 @@ static int pktdma_setup_resources(struct udma_dev *ud)
> irq_res.desc[i].start = rm_res->desc[j].start +
> oes->pktdma_rchan_flow;
> irq_res.desc[i].num = rm_res->desc[j].num;
> +
> + if (rm_res->desc[j].num_sec) {
> + irq_res.desc[i].start_sec = rm_res->desc[j].start_sec +
> + oes->pktdma_rchan_flow;
> + irq_res.desc[i].num_sec = rm_res->desc[j].num_sec;
> + }
> }
> }
> ret = ti_sci_inta_msi_domain_alloc_irqs(ud->dev, &irq_res);
--
Péter
© 2016 - 2025 Red Hat, Inc.