Skip to contentSkip to conversation

To use DMA generic APIs for Samsung DMA

PATCH New Boojin Kim 7 participants 33 messages Sep 2, 2011 – Sep 21, 2011

Subsystems (10)
lore
Share & tools
lore

Boojin Kim

author
#0 lore raw

v8 cover To use DMA generic APIs for Samsung DMA

This patchset adds support DMA generic APIs for samsung DMA.

The changes from V7 is following:
- Divides patch file.
: The 03 patch on V7 patchset is divided into the 03 and 04 patch on V8 patchset.
The O3 patch is only for DMA_SLAVE_CONFIG command.
The 04 patch is only for DMA_TERMINATE_ALL command.
- Code clean-up
: Remove unnecessary code on 05 patch.

[PATCH v8 01/16] DMA: PL330: Add support runtime PM for PL330 DMAC
[PATCH v8 02/16] DMA: PL330: Update PL330 DMA API driver
[PATCH v8 03/16] DMA: PL330: Support DMA_SLAVE_CONFIG command
[PATCH v8 04/16] DMA: PL330: Remove the start operation for handling DMA_TERMINATE_ALL command [PATCH v8 05/16] DMA: PL330: Add DMA_CYCLIC capability
[PATCH v8 06/16] ARM: SAMSUNG: Update to use PL330-DMA driver
[PATCH v8 07/16] ARM: SAMSUNG: Add common DMA operations
[PATCH v8 08/16] ARM: EXYNOS4: Use generic DMA PL330 driver
[PATCH v8 09/16] ARM: S5PV210: Use generic DMA PL330 driver
[PATCH v8 10/16] ARM: S5PC100: Use generic DMA PL330 driver
[PATCH v8 11/16] ARM: S5P64X0: Use generic DMA PL330 driver
[PATCH v8 12/16] ARM: SAMSUNG: Remove S3C-PL330-DMA driver
[PATCH v8 13/16] spi/s3c64xx: Add support DMA engine API
[PATCH v8 14/16] spi/s3c64xx: Merge dma control code
[PATCH v8 15/16] ASoC: Samsung: Update DMA interface
[PATCH v8 16/16] ARM: SAMSUNG: Remove Samsung specific enum type for dma direction

author
#1 lore raw

PATCH v8 1/16 DMA: PL330: Add support runtime PM for PL330 DMAC

---
 drivers/dma/pl330.c |   75 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 73 insertions(+), 2 deletions(-)
drivers/dma/pl330.c +73 -2
index 00eee59..0b99af1 100644
@@ -17,6 +17,7 @@
 #include <linux/interrupt.h>
 #include <linux/amba/bus.h>
 #include <linux/amba/pl330.h>
+#include <linux/pm_runtime.h>
 
 #define NR_DEFAULT_DESC	16
 
@@ -83,6 +84,8 @@ struct dma_pl330_dmac {
 
 	/* Peripheral channels connected to this DMAC */
 	struct dma_pl330_chan *peripherals; /* keep at end */
+
+	struct clk *clk;
 };
 
 struct dma_pl330_desc {
@@ -696,6 +699,30 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 		goto probe_err1;
 	}
 
+	pdmac->clk = clk_get(&adev->dev, "dma");
+	if (IS_ERR(pdmac->clk)) {
+		dev_err(&adev->dev, "Cannot get operation clock.\n");
+		ret = -EINVAL;
+		goto probe_err1;
+	}
+
+	amba_set_drvdata(adev, pdmac);
+
+#ifdef CONFIG_PM_RUNTIME
+	/* to use the runtime PM helper functions */
+	pm_runtime_enable(&adev->dev);
+
+	/* enable the power domain */
+	if (pm_runtime_get_sync(&adev->dev)) {
+		dev_err(&adev->dev, "failed to get runtime pm\n");
+		ret = -ENODEV;
+		goto probe_err1;
+	}
+#else
+	/* enable dma clk */
+	clk_enable(pdmac->clk);
+#endif
+
 	irq = adev->irq[0];
 	ret = request_irq(irq, pl330_irq_handler, 0,
 			dev_name(&adev->dev), pi);
@@ -771,8 +798,6 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 		goto probe_err4;
 	}
 
-	amba_set_drvdata(adev, pdmac);
-
 	dev_info(&adev->dev,
 		"Loaded driver for PL330 DMAC-%d\n", adev->periphid);
 	dev_info(&adev->dev,
@@ -833,6 +858,13 @@ static int __devexit pl330_remove(struct amba_device *adev)
 	res = &adev->res;
 	release_mem_region(res->start, resource_size(res));
 
+#ifdef CONFIG_PM_RUNTIME
+	pm_runtime_put(&adev->dev);
+	pm_runtime_disable(&adev->dev);
+#else
+	clk_disable(pdmac->clk);
+#endif
+
 	kfree(pdmac);
 
 	return 0;
@@ -846,10 +878,49 @@ static struct amba_id pl330_ids[] = {
 	{ 0, 0 },
 };
 
+#ifdef CONFIG_PM_RUNTIME
+static int pl330_runtime_suspend(struct device *dev)
+{
+	struct dma_pl330_dmac *pdmac = dev_get_drvdata(dev);
+
+	if (!pdmac) {
+		dev_err(dev, "failed to get dmac\n");
+		return -ENODEV;
+	}
+
+	clk_disable(pdmac->clk);
+
+	return 0;
+}
+
+static int pl330_runtime_resume(struct device *dev)
+{
+	struct dma_pl330_dmac *pdmac = dev_get_drvdata(dev);
+
+	if (!pdmac) {
+		dev_err(dev, "failed to get dmac\n");
+		return -ENODEV;
+	}
+
+	clk_enable(pdmac->clk);
+
+	return 0;
+}
+#else
+#define pl330_runtime_suspend	NULL
+#define pl330_runtime_resume	NULL
+#endif /* CONFIG_PM_RUNTIME */
+
+static const struct dev_pm_ops pl330_pm_ops = {
+	.runtime_suspend = pl330_runtime_suspend,
+	.runtime_resume = pl330_runtime_resume,
+};
+
 static struct amba_driver pl330_driver = {
 	.drv = {
 		.owner = THIS_MODULE,
 		.name = "dma-pl330",
+		.pm = &pl330_pm_ops,
 	},
 	.id_table = pl330_ids,
 	.probe = pl330_probe,
Signature · 1 line
1.7.1
author
#2 lore raw

PATCH v8 2/16 DMA: PL330: Update PL330 DMA API driver

In reply to Boojin Kim

This patch updates following 3 items.
1. Removes unneccessary code.
2. Add AMBA, PL330 configuration
3. Change the meaning of 'peri_id' variable from PL330 event number to specific dma id by user.

---
 drivers/dma/Kconfig        |    3 ++-
 drivers/dma/pl330.c        |   14 +++++++++-----
 include/linux/amba/pl330.h |    6 +-----
 3 files changed, 12 insertions(+), 11 deletions(-)
drivers/dma/Kconfig +2 -1
index 2e3b3d3..ab8f469 100644
@@ -193,7 +193,8 @@ config ARCH_HAS_ASYNC_TX_FIND_CHANNEL
 config PL330_DMA
 	tristate "DMA API Driver for PL330"
 	select DMA_ENGINE
-	depends on PL330
+	depends on ARM_AMBA
+	select PL330
 	help
 	  Select if your platform has one or more PL330 DMACs.
 	  You need to provide platform specific settings via
drivers/dma/pl330.c +9 -5
index 0b99af1..d5829c7 100644
@@ -18,6 +18,7 @@
 #include <linux/amba/bus.h>
 #include <linux/amba/pl330.h>
 #include <linux/pm_runtime.h>
+#include <linux/scatterlist.h>
 
 #define NR_DEFAULT_DESC	16
 
@@ -69,6 +70,10 @@ struct dma_pl330_chan {
 	 * NULL if the channel is available to be acquired.
 	 */
 	void *pl330_chid;
+
+	/* For D-to-M and M-to-D channels */
+	int burst_sz; /* the peripheral fifo width */
+	dma_addr_t fifo_addr;
 };
 
 struct dma_pl330_dmac {
@@ -456,7 +461,7 @@ static struct dma_pl330_desc *pl330_get_desc(struct dma_pl330_chan *pch)
 
 	if (peri) {
 		desc->req.rqtype = peri->rqtype;
-		desc->req.peri = peri->peri_id;
+		desc->req.peri = pch->chan.chan_id;
 	} else {
 		desc->req.rqtype = MEMTOMEM;
 		desc->req.peri = 0;
@@ -582,7 +587,7 @@ pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 	struct dma_pl330_peri *peri = chan->private;
 	struct scatterlist *sg;
 	unsigned long flags;
-	int i, burst_size;
+	int i;
 	dma_addr_t addr;
 
 	if (unlikely(!pch || !sgl || !sg_len || !peri))
@@ -598,8 +603,7 @@ pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 		return NULL;
 	}
 
-	addr = peri->fifo_addr;
-	burst_size = peri->burst_sz;
+	addr = pch->fifo_addr;
 
 	first = NULL;
 
@@ -647,7 +651,7 @@ pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 				sg_dma_address(sg), addr, sg_dma_len(sg));
 		}
 
-		desc->rqcfg.brst_size = burst_size;
+		desc->rqcfg.brst_size = pch->burst_sz;
 		desc->rqcfg.brst_len = 1;
 	}
 
include/linux/amba/pl330.h +1 -5
index cbee7de..d12f077 100644
@@ -19,12 +19,8 @@ struct dma_pl330_peri {
 	 * Peri_Req i/f of the DMAC that is
 	 * peripheral could be reached from.
 	 */
-	u8 peri_id; /* {0, 31} */
+	u8 peri_id; /* specific dma id */
 	enum pl330_reqtype rqtype;
-
-	/* For M->D and D->M Channels */
-	int burst_sz; /* in power of 2 */
-	dma_addr_t fifo_addr;
 };
 
 struct dma_pl330_platdata {
Signature · 1 line
1.7.1
author
#3 lore raw

PATCH v8 3/16 DMA: PL330: Support DMA_SLAVE_CONFIG command

In reply to Boojin Kim
---
 drivers/dma/pl330.c |   49 +++++++++++++++++++++++++++++++++++++------------
 1 files changed, 37 insertions(+), 12 deletions(-)
drivers/dma/pl330.c +37 -12
index d5829c7..e7f9d1d 100644
@@ -73,6 +73,7 @@ struct dma_pl330_chan {
 
 	/* For D-to-M and M-to-D channels */
 	int burst_sz; /* the peripheral fifo width */
+	int burst_len; /* the number of burst */
 	dma_addr_t fifo_addr;
 };
 
@@ -263,23 +264,47 @@ static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned
 	struct dma_pl330_chan *pch = to_pchan(chan);
 	struct dma_pl330_desc *desc;
 	unsigned long flags;
+	struct dma_pl330_dmac *pdmac = pch->dmac;
+	struct dma_slave_config *slave_config;
 
-	/* Only supports DMA_TERMINATE_ALL */
-	if (cmd != DMA_TERMINATE_ALL)
-		return -ENXIO;
+	switch (cmd) {
+	case DMA_TERMINATE_ALL:
+		spin_lock_irqsave(&pch->lock, flags);
 
-	spin_lock_irqsave(&pch->lock, flags);
+		/* FLUSH the PL330 Channel thread */
+		pl330_chan_ctrl(pch->pl330_chid, PL330_OP_FLUSH);
 
-	/* FLUSH the PL330 Channel thread */
-	pl330_chan_ctrl(pch->pl330_chid, PL330_OP_FLUSH);
-
-	/* Mark all desc done */
-	list_for_each_entry(desc, &pch->work_list, node)
-		desc->status = DONE;
+		/* Mark all desc done */
+		list_for_each_entry(desc, &pch->work_list, node)
+			desc->status = DONE;
 
-	spin_unlock_irqrestore(&pch->lock, flags);
+		spin_unlock_irqrestore(&pch->lock, flags);
 
-	pl330_tasklet((unsigned long) pch);
+		pl330_tasklet((unsigned long) pch);
+		break;
+	case DMA_SLAVE_CONFIG:
+		slave_config = (struct dma_slave_config *)arg;
+
+		if (slave_config->direction == DMA_TO_DEVICE) {
+			if (slave_config->dst_addr)
+				pch->fifo_addr = slave_config->dst_addr;
+			if (slave_config->dst_addr_width)
+				pch->burst_sz = __ffs(slave_config->dst_addr_width);
+			if (slave_config->dst_maxburst)
+				pch->burst_len = slave_config->dst_maxburst;
+		} else if (slave_config->direction == DMA_FROM_DEVICE) {
+			if (slave_config->src_addr)
+				pch->fifo_addr = slave_config->src_addr;
+			if (slave_config->src_addr_width)
+				pch->burst_sz = __ffs(slave_config->src_addr_width);
+			if (slave_config->src_maxburst)
+				pch->burst_len = slave_config->src_maxburst;
+		}
+		break;
+	default:
+		dev_err(pch->dmac->pif.dev, "Not supported command.\n");
+		return -ENXIO;
+	}
 
 	return 0;
 }
Signature · 1 line
1.7.1
author
#4 lore raw

PATCH v8 4/16 DMA: PL330: Remove the start operation for handling DMA_TERMINATE_ALL command

In reply to Boojin Kim

Origianl code carries out the start operation after flush operation. But start operation is not required for DMA_TERMINATE_ALL command. So, This patch removes the unnecessary start operation and only carries out the flush oeration for handling DMA_TERMINATE_ALL command.

---
 drivers/dma/pl330.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/dma/pl330.c +7 -4
