linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] dmaengine: remove FSLDMA_EXTERNAL_START
@ 2014-10-11 15:46 Vinod Koul
  2014-10-11 15:46 ` [PATCH 1/6] dmaengine: add dmaengine_prep_dma_sg() helper Vinod Koul
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Vinod Koul @ 2014-10-11 15:46 UTC (permalink / raw)
  To: dmaengine; +Cc: Vinod Koul, Zhang Wei, linuxppc-dev, linux-kernel

FSLDMA_EXTERNAL_START is one of the custom methods in device_control. Since
we are planning to deprecate device_control, we should move this to an API.

This serries adds the fsl_dma_external_start() API for users and also
converts the users.

I would like this to be merged thru dmanegine tree due to new dependency.

Vinod Koul (6):
  dmaengine: add dmaengine_prep_dma_sg() helper
  dmaengine: freescale: add and export fsl_dma_external_start()
  carma-fpga: use dmaengine_xxx() API
  carma-fpga: move to fsl_dma_external_start()
  dmaengine: freescale: remove FSLDMA_EXTERNAL_START control method
  dmaengine: remove FSLDMA_EXTERNAL_START

 drivers/dma/fsldma.c                    |   25 +++++++++++++++----------
 drivers/misc/carma/carma-fpga-program.c |   12 ++++++------
 include/linux/dmaengine.h               |   13 ++++++++++---
 include/linux/fsldma.h                  |   13 +++++++++++++
 4 files changed, 44 insertions(+), 19 deletions(-)
 create mode 100644 include/linux/fsldma.h

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

* [PATCH 1/6] dmaengine: add dmaengine_prep_dma_sg() helper
  2014-10-11 15:46 [PATCH 0/6] dmaengine: remove FSLDMA_EXTERNAL_START Vinod Koul
@ 2014-10-11 15:46 ` Vinod Koul
  2014-10-11 15:46 ` [PATCH 2/6] dmaengine: freescale: add and export fsl_dma_external_start() Vinod Koul
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2014-10-11 15:46 UTC (permalink / raw)
  To: dmaengine; +Cc: Vinod Koul, Zhang Wei, linuxppc-dev, linux-kernel

This was only prep API which didnt have an helper

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 include/linux/dmaengine.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 3d291f5..ce8a08e 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -757,6 +757,16 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma(
 	return chan->device->device_prep_interleaved_dma(chan, xt, flags);
 }
 
+static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_sg(
+		struct dma_chan *chan,
+		struct scatterlist *dst_sg, unsigned int dst_nents,
+		struct scatterlist *src_sg, unsigned int src_nents,
+		unsigned long flags)
+{
+	return chan->device->device_prep_dma_sg(chan, dst_sg, dst_nents,
+			src_sg, src_nents, flags);
+}
+
 static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
 {
 	if (!chan || !caps)
-- 
1.7.0.4

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

* [PATCH 2/6] dmaengine: freescale: add and export fsl_dma_external_start()
  2014-10-11 15:46 [PATCH 0/6] dmaengine: remove FSLDMA_EXTERNAL_START Vinod Koul
  2014-10-11 15:46 ` [PATCH 1/6] dmaengine: add dmaengine_prep_dma_sg() helper Vinod Koul
@ 2014-10-11 15:46 ` Vinod Koul
  2014-10-11 15:46 ` [PATCH 3/6] carma-fpga: use dmaengine_xxx() API Vinod Koul
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2014-10-11 15:46 UTC (permalink / raw)
  To: dmaengine; +Cc: Vinod Koul, Zhang Wei, linuxppc-dev, linux-kernel

The freescale driver uses custom device control FSLDMA_EXTERNAL_START to
put the controller in external start mode.
Since we are planning to deprecate the device control, move this to exported
API. Subsequent patches will remove the FSLDMA_EXTERNAL_START

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 drivers/dma/fsldma.c   |   16 +++++++++++++++-
 include/linux/fsldma.h |   13 +++++++++++++
 2 files changed, 28 insertions(+), 1 deletions(-)
 create mode 100644 include/linux/fsldma.h

diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index d5d6885..0cded86 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -36,7 +36,7 @@
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
-
+#include <linux/fsldma.h>
 #include "dmaengine.h"
 #include "fsldma.h"
 
@@ -367,6 +367,20 @@ static void fsl_chan_toggle_ext_start(struct fsldma_chan *chan, int enable)
 		chan->feature &= ~FSL_DMA_CHAN_START_EXT;
 }
 
