All of lore.kernel.org
 help / color / mirror / Atom feed
From: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
To: dan.j.williams@intel.com, vkoul@kernel.org,
	michal.simek@xilinx.com, appana.durga.rao@xilinx.com,
	lars@metafoo.de, radhey.shyam.pandey@xilinx.com
Cc: dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [1/3] dmaengine: xilinx_dma: Refactor axidma channel allocation
Date: Fri, 27 Jul 2018 16:20:37 +0530	[thread overview]
Message-ID: <1532688639-32230-2-git-send-email-radhey.shyam.pandey@xilinx.com> (raw)

In axidma alloc_chan_resources merge BD and cyclic BD allocation.

Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 drivers/dma/xilinx/xilinx_dma.c |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index c124423..06d1632 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -887,6 +887,24 @@ static int xilinx_dma_alloc_chan_resources(struct dma_chan *dchan)
 				chan->id);
 			return -ENOMEM;
 		}
+		/*
+		 * For cyclic DMA mode we need to program the tail Descriptor
+		 * register with a value which is not a part of the BD chain
+		 * so allocating a desc segment during channel allocation for
+		 * programming tail descriptor.
+		 */
+		chan->cyclic_seg_v = dma_zalloc_coherent(chan->dev,
+					sizeof(*chan->cyclic_seg_v),
+					&chan->cyclic_seg_p, GFP_KERNEL);
+		if (!chan->cyclic_seg_v) {
+			dev_err(chan->dev,
+				"unable to allocate desc segment for cyclic DMA\n");
+			dma_free_coherent(chan->dev, sizeof(*chan->seg_v) *
+				XILINX_DMA_NUM_DESCS, chan->seg_v,
+				chan->seg_p);
+			return -ENOMEM;
+		}
+		chan->cyclic_seg_v->phys = chan->cyclic_seg_p;
 
 		for (i = 0; i < XILINX_DMA_NUM_DESCS; i++) {
 			chan->seg_v[i].hw.next_desc =
@@ -922,24 +940,6 @@ static int xilinx_dma_alloc_chan_resources(struct dma_chan *dchan)
 		return -ENOMEM;
 	}
 
-	if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
-		/*
-		 * For cyclic DMA mode we need to program the tail Descriptor
-		 * register with a value which is not a part of the BD chain
-		 * so allocating a desc segment during channel allocation for
-		 * programming tail descriptor.
-		 */
-		chan->cyclic_seg_v = dma_zalloc_coherent(chan->dev,
-					sizeof(*chan->cyclic_seg_v),
-					&chan->cyclic_seg_p, GFP_KERNEL);
-		if (!chan->cyclic_seg_v) {
-			dev_err(chan->dev,
-				"unable to allocate desc segment for cyclic DMA\n");
-			return -ENOMEM;
-		}
-		chan->cyclic_seg_v->phys = chan->cyclic_seg_p;
-	}
-
 	dma_cookie_init(dchan);
 
 	if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {

WARNING: multiple messages have this Message-ID (diff)
From: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
To: <dan.j.williams@intel.com>, <vkoul@kernel.org>,
	<michal.simek@xilinx.com>, <appana.durga.rao@xilinx.com>,
	<lars@metafoo.de>, <radhey.shyam.pandey@xilinx.com>
Cc: <dmaengine@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH 1/3] dmaengine: xilinx_dma: Refactor axidma channel allocation
Date: Fri, 27 Jul 2018 16:20:37 +0530	[thread overview]
Message-ID: <1532688639-32230-2-git-send-email-radhey.shyam.pandey@xilinx.com> (raw)
In-Reply-To: <1532688639-32230-1-git-send-email-radhey.shyam.pandey@xilinx.com>

In axidma alloc_chan_resources merge BD and cyclic BD allocation.

Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 drivers/dma/xilinx/xilinx_dma.c |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index c124423..06d1632 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -887,6 +887,24 @@ static int xilinx_dma_alloc_chan_resources(struct dma_chan *dchan)
 				chan->id);
 			return -ENOMEM;
 		}