index e7f9d1d..59943ec 100644
@@ -262,10 +262,11 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan)
 static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned long arg)
 {
 	struct dma_pl330_chan *pch = to_pchan(chan);
-	struct dma_pl330_desc *desc;
+	struct dma_pl330_desc *desc, *_dt;
 	unsigned long flags;
 	struct dma_pl330_dmac *pdmac = pch->dmac;
 	struct dma_slave_config *slave_config;
+	LIST_HEAD(list);
 
 	switch (cmd) {
 	case DMA_TERMINATE_ALL:
@@ -275,12 +276,14 @@ static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned
 		pl330_chan_ctrl(pch->pl330_chid, PL330_OP_FLUSH);
 
 		/* Mark all desc done */
-		list_for_each_entry(desc, &pch->work_list, node)
+		list_for_each_entry_safe(desc, _dt, &pch->work_list , node) {
 			desc->status = DONE;
+			pch->completed = desc->txd.cookie;
+			list_move_tail(&desc->node, &list);
+		}
 
+		list_splice_tail_init(&list, &pdmac->desc_pool);
 		spin_unlock_irqrestore(&pch->lock, flags);
-
-		pl330_tasklet((unsigned long) pch);
 		break;
 	case DMA_SLAVE_CONFIG:
 		slave_config = (struct dma_slave_config *)arg;
Signature · 1 line
1.7.1
#5 lore raw

PATCH v8 4/16 DMA: PL330: Remove the start operation for handling DMA_TERMINATE_ALL command

Quoted 1 line · Boojin Kim

Origianl code carries out the start operation after flush operation.

Orignal

Quoted 2 lines

But start operation is not required for DMA_TERMINATE_ALL command. So, This patch removes the unnecessary start operation and only carries out

this should be all lowercase

Quoted 1 line

the flush oeration for handling DMA_TERMINATE_ALL command.

operation ^^^^^^^^

Quoted 35 lines
---
 drivers/dma/pl330.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/dma/pl330.c +4 -2
index e7f9d1d..59943ec 100644
@@ -262,10 +262,11 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan)
 static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned long arg)
 {
 	struct dma_pl330_chan *pch = to_pchan(chan);
-	struct dma_pl330_desc *desc;
+	struct dma_pl330_desc *desc, *_dt;
 	unsigned long flags;
 	struct dma_pl330_dmac *pdmac = pch->dmac;
 	struct dma_slave_config *slave_config;
+	LIST_HEAD(list);
 
 	switch (cmd) {
 	case DMA_TERMINATE_ALL:
@@ -275,12 +276,14 @@ static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned
 		pl330_chan_ctrl(pch->pl330_chid, PL330_OP_FLUSH);
 
 		/* Mark all desc done */
-		list_for_each_entry(desc, &pch->work_list, node)
+		list_for_each_entry_safe(desc, _dt, &pch->work_list , node) {
 			desc->status = DONE;
+			pch->completed = desc->txd.cookie;

drivers/dma/pl330.c static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned · line 289

Quoted 10 lines
drivers/dma/pl330.c +3 -2
+			list_move_tail(&desc->node, &list);
+		}
 
+		list_splice_tail_init(&list, &pdmac->desc_pool);
 		spin_unlock_irqrestore(&pch->lock, flags);
-
-		pl330_tasklet((unsigned long) pch);
 		break;
 	case DMA_SLAVE_CONFIG:
 		slave_config = (struct dma_slave_config *)arg;

If this is the only fix required in entire series, I can fix this up while applying

Signature · 1 line
~Vinod
#6 lore raw

PATCH v8 4/16 DMA: PL330: Remove the start operation for handling DMA_TERMINATE_ALL command

In reply to Boojin Kim
Quoted 4 lines · Boojin Kim

Origianl code carries out the start operation after flush operation. But start operation is not required for DMA_TERMINATE_ALL command. So, This patch removes the unnecessary start operation and only carries out the flush oeration for handling DMA_TERMINATE_ALL command.

Not exactly. The 'start' is impotent when called from this path because there is nothing left queued after the call to 'flush'.
pl330_tasklet() is called because that is a common function that does the house-keeping acc to what's presently in 'work' and 'done' lists.

Though as a side-effect, your patch does avoid doing callbacks on submitted xfers during DMA_TERMINATE_ALL - which may or may not be the right thing to do.
I remember seeing some dmac drivers doing the callbacks while some specifically avoiding them during DMA_TERMINATE_ALL.
While I personally prefer the former, I guess it's for maintainers to decide. Vinod ?

#7 lore raw

PATCH v8 4/16 DMA: PL330: Remove the start operation for handling DMA_TERMINATE_ALL command

Quoted 6 lines · Jassi Brar
Quoted 4 lines · Boojin Kim

Origianl code carries out the start operation after flush operation. But start operation is not required for DMA_TERMINATE_ALL command. So, This patch removes the unnecessary start operation and only carries out the flush oeration for handling DMA_TERMINATE_ALL command.

Quoted 8 lines

Not exactly. The 'start' is impotent when called from this path because there is nothing left queued after the call to 'flush'.
pl330_tasklet() is called because that is a common function that does the house-keeping acc to what's presently in 'work' and 'done' lists.

Though as a side-effect, your patch does avoid doing callbacks on submitted xfers during DMA_TERMINATE_ALL - which may or may not be the right thing to do.

It is defined that DMA_TERMINATE_ALL does not call the callbacks:

1. int dmaengine_terminate_all(struct dma_chan *chan)

This causes all activity for the DMA channel to be stopped, and may discard data in the DMA FIFO which hasn't been fully transferred. No callback functions will be called for any incomplete transfers.

#8 lore raw

PATCH v8 4/16 DMA: PL330: Remove the start operation for handling DMA_TERMINATE_ALL command

Quoted 16 lines · Russell King - ARM Linux
Quoted 6 lines · Jassi Brar
Quoted 4 lines · Boojin Kim

Origianl code carries out the start operation after flush operation. But start operation is not required for DMA_TERMINATE_ALL command. So, This patch removes the unnecessary start operation and only carries out the flush oeration for handling DMA_TERMINATE_ALL command.

Quoted 8 lines

Not exactly. The 'start' is impotent when called from this path because there is nothing left queued after the call to 'flush'.
pl330_tasklet() is called because that is a common function that does the house-keeping acc to what's presently in 'work' and 'done' lists.

Though as a side-effect, your patch does avoid doing callbacks on submitted xfers during DMA_TERMINATE_ALL - which may or may not be the right thing to do.

Quoted 8 lines

It is defined that DMA_TERMINATE_ALL does not call the callbacks:

1. int dmaengine_terminate_all(struct dma_chan *chan)

? This causes all activity for the DMA channel to be stopped, and may ? discard data in the DMA FIFO which hasn't been fully transferred. ? No callback functions will be called for any incomplete transfers.

Ok, thanks for the info.

Boojin Kim, please re-write the changelog to state only preventing callbacks during DMA_TERMINATE_ALL as the reason.

#9 lore raw

PATCH v8 4/16 DMA: PL330: Remove the start operation for handling DMA_TERMINATE_ALL command

Quoted 23 lines · Jassi Brar
Quoted 20 lines · Russell King - ARM Linux
Quoted 6 lines · Jassi Brar
Quoted 4 lines · Boojin Kim

Origianl code carries out the start operation after flush operation. But start operation is not required for DMA_TERMINATE_ALL command. So, This patch removes the unnecessary start operation and only carries out the flush oeration for handling DMA_TERMINATE_ALL command.

Quoted 8 lines

Not exactly. The 'start' is impotent when called from this path because there is nothing left queued after the call to 'flush'.
pl330_tasklet() is called because that is a common function that does the house-keeping acc to what's presently in 'work' and 'done' lists.

Though as a side-effect, your patch does avoid doing callbacks on submitted xfers during DMA_TERMINATE_ALL - which may or may not be the right thing to do.

It is defined that DMA_TERMINATE_ALL does not call the callbacks:

1. int dmaengine_terminate_all(struct dma_chan *chan)

Quoted 8 lines
Quoted 4 lines

This causes all activity for the DMA channel to be stopped, and may discard data in the DMA FIFO which hasn't been fully transferred. No callback functions will be called for any incomplete transfers.

Ok, thanks for the info.

Boojin Kim, please re-write the changelog to state only preventing callbacks during DMA_TERMINATE_ALL as the reason.

As above, we don't need callback as well start operation in DMA_TERMIANTE_ALL command and her patch just removed them for DMA_TERMINATE_ALL here. So current git message seems to have proper behavior of patch.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#10 lore raw

PATCH v8 4/16 DMA: PL330: Remove the start operation for handling DMA_TERMINATE_ALL command

Quoted 28 lines · Kukjin Kim
Quoted 27 lines · Jassi Brar
Quoted 24 lines · Russell King - ARM Linux
Quoted 6 lines · Jassi Brar
Quoted 4 lines · Boojin Kim

Origianl code carries out the start operation after flush operation. But start operation is not required for DMA_TERMINATE_ALL command. So, This patch removes the unnecessary start operation and only carries out the flush oeration for handling DMA_TERMINATE_ALL command.

Quoted 8 lines

Not exactly. The 'start' is impotent when called from this path because there is nothing left queued after the call to 'flush'.
pl330_tasklet() is called because that is a common function that does the house-keeping acc to what's presently in 'work' and 'done' lists.

Though as a side-effect, your patch does avoid doing callbacks on submitted xfers during DMA_TERMINATE_ALL - which may or may not be the right thing to do.

It is defined that DMA_TERMINATE_ALL does not call the callbacks:

1. int dmaengine_terminate_all(struct dma_chan *chan)

? This causes all activity for the DMA channel to be stopped, and may ? discard data in the DMA FIFO which hasn't been fully transferred. ? No callback functions will be called for any incomplete transfers.

Quoted 7 lines
Quoted 4 lines

Ok, thanks for the info.

Boojin Kim, please re-write the changelog to state only preventing callbacks during DMA_TERMINATE_ALL as the reason.

As above, we don't need callback as well start operation in DMA_TERMIANTE_ALL command and her patch just removed them for DMA_TERMINATE_ALL here. So current git message seems to have proper behavior of patch.

Nopes.

No modification to current code is needed if only the following is to be the reason.
{
Origianl code carries out the start operation after flush operation. But start operation is not required for DMA_TERMINATE_ALL command. So, This patch removes the unnecessary start operation and only carries out the flush oeration for handling DMA_TERMINATE_ALL command.
}

The patch, however, has unintended good effect of "preventing callbacks from DMA_TERMINATE_ALL".
The only valid reason, and which is no way implied by the changelog.

author
#11 lore raw

PATCH v8 4/16 DMA: PL330: Remove the start operation for handling DMA_TERMINATE_ALL command

Quoted 64 lines · Jassi Brar

Subject: Re: [PATCH v8 04/16] DMA: PL330: Remove the start operation for handling DMA_TERMINATE_ALL command

Quoted 6 lines · Kukjin Kim
Quoted 5 lines · Jassi Brar
Quoted 2 lines · Russell King - ARM Linux
Quoted 1 line · Jassi Brar

On Fri, Sep 2, 2011 at 6:14 AM, Boojin Kim

Quoted 1 line · <[email protected]> wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Origianl code carries out the start operation after flush

operation.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

But start operation is not required for DMA_TERMINATE_ALL

command.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

So, This patch removes the unnecessary start operation and

only carries out

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

the flush oeration for handling DMA_TERMINATE_ALL command.

Not exactly. The 'start' is impotent when called from this path

because there

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

is nothing left queued after the call to 'flush'. pl330_tasklet() is called because that is a common function that

does the

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

house-keeping acc to what's presently in 'work' and 'done' lists.

Though as a side-effect, your patch does avoid doing callbacks

on submitted

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

xfers during DMA_TERMINATE_ALL - which may or may not be the

right thing

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

to do.

It is defined that DMA_TERMINATE_ALL does not call the callbacks:

1. int dmaengine_terminate_all(struct dma_chan *chan)

? This causes all activity for the DMA channel to be stopped, and

may

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

? discard data in the DMA FIFO which hasn't been fully transferred. ? No callback functions will be called for any incomplete

transfers.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Ok, thanks for the info.

Boojin Kim, please re-write the changelog to state only preventing callbacks during DMA_TERMINATE_ALL as the reason.

As above, we don't need callback as well start operation in

DMA_TERMIANTE_ALL command and her patch just removed them for DMA_TERMINATE_ALL here. So current git message seems to have proper behavior of patch.

Quoted 1 line

Nopes.

No modification to current code is needed if only the following is to be the reason.
{
Origianl code carries out the start operation after flush operation. But start operation is not required for DMA_TERMINATE_ALL command. So, This patch removes the unnecessary start operation and only carries out
the flush oeration for handling DMA_TERMINATE_ALL command. }

Quoted 4 lines

The patch, however, has unintended good effect of "preventing callbacks
from DMA_TERMINATE_ALL".
The only valid reason, and which is no way implied by the changelog.

According to dmaengine document, dmaengine_terminate_all() is used to pause or stop the channel. So, dmaengine_terminate_all() doesn?t need to have the start operation and callback calling.
This patch is originally aimed at removing unnecessary operations including the start operation and callback call for dmaengine_terminate_all(). And I think my message pretty expresses the purpose of this patch.

Thanks,
Boojin kim

author
#12 lore raw

PATCH v8 5/16 DMA: PL330: Add DMA_CYCLIC capability

In reply to Boojin Kim

This patch adds DMA_CYCLIC capability that is used for audio driver. DMA driver activated with it reuses the dma requests that were submitted through tx_submit().

---
 drivers/dma/pl330.c |   84 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 83 insertions(+), 1 deletions(-)
drivers/dma/pl330.c +83 -1
index 59943ec..621134f 100644
@@ -75,6 +75,9 @@ struct dma_pl330_chan {
 	int burst_sz; /* the peripheral fifo width */
 	int burst_len; /* the number of burst */
 	dma_addr_t fifo_addr;
+
+	/* for cyclic capability */
+	bool cyclic;
 };
 
 struct dma_pl330_dmac {
@@ -161,6 +164,31 @@ static inline void free_desc_list(struct list_head *list)
 	spin_unlock_irqrestore(&pdmac->pool_lock, flags);
 }
 
+static inline void handle_cyclic_desc_list(struct list_head *list)
+{
+	struct dma_pl330_desc *desc;
+	struct dma_pl330_chan *pch;
+	unsigned long flags;
+
+	if (list_empty(list))
+		return;
+
+	list_for_each_entry(desc, list, node) {
+		dma_async_tx_callback callback;
+
+		/* Change status to reload it */
+		desc->status = PREP;
+		pch = desc->pchan;
+		callback = desc->txd.callback;
+		if (callback)
+			callback(desc->txd.callback_param);
+	}
+
+	spin_lock_irqsave(&pch->lock, flags);
+	list_splice_tail_init(list, &pch->work_list);
+	spin_unlock_irqrestore(&pch->lock, flags);
+}
+
 static inline void fill_queue(struct dma_pl330_chan *pch)
 {
 	struct dma_pl330_desc *desc;
@@ -214,7 +242,10 @@ static void pl330_tasklet(unsigned long data)
 
 	spin_unlock_irqrestore(&pch->lock, flags);
 
-	free_desc_list(&list);
+	if (pch->cyclic)
+		handle_cyclic_desc_list(&list);
+	else
+		free_desc_list(&list);
 }
 
 static void dma_pl330_rqcb(void *token, enum pl330_op_err err)
@@ -245,6 +276,7 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan)
 	spin_lock_irqsave(&pch->lock, flags);
 
 	pch->completed = chan->cookie = 1;
+	pch->cyclic = false;
 
 	pch->pl330_chid = pl330_request_channel(&pdmac->pif);
 	if (!pch->pl330_chid) {
@@ -324,6 +356,9 @@ static void pl330_free_chan_resources(struct dma_chan *chan)
 	pl330_release_channel(pch->pl330_chid);
 	pch->pl330_chid = NULL;
 
+	if (pch->cyclic)
+		list_splice_tail_init(&pch->work_list, &pch->dmac->desc_pool);
+
 	spin_unlock_irqrestore(&pch->lock, flags);
 }
 
@@ -560,6 +595,51 @@ static inline int get_burst_len(struct dma_pl330_desc *desc, size_t len)
 	return burst_len;
 }
 