+int fsl_dma_external_start(struct dma_chan *dchan, int enable)
+{
+	struct fsldma_chan *chan;
+
+	if (!dchan)
+		return -EINVAL;
+
+	chan = to_fsl_chan(dchan);
+
+	fsl_chan_toggle_ext_start(chan, enable);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(fsl_dma_external_start);
+
 static void append_ld_queue(struct fsldma_chan *chan, struct fsl_desc_sw *desc)
 {
 	struct fsl_desc_sw *tail = to_fsl_desc(chan->ld_pending.prev);
diff --git a/include/linux/fsldma.h b/include/linux/fsldma.h
new file mode 100644
index 0000000..b213c02
--- /dev/null
+++ b/include/linux/fsldma.h
@@ -0,0 +1,13 @@
+/*
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef FSL_DMA_H
+#define FSL_DMA_H
+/* fsl dma API for enxternal start */
+int fsl_dma_external_start(struct dma_chan *dchan, int enable);
+
+#endif
-- 
1.7.0.4

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

* [PATCH 3/6] carma-fpga: use dmaengine_xxx() API
  2014-10-11 15:46 [PATCH 0/6] dmaengine: remove FSLDMA_EXTERNAL_START Vinod Koul
  2014-10-11 15:46 ` [PATCH 1/6] dmaengine: add dmaengine_prep_dma_sg() helper Vinod Koul
  2014-10-11 15:46 ` [PATCH 2/6] dmaengine: freescale: add and export fsl_dma_external_start() Vinod Koul
@ 2014-10-11 15:46 ` Vinod Koul
  2014-10-11 15:46 ` [PATCH 4/6] carma-fpga: move to fsl_dma_external_start() Vinod Koul
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2014-10-11 15:46 UTC (permalink / raw)
  To: dmaengine; +Cc: Vinod Koul, Zhang Wei, linuxppc-dev, linux-kernel

The drivers should use dmaengine_slave_config() and dmaengine_prep_dma_sg()
API instead of accessing the device_control which will be deprecated soon

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 drivers/misc/carma/carma-fpga-program.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/misc/carma/carma-fpga-program.c b/drivers/misc/carma/carma-fpga-program.c
index 7be8983..fd0cb8b 100644
--- a/drivers/misc/carma/carma-fpga-program.c
+++ b/drivers/misc/carma/carma-fpga-program.c
@@ -518,8 +518,7 @@ static noinline int fpga_program_dma(struct fpga_dev *priv)
 	config.direction = DMA_MEM_TO_DEV;
 	config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
 	config.dst_maxburst = fpga_fifo_size(priv->regs) / 2 / 4;
-	ret = chan->device->device_control(chan, DMA_SLAVE_CONFIG,
-					   (unsigned long)&config);
+	ret = dmaengine_slave_config(chan, &config);
 	if (ret) {
 		dev_err(priv->dev, "DMA slave configuration failed\n");
 		goto out_dma_unmap;
@@ -532,9 +531,9 @@ static noinline int fpga_program_dma(struct fpga_dev *priv)
 	}
 
 	/* setup and submit the DMA transaction */
-	tx = chan->device->device_prep_dma_sg(chan,
-					      table.sgl, num_pages,
-					      vb->sglist, vb->sglen, 0);
+
+	tx = dmaengine_prep_dma_sg(chan, table.sgl, num_pages,
+			vb->sglist, vb->sglen, 0);
 	if (!tx) {
 		dev_err(priv->dev, "Unable to prep DMA transaction\n");
 		ret = -ENOMEM;
-- 
1.7.0.4

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

* [PATCH 4/6] carma-fpga: move to fsl_dma_external_start()
  2014-10-11 15:46 [PATCH 0/6] dmaengine: remove FSLDMA_EXTERNAL_START Vinod Koul
                   ` (2 preceding siblings ...)
  2014-10-11 15:46 ` [PATCH 3/6] carma-fpga: use dmaengine_xxx() API Vinod Koul
@ 2014-10-11 15:46 ` Vinod Koul
  2014-10-11 15:46 ` [PATCH 5/6] dmaengine: freescale: remove FSLDMA_EXTERNAL_START control method Vinod Koul
  2014-10-11 15:46 ` [PATCH 6/6] dmaengine: remove FSLDMA_EXTERNAL_START Vinod Koul
  5 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2014-10-11 15:46 UTC (permalink / raw)
  To: dmaengine; +Cc: Vinod Koul, Zhang Wei, linuxppc-dev, linux-kernel

carma-fpga driver uses device control with custom FSLDMA_EXTERNAL_START
command. Since we wnat to deprecate the device control, move this driver to
use new fsl_dma_external_start() API

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 drivers/misc/carma/carma-fpga-program.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/carma/carma-fpga-program.c b/drivers/misc/carma/carma-fpga-program.c
index fd0cb8b..298f912 100644
--- a/drivers/misc/carma/carma-fpga-program.c
+++ b/drivers/misc/carma/carma-fpga-program.c
@@ -16,6 +16,7 @@
 #include <linux/completion.h>
 #include <linux/miscdevice.h>
 #include <linux/dmaengine.h>
+#include <linux/fsldma.h>
 #include <linux/interrupt.h>
 #include <linux/highmem.h>
 #include <linux/kernel.h>
@@ -524,7 +525,7 @@ static noinline int fpga_program_dma(struct fpga_dev *priv)
 		goto out_dma_unmap;
 	}
 
-	ret = chan->device->device_control(chan, FSLDMA_EXTERNAL_START, 1);
+	ret = fsl_dma_external_start(chan, 1)
 	if (ret) {
 		dev_err(priv->dev, "DMA external control setup failed\n");
 		goto out_dma_unmap;
-- 
1.7.0.4

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

* [PATCH 5/6] dmaengine: freescale: remove FSLDMA_EXTERNAL_START control method
  2014-10-11 15:46 [PATCH 0/6] dmaengine: remove FSLDMA_EXTERNAL_START Vinod Koul
                   ` (3 preceding siblings ...)
  2014-10-11 15:46 ` [PATCH 4/6] carma-fpga: move to fsl_dma_external_start() Vinod Koul
@ 2014-10-11 15:46 ` Vinod Koul
  2014-10-11 15:46 ` [PATCH 6/6] dmaengine: remove FSLDMA_EXTERNAL_START Vinod Koul
  5 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2014-10-11 15:46 UTC (permalink / raw)
  To: dmaengine; +Cc: Vinod Koul, Zhang Wei, linuxppc-dev, linux-kernel

since users have been move to fsl_dma_external_start() API, so remove this
now

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 drivers/dma/fsldma.c |    9 ---------
 1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 0cded86..994bcb2 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -1012,15 +1012,6 @@ static int fsl_dma_device_control(struct dma_chan *dchan,
 		chan->set_request_count(chan, size);
 		return 0;
 
-	case FSLDMA_EXTERNAL_START:
-
-		/* make sure the channel supports external start */
-		if (!chan->toggle_ext_start)
-			return -ENXIO;
-
-		chan->toggle_ext_start(chan, arg);
-		return 0;
-
 	default:
 		return -ENXIO;
 	}
-- 
1.7.0.4

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

* [PATCH 6/6] dmaengine: remove FSLDMA_EXTERNAL_START
  2014-10-11 15:46 [PATCH 0/6] dmaengine: remove FSLDMA_EXTERNAL_START Vinod Koul
                   ` (4 preceding siblings ...)
  2014-10-11 15:46 ` [PATCH 5/6] dmaengine: freescale: remove FSLDMA_EXTERNAL_START control method Vinod Koul
@ 2014-10-11 15:46 ` Vinod Koul
  5 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2014-10-11 15:46 UTC (permalink / raw)
  To: dmaengine; +Cc: Vinod Koul, Zhang Wei, linuxppc-dev, linux-kernel

as users have been converted, so no need of this custom method

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 include/linux/dmaengine.h |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index ce8a08e..3254a03 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -199,15 +199,12 @@ enum dma_ctrl_flags {
  * configuration data in statically from the platform). An additional
  * argument of struct dma_slave_config must be passed in with this
  * command.
- * @FSLDMA_EXTERNAL_START: this command will put the Freescale DMA controller
- * into external start mode.
  */
 enum dma_ctrl_cmd {
 	DMA_TERMINATE_ALL,
 	DMA_PAUSE,
 	DMA_RESUME,
 	DMA_SLAVE_CONFIG,
-	FSLDMA_EXTERNAL_START,
 };
 
 /**
-- 
1.7.0.4

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

end of thread, other threads:[~2014-10-11 16:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-11 15:46 [PATCH 0/6] dmaengine: remove FSLDMA_EXTERNAL_START Vinod Koul
2014-10-11 15:46 ` [PATCH 1/6] dmaengine: add dmaengine_prep_dma_sg() helper Vinod Koul
2014-10-11 15:46 ` [PATCH 2/6] dmaengine: freescale: add and export fsl_dma_external_start() Vinod Koul
2014-10-11 15:46 ` [PATCH 3/6] carma-fpga: use dmaengine_xxx() API Vinod Koul
2014-10-11 15:46 ` [PATCH 4/6] carma-fpga: move to fsl_dma_external_start() Vinod Koul
2014-10-11 15:46 ` [PATCH 5/6] dmaengine: freescale: remove FSLDMA_EXTERNAL_START control method Vinod Koul
2014-10-11 15:46 ` [PATCH 6/6] dmaengine: remove FSLDMA_EXTERNAL_START Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).