All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vignesh Raghavendra <vigneshr@ti.com>
To: Peter Ujfalusi <peter.ujfalusi@gmail.com>, Vinod Koul <vkoul@kernel.org>
Cc: <dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	<linux-arm-kernel@lists.infradead.org>, <j-luthra@ti.com>,
	<j-choudhary@ti.com>, <francesco@dolcini.it>
Subject: [PATCH] dmaengine: ti: k3-udma: Fix teardown timeout for cyclic mode
Date: Mon, 21 Aug 2023 16:10:03 +0530	[thread overview]
Message-ID: <20230821104003.3001021-1-vigneshr@ti.com> (raw)

In cyclic mode, last descriptor needs to have EOP flag set so that
teardown flushes data towards PDMA in case of MEM_TO_DMA.  Else,
operation will not complete successfully leading to spurious timeout on
channel terminate.

Without this terminating aplay cmd outputs false error msg like:
[116.402800] ti-bcdma 485c0100.dma-controller: chan1 teardown timeout!

This doesn't seem to be problem with UDMA-P on J7xx devices (although is
a requirement as per spec) but shows up easily on BCDMA + McASP. Fix
this by setting the appropriate flag

Fixes: 017794739702 ("dmaengine: ti: k3-udma: Initial support for K3 BCDMA")
Suggested-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---

This complete reimplementation based on learning of HW behavior for problems
reported at
https://lore.kernel.org/linux-arm-kernel/20220215044112.161634-1-vigneshr@ti.com/

 drivers/dma/ti/k3-udma.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index 30fd2f386f36..02aac7be8d28 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -3476,6 +3476,10 @@ udma_prep_dma_cyclic_tr(struct udma_chan *uc, dma_addr_t buf_addr,
 	u16 tr0_cnt0, tr0_cnt1, tr1_cnt0;
 	unsigned int i;
 	int num_tr;
+	u32 period_csf = 0;
+
+	if (uc->config.ep_type == PSIL_EP_PDMA_XY && dir == DMA_MEM_TO_DEV)
+		period_csf = CPPI5_TR_CSF_EOP;
 
 	num_tr = udma_get_tr_counters(period_len, __ffs(buf_addr), &tr0_cnt0,
 				      &tr0_cnt1, &tr1_cnt0);
@@ -3525,8 +3529,10 @@ udma_prep_dma_cyclic_tr(struct udma_chan *uc, dma_addr_t buf_addr,
 		}
 
 		if (!(flags & DMA_PREP_INTERRUPT))
-			cppi5_tr_csf_set(&tr_req[tr_idx].flags,
-					 CPPI5_TR_CSF_SUPR_EVT);
+			period_csf |= CPPI5_TR_CSF_SUPR_EVT;
+
+		if (period_csf)
+			cppi5_tr_csf_set(&tr_req[tr_idx].flags, period_csf);
 
 		period_addr += period_len;
 	}
-- 
2.41.0


WARNING: multiple messages have this Message-ID (diff)
From: Vignesh Raghavendra <vigneshr@ti.com>
To: Peter Ujfalusi <peter.ujfalusi@gmail.com>, Vinod Koul <vkoul@kernel.org>
Cc: <dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	<linux-arm-kernel@lists.infradead.org>, <j-luthra@ti.com>,
	<j-choudhary@ti.com>, <francesco@dolcini.it>
Subject: [PATCH] dmaengine: ti: k3-udma: Fix teardown timeout for cyclic mode
Date: Mon, 21 Aug 2023 16:10:03 +0530	[thread overview]
Message-ID: <20230821104003.3001021-1-vigneshr@ti.com> (raw)

In cyclic mode, last descriptor needs to have EOP flag set so that
teardown flushes data towards PDMA in case of MEM_TO_DMA.  Else,
operation will not complete successfully leading to spurious timeout on
channel terminate.

Without this terminating aplay cmd outputs false error msg like:
[116.402800] ti-bcdma 485c0100.dma-controller: chan1 teardown timeout!

This doesn't seem to be problem with UDMA-P on J7xx devices (although is
a requirement as per spec) but shows up easily on BCDMA + McASP. Fix
this by setting the appropriate flag

Fixes: 017794739702 ("dmaengine: ti: k3-udma: Initial support for K3 BCDMA")
Suggested-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---

This complete reimplementation based on learning of HW behavior for problems
reported at
https://lore.kernel.org/linux-arm-kernel/20220215044112.161634-1-vigneshr@ti.com/

 drivers/dma/ti/k3-udma.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index 30fd2f386f36..02aac7be8d28 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -3476,6 +3476,10 @@ udma_prep_dma_cyclic_tr(struct udma_chan *uc, dma_addr_t buf_addr,
 	u16 tr0_cnt0, tr0_cnt1, tr1_cnt0;
 	unsigned int i;
 	int num_tr;
+	u32 period_csf = 0;
+
+	if (uc->config.ep_type == PSIL_EP_PDMA_XY && dir == DMA_MEM_TO_DEV)
+		period_csf = CPPI5_TR_CSF_EOP;
 
 	num_tr = udma_get_tr_counters(period_len, __ffs(buf_addr), &tr0_cnt0,
 				      &tr0_cnt1, &tr1_cnt0);
@@ -3525,8 +3529,10 @@ udma_prep_dma_cyclic_tr(struct udma_chan *uc, dma_addr_t buf_addr,
 		}
 
 		if (!(flags & DMA_PREP_INTERRUPT))
-			cppi5_tr_csf_set(&tr_req[tr_idx].flags,
-					 CPPI5_TR_CSF_SUPR_EVT);
+			period_csf |= CPPI5_TR_CSF_SUPR_EVT;
+
+		if (period_csf)
+			cppi5_tr_csf_set(&tr_req[tr_idx].flags, period_csf);
 
 		period_addr += period_len;
 	}
-- 
2.41.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2023-08-21 10:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-21 10:40 Vignesh Raghavendra [this message]
2023-08-21 10:40 ` [PATCH] dmaengine: ti: k3-udma: Fix teardown timeout for cyclic mode Vignesh Raghavendra
2023-08-21 20:09 ` Péter Ujfalusi
2023-08-21 20:09   ` Péter Ujfalusi
2024-03-12 18:13 ` Francesco Dolcini
2024-03-12 18:13   ` Francesco Dolcini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230821104003.3001021-1-vigneshr@ti.com \
    --to=vigneshr@ti.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=francesco@dolcini.it \
    --cc=j-choudhary@ti.com \
    --cc=j-luthra@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.ujfalusi@gmail.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.