+static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
+		struct dma_chan *chan, dma_addr_t dma_addr, size_t len,
+		size_t period_len, enum dma_data_direction direction)
+{
+	struct dma_pl330_desc *desc;
+	struct dma_pl330_chan *pch = to_pchan(chan);
+	dma_addr_t dst;
+	dma_addr_t src;
+
+	desc = pl330_get_desc(pch);
+	if (!desc) {
+		dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n",
+			__func__, __LINE__);
+		return NULL;
+	}
+
+	switch (direction) {
+	case DMA_TO_DEVICE:
+		desc->rqcfg.src_inc = 1;
+		desc->rqcfg.dst_inc = 0;
+		src = dma_addr;
+		dst = pch->fifo_addr;
+		break;
+	case DMA_FROM_DEVICE:
+		desc->rqcfg.src_inc = 0;
+		desc->rqcfg.dst_inc = 1;
+		src = pch->fifo_addr;
+		dst = dma_addr;
+		break;
+	default:
+		dev_err(pch->dmac->pif.dev, "%s:%d Invalid dma direction\n",
+		__func__, __LINE__);
+		return NULL;
+	}
+
+	desc->rqcfg.brst_size = pch->burst_sz;
+	desc->rqcfg.brst_len = 1;
+
+	pch->cyclic = true;
+
+	fill_px(&desc->px, dst, src, period_len);
+
+	return &desc->txd;
+}
+
 static struct dma_async_tx_descriptor *
 pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,
 		dma_addr_t src, size_t len, unsigned long flags)
@@ -791,6 +871,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 			case MEMTODEV:
 			case DEVTOMEM:
 				dma_cap_set(DMA_SLAVE, pd->cap_mask);
+				dma_cap_set(DMA_CYCLIC, pd->cap_mask);
 				break;
 			default:
 				dev_err(&adev->dev, "DEVTODEV Not Supported\n");
@@ -819,6 +900,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 	pd->device_alloc_chan_resources = pl330_alloc_chan_resources;
 	pd->device_free_chan_resources = pl330_free_chan_resources;
 	pd->device_prep_dma_memcpy = pl330_prep_dma_memcpy;
+	pd->device_prep_dma_cyclic = pl330_prep_dma_cyclic;
 	pd->device_tx_status = pl330_tx_status;
 	pd->device_prep_slave_sg = pl330_prep_slave_sg;
 	pd->device_control = pl330_control;
Signature · 1 line
1.7.1
author
#13 lore raw

PATCH v8 6/16 ARM: SAMSUNG: Update to use PL330-DMA driver

In reply to Boojin Kim

This patch adds to support PL330-DMA driver on DMADEVICE for S5P SoCs.

---
 arch/arm/mach-exynos4/include/mach/dma.h           |    4 ++--
 arch/arm/mach-s5p64x0/include/mach/dma.h           |    2 +-
 arch/arm/mach-s5pc100/include/mach/dma.h           |    2 +-
 arch/arm/mach-s5pv210/include/mach/dma.h           |    2 +-
 arch/arm/plat-samsung/Kconfig                      |    9 +++++++++
 .../include/plat/{s3c-dma-pl330.h => dma-pl330.h}  |    8 ++++----
 .../plat-samsung/include/plat/s3c-pl330-pdata.h    |    2 +-
 7 files changed, 19 insertions(+), 10 deletions(-)
 rename arch/arm/plat-samsung/include/plat/{s3c-dma-pl330.h => dma-pl330.h} (93%)
arch/arm/mach-exynos4/include/mach/dma.h +2 -2
index 81209eb..201842a 100644
@@ -20,7 +20,7 @@
 #ifndef __MACH_DMA_H
 #define __MACH_DMA_H
 
-/* This platform uses the common S3C DMA API driver for PL330 */
-#include <plat/s3c-dma-pl330.h>
+/* This platform uses the common DMA API driver for PL330 */
+#include <plat/dma-pl330.h>
 
 #endif /* __MACH_DMA_H */
arch/arm/mach-s5p64x0/include/mach/dma.h +1 -1
index 81209eb..1beae2c 100644
@@ -21,6 +21,6 @@
 #define __MACH_DMA_H
 
 /* This platform uses the common S3C DMA API driver for PL330 */
-#include <plat/s3c-dma-pl330.h>
+#include <plat/dma-pl330.h>
 
 #endif /* __MACH_DMA_H */
arch/arm/mach-s5pc100/include/mach/dma.h +1 -1
index 81209eb..1beae2c 100644
@@ -21,6 +21,6 @@
 #define __MACH_DMA_H
 
 /* This platform uses the common S3C DMA API driver for PL330 */
-#include <plat/s3c-dma-pl330.h>
+#include <plat/dma-pl330.h>
 
 #endif /* __MACH_DMA_H */
arch/arm/mach-s5pv210/include/mach/dma.h +1 -1
index 81209eb..1beae2c 100644
@@ -21,6 +21,6 @@
 #define __MACH_DMA_H
 
 /* This platform uses the common S3C DMA API driver for PL330 */
-#include <plat/s3c-dma-pl330.h>
+#include <plat/dma-pl330.h>
 
 #endif /* __MACH_DMA_H */
arch/arm/plat-samsung/Kconfig +9 -0
index b3e1065..e6f01ab 100644
@@ -306,6 +306,15 @@ config S3C_PL330_DMA
 	help
 	  S3C DMA API Driver for PL330 DMAC.
 
+config SAMSUNG_DMADEV
+	bool
+	select DMADEVICES
+	select PL330_DMA if (CPU_EXYNOS4210 || CPU_S5PV210 || CPU_S5PC100 || \
+					CPU_S5P6450 || CPU_S5P6440)
+	select ARM_AMBA
+	help
+	  Use DMA device engine for PL330 DMAC.
+
 comment "Power management"
 
 config SAMSUNG_PM_DEBUG
arch/arm/plat-samsung/include/plat/dma-pl330.h renamed from arch/arm/plat-samsung/include/plat/s3c-dma-pl330.h +4 -4
similarity index 93%
rename from arch/arm/plat-samsung/include/plat/s3c-dma-pl330.h
rename to arch/arm/plat-samsung/include/plat/dma-pl330.h
index 8107442..0a5dade 100644
@@ -8,8 +8,8 @@
  * (at your option) any later version.
  */
 
-#ifndef	__S3C_DMA_PL330_H_
-#define	__S3C_DMA_PL330_H_
+#ifndef __DMA_PL330_H_
+#define __DMA_PL330_H_ __FILE__
 
 #define S3C2410_DMAF_AUTOSTART		(1 << 0)
 #define S3C2410_DMAF_CIRCULAR		(1 << 1)
@@ -20,7 +20,7 @@
  * For the sake of consistency across client drivers,
  * We keep the channel names unchanged and only add
  * missing peripherals are added.
- * Order is not important since S3C PL330 API driver
+ * Order is not important since DMA PL330 API driver
  * use these just as IDs.
  */
 enum dma_ch {
@@ -95,4 +95,4 @@ static inline bool s3c_dma_has_circular(void)
 
 #include <plat/dma.h>
 
-#endif	/* __S3C_DMA_PL330_H_ */
+#endif	/* __DMA_PL330_H_ */
arch/arm/plat-samsung/include/plat/s3c-pl330-pdata.h +1 -1
index bf5e2a9..64fdf66 100644
@@ -12,7 +12,7 @@
 #ifndef __S3C_PL330_PDATA_H
 #define __S3C_PL330_PDATA_H
 
-#include <plat/s3c-dma-pl330.h>
+#include <plat/dma-pl330.h>
 
 /*
  * Every PL330 DMAC has max 32 peripheral interfaces,
Signature · 1 line
1.7.1
author
#14 lore raw

PATCH v8 7/16 ARM: SAMSUNG: Add common DMA operations

In reply to Boojin Kim

This patch adds common DMA operations which are used for Samsung DMA drivers. Currently there are two types of DMA driver for Samsung SoCs. The one is S3C-DMA for S3C SoCs and the other is PL330-DMA for S5P SoCs. This patch provides funcion pointers for common DMA operations to DMA client driver like SPI and Audio. It makes DMA client drivers support multi-platform.
In addition, this common DMA operations implement the shared actions that are needed for DMA client driver. For example shared actions are filter() function for dma_request_channel() and parameter passing for device_prep_slave_sg().

---
 arch/arm/mach-s3c2410/include/mach/dma.h       |    8 ++-
 arch/arm/mach-s3c64xx/include/mach/dma.h       |    4 +
 arch/arm/plat-samsung/Makefile                 |    6 +-
 arch/arm/plat-samsung/dma-ops.c                |  131 +++++++++++++++++++++++
 arch/arm/plat-samsung/include/plat/dma-ops.h   |   63 +++++++++++
 arch/arm/plat-samsung/include/plat/dma-pl330.h |    4 +
 arch/arm/plat-samsung/include/plat/dma.h       |    1 +
 arch/arm/plat-samsung/s3c-dma-ops.c            |  133 ++++++++++++++++++++++++
 8 files changed, 347 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/plat-samsung/dma-ops.c
 create mode 100644 arch/arm/plat-samsung/include/plat/dma-ops.h
 create mode 100644 arch/arm/plat-samsung/s3c-dma-ops.c
arch/arm/mach-s3c2410/include/mach/dma.h +7 -1
index b2b2a5b..e61a91f 100644
@@ -13,7 +13,6 @@
 #ifndef __ASM_ARCH_DMA_H
 #define __ASM_ARCH_DMA_H __FILE__
 
-#include <plat/dma.h>
 #include <linux/sysdev.h>
 
 #define MAX_DMA_TRANSFER_SIZE   0x100000 /* Data Unit is half word  */
@@ -51,6 +50,13 @@ enum dma_ch {
 	DMACH_MAX,		/* the end entry */
 };
 
+static inline bool samsung_dma_is_dmadev(void)
+{
+	return false;
+}
+
+#include <plat/dma.h>
+
 #define DMACH_LOW_LEVEL	(1<<28)	/* use this to specifiy hardware ch no */
 
 /* we have 4 dma channels */
arch/arm/mach-s3c64xx/include/mach/dma.h +4 -0
index 0a5d926..49c3a53 100644
@@ -63,6 +63,10 @@ static __inline__ bool s3c_dma_has_circular(void)
 	return true;
 }
 
+static inline bool samsung_dma_is_dmadev(void)
+{
+	return false;
+}
 #define S3C2410_DMAF_CIRCULAR		(1 << 0)
 
 #include <plat/dma.h>
arch/arm/plat-samsung/Makefile +4 -2
index 853764b..e2ee0b8 100644
@@ -63,9 +63,11 @@ obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT)	+= dev-backlight.o
 
 # DMA support
 
-obj-$(CONFIG_S3C_DMA)		+= dma.o
+obj-$(CONFIG_S3C_DMA)		+= dma.o s3c-dma-ops.o
 
-obj-$(CONFIG_S3C_PL330_DMA)	+= s3c-pl330.o
+obj-$(CONFIG_SAMSUNG_DMADEV)	+= dma-ops.o
+
+obj-$(CONFIG_S3C_PL330_DMA)	+= s3c-pl330.o s3c-dma-ops.o
 
 # PM support
 
arch/arm/plat-samsung/dma-ops.c new file +131 -0

