[v3,05/20] dmaengine: ti: k3-udma-glue: Get the ringacc from udma_dev

Message ID 20201208090440.31792-6-peter.ujfalusi@ti.com
State Accepted
Commit aa8a4c4edad0bed7aaf3a7cfcae9fa555d847955
Headers show
Series
  • dmaengine/soc: k3-udma: Add support for BCDMA and PKTDMA
Related show

Commit Message

Peter Ujfalusi Dec. 8, 2020, 9:04 a.m.
If of_xudma_dev_get() returns with the valid udma_dev then the driver
already got the ringacc, there is no need to execute
of_k3_ringacc_get_by_phandle() for each channel via the glue layer.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

---
 drivers/dma/ti/k3-udma-glue.c    | 6 +-----
 drivers/dma/ti/k3-udma-private.c | 6 ++++++
 drivers/dma/ti/k3-udma.h         | 1 +
 3 files changed, 8 insertions(+), 5 deletions(-)

-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

Comments

Grygorii Strashko Dec. 8, 2020, 11:52 a.m. | #1
On 08/12/2020 11:04, Peter Ujfalusi wrote:
> If of_xudma_dev_get() returns with the valid udma_dev then the driver

> already got the ringacc, there is no need to execute

> of_k3_ringacc_get_by_phandle() for each channel via the glue layer.

> 

> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> ---

>   drivers/dma/ti/k3-udma-glue.c    | 6 +-----

>   drivers/dma/ti/k3-udma-private.c | 6 ++++++

>   drivers/dma/ti/k3-udma.h         | 1 +

>   3 files changed, 8 insertions(+), 5 deletions(-)

Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>


-- 
Best regards,
grygorii

Patch

diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c
index 29d1524d1916..8a8988be4175 100644
--- a/drivers/dma/ti/k3-udma-glue.c
+++ b/drivers/dma/ti/k3-udma-glue.c
@@ -86,15 +86,11 @@  struct k3_udma_glue_rx_channel {
 static int of_k3_udma_glue_parse(struct device_node *udmax_np,
 				 struct k3_udma_glue_common *common)
 {
-	common->ringacc = of_k3_ringacc_get_by_phandle(udmax_np,
-						       "ti,ringacc");
-	if (IS_ERR(common->ringacc))
-		return PTR_ERR(common->ringacc);
-
 	common->udmax = of_xudma_dev_get(udmax_np, NULL);
 	if (IS_ERR(common->udmax))
 		return PTR_ERR(common->udmax);
 
+	common->ringacc = xudma_get_ringacc(common->udmax);
 	common->tisci_rm = xudma_dev_get_tisci_rm(common->udmax);
 
 	return 0;
diff --git a/drivers/dma/ti/k3-udma-private.c b/drivers/dma/ti/k3-udma-private.c
index c9fb1d832581..0856721d0b04 100644
--- a/drivers/dma/ti/k3-udma-private.c
+++ b/drivers/dma/ti/k3-udma-private.c
@@ -56,6 +56,12 @@  struct device *xudma_get_device(struct udma_dev *ud)
 }
 EXPORT_SYMBOL(xudma_get_device);
 
+struct k3_ringacc *xudma_get_ringacc(struct udma_dev *ud)
+{
+	return ud->ringacc;
+}
+EXPORT_SYMBOL(xudma_get_ringacc);
+
 u32 xudma_dev_get_psil_base(struct udma_dev *ud)
 {
 	return ud->psil_base;
diff --git a/drivers/dma/ti/k3-udma.h b/drivers/dma/ti/k3-udma.h
index d1cace0cb43b..b4334b1b7b14 100644
--- a/drivers/dma/ti/k3-udma.h
+++ b/drivers/dma/ti/k3-udma.h
@@ -113,6 +113,7 @@  int xudma_navss_psil_unpair(struct udma_dev *ud, u32 src_thread,
 
 struct udma_dev *of_xudma_dev_get(struct device_node *np, const char *property);
 struct device *xudma_get_device(struct udma_dev *ud);
+struct k3_ringacc *xudma_get_ringacc(struct udma_dev *ud);
 void xudma_dev_put(struct udma_dev *ud);
 u32 xudma_dev_get_psil_base(struct udma_dev *ud);
 struct udma_tisci_rm *xudma_dev_get_tisci_rm(struct udma_dev *ud);