dmaengine Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] dmaengine: sprd: Fix the DMA link-list configuration
@ 2019-08-30  7:37 Baolin Wang
  2019-09-04  5:55 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Baolin Wang @ 2019-08-30  7:37 UTC (permalink / raw)
  To: vkoul
  Cc: orsonzhai, zhang.lyra, dan.j.williams, linux-kernel, dmaengine,
	eric.long, baolin.wang

For the Spreadtrum DMA link-list mode, when the DMA engine got a slave
hardware request, which will trigger the DMA engine to load the DMA
configuration from the link-list memory automatically. But before the
slave hardware request, the slave will get an incorrect residue due
to the first node used to trigger the link-list was configured as the
last source address and destination address.

Thus we should make sure the first node was configured the start source
address and destination address, which can fix this issue.

Fixes: 4ac695464763 ("dmaengine: sprd: Support DMA link-list mode")
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/dma/sprd-dma.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
index baac476..525dc73 100644
--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -908,6 +908,7 @@ static int sprd_dma_fill_linklist_desc(struct dma_chan *chan,
 	struct sprd_dma_chn *schan = to_sprd_dma_chan(chan);
 	struct dma_slave_config *slave_cfg = &schan->slave_cfg;
 	dma_addr_t src = 0, dst = 0;
+	dma_addr_t start_src = 0, start_dst = 0;
 	struct sprd_dma_desc *sdesc;
 	struct scatterlist *sg;
 	u32 len = 0;
@@ -954,6 +955,11 @@ static int sprd_dma_fill_linklist_desc(struct dma_chan *chan,
 			dst = sg_dma_address(sg);
 		}
 
+		if (!i) {
+			start_src = src;
+			start_dst = dst;
+		}
+
 		/*
 		 * The link-list mode needs at least 2 link-list
 		 * configurations. If there is only one sg, it doesn't
@@ -970,8 +976,8 @@ static int sprd_dma_fill_linklist_desc(struct dma_chan *chan,
 		}
 	}
 
-	ret = sprd_dma_fill_desc(chan, &sdesc->chn_hw, 0, 0, src, dst, len,
-				 dir, flags, slave_cfg);
+	ret = sprd_dma_fill_desc(chan, &sdesc->chn_hw, 0, 0, start_src,
+				 start_dst, len, dir, flags, slave_cfg);
 	if (ret) {
 		kfree(sdesc);
 		return NULL;
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] dmaengine: sprd: Fix the DMA link-list configuration
  2019-08-30  7:37 [PATCH] dmaengine: sprd: Fix the DMA link-list configuration Baolin Wang
@ 2019-09-04  5:55 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2019-09-04  5:55 UTC (permalink / raw)
  To: Baolin Wang
  Cc: orsonzhai, zhang.lyra, dan.j.williams, linux-kernel, dmaengine,
	eric.long

On 30-08-19, 15:37, Baolin Wang wrote:
> For the Spreadtrum DMA link-list mode, when the DMA engine got a slave
> hardware request, which will trigger the DMA engine to load the DMA
> configuration from the link-list memory automatically. But before the
> slave hardware request, the slave will get an incorrect residue due
> to the first node used to trigger the link-list was configured as the
> last source address and destination address.
> 
> Thus we should make sure the first node was configured the start source
> address and destination address, which can fix this issue.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-30  7:37 [PATCH] dmaengine: sprd: Fix the DMA link-list configuration Baolin Wang
2019-09-04  5:55 ` Vinod Koul

dmaengine Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dmaengine/0 dmaengine/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dmaengine dmaengine/ https://lore.kernel.org/dmaengine \
		dmaengine@vger.kernel.org dmaengine@archiver.kernel.org
	public-inbox-index dmaengine

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.dmaengine


AGPL code for this site: git clone https://public-inbox.org/ public-inbox