131 lines not on this page · raw message

arch/arm/plat-samsung/include/plat/dma-ops.h new file +63 -0

63 lines not on this page · raw message

arch/arm/plat-samsung/include/plat/dma-pl330.h +4 -0
index 0a5dade..2916920 100644
@@ -93,6 +93,10 @@ static inline bool s3c_dma_has_circular(void)
 	return true;
 }
 
+static inline bool samsung_dma_is_dmadev(void)
+{
+	return true;
+}
 #include <plat/dma.h>
 
 #endif	/* __DMA_PL330_H_ */
arch/arm/plat-samsung/include/plat/dma.h +1 -0
index 8c273b7..3610760 100644
@@ -126,3 +126,4 @@ extern int s3c2410_dma_set_opfn(enum dma_ch, s3c2410_dma_opfn_t rtn);
 extern int s3c2410_dma_set_buffdone_fn(enum dma_ch, s3c2410_dma_cbfn_t rtn);
 
 
+#include <plat/dma-ops.h>
arch/arm/plat-samsung/s3c-dma-ops.c new file +133 -0

133 lines not on this page · raw message

Signature · 1 line
1.7.1
author
#15 lore raw

PATCH v8 8/16 ARM: EXYNOS4: Use generic DMA PL330 driver

In reply to Boojin Kim

This patch makes Samsung EXYNOS4 to use DMA PL330 driver on DMADEVICE. The EXYNOS4 uses DMA generic APIs instead of SAMSUNG specific S3C-PL330 APIs.

---
 arch/arm/mach-exynos4/Kconfig |    2 +-
 arch/arm/mach-exynos4/clock.c |   11 ++-
 arch/arm/mach-exynos4/dma.c   |  299 ++++++++++++++++++++++++++---------------
 3 files changed, 198 insertions(+), 114 deletions(-)
arch/arm/mach-exynos4/Kconfig +1 -1
index 0c77ab9..9f00cf3 100644
@@ -11,7 +11,7 @@ if ARCH_EXYNOS4
 
 config CPU_EXYNOS4210
 	bool
-	select S3C_PL330_DMA
+	select SAMSUNG_DMADEV
 	help
 	  Enable EXYNOS4210 CPU support
 
arch/arm/mach-exynos4/clock.c +9 -2
index 851dea0..fee2dd8 100644
@@ -43,6 +43,11 @@ static struct clk clk_sclk_usbphy1 = {
 	.name		= "sclk_usbphy1",
 };
 
