dmaengine Archive on lore.kernel.org
 help / color / Atom feed
From: Alexandru Ardelean <alexandru.ardelean@analog.com>
To: <dmaengine@vger.kernel.org>
Cc: Alexandru Ardelean <alexandru.ardelean@analog.com>
Subject: [PATCH 3/4] dmaengine: axi-dmac: terminate early DMA transfers after a partial one
Date: Thu, 6 Jun 2019 13:45:49 +0300
Message-ID: <20190606104550.32336-3-alexandru.ardelean@analog.com> (raw)
In-Reply-To: <20190606104550.32336-1-alexandru.ardelean@analog.com>

When a partial transfer is received, the driver should not submit any more
segments to the hardware, as they will be ignored/unused until a new
transfer start operation is done.

This change implements this by adding a new flag on the AXI DMAC
descriptor. This flags is set to true, if there was a partial transfer in
a previously completed segment. When that flag is true, the TLAST flag is
added to the to the submitted segment, signaling the controller to stop
receiving more segments.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/dma/dma-axi-dmac.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
index e0702697e2b3..3b418d545c7a 100644
--- a/drivers/dma/dma-axi-dmac.c
+++ b/drivers/dma/dma-axi-dmac.c
@@ -97,6 +97,7 @@ struct axi_dmac_sg {
 struct axi_dmac_desc {
 	struct virt_dma_desc vdesc;
 	bool cyclic;
+	bool have_partial_xfer;
 
 	unsigned int num_submitted;
 	unsigned int num_completed;
@@ -221,7 +222,8 @@ static void axi_dmac_start_transfer(struct axi_dmac_chan *chan)
 	}
 
 	desc->num_submitted++;
-	if (desc->num_submitted == desc->num_sgs) {
+	if (desc->num_submitted == desc->num_sgs ||
+	    desc->have_partial_xfer) {
 		if (desc->cyclic)
 			desc->num_submitted = 0; /* Start again */
 		else
@@ -295,6 +297,7 @@ static void axi_dmac_dequeue_partial_xfers(struct axi_dmac_chan *chan)
 				if (sg->id == AXI_DMAC_SG_UNUSED)
 					continue;
 				if (sg->id == id) {
+					desc->have_partial_xfer = true;
 					sg->partial_len = len;
 					found_sg = true;
 					break;
-- 
2.20.1


  parent reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06 10:45 [PATCH 1/4] dmaengine: virt-dma: store result on dma descriptor Alexandru Ardelean
2019-06-06 10:45 ` [PATCH 2/4] dmaengine: axi-dmac: populate residue info for completed xfers Alexandru Ardelean
2019-06-06 10:45 ` Alexandru Ardelean [this message]
2019-06-06 10:45 ` [PATCH 4/4] dmaengine: axi-dmac: add regmap support Alexandru Ardelean
2019-06-14  5:52   ` Vinod Koul
2019-06-14  8:14     ` Ardelean, Alexandru
2019-06-14  5:53 ` [PATCH 1/4] dmaengine: virt-dma: store result on dma descriptor Vinod Koul

Reply instructions:

You may reply publically 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=20190606104550.32336-3-alexandru.ardelean@analog.com \
    --to=alexandru.ardelean@analog.com \
    --cc=dmaengine@vger.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

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


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