+		/*
+		 * For cyclic DMA mode we need to program the tail Descriptor
+		 * register with a value which is not a part of the BD chain
+		 * so allocating a desc segment during channel allocation for
+		 * programming tail descriptor.
+		 */
+		chan->cyclic_seg_v = dma_zalloc_coherent(chan->dev,
+					sizeof(*chan->cyclic_seg_v),
+					&chan->cyclic_seg_p, GFP_KERNEL);
+		if (!chan->cyclic_seg_v) {
+			dev_err(chan->dev,
+				"unable to allocate desc segment for cyclic DMA\n");
+			dma_free_coherent(chan->dev, sizeof(*chan->seg_v) *
+				XILINX_DMA_NUM_DESCS, chan->seg_v,
+				chan->seg_p);
+			return -ENOMEM;
+		}
+		chan->cyclic_seg_v->phys = chan->cyclic_seg_p;
 
 		for (i = 0; i < XILINX_DMA_NUM_DESCS; i++) {
 			chan->seg_v[i].hw.next_desc =
@@ -922,24 +940,6 @@ static int xilinx_dma_alloc_chan_resources(struct dma_chan *dchan)
 		return -ENOMEM;
 	}
 
-	if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
-		/*
-		 * For cyclic DMA mode we need to program the tail Descriptor
-		 * register with a value which is not a part of the BD chain
-		 * so allocating a desc segment during channel allocation for
-		 * programming tail descriptor.
-		 */
-		chan->cyclic_seg_v = dma_zalloc_coherent(chan->dev,
-					sizeof(*chan->cyclic_seg_v),
-					&chan->cyclic_seg_p, GFP_KERNEL);
-		if (!chan->cyclic_seg_v) {
-			dev_err(chan->dev,
-				"unable to allocate desc segment for cyclic DMA\n");
-			return -ENOMEM;
-		}
-		chan->cyclic_seg_v->phys = chan->cyclic_seg_p;
-	}
-
 	dma_cookie_init(dchan);
 
 	if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
-- 
1.7.1


WARNING: multiple messages have this Message-ID (diff)
From: radhey.shyam.pandey@xilinx.com (Radhey Shyam Pandey)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] dmaengine: xilinx_dma: Refactor axidma channel allocation
Date: Fri, 27 Jul 2018 16:20:37 +0530	[thread overview]
Message-ID: <1532688639-32230-2-git-send-email-radhey.shyam.pandey@xilinx.com> (raw)
In-Reply-To: <1532688639-32230-1-git-send-email-radhey.shyam.pandey@xilinx.com>

In axidma alloc_chan_resources merge BD and cyclic BD allocation.

Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 drivers/dma/xilinx/xilinx_dma.c |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index c124423..06d1632 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -887,6 +887,24 @@ static int xilinx_dma_alloc_chan_resources(struct dma_chan *dchan)
 				chan->id);
 			return -ENOMEM;
 		}
+		/*
+		 * For cyclic DMA mode we need to program the tail Descriptor
+		 * register with a value which is not a part of the BD chain
+		 * so allocating a desc segment during channel allocation for
+		 * programming tail descriptor.
+		 */
+		chan->cyclic_seg_v = dma_zalloc_coherent(chan->dev,
+					sizeof(*chan->cyclic_seg_v),
+					&chan->cyclic_seg_p, GFP_KERNEL);
+		if (!chan->cyclic_seg_v) {
+			dev_err(chan->dev,
+				"unable to allocate desc segment for cyclic DMA\n");
+			dma_free_coherent(chan->dev, sizeof(*chan->seg_v) *
+				XILINX_DMA_NUM_DESCS, chan->seg_v,
+				chan->seg_p);
+			return -ENOMEM;
+		}
+		chan->cyclic_seg_v->phys = chan->cyclic_seg_p;
 
 		for (i = 0; i < XILINX_DMA_NUM_DESCS; i++) {
 			chan->seg_v[i].hw.next_desc =
@@ -922,24 +940,6 @@ static int xilinx_dma_alloc_chan_resources(struct dma_chan *dchan)
 		return -ENOMEM;
 	}
 
-	if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
-		/*
-		 * For cyclic DMA mode we need to program the tail Descriptor
-		 * register with a value which is not a part of the BD chain
-		 * so allocating a desc segment during channel allocation for
-		 * programming tail descriptor.
-		 */
-		chan->cyclic_seg_v = dma_zalloc_coherent(chan->dev,
-					sizeof(*chan->cyclic_seg_v),
-					&chan->cyclic_seg_p, GFP_KERNEL);
-		if (!chan->cyclic_seg_v) {
-			dev_err(chan->dev,
-				"unable to allocate desc segment for cyclic DMA\n");
-			return -ENOMEM;
-		}
-		chan->cyclic_seg_v->phys = chan->cyclic_seg_p;
-	}
-
 	dma_cookie_init(dchan);
 
 	if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