+static struct clk dummy_apb_pclk = {
+	.name		= "apb_pclk",
+	.id		= -1,
+};
+
 static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable)
 {
 	return s5p_gatectrl(S5P_CLKSRC_MASK_TOP, clk, enable);
@@ -454,12 +459,12 @@ static struct clk init_clocks_off[] = {
 		.enable		= exynos4_clk_ip_fsys_ctrl,
 		.ctrlbit	= (1 << 10),
 	}, {
-		.name		= "pdma",
+		.name		= "dma",
 		.devname	= "s3c-pl330.0",
 		.enable		= exynos4_clk_ip_fsys_ctrl,
 		.ctrlbit	= (1 << 0),
 	}, {
-		.name		= "pdma",
+		.name		= "dma",
 		.devname	= "s3c-pl330.1",
 		.enable		= exynos4_clk_ip_fsys_ctrl,
 		.ctrlbit	= (1 << 1),
@@ -1210,5 +1215,7 @@ void __init exynos4_register_clocks(void)
 	s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
 	s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
 
+	s3c24xx_register_clock(&dummy_apb_pclk);
+
 	s3c_pwmclk_init();
 }
arch/arm/mach-exynos4/dma.c +188 -111

339 lines not on this page · raw message

Signature · 1 line
1.7.1
author
#16 lore raw

PATCH v8 9/16 ARM: S5PV210: Use generic DMA PL330 driver

In reply to Boojin Kim

This patch makes Samsung S5PV210 to use DMA PL330 driver on DMADEVICE. The S5PV210 uses DMA generic APIs instead of SAMSUNG specific S3C-PL330 APIs.

---
 arch/arm/mach-s5pv210/Kconfig            |    2 +-
 arch/arm/mach-s5pv210/clock.c            |   10 +-
 arch/arm/mach-s5pv210/dma.c              |  316 +++++++++++++++++++-----------
 arch/arm/mach-s5pv210/include/mach/dma.h |    2 +-
 4 files changed, 214 insertions(+), 116 deletions(-)
arch/arm/mach-s5pv210/Kconfig +1 -1
index 69dd87c..d960090 100644
@@ -11,7 +11,7 @@ if ARCH_S5PV210
 
 config CPU_S5PV210
 	bool
-	select S3C_PL330_DMA
+	select SAMSUNG_DMADEV
 	select S5P_EXT_INT
 	select S5P_HRT
 	select S5PV210_PM if PM
arch/arm/mach-s5pv210/clock.c +8 -2
index 52a8e60..d35726a 100644
@@ -203,6 +203,11 @@ static struct clk clk_pcmcdclk2 = {
 	.name		= "pcmcdclk",
 };
 
+static struct clk dummy_apb_pclk = {
+	.name		= "apb_pclk",
+	.id		= -1,
+};
+
 static struct clk *clkset_vpllsrc_list[] = {
 	[0] = &clk_fin_vpll,
 	[1] = &clk_sclk_hdmi27m,
@@ -289,13 +294,13 @@ static struct clk_ops clk_fout_apll_ops = {
 
 static struct clk init_clocks_off[] = {
 	{
-		.name		= "pdma",
+		.name		= "dma",
 		.devname	= "s3c-pl330.0",
 		.parent		= &clk_hclk_psys.clk,
 		.enable		= s5pv210_clk_ip0_ctrl,
 		.ctrlbit	= (1 << 3),
 	}, {
-		.name		= "pdma",
+		.name		= "dma",
 		.devname	= "s3c-pl330.1",
 		.parent		= &clk_hclk_psys.clk,
 		.enable		= s5pv210_clk_ip0_ctrl,
@@ -1161,5 +1166,6 @@ void __init s5pv210_register_clocks(void)
 	s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
 	s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
 
+	s3c24xx_register_clock(&dummy_apb_pclk);
 	s3c_pwmclk_init();
 }
arch/arm/mach-s5pv210/dma.c +204 -112

359 lines not on this page · raw message

arch/arm/mach-s5pv210/include/mach/dma.h +1 -1
index 1beae2c..201842a 100644
@@ -20,7 +20,7 @@
 #ifndef __MACH_DMA_H
 #define __MACH_DMA_H
 
-/* This platform uses the common S3C DMA API driver for PL330 */
+/* This platform uses the common DMA API driver for PL330 */
 #include <plat/dma-pl330.h>
 
 #endif /* __MACH_DMA_H */
Signature · 1 line
1.7.1
author
#17 lore raw

PATCH v8 10/16 ARM: S5PC100: Use generic DMA PL330 driver

In reply to Boojin Kim

This patch makes Samsung S5PC100 to use DMA PL330 driver on DMADEVICE. The S5PC100 uses DMA generic APIs instead of SAMSUNG specific S3C-PL330 APIs.

---
 arch/arm/mach-s5pc100/Kconfig            |    2 +-
 arch/arm/mach-s5pc100/clock.c            |   11 +-
 arch/arm/mach-s5pc100/dma.c              |  323 +++++++++++++++++++----------
 arch/arm/mach-s5pc100/include/mach/dma.h |    2 +-
 4 files changed, 222 insertions(+), 116 deletions(-)
arch/arm/mach-s5pc100/Kconfig +1 -1
index e8a33c4..e538a4c 100644
@@ -10,7 +10,7 @@ if ARCH_S5PC100
 config CPU_S5PC100
 	bool
 	select S5P_EXT_INT
-	select S3C_PL330_DMA
+	select SAMSUNG_DMADEV
 	help
 	  Enable S5PC100 CPU support
 
arch/arm/mach-s5pc100/clock.c +9 -2
index ff5cbb3..6527c05 100644
@@ -33,6 +33,11 @@ static struct clk s5p_clk_otgphy = {
 	.name		= "otg_phy",
 };
 
+static struct clk dummy_apb_pclk = {
+	.name		= "apb_pclk",
+	.id		= -1,
+};
+
 static struct clk *clk_src_mout_href_list[] = {
 	[0] = &s5p_clk_27m,
 	[1] = &clk_fin_hpll,
@@ -454,13 +459,13 @@ static struct clk init_clocks_off[] = {
 		.enable		= s5pc100_d1_0_ctrl,
 		.ctrlbit	= (1 << 2),
 	}, {
-		.name		= "pdma",
+		.name		= "dma",
 		.devname	= "s3c-pl330.1",
 		.parent		= &clk_div_d1_bus.clk,
 		.enable		= s5pc100_d1_0_ctrl,
 		.ctrlbit	= (1 << 1),
 	}, {
-		.name		= "pdma",
+		.name		= "dma",
 		.devname	= "s3c-pl330.0",
 		.parent		= &clk_div_d1_bus.clk,
 		.enable		= s5pc100_d1_0_ctrl,
@@ -1276,5 +1281,7 @@ void __init s5pc100_register_clocks(void)
 	s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
 	s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
 
+	s3c24xx_register_clock(&dummy_apb_pclk);
+
 	s3c_pwmclk_init();
 }
arch/arm/mach-s5pc100/dma.c +211 -112

365 lines not on this page · raw message

arch/arm/mach-s5pc100/include/mach/dma.h +1 -1
index 1beae2c..201842a 100644
@@ -20,7 +20,7 @@
 #ifndef __MACH_DMA_H
 #define __MACH_DMA_H
 
-/* This platform uses the common S3C DMA API driver for PL330 */
+/* This platform uses the common DMA API driver for PL330 */
 #include <plat/dma-pl330.h>
 
 #endif /* __MACH_DMA_H */
Signature · 1 line
1.7.1
author
#18 lore raw

PATCH v8 11/16 ARM: S5P64X0: Use generic DMA PL330 driver

In reply to Boojin Kim

This patch makes Samsung S5P64X0 to use DMA PL330 driver on DMADEVICE. The S5P64X0 uses DMA generic APIs instead of SAMSUNG specific S3C-PL330 APIs.

---
 arch/arm/mach-s5p64x0/Kconfig            |    4 +-
 arch/arm/mach-s5p64x0/clock-s5p6440.c    |    9 +-
 arch/arm/mach-s5p64x0/clock-s5p6450.c    |    9 +-
 arch/arm/mach-s5p64x0/dma.c              |  273 ++++++++++++++++++++----------
 arch/arm/mach-s5p64x0/include/mach/dma.h |    2 +-
 5 files changed, 201 insertions(+), 96 deletions(-)
arch/arm/mach-s5p64x0/Kconfig +2 -2
index 65c7518..9527ed2 100644
@@ -9,14 +9,14 @@ if ARCH_S5P64X0
 
 config CPU_S5P6440
 	bool
-	select S3C_PL330_DMA
+	select SAMSUNG_DMADEV
 	select S5P_HRT
 	help
 	  Enable S5P6440 CPU support
 
 config CPU_S5P6450
 	bool
-	select S3C_PL330_DMA
+	select SAMSUNG_DMADEV
 	select S5P_HRT
 	help
 	  Enable S5P6450 CPU support
arch/arm/mach-s5p64x0/clock-s5p6440.c +8 -1
index 0e9cd30..c1f548f 100644
@@ -146,7 +146,7 @@ static struct clk init_clocks_off[] = {
 		.enable		= s5p64x0_hclk0_ctrl,
 		.ctrlbit	= (1 << 8),
 	}, {
-		.name		= "pdma",
+		.name		= "dma",
 		.parent		= &clk_hclk_low.clk,
 		.enable		= s5p64x0_hclk0_ctrl,
 		.ctrlbit	= (1 << 12),
@@ -499,6 +499,11 @@ static struct clksrc_clk *sysclks[] = {
 	&clk_pclk_low,
 };
 
+static struct clk dummy_apb_pclk = {
+	.name		= "apb_pclk",
+	.id		= -1,
+};
+
 void __init_or_cpufreq s5p6440_setup_clocks(void)
 {
 	struct clk *xtal_clk;
@@ -581,5 +586,7 @@ void __init s5p6440_register_clocks(void)
 	s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
 	s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
 
+	s3c24xx_register_clock(&dummy_apb_pclk);
+
 	s3c_pwmclk_init();
 }
arch/arm/mach-s5p64x0/clock-s5p6450.c +8 -1
index d9dc16c..3d9b609 100644
@@ -179,7 +179,7 @@ static struct clk init_clocks_off[] = {
 		.enable		= s5p64x0_hclk0_ctrl,
 		.ctrlbit	= (1 << 3),
 	}, {
-		.name		= "pdma",
+		.name		= "dma",
 		.parent		= &clk_hclk_low.clk,
 		.enable		= s5p64x0_hclk0_ctrl,
 		.ctrlbit	= (1 << 12),
@@ -553,6 +553,11 @@ static struct clksrc_clk *sysclks[] = {
 	&clk_sclk_audio0,
 };
 
+static struct clk dummy_apb_pclk = {
+	.name		= "apb_pclk",
+	.id		= -1,
+};
+
 void __init_or_cpufreq s5p6450_setup_clocks(void)
 {
 	struct clk *xtal_clk;
@@ -632,5 +637,7 @@ void __init s5p6450_register_clocks(void)
 	s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
 	s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
 
+	s3c24xx_register_clock(&dummy_apb_pclk);
+
 	s3c_pwmclk_init();
 }
arch/arm/mach-s5p64x0/dma.c +182 -91

310 lines not on this page · raw message

arch/arm/mach-s5p64x0/include/mach/dma.h +1 -1
index 1beae2c..5a622af 100644
@@ -20,7 +20,7 @@
 #ifndef __MACH_DMA_H
 #define __MACH_DMA_H
 
-/* This platform uses the common S3C DMA API driver for PL330 */
+/* This platform uses the common common DMA API driver for PL330 */
 #include <plat/dma-pl330.h>
 
 #endif /* __MACH_DMA_H */
Signature · 1 line
1.7.1
author
#19 lore raw

PATCH v8 12/16 ARM: SAMSUNG: Remove S3C-PL330-DMA driver

In reply to Boojin Kim

Since DMA generic APIs can be used for Samsung DMA now so that the s3c-pl330 which includes Samsung specific DMA APIs can be removed.

---
 arch/arm/plat-samsung/Kconfig                      |    6 -
 arch/arm/plat-samsung/Makefile                     |    2 -
 arch/arm/plat-samsung/include/plat/dma-pl330.h     |   10 +-
 .../plat-samsung/include/plat/s3c-pl330-pdata.h    |   32 -
 arch/arm/plat-samsung/s3c-pl330.c                  | 1244 --------------------
 5 files changed, 6 insertions(+), 1288 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/s3c-pl330-pdata.h
 delete mode 100644 arch/arm/plat-samsung/s3c-pl330.c
arch/arm/plat-samsung/Kconfig +0 -6
index e6f01ab..0a3eec6 100644
@@ -300,12 +300,6 @@ config S3C_DMA
 	help
 	  Internal configuration for S3C DMA core
 
-config S3C_PL330_DMA
-	bool
-	select PL330
-	help
-	  S3C DMA API Driver for PL330 DMAC.
-
 config SAMSUNG_DMADEV
 	bool
 	select DMADEVICES
arch/arm/plat-samsung/Makefile +0 -2
index e2ee0b8..9075849 100644
@@ -67,8 +67,6 @@ obj-$(CONFIG_S3C_DMA)		+= dma.o s3c-dma-ops.o
 
 obj-$(CONFIG_SAMSUNG_DMADEV)	+= dma-ops.o
 
-obj-$(CONFIG_S3C_PL330_DMA)	+= s3c-pl330.o s3c-dma-ops.o
-
 # PM support
 
 obj-$(CONFIG_PM)		+= pm.o
arch/arm/plat-samsung/include/plat/dma-pl330.h +6 -4
index 2916920..9a1dadb 100644
@@ -11,9 +11,6 @@
 #ifndef __DMA_PL330_H_
 #define __DMA_PL330_H_ __FILE__
 
-#define S3C2410_DMAF_AUTOSTART		(1 << 0)
-#define S3C2410_DMAF_CIRCULAR		(1 << 1)
-
 /*
  * PL330 can assign any channel to communicate with
  * any of the peripherals attched to the DMAC.
@@ -88,6 +85,10 @@ enum dma_ch {
 	DMACH_MAX,
 };
 
+struct s3c2410_dma_client {
+	char	*name;
+};
+
 static inline bool s3c_dma_has_circular(void)
 {
 	return true;
@@ -97,6 +98,7 @@ static inline bool samsung_dma_is_dmadev(void)
 {
 	return true;
 }
-#include <plat/dma.h>
+
+#include <plat/dma-ops.h>
 
 #endif	/* __DMA_PL330_H_ */
arch/arm/plat-samsung/include/plat/s3c-pl330-pdata.h deleted +0 -32
deleted file mode 100644
index 64fdf66..0000000
@@ -1,32 +0,0 @@
-/* linux/arch/arm/plat-samsung/include/plat/s3c-pl330-pdata.h
- *
- * Copyright (C) 2010 Samsung Electronics Co. Ltd.
- *	Jaswinder Singh <[email protected]>
- *
- * This program 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 __S3C_PL330_PDATA_H
-#define __S3C_PL330_PDATA_H
-
-#include <plat/dma-pl330.h>
-
-/*
- * Every PL330 DMAC has max 32 peripheral interfaces,
- * of which some may be not be really used in your
- * DMAC's configuration.
- * Populate this array of 32 peri i/fs with relevant
- * channel IDs for used peri i/f and DMACH_MAX for
- * those unused.
- *
- * The platforms just need to provide this info
- * to the S3C DMA API driver for PL330.
- */
-struct s3c_pl330_platdata {
-	enum dma_ch peri[32];
-};
-
-#endif /* __S3C_PL330_PDATA_H */
arch/arm/plat-samsung/s3c-pl330.c deleted +0 -1244

1,244 lines not on this page · raw message

Signature · 1 line
1.7.1
author
#20 lore raw

PATCH v8 13/16 spi/s3c64xx: Add support DMA engine API

In reply to Boojin Kim

This patch adds to support DMA generic API to transfer raw SPI data. Basiclly the spi driver uses DMA generic API if architecture supports it. Otherwise, uses Samsung specific S3C-PL330 APIs.

---
 drivers/spi/spi-s3c64xx.c |  141 ++++++++++++++++++++++-----------------------
 1 files changed, 69 insertions(+), 72 deletions(-)
drivers/spi/spi-s3c64xx.c +69 -72
index 595dacc..24f4903 100644
@@ -171,6 +171,9 @@ struct s3c64xx_spi_driver_data {
 	unsigned                        state;
 	unsigned                        cur_mode, cur_bpw;
 	unsigned                        cur_speed;
+	unsigned			rx_ch;
+	unsigned			tx_ch;
+	struct samsung_dma_ops		*ops;
 };
 
 static struct s3c2410_dma_client s3c64xx_spi_dma_client = {
@@ -226,6 +229,38 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
 	writel(val, regs + S3C64XX_SPI_CH_CFG);
 }
 
+static void s3c64xx_spi_dma_rxcb(void *data)
+{
+	struct s3c64xx_spi_driver_data *sdd
+		= (struct s3c64xx_spi_driver_data *)data;
+	unsigned long flags;
+
+	spin_lock_irqsave(&sdd->lock, flags);
+
+	sdd->state &= ~RXBUSY;
+	/* If the other done */
+	if (!(sdd->state & TXBUSY))
+		complete(&sdd->xfer_completion);
+
+	spin_unlock_irqrestore(&sdd->lock, flags);
+}
+
+static void s3c64xx_spi_dma_txcb(void *data)
+{
+	struct s3c64xx_spi_driver_data *sdd
+		= (struct s3c64xx_spi_driver_data *)data;
+	unsigned long flags;
+
+	spin_lock_irqsave(&sdd->lock, flags);
+
+	sdd->state &= ~TXBUSY;
+	/* If the other done */
+	if (!(sdd->state & RXBUSY))
+		complete(&sdd->xfer_completion);
+
+	spin_unlock_irqrestore(&sdd->lock, flags);
+}
+
 static void enable_datapath(struct s3c64xx_spi_driver_data *sdd,
 				struct spi_device *spi,
 				struct spi_transfer *xfer, int dma_mode)
@@ -233,6 +268,7 @@ static void enable_datapath(struct s3c64xx_spi_driver_data *sdd,
 	struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
 	void __iomem *regs = sdd->regs;
 	u32 modecfg, chcfg;
+	struct samsung_dma_prep_info info;
 
 	modecfg = readl(regs + S3C64XX_SPI_MODE_CFG);
 	modecfg &= ~(S3C64XX_SPI_MODE_TXDMA_ON | S3C64XX_SPI_MODE_RXDMA_ON);
@@ -258,10 +294,14 @@ static void enable_datapath(struct s3c64xx_spi_driver_data *sdd,
 		chcfg |= S3C64XX_SPI_CH_TXCH_ON;
 		if (dma_mode) {
 			modecfg |= S3C64XX_SPI_MODE_TXDMA_ON;
-			s3c2410_dma_config(sdd->tx_dmach, sdd->cur_bpw / 8);
-			s3c2410_dma_enqueue(sdd->tx_dmach, (void *)sdd,
-						xfer->tx_dma, xfer->len);
-			s3c2410_dma_ctrl(sdd->tx_dmach, S3C2410_DMAOP_START);
+			info.cap = DMA_SLAVE;
+			info.direction = DMA_TO_DEVICE;
+			info.buf = xfer->tx_dma;
+			info.len = xfer->len;
+			info.fp = s3c64xx_spi_dma_txcb;
+			info.fp_param = sdd;
+			sdd->ops->prepare(sdd->tx_ch, &info);
+			sdd->ops->trigger(sdd->tx_ch);
 		} else {
 			switch (sdd->cur_bpw) {
 			case 32:
@@ -293,10 +333,14 @@ static void enable_datapath(struct s3c64xx_spi_driver_data *sdd,
 			writel(((xfer->len * 8 / sdd->cur_bpw) & 0xffff)
 					| S3C64XX_SPI_PACKET_CNT_EN,
 					regs + S3C64XX_SPI_PACKET_CNT);
-			s3c2410_dma_config(sdd->rx_dmach, sdd->cur_bpw / 8);
-			s3c2410_dma_enqueue(sdd->rx_dmach, (void *)sdd,
-						xfer->rx_dma, xfer->len);
-			s3c2410_dma_ctrl(sdd->rx_dmach, S3C2410_DMAOP_START);
+			info.cap = DMA_SLAVE;
+			info.direction = DMA_FROM_DEVICE;
+			info.buf = xfer->rx_dma;
+			info.len = xfer->len;
+			info.fp = s3c64xx_spi_dma_rxcb;
+			info.fp_param = sdd;
+			sdd->ops->prepare(sdd->rx_ch, &info);
+			sdd->ops->trigger(sdd->rx_ch);
 		}
 	}
 
@@ -482,46 +526,6 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
 	}
 }
 
-static void s3c64xx_spi_dma_rxcb(struct s3c2410_dma_chan *chan, void *buf_id,
-				 int size, enum s3c2410_dma_buffresult res)
-{
-	struct s3c64xx_spi_driver_data *sdd = buf_id;
-	unsigned long flags;
-
-	spin_lock_irqsave(&sdd->lock, flags);
-
-	if (res == S3C2410_RES_OK)
-		sdd->state &= ~RXBUSY;
-	else
-		dev_err(&sdd->pdev->dev, "DmaAbrtRx-%d\n", size);
-
-	/* If the other done */
-	if (!(sdd->state & TXBUSY))
-		complete(&sdd->xfer_completion);
-
-	spin_unlock_irqrestore(&sdd->lock, flags);
-}
-
-static void s3c64xx_spi_dma_txcb(struct s3c2410_dma_chan *chan, void *buf_id,
-				 int size, enum s3c2410_dma_buffresult res)
-{
-	struct s3c64xx_spi_driver_data *sdd = buf_id;
-	unsigned long flags;
-
-	spin_lock_irqsave(&sdd->lock, flags);
-
-	if (res == S3C2410_RES_OK)
-		sdd->state &= ~TXBUSY;
-	else
-		dev_err(&sdd->pdev->dev, "DmaAbrtTx-%d \n", size);
-
-	/* If the other done */
-	if (!(sdd->state & RXBUSY))
-		complete(&sdd->xfer_completion);
-
-	spin_unlock_irqrestore(&sdd->lock, flags);
-}
-
 #define XFER_DMAADDR_INVALID DMA_BIT_MASK(32)
 
 static int s3c64xx_spi_map_mssg(struct s3c64xx_spi_driver_data *sdd,
@@ -696,12 +700,10 @@ static void handle_msg(struct s3c64xx_spi_driver_data *sdd,
 			if (use_dma) {
 				if (xfer->tx_buf != NULL
 						&& (sdd->state & TXBUSY))
-					s3c2410_dma_ctrl(sdd->tx_dmach,
-							S3C2410_DMAOP_FLUSH);
+					sdd->ops->stop(sdd->tx_ch);
 				if (xfer->rx_buf != NULL
 						&& (sdd->state & RXBUSY))
-					s3c2410_dma_ctrl(sdd->rx_dmach,
-							S3C2410_DMAOP_FLUSH);
+					sdd->ops->stop(sdd->rx_ch);
 			}
 
 			goto out;
@@ -741,24 +743,19 @@ out:
 
 static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
 {
-	if (s3c2410_dma_request(sdd->rx_dmach,
-					&s3c64xx_spi_dma_client, NULL) < 0) {
-		dev_err(&sdd->pdev->dev, "cannot get RxDMA\n");
-		return 0;
-	}
-	s3c2410_dma_set_buffdone_fn(sdd->rx_dmach, s3c64xx_spi_dma_rxcb);
-	s3c2410_dma_devconfig(sdd->rx_dmach, S3C2410_DMASRC_HW,
-					sdd->sfr_start + S3C64XX_SPI_RX_DATA);
-
-	if (s3c2410_dma_request(sdd->tx_dmach,
-					&s3c64xx_spi_dma_client, NULL) < 0) {
-		dev_err(&sdd->pdev->dev, "cannot get TxDMA\n");
-		s3c2410_dma_free(sdd->rx_dmach, &s3c64xx_spi_dma_client);
-		return 0;
-	}
-	s3c2410_dma_set_buffdone_fn(sdd->tx_dmach, s3c64xx_spi_dma_txcb);
-	s3c2410_dma_devconfig(sdd->tx_dmach, S3C2410_DMASRC_MEM,
-					sdd->sfr_start + S3C64XX_SPI_TX_DATA);
+
+	struct samsung_dma_info info;
+	sdd->ops = samsung_dma_get_ops();
+
+	info.cap = DMA_SLAVE;
+	info.client = &s3c64xx_spi_dma_client;
+	info.direction = DMA_FROM_DEVICE;
+	info.fifo = sdd->sfr_start + S3C64XX_SPI_RX_DATA;
+	info.width = sdd->cur_bpw / 8;
+	sdd->rx_ch = sdd->ops->request(sdd->rx_dmach, &info);
+	info.direction = DMA_TO_DEVICE;
+	info.fifo = sdd->sfr_start + S3C64XX_SPI_TX_DATA;
+	sdd->tx_ch = sdd->ops->request(sdd->tx_dmach, &info);
 
 	return 1;
 }
@@ -799,8 +796,8 @@ static void s3c64xx_spi_work(struct work_struct *work)
 	spin_unlock_irqrestore(&sdd->lock, flags);
 
 	/* Free DMA channels */
-	s3c2410_dma_free(sdd->tx_dmach, &s3c64xx_spi_dma_client);
-	s3c2410_dma_free(sdd->rx_dmach, &s3c64xx_spi_dma_client);
+	sdd->ops->release(sdd->rx_ch, &s3c64xx_spi_dma_client);
+	sdd->ops->release(sdd->tx_ch, &s3c64xx_spi_dma_client);
 }
 
 static int s3c64xx_spi_transfer(struct spi_device *spi,
Signature · 1 line
1.7.1
author
#21 lore raw

PATCH v8 14/16 spi/s3c64xx: Merge dma control code

In reply to Boojin Kim

This patch modifies to merge the dma control code. Original s3c64xx spi driver has each dma control code for rx and tx channel. This patch merges these dma control codes into one. With this patch, a dma setup function and callback function handle for both rx and tx channel.

---
 drivers/spi/spi-s3c64xx.c |  140 ++++++++++++++++++++++++--------------------
 1 files changed, 76 insertions(+), 64 deletions(-)
drivers/spi/spi-s3c64xx.c +76 -64
index 24f4903..019a716 100644
@@ -131,6 +131,12 @@
 #define RXBUSY    (1<<2)
 #define TXBUSY    (1<<3)
 
+struct s3c64xx_spi_dma_data {
+	unsigned		ch;
+	enum dma_data_direction direction;
+	enum dma_ch	dmach;
+};
+
 /**
  * struct s3c64xx_spi_driver_data - Runtime info holder for SPI driver.
  * @clk: Pointer to the spi clock.
@@ -164,15 +170,13 @@ struct s3c64xx_spi_driver_data {
 	struct work_struct              work;
 	struct list_head                queue;
 	spinlock_t                      lock;
-	enum dma_ch                     rx_dmach;
-	enum dma_ch                     tx_dmach;
 	unsigned long                   sfr_start;
 	struct completion               xfer_completion;
 	unsigned                        state;
 	unsigned                        cur_mode, cur_bpw;
 	unsigned                        cur_speed;
-	unsigned			rx_ch;
-	unsigned			tx_ch;
+	struct s3c64xx_spi_dma_data	rx_dma;
+	struct s3c64xx_spi_dma_data	tx_dma;
 	struct samsung_dma_ops		*ops;
 };
 
@@ -229,36 +233,76 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
 	writel(val, regs + S3C64XX_SPI_CH_CFG);
 }
 
-static void s3c64xx_spi_dma_rxcb(void *data)
+static void s3c64xx_spi_dmacb(void *data)
 {
-	struct s3c64xx_spi_driver_data *sdd
-		= (struct s3c64xx_spi_driver_data *)data;
+	struct s3c64xx_spi_driver_data *sdd;
+	struct s3c64xx_spi_dma_data *dma = data;
 	unsigned long flags;
 
+	if (dma->direction == DMA_FROM_DEVICE)
+		sdd = container_of(data,
+			struct s3c64xx_spi_driver_data, rx_dma);
+	else
+		sdd = container_of(data,
+			struct s3c64xx_spi_driver_data, tx_dma);
+
 	spin_lock_irqsave(&sdd->lock, flags);
 
-	sdd->state &= ~RXBUSY;
-	/* If the other done */
-	if (!(sdd->state & TXBUSY))
-		complete(&sdd->xfer_completion);
+	if (dma->direction == DMA_FROM_DEVICE) {
+		sdd->state &= ~RXBUSY;
+		if (!(sdd->state & TXBUSY))
+			complete(&sdd->xfer_completion);
+	} else {
+		sdd->state &= ~TXBUSY;
+		if (!(sdd->state & RXBUSY))
+			complete(&sdd->xfer_completion);
+	}
 
 	spin_unlock_irqrestore(&sdd->lock, flags);
 }
 
-static void s3c64xx_spi_dma_txcb(void *data)
+static void prepare_dma(struct s3c64xx_spi_dma_data *dma,
+					unsigned len, dma_addr_t buf)
 {
-	struct s3c64xx_spi_driver_data *sdd
-		= (struct s3c64xx_spi_driver_data *)data;
-	unsigned long flags;
+	struct s3c64xx_spi_driver_data *sdd;
+	struct samsung_dma_prep_info info;
 
-	spin_lock_irqsave(&sdd->lock, flags);
+	if (dma->direction == DMA_FROM_DEVICE)
+		sdd = container_of((void *)dma,
+			struct s3c64xx_spi_driver_data, rx_dma);
+	else
+		sdd = container_of((void *)dma,
+			struct s3c64xx_spi_driver_data, tx_dma);
 
-	sdd->state &= ~TXBUSY;
-	/* If the other done */
-	if (!(sdd->state & RXBUSY))
-		complete(&sdd->xfer_completion);
+	info.cap = DMA_SLAVE;
+	info.len = len;
+	info.fp = s3c64xx_spi_dmacb;
+	info.fp_param = dma;
+	info.direction = dma->direction;
+	info.buf = buf;
+
+	sdd->ops->prepare(dma->ch, &info);
+	sdd->ops->trigger(dma->ch);
+}
 
-	spin_unlock_irqrestore(&sdd->lock, flags);
+static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
+{
+	struct samsung_dma_info info;
+
+	sdd->ops = samsung_dma_get_ops();
+
+	info.cap = DMA_SLAVE;
+	info.client = &s3c64xx_spi_dma_client;
+	info.width = sdd->cur_bpw / 8;
+
+	info.direction = sdd->rx_dma.direction;
+	info.fifo = sdd->sfr_start + S3C64XX_SPI_RX_DATA;
+	sdd->rx_dma.ch = sdd->ops->request(sdd->rx_dma.dmach, &info);
+	info.direction =  sdd->tx_dma.direction;
+	info.fifo = sdd->sfr_start + S3C64XX_SPI_TX_DATA;
+	sdd->tx_dma.ch = sdd->ops->request(sdd->tx_dma.dmach, &info);
+
+	return 1;
 }
 
 static void enable_datapath(struct s3c64xx_spi_driver_data *sdd,
@@ -268,7 +312,6 @@ static void enable_datapath(struct s3c64xx_spi_driver_data *sdd,
 	struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
 	void __iomem *regs = sdd->regs;
 	u32 modecfg, chcfg;
-	struct samsung_dma_prep_info info;
 
 	modecfg = readl(regs + S3C64XX_SPI_MODE_CFG);
 	modecfg &= ~(S3C64XX_SPI_MODE_TXDMA_ON | S3C64XX_SPI_MODE_RXDMA_ON);
@@ -294,14 +337,7 @@ static void enable_datapath(struct s3c64xx_spi_driver_data *sdd,
 		chcfg |= S3C64XX_SPI_CH_TXCH_ON;
 		if (dma_mode) {
 			modecfg |= S3C64XX_SPI_MODE_TXDMA_ON;
-			info.cap = DMA_SLAVE;
-			info.direction = DMA_TO_DEVICE;
-			info.buf = xfer->tx_dma;
-			info.len = xfer->len;
-			info.fp = s3c64xx_spi_dma_txcb;
-			info.fp_param = sdd;
-			sdd->ops->prepare(sdd->tx_ch, &info);
-			sdd->ops->trigger(sdd->tx_ch);
+			prepare_dma(&sdd->tx_dma, xfer->len, xfer->tx_dma);
 		} else {
 			switch (sdd->cur_bpw) {
 			case 32:
@@ -333,14 +369,7 @@ static void enable_datapath(struct s3c64xx_spi_driver_data *sdd,
 			writel(((xfer->len * 8 / sdd->cur_bpw) & 0xffff)
 					| S3C64XX_SPI_PACKET_CNT_EN,
 					regs + S3C64XX_SPI_PACKET_CNT);
-			info.cap = DMA_SLAVE;
-			info.direction = DMA_FROM_DEVICE;
-			info.buf = xfer->rx_dma;
-			info.len = xfer->len;
-			info.fp = s3c64xx_spi_dma_rxcb;
-			info.fp_param = sdd;
-			sdd->ops->prepare(sdd->rx_ch, &info);
-			sdd->ops->trigger(sdd->rx_ch);
+			prepare_dma(&sdd->rx_dma, xfer->len, xfer->rx_dma);
 		}
 	}
 
@@ -700,10 +729,10 @@ static void handle_msg(struct s3c64xx_spi_driver_data *sdd,
 			if (use_dma) {
 				if (xfer->tx_buf != NULL
 						&& (sdd->state & TXBUSY))
-					sdd->ops->stop(sdd->tx_ch);
+					sdd->ops->stop(sdd->tx_dma.ch);
 				if (xfer->rx_buf != NULL
 						&& (sdd->state & RXBUSY))
-					sdd->ops->stop(sdd->rx_ch);
+					sdd->ops->stop(sdd->rx_dma.ch);
 			}
 
 			goto out;
@@ -741,25 +770,6 @@ out:
 		msg->complete(msg->context);
 }
 
-static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
-{
-
-	struct samsung_dma_info info;
-	sdd->ops = samsung_dma_get_ops();
-
-	info.cap = DMA_SLAVE;
-	info.client = &s3c64xx_spi_dma_client;
-	info.direction = DMA_FROM_DEVICE;
-	info.fifo = sdd->sfr_start + S3C64XX_SPI_RX_DATA;
-	info.width = sdd->cur_bpw / 8;
-	sdd->rx_ch = sdd->ops->request(sdd->rx_dmach, &info);
-	info.direction = DMA_TO_DEVICE;
-	info.fifo = sdd->sfr_start + S3C64XX_SPI_TX_DATA;
-	sdd->tx_ch = sdd->ops->request(sdd->tx_dmach, &info);
-
-	return 1;
-}
-
 static void s3c64xx_spi_work(struct work_struct *work)
 {
 	struct s3c64xx_spi_driver_data *sdd = container_of(work,
@@ -796,8 +806,8 @@ static void s3c64xx_spi_work(struct work_struct *work)
 	spin_unlock_irqrestore(&sdd->lock, flags);
 
 	/* Free DMA channels */
-	sdd->ops->release(sdd->rx_ch, &s3c64xx_spi_dma_client);
-	sdd->ops->release(sdd->tx_ch, &s3c64xx_spi_dma_client);
+	sdd->ops->release(sdd->rx_dma.ch, &s3c64xx_spi_dma_client);
+	sdd->ops->release(sdd->tx_dma.ch, &s3c64xx_spi_dma_client);
 }
 
 static int s3c64xx_spi_transfer(struct spi_device *spi,
@@ -1014,8 +1024,10 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
 	sdd->cntrlr_info = sci;
 	sdd->pdev = pdev;
 	sdd->sfr_start = mem_res->start;
-	sdd->tx_dmach = dmatx_res->start;
-	sdd->rx_dmach = dmarx_res->start;
+	sdd->tx_dma.dmach = dmatx_res->start;
+	sdd->tx_dma.direction = DMA_TO_DEVICE;
+	sdd->rx_dma.dmach = dmarx_res->start;
+	sdd->rx_dma.direction = DMA_FROM_DEVICE;
 
 	sdd->cur_bpw = 8;
 
@@ -1103,7 +1115,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
 					pdev->id, master->num_chipselect);
 	dev_dbg(&pdev->dev, "\tIOmem=[0x%x-0x%x]\tDMA=[Rx-%d, Tx-%d]\n",
 					mem_res->end, mem_res->start,
-					sdd->rx_dmach, sdd->tx_dmach);
+					sdd->rx_dma.dmach, sdd->tx_dma.dmach);
 
 	return 0;
 
Signature · 1 line
1.7.1
author
#22 lore raw

PATCH v8 15/16 ASoC: Samsung: Update DMA interface

In reply to Boojin Kim

This patch adds to support the DMA PL330 driver that uses DMA generic API. Samsung sound driver uses DMA generic API if architecture supports it. Otherwise, use samsung specific S3C-PL330 API driver to transfer PCM data.

Cc Jassi Brar <[email protected]>
Cc Liam Girdwood <[email protected]>
[kgene.kim at samsung.com: removed useless variable]
---
 arch/arm/mach-s3c2410/include/mach/dma.h       |   10 +-
 arch/arm/mach-s3c64xx/include/mach/dma.h       |    2 +-
 arch/arm/plat-samsung/include/plat/dma-pl330.h |    2 +-
 sound/soc/samsung/ac97.c                       |   10 ++-
 sound/soc/samsung/dma.c                        |  146 ++++++++++--------------
 sound/soc/samsung/dma.h                        |    4 +-
 6 files changed, 78 insertions(+), 96 deletions(-)
arch/arm/mach-s3c2410/include/mach/dma.h +5 -5
index e61a91f..4e485ba 100644
@@ -50,6 +50,11 @@ enum dma_ch {
 	DMACH_MAX,		/* the end entry */
 };
 
+static inline bool samsung_dma_has_circular(void)
+{
+	return false;
+}
+
 static inline bool samsung_dma_is_dmadev(void)
 {
 	return false;
@@ -202,9 +207,4 @@ struct s3c2410_dma_chan {
 
 typedef unsigned long dma_device_t;
 
-static inline bool s3c_dma_has_circular(void)
-{
-	return false;
-}
-
 #endif /* __ASM_ARCH_DMA_H */
arch/arm/mach-s3c64xx/include/mach/dma.h +1 -1
index 49c3a53..74fdf25 100644
@@ -58,7 +58,7 @@ enum dma_ch {
 	DMACH_MAX		/* the end */
 };
 
-static __inline__ bool s3c_dma_has_circular(void)
+static inline bool samsung_dma_has_circular(void)
 {
 	return true;
 }
arch/arm/plat-samsung/include/plat/dma-pl330.h +1 -1
index 9a1dadb..2e55e59 100644
@@ -89,7 +89,7 @@ struct s3c2410_dma_client {
 	char	*name;
 };
 
-static inline bool s3c_dma_has_circular(void)
+static inline bool samsung_dma_has_circular(void)
 {
 	return true;
 }
sound/soc/samsung/ac97.c +8 -2
index f97110e..b4f9b00 100644
@@ -271,7 +271,10 @@ static int s3c_ac97_trigger(struct snd_pcm_substream *substream, int cmd,
 
 	writel(ac_glbctrl, s3c_ac97.regs + S3C_AC97_GLBCTRL);
 
-	s3c2410_dma_ctrl(dma_data->channel, S3C2410_DMAOP_STARTED);
+	if (!dma_data->ops)
+		dma_data->ops = samsung_dma_get_ops();
+
+	dma_data->ops->started(dma_data->channel);
 
 	return 0;
 }
@@ -317,7 +320,10 @@ static int s3c_ac97_mic_trigger(struct snd_pcm_substream *substream,
 
 	writel(ac_glbctrl, s3c_ac97.regs + S3C_AC97_GLBCTRL);
 
-	s3c2410_dma_ctrl(dma_data->channel, S3C2410_DMAOP_STARTED);
+	if (!dma_data->ops)
+		dma_data->ops = samsung_dma_get_ops();
+
+	dma_data->ops->started(dma_data->channel);
 
 	return 0;
 }
sound/soc/samsung/dma.c +60 -86

247 lines not on this page · raw message

sound/soc/samsung/dma.h +3 -1
index c506592..7d1ead7 100644
@@ -6,7 +6,7 @@
  *  Free Software Foundation;  either version 2 of the  License, or (at your
  *  option) any later version.
  *
- *  ALSA PCM interface for the Samsung S3C24xx CPU
+ *  ALSA PCM interface for the Samsung SoC
  */
 
 #ifndef _S3C_AUDIO_H
@@ -17,6 +17,8 @@ struct s3c_dma_params {
 	int channel;				/* Channel ID */
 	dma_addr_t dma_addr;
 	int dma_size;			/* Size of the DMA transfer */
+	unsigned ch;
+	struct samsung_dma_ops *ops;
 };
 
 #endif
Signature · 1 line
1.7.1
author
#23 lore raw

PATCH v8 16/16 ARM: SAMSUNG: Remove Samsung specific enum type for dma direction

In reply to Boojin Kim

This patch removes the samsung specific enum type 's3c2410_dmasrc' and uses 'dma_data_direction' instead.

---
 arch/arm/mach-s3c2410/include/mach/dma.h         |    2 +-
 arch/arm/mach-s3c2412/dma.c                      |    4 ++--
 arch/arm/mach-s3c64xx/dma.c                      |   10 +++++-----
 arch/arm/mach-s3c64xx/include/mach/dma.h         |    2 +-
 arch/arm/plat-s3c24xx/dma.c                      |   10 +++++-----
 arch/arm/plat-samsung/include/plat/dma-s3c24xx.h |    2 +-
 arch/arm/plat-samsung/include/plat/dma.h         |    9 +++------
 arch/arm/plat-samsung/s3c-dma-ops.c              |    5 +----
 drivers/mmc/host/s3cmci.c                        |    6 +++---
 9 files changed, 22 insertions(+), 28 deletions(-)
arch/arm/mach-s3c2410/include/mach/dma.h +1 -1
index 4e485ba..ae8e482 100644
@@ -174,7 +174,7 @@ struct s3c2410_dma_chan {
 	struct s3c2410_dma_client *client;
 
 	/* channel configuration */
-	enum s3c2410_dmasrc	 source;
+	enum dma_data_direction	 source;
 	enum dma_ch		 req_ch;
 	unsigned long		 dev_addr;
 	unsigned long		 load_timeout;
arch/arm/mach-s3c2412/dma.c +2 -2
index 7abecfc..b4fc3ba 100644
@@ -148,11 +148,11 @@ static struct s3c24xx_dma_map __initdata s3c2412_dma_mappings[] = {
 
 static void s3c2412_dma_direction(struct s3c2410_dma_chan *chan,
 				  struct s3c24xx_dma_map *map,
-				  enum s3c2410_dmasrc dir)
+				  enum dma_data_direction dir)
 {
 	unsigned long chsel;
 
-	if (dir == S3C2410_DMASRC_HW)
+	if (dir == DMA_FROM_DEVICE)
 		chsel = map->channels_rx[0];
 	else
 		chsel = map->channels[0];
arch/arm/mach-s3c64xx/dma.c +5 -5
index 204bfaf..67c97fa 100644
@@ -147,14 +147,14 @@ static void s3c64xx_dma_fill_lli(struct s3c2410_dma_chan *chan,
 	u32 control0, control1;
 
 	switch (chan->source) {
-	case S3C2410_DMASRC_HW:
+	case DMA_FROM_DEVICE:
 		src = chan->dev_addr;
 		dst = data;
 		control0 = PL080_CONTROL_SRC_AHB2;
 		control0 |= PL080_CONTROL_DST_INCR;
 		break;
 
-	case S3C2410_DMASRC_MEM:
+	case DMA_TO_DEVICE:
 		src = data;
 		dst = chan->dev_addr;
 		control0 = PL080_CONTROL_DST_AHB2;
@@ -416,7 +416,7 @@ EXPORT_SYMBOL(s3c2410_dma_enqueue);
 
 
 int s3c2410_dma_devconfig(enum dma_ch channel,
-			  enum s3c2410_dmasrc source,
+			  enum dma_data_direction source,
 			  unsigned long devaddr)
 {
 	struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
@@ -437,11 +437,11 @@ int s3c2410_dma_devconfig(enum dma_ch channel,
 	pr_debug("%s: peripheral %d\n", __func__, peripheral);
 
 	switch (source) {
-	case S3C2410_DMASRC_HW:
+	case DMA_FROM_DEVICE:
 		config = 2 << PL080_CONFIG_FLOW_CONTROL_SHIFT;
 		config |= peripheral << PL080_CONFIG_SRC_SEL_SHIFT;
 		break;
-	case S3C2410_DMASRC_MEM:
+	case DMA_TO_DEVICE:
 		config = 1 << PL080_CONFIG_FLOW_CONTROL_SHIFT;
 		config |= peripheral << PL080_CONFIG_DST_SEL_SHIFT;
 		break;
arch/arm/mach-s3c64xx/include/mach/dma.h +1 -1
index 74fdf25..fe1a98c 100644
@@ -99,7 +99,7 @@ struct s3c2410_dma_chan {
 	unsigned char		 peripheral;
 
 	unsigned int		 flags;
-	enum s3c2410_dmasrc	 source;
+	enum dma_data_direction	 source;
 
 
 	dma_addr_t		dev_addr;
arch/arm/plat-s3c24xx/dma.c +5 -5
index 539bd0e..53754bc 100644
@@ -1094,14 +1094,14 @@ EXPORT_SYMBOL(s3c2410_dma_config);
  *
  * configure the dma source/destination hardware type and address
  *
- * source:    S3C2410_DMASRC_HW: source is hardware
- *            S3C2410_DMASRC_MEM: source is memory
+ * source:    DMA_FROM_DEVICE: source is hardware
+ *            DMA_TO_DEVICE: source is memory
  *
  * devaddr:   physical address of the source
 */
 
 int s3c2410_dma_devconfig(enum dma_ch channel,
-			  enum s3c2410_dmasrc source,
+			  enum dma_data_direction source,
 			  unsigned long devaddr)
 {
 	struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
@@ -1131,7 +1131,7 @@ int s3c2410_dma_devconfig(enum dma_ch channel,
 	 hwcfg |= S3C2410_DISRCC_INC;
 
 	switch (source) {
-	case S3C2410_DMASRC_HW:
+	case DMA_FROM_DEVICE:
 		/* source is hardware */
 		pr_debug("%s: hw source, devaddr=%08lx, hwcfg=%d\n",
 			 __func__, devaddr, hwcfg);
@@ -1142,7 +1142,7 @@ int s3c2410_dma_devconfig(enum dma_ch channel,
 		chan->addr_reg = dma_regaddr(chan, S3C2410_DMA_DIDST);
 		break;
 
-	case S3C2410_DMASRC_MEM:
+	case DMA_TO_DEVICE:
 		/* source is memory */
 		pr_debug("%s: mem source, devaddr=%08lx, hwcfg=%d\n",
 			 __func__, devaddr, hwcfg);
arch/arm/plat-samsung/include/plat/dma-s3c24xx.h +1 -1
index 336d5ac..1982829 100644
@@ -47,7 +47,7 @@ struct s3c24xx_dma_selection {
 
 	void	(*direction)(struct s3c2410_dma_chan *chan,
 			     struct s3c24xx_dma_map *map,
-			     enum s3c2410_dmasrc dir);
+			     enum dma_data_direction dir);
 };
 
 extern int s3c24xx_dma_init_map(struct s3c24xx_dma_selection *sel);
arch/arm/plat-samsung/include/plat/dma.h +3 -6
index 3610760..b906112 100644
@@ -10,17 +10,14 @@
  * published by the Free Software Foundation.
 */
 
+#include <linux/dma-mapping.h>
+
 enum s3c2410_dma_buffresult {
 	S3C2410_RES_OK,
 	S3C2410_RES_ERR,
 	S3C2410_RES_ABORT
 };
 
-enum s3c2410_dmasrc {
-	S3C2410_DMASRC_HW,		/* source is memory */
-	S3C2410_DMASRC_MEM		/* source is hardware */
-};
-
 /* enum s3c2410_chan_op
  *
  * operation codes passed to the DMA code by the user, and also used
@@ -112,7 +109,7 @@ extern int s3c2410_dma_config(enum dma_ch channel, int xferunit);
 */
 
 extern int s3c2410_dma_devconfig(enum dma_ch channel,
-		enum s3c2410_dmasrc source, unsigned long devaddr);
+		enum dma_data_direction source, unsigned long devaddr);
 
 /* s3c2410_dma_getposition
  *
arch/arm/plat-samsung/s3c-dma-ops.c +1 -4
index 33ab324..582333c 100644
@@ -48,10 +48,7 @@ static unsigned s3c_dma_request(enum dma_ch dma_ch,
 	data->ch = dma_ch;
 	list_add_tail(&data->node, &dma_list);
 
-	if (info->direction == DMA_FROM_DEVICE)
-		s3c2410_dma_devconfig(dma_ch, S3C2410_DMASRC_HW, info->fifo);
-	else
-		s3c2410_dma_devconfig(dma_ch, S3C2410_DMASRC_MEM, info->fifo);
+	s3c2410_dma_devconfig(dma_ch, info->direction, info->fifo);
 
 	if (info->cap == DMA_CYCLIC)
 		s3c2410_dma_setflags(dma_ch, S3C2410_DMAF_CIRCULAR);
drivers/mmc/host/s3cmci.c +3 -3
index a04f87d..03cfdab 100644
@@ -913,9 +913,9 @@ request_done:
 }
 
 static void s3cmci_dma_setup(struct s3cmci_host *host,
-			     enum s3c2410_dmasrc source)
+			     enum dma_data_direction source)
 {
-	static enum s3c2410_dmasrc last_source = -1;
+	static enum dma_data_direction last_source = -1;
 	static int setup_ok;
 
 	if (last_source == source)
@@ -1087,7 +1087,7 @@ static int s3cmci_prepare_dma(struct s3cmci_host *host, struct mmc_data *data)
 
 	BUG_ON((data->flags & BOTH_DIR) == BOTH_DIR);
 
-	s3cmci_dma_setup(host, rw ? S3C2410_DMASRC_MEM : S3C2410_DMASRC_HW);
+	s3cmci_dma_setup(host, rw ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
 	s3c2410_dma_ctrl(host->dma, S3C2410_DMAOP_FLUSH);
 
 	dma_len = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
Signature · 1 line
1.7.1
#24 lore raw

v8 cover To use DMA generic APIs for Samsung DMA

In reply to Boojin Kim
Quoted 10 lines · Boojin Kim

This patchset adds support DMA generic APIs for samsung DMA.

The changes from V7 is following:
- Divides patch file.
: The 03 patch on V7 patchset is divided into the 03 and 04 patch on V8 patchset.
The O3 patch is only for DMA_SLAVE_CONFIG command.
The 04 patch is only for DMA_TERMINATE_ALL command.
- Code clean-up
: Remove unnecessary code on 05 patch.

Quoted 16 lines

[PATCH v8 01/16] DMA: PL330: Add support runtime PM for PL330 DMAC
[PATCH v8 02/16] DMA: PL330: Update PL330 DMA API driver
[PATCH v8 03/16] DMA: PL330: Support DMA_SLAVE_CONFIG command
[PATCH v8 04/16] DMA: PL330: Remove the start operation for handling DMA_TERMINATE_ALL command [PATCH v8 05/16] DMA: PL330: Add DMA_CYCLIC capability
[PATCH v8 06/16] ARM: SAMSUNG: Update to use PL330-DMA driver
[PATCH v8 07/16] ARM: SAMSUNG: Add common DMA operations
[PATCH v8 08/16] ARM: EXYNOS4: Use generic DMA PL330 driver
[PATCH v8 09/16] ARM: S5PV210: Use generic DMA PL330 driver
[PATCH v8 10/16] ARM: S5PC100: Use generic DMA PL330 driver
[PATCH v8 11/16] ARM: S5P64X0: Use generic DMA PL330 driver
[PATCH v8 12/16] ARM: SAMSUNG: Remove S3C-PL330-DMA driver
[PATCH v8 13/16] spi/s3c64xx: Add support DMA engine API
[PATCH v8 14/16] spi/s3c64xx: Merge dma control code
[PATCH v8 15/16] ASoC: Samsung: Update DMA interface
[PATCH v8 16/16] ARM: SAMSUNG: Remove Samsung specific enum type for dma direction

Thanks,

I have pushed these into my samsung-dma branch, Fixed the typos in the changelog of patch 4.

Please check and let me know if all are fine, I will push them to my next tomorrow

If anyone has concerns on this series please let me know by tomorrow

Signature · 1 line
~Vinod
#25 lore raw

v8 cover To use DMA generic APIs for Samsung DMA

Quoted 29 lines · Vinod Koul
Quoted 10 lines · Boojin Kim

This patchset adds support DMA generic APIs for samsung DMA.

The changes from V7 is following:
- Divides patch file.
? : The 03 patch on V7 patchset is divided into the 03 and 04 patch on V8 patchset. ? ? The O3 patch is only for DMA_SLAVE_CONFIG command.
? ? The 04 patch is only for DMA_TERMINATE_ALL command.
- Code clean-up
? : Remove unnecessary code on 05 patch.

Quoted 16 lines

[PATCH v8 01/16] DMA: PL330: Add support runtime PM for PL330 DMAC
[PATCH v8 02/16] DMA: PL330: Update PL330 DMA API driver
[PATCH v8 03/16] DMA: PL330: Support DMA_SLAVE_CONFIG command
[PATCH v8 04/16] DMA: PL330: Remove the start operation for handling DMA_TERMINATE_ALL command [PATCH v8 05/16] DMA: PL330: Add DMA_CYCLIC capability
[PATCH v8 06/16] ARM: SAMSUNG: Update to use PL330-DMA driver
[PATCH v8 07/16] ARM: SAMSUNG: Add common DMA operations
[PATCH v8 08/16] ARM: EXYNOS4: Use generic DMA PL330 driver
[PATCH v8 09/16] ARM: S5PV210: Use generic DMA PL330 driver
[PATCH v8 10/16] ARM: S5PC100: Use generic DMA PL330 driver
[PATCH v8 11/16] ARM: S5P64X0: Use generic DMA PL330 driver
[PATCH v8 12/16] ARM: SAMSUNG: Remove S3C-PL330-DMA driver
[PATCH v8 13/16] spi/s3c64xx: Add support DMA engine API
[PATCH v8 14/16] spi/s3c64xx: Merge dma control code
[PATCH v8 15/16] ASoC: Samsung: Update DMA interface
[PATCH v8 16/16] ARM: SAMSUNG: Remove Samsung specific enum type for dma direction

Thanks,

Quoted 8 lines

I have pushed these into my samsung-dma branch, Fixed the typos in the changelog of patch 4.

Please check and let me know if all are fine, I will push them to my next tomorrow

If anyone has concerns on this series please let me know by tomorrow

I have no concern about patches modifying samsung specific code.

Of the patches touching common pl330 code, I had acked Patch-1,2,3 & 5 in previous revisions already. So for them, you may add my

The changelog for [PATCH v8 04/16] is misleading - we don't need any modification for the reason mentioned in changelog. But the modification has positive side-effect of preventing callbacks during terminate_all which is no way understood from the changelog. So I would like to changelog corrected.

thanks,
-jassi

#26 lore raw

v8 cover To use DMA generic APIs for Samsung DMA

Quoted 36 lines · Jassi Brar
Quoted 35 lines · Vinod Koul
Quoted 10 lines · Boojin Kim

This patchset adds support DMA generic APIs for samsung DMA.

The changes from V7 is following:
- Divides patch file.
: The 03 patch on V7 patchset is divided into the 03 and 04 patch on V8 patchset.
The O3 patch is only for DMA_SLAVE_CONFIG command.
The 04 patch is only for DMA_TERMINATE_ALL command.
- Code clean-up
: Remove unnecessary code on 05 patch.

Quoted 16 lines

[PATCH v8 01/16] DMA: PL330: Add support runtime PM for PL330 DMAC
[PATCH v8 02/16] DMA: PL330: Update PL330 DMA API driver
[PATCH v8 03/16] DMA: PL330: Support DMA_SLAVE_CONFIG command
[PATCH v8 04/16] DMA: PL330: Remove the start operation for handling DMA_TERMINATE_ALL command [PATCH v8 05/16] DMA: PL330: Add DMA_CYCLIC capability
[PATCH v8 06/16] ARM: SAMSUNG: Update to use PL330-DMA driver
[PATCH v8 07/16] ARM: SAMSUNG: Add common DMA operations
[PATCH v8 08/16] ARM: EXYNOS4: Use generic DMA PL330 driver
[PATCH v8 09/16] ARM: S5PV210: Use generic DMA PL330 driver
[PATCH v8 10/16] ARM: S5PC100: Use generic DMA PL330 driver
[PATCH v8 11/16] ARM: S5P64X0: Use generic DMA PL330 driver
[PATCH v8 12/16] ARM: SAMSUNG: Remove S3C-PL330-DMA driver
[PATCH v8 13/16] spi/s3c64xx: Add support DMA engine API
[PATCH v8 14/16] spi/s3c64xx: Merge dma control code
[PATCH v8 15/16] ASoC: Samsung: Update DMA interface
[PATCH v8 16/16] ARM: SAMSUNG: Remove Samsung specific enum type for dma direction

Thanks,

I have pushed these into my samsung-dma branch, Fixed the typos in the changelog of patch 4.

Please check and let me know if all are fine, I will push them to my next tomorrow

Quoted 8 lines
Quoted 2 lines

If anyone has concerns on this series please let me know by tomorrow

I have no concern about patches modifying samsung specific code.

Of the patches touching common pl330 code, I had acked Patch-1,2,3 & 5 in previous revisions already. So for them, you may add my

Ok

Quoted 6 lines

The changelog for [PATCH v8 04/16] is misleading - we don't need any modification for the reason mentioned in changelog. But the modification has positive side-effect of preventing callbacks during terminate_all which is no way understood from the changelog. So I would like to changelog corrected.

I thought change log was correct in depicting what patch does and Boojin had replied.... I will check again...

Signature · 1 line
~Vinod
#27 lore raw

v8 cover To use DMA generic APIs for Samsung DMA

Quoted 7 lines · Vinod Koul
Quoted 5 lines

The changelog for [PATCH v8 04/16] is misleading - we don't need any modification for the reason mentioned in changelog. But the modification has positive side-effect of preventing callbacks during terminate_all which is no way understood from the changelog. So I would like to changelog corrected.

I thought change log was correct in depicting what patch does and Boojin had replied.... I will check again...

I didn't reply because I ran out of ways to explain the same thing in different words.

#28 lore raw

v8 cover To use DMA generic APIs for Samsung DMA

Quoted 7 lines · Jassi Brar
Quoted 5 lines · Vinod Koul
Quoted 5 lines

The changelog for [PATCH v8 04/16] is misleading - we don't need any modification for the reason mentioned in changelog. But the modification has positive side-effect of preventing callbacks during terminate_all which is no way understood from the changelog. So I would like to changelog corrected.

Quoted 5 lines
Quoted 2 lines

I thought change log was correct in depicting what patch does and Boojin had replied.... I will check again...

I didn't reply because I ran out of ways to explain the same thing in different words.

I checked again the patch, change log and your comments.
I agree with current change log, and also your observation is right but that is just a side effect, which IMO should be best left to developer to choose or not, in this case she ignored it

So no changes to this and I a ready to merge it to my next in a day or two...

Signature · 1 line
~Vinod
#29 lore raw

v8 cover To use DMA generic APIs for Samsung DMA

Quoted 14 lines · Vinod Koul
Quoted 7 lines · Jassi Brar
Quoted 5 lines · Vinod Koul
Quoted 5 lines

The changelog for [PATCH v8 04/16] is misleading - we don't need any modification for the reason mentioned in changelog. But the modification has positive side-effect of preventing callbacks during terminate_all which is no way understood from the changelog. So I would like to changelog corrected.

Quoted 5 lines
Quoted 2 lines

I thought change log was correct in depicting what patch does and Boojin had replied.... I will check again...

I didn't reply because I ran out of ways to explain the same thing in different words.

Quoted 8 lines

I checked again the patch, change log and your comments.
I agree with current change log, and also your observation is right but that is just a side effect, which IMO should be best left to developer to choose or not, in this case she ignored it

So no changes to this and I a ready to merge it to my next in a day or two...

So as a note, pulled git://git.infradead.org/users/vkoul/slave-dma.git samsung_dma for other regarding dma patches in arch/arm/ samsung stuff.

If any problems, please let me know.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#30 lore raw

v8 cover To use DMA generic APIs for Samsung DMA

Quoted 20 lines · Kukjin Kim
Quoted 19 lines · Vinod Koul
Quoted 7 lines · Jassi Brar
Quoted 5 lines · Vinod Koul
Quoted 5 lines

The changelog for [PATCH v8 04/16] is misleading - we don't need any modification for the reason mentioned in changelog. But the modification has positive side-effect of preventing callbacks during terminate_all which is no way understood from the changelog. So I would like to changelog corrected.

Quoted 5 lines
Quoted 2 lines

I thought change log was correct in depicting what patch does and Boojin had replied.... I will check again...

I didn't reply because I ran out of ways to explain the same thing in different words.

I checked again the patch, change log and your comments.
I agree with current change log, and also your observation is right but that is just a side effect, which IMO should be best left to developer to choose or not, in this case she ignored it

Quoted 7 lines
Quoted 3 lines

So no changes to this and I a ready to merge it to my next in a day or two...

So as a note, pulled git://git.infradead.org/users/vkoul/slave-dma.git samsung_dma for other regarding dma patches in arch/arm/ samsung stuff.

If any problems, please let me know.

I am pushing them to next now..

Signature · 1 line
~Vinod
#31 lore raw

v8 cover To use DMA generic APIs for Samsung DMA

In reply to Vinod Koul
Quoted 5 lines · Vinod Koul
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

The changelog for [PATCH v8 04/16] is misleading - we don't need any modification for the reason mentioned in changelog. But the modification has positive side-effect of preventing callbacks during terminate_all which is no way understood from the changelog. So I would like to changelog corrected.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I thought change log was correct in depicting what patch does and Boojin had replied.... I will check again...

I didn't reply because I ran out of ways to explain the same thing in different words.

I checked again the patch, change log and your comments.
I agree with current change log, and also your observation is right but that is just a side effect,

It is not "just a side effect", it is "the only tangible effect". If it were not for this 'side-effect', the patch would be _purely_ cosmetic rearrangement.
The _only_ difference seen would be by clients who would no longer have callbacks when they issue terminate_all.
And I don't think that is expected at all reading the changelog in current form.

Quoted 2 lines

So no changes to this and I a ready to merge it to my next in a day or two...

I guess the world isn't gonna come to grinding halt with this changelog. Please feel free to do what you think is the best.

#32 lore raw

v8 cover To use DMA generic APIs for Samsung DMA

In reply to Vinod Koul
Quoted 30 lines · Vinod Koul
Quoted 5 lines · Boojin Kim

This patchset adds support DMA generic APIs for samsung DMA.

The changes from V7 is following:
- Divides patch file.
: The 03 patch on V7 patchset is divided into the 03 and 04 patch on V8

patchset.

Quoted 9 lines

The O3 patch is only for DMA_SLAVE_CONFIG command. The 04 patch is only for DMA_TERMINATE_ALL command.
- Code clean-up
: Remove unnecessary code on 05 patch.

[PATCH v8 01/16] DMA: PL330: Add support runtime PM for PL330 DMAC [PATCH v8 02/16] DMA: PL330: Update PL330 DMA API driver [PATCH v8 03/16] DMA: PL330: Support DMA_SLAVE_CONFIG command [PATCH v8 04/16] DMA: PL330: Remove the start operation for handling

DMA_TERMINATE_ALL command

Quoted 4 lines

[PATCH v8 05/16] DMA: PL330: Add DMA_CYCLIC capability [PATCH v8 06/16] ARM: SAMSUNG: Update to use PL330-DMA driver [PATCH v8 07/16] ARM: SAMSUNG: Add common DMA operations [PATCH v8 08/16] ARM: EXYNOS4: Use generic DMA PL330 driver

Quoted 8 lines

[PATCH v8 09/16] ARM: S5PV210: Use generic DMA PL330 driver [PATCH v8 10/16] ARM: S5PC100: Use generic DMA PL330 driver [PATCH v8 11/16] ARM: S5P64X0: Use generic DMA PL330 driver [PATCH v8 12/16] ARM: SAMSUNG: Remove S3C-PL330-DMA driver [PATCH v8 13/16] spi/s3c64xx: Add support DMA engine API [PATCH v8 14/16] spi/s3c64xx: Merge dma control code [PATCH v8 15/16] ASoC: Samsung: Update DMA interface [PATCH v8 16/16] ARM: SAMSUNG: Remove Samsung specific enum type for

Quoted 9 lines

dma direction
Thanks,

I have pushed these into my samsung-dma branch, Fixed the typos in the changelog of patch 4.

Please check and let me know if all are fine, I will push them to my next tomorrow

Hi Vinod,

Thanks for your applying.

When you push them to your next, I will merge samsung-dma branch to my -next to avoid conflicts.

If any problems, please let me know.

Quoted 1 line

If anyone has concerns on this series please let me know by tomorrow

Thanks again.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.