-- 
1.7.1

             reply	other threads:[~2018-07-27 10:50 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27 10:50 Radhey Shyam Pandey [this message]
2018-07-27 10:50 ` [PATCH 1/3] dmaengine: xilinx_dma: Refactor axidma channel allocation Radhey Shyam Pandey
2018-07-27 10:50 ` Radhey Shyam Pandey
  -- strict thread matches above, loose matches on Subject: below --
2018-09-11  9:31 [3/3] dmaengine: xilinx_dma: Fix 64-bit simple CDMA transfer Radhey Shyam Pandey
2018-09-11  9:31 ` [PATCH 3/3] " Radhey Shyam Pandey
2018-09-11  9:31 ` Radhey Shyam Pandey
2018-09-11  7:41 [3/3] " Vinod Koul
2018-09-11  7:41 ` [PATCH 3/3] " Vinod
2018-09-11  7:41 ` Vinod
2018-09-07 12:08 [3/3] " Radhey Shyam Pandey
2018-09-07 12:08 ` [PATCH 3/3] " Radhey Shyam Pandey
2018-09-07 12:08 ` Radhey Shyam Pandey
2018-08-29 17:05 [3/3] " Radhey Shyam Pandey
2018-08-29 17:05 ` [PATCH 3/3] " Radhey Shyam Pandey
2018-08-29 17:05 ` Radhey Shyam Pandey
2018-08-29  4:01 [3/3] " Vinod Koul
2018-08-29  4:01 ` [PATCH 3/3] " Vinod
2018-08-29  4:01 ` Vinod
2018-08-28 14:03 [3/3] " Radhey Shyam Pandey
2018-08-28 14:03 ` [PATCH 3/3] " Radhey Shyam Pandey
2018-08-28 14:03 ` Radhey Shyam Pandey
2018-08-28 13:03 [2/3] dmaengine: xilinx_dma: Refactor axidma channel validation Radhey Shyam Pandey
2018-08-28 13:03 ` [PATCH 2/3] " Radhey Shyam Pandey
2018-08-28 13:03 ` Radhey Shyam Pandey
2018-08-21 15:55 [3/3] dmaengine: xilinx_dma: Fix 64-bit simple CDMA transfer Vinod Koul
2018-08-21 15:55 ` [PATCH 3/3] " Vinod
2018-08-21 15:55 ` Vinod
2018-08-21 15:50 [2/3] dmaengine: xilinx_dma: Refactor axidma channel validation Vinod Koul
2018-08-21 15:50 ` [PATCH 2/3] " Vinod
2018-08-21 15:50 ` Vinod
2018-08-21  7:31 [1/3] dmaengine: xilinx_dma: Refactor axidma channel allocation Appana Durga Kedareswara Rao
2018-08-21  7:31 ` [PATCH 1/3] " Appana Durga Kedareswara Rao
2018-08-21  7:31 ` Appana Durga Kedareswara Rao
2018-07-27 10:50 [3/3] dmaengine: xilinx_dma: Fix 64-bit simple CDMA transfer Radhey Shyam Pandey
2018-07-27 10:50 ` [PATCH 3/3] " Radhey Shyam Pandey
2018-07-27 10:50 ` Radhey Shyam Pandey
2018-07-27 10:50 [2/3] dmaengine: xilinx_dma: Refactor axidma channel validation Radhey Shyam Pandey
2018-07-27 10:50 ` [PATCH 2/3] " Radhey Shyam Pandey
2018-07-27 10:50 ` Radhey Shyam Pandey
2018-07-27 10:50 [PATCH 0/3] dmaengine: xilinx_dma: Minor fix and refactoring Radhey Shyam Pandey
2018-07-27 10:50 ` Radhey Shyam Pandey

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=1532688639-32230-2-git-send-email-radhey.shyam.pandey@xilinx.com \
    --to=radhey.shyam.pandey@xilinx.com \
    --cc=appana.durga.rao@xilinx.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.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.