linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] at_xdmac update for generic slave capabilities
@ 2014-11-13 14:14 Ludovic Desroches
  2014-11-13 14:14 ` [PATCH 1/2] dmaengine: at_xdmac: correct destination abbreviation Ludovic Desroches
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ludovic Desroches @ 2014-11-13 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Please add this update of the at_xdmac driver to the "Implement generic slave
capabilities retrieval" set of patches.

Tell me if something missing.

Ludovic Desroches (2):
  dmaengine: at_xdmac: correct destination abbreviation
  dmaengine: at_xdmac: split device_control

 drivers/dma/at_xdmac.c | 96 ++++++++++++++++++++++++++++++--------------------
 1 file changed, 58 insertions(+), 38 deletions(-)

-- 
2.0.3

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

* [PATCH 1/2] dmaengine: at_xdmac: correct destination abbreviation
  2014-11-13 14:14 [PATCH 0/2] at_xdmac update for generic slave capabilities Ludovic Desroches
@ 2014-11-13 14:14 ` Ludovic Desroches
  2014-11-13 14:25   ` Ludovic Desroches
  2014-11-13 14:30   ` Maxime Ripard
  2014-11-13 14:14 ` [PATCH 2/2] dmaengine: at_xdmac: split device_control Ludovic Desroches
  2014-11-13 15:11 ` [PATCH] dmaengine: at_xdmac: Declare slave capabilities for the generic code Ludovic Desroches
  2 siblings, 2 replies; 8+ messages in thread
From: Ludovic Desroches @ 2014-11-13 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

TODO

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/dma/at_xdmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
index b60d77a..ff67466 100644
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -1229,7 +1229,7 @@ static int at_xdmac_device_slave_caps(struct dma_chan *dchan,
 {
 
 	caps->src_addr_widths = AT_XDMAC_DMA_BUSWIDTHS;
-	caps->dstn_addr_widths = AT_XDMAC_DMA_BUSWIDTHS;
+	caps->dst_addr_widths = AT_XDMAC_DMA_BUSWIDTHS;
 	caps->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
 	caps->cmd_pause = true;
 	caps->cmd_terminate = true;
-- 
2.0.3

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

* [PATCH 2/2] dmaengine: at_xdmac: split device_control
  2014-11-13 14:14 [PATCH 0/2] at_xdmac update for generic slave capabilities Ludovic Desroches
  2014-11-13 14:14 ` [PATCH 1/2] dmaengine: at_xdmac: correct destination abbreviation Ludovic Desroches
@ 2014-11-13 14:14 ` Ludovic Desroches
  2014-11-13 16:41   ` Maxime Ripard
  2014-11-13 15:11 ` [PATCH] dmaengine: at_xdmac: Declare slave capabilities for the generic code Ludovic Desroches
  2 siblings, 1 reply; 8+ messages in thread
From: Ludovic Desroches @ 2014-11-13 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

Use newly introduced callbacks.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/dma/at_xdmac.c | 94 ++++++++++++++++++++++++++++++--------------------
 1 file changed, 57 insertions(+), 37 deletions(-)

diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
index ff67466..c7f3350 100644
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -1107,58 +1107,75 @@ static void at_xdmac_issue_pending(struct dma_chan *chan)
 	return;
 }
 
-static int at_xdmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
-			    unsigned long arg)
+static int at_xdmac_device_config(struct dma_chan *chan,
+				  struct dma_slave_config *config)
+{
+	struct at_xdmac_chan	*atchan = to_at_xdmac_chan(chan);
+	int ret;
+
+	dev_dbg(chan2dev(chan), "%s\n", __func__);
+
+	spin_lock_bh(&atchan->lock);
+	ret = at_xdmac_set_slave_config(chan, config);
+	spin_unlock_bh(&atchan->lock);
+
+	return ret;
+}
+
+static int at_xdmac_device_pause(struct dma_chan *chan)
 {
-	struct at_xdmac_desc	*desc, *_desc;
 	struct at_xdmac_chan	*atchan = to_at_xdmac_chan(chan);
 	struct at_xdmac		*atxdmac = to_at_xdmac(atchan->chan.device);
-	int			ret = 0;
 
-	dev_dbg(chan2dev(chan), "%s: cmd=%d\n", __func__, cmd);
+	dev_dbg(chan2dev(chan), "%s\n", __func__);
 
 	spin_lock_bh(&atchan->lock);
+	at_xdmac_write(atxdmac, AT_XDMAC_GRWS, atchan->mask);
+	set_bit(AT_XDMAC_CHAN_IS_PAUSED, &atchan->status);
+	spin_unlock_bh(&atchan->lock);
 
-	switch (cmd) {
-	case DMA_PAUSE:
-		at_xdmac_write(atxdmac, AT_XDMAC_GRWS, atchan->mask);
-		set_bit(AT_XDMAC_CHAN_IS_PAUSED, &atchan->status);
-		break;
+	return 0;
+}
 
-	case DMA_RESUME:
-		if (!at_xdmac_chan_is_paused(atchan))
-			break;
+static int at_xdmac_device_resume(struct dma_chan *chan)
+{
+	struct at_xdmac_chan	*atchan = to_at_xdmac_chan(chan);
+	struct at_xdmac		*atxdmac = to_at_xdmac(atchan->chan.device);
 
-		at_xdmac_write(atxdmac, AT_XDMAC_GRWR, atchan->mask);
-		clear_bit(AT_XDMAC_CHAN_IS_PAUSED, &atchan->status);
-		break;
+	dev_dbg(chan2dev(chan), "%s\n", __func__);
 
-	case DMA_TERMINATE_ALL:
-		at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask);
-		while (at_xdmac_read(atxdmac, AT_XDMAC_GS) & atchan->mask)
-			cpu_relax();
+	spin_lock_bh(&atchan->lock);
+	if (!at_xdmac_chan_is_paused(atchan))
+		return 0;
 
-		/* Cancel all pending transfers. */
-		list_for_each_entry_safe(desc, _desc, &atchan->xfers_list, xfer_node)
-			at_xdmac_remove_xfer(atchan, desc);
+	at_xdmac_write(atxdmac, AT_XDMAC_GRWR, atchan->mask);
+	clear_bit(AT_XDMAC_CHAN_IS_PAUSED, &atchan->status);
+	spin_unlock_bh(&atchan->lock);
+
+	return 0;
+}
+
+static int at_xdmac_device_terminate_all(struct dma_chan *chan)
+{
+	struct at_xdmac_desc	*desc, *_desc;
+	struct at_xdmac_chan	*atchan = to_at_xdmac_chan(chan);
+	struct at_xdmac		*atxdmac = to_at_xdmac(atchan->chan.device);
 
-		clear_bit(AT_XDMAC_CHAN_IS_CYCLIC, &atchan->status);
-		break;
+	dev_dbg(chan2dev(chan), "%s\n", __func__);
 
-	case DMA_SLAVE_CONFIG:
-		ret = at_xdmac_set_slave_config(chan,
-				(struct dma_slave_config *)arg);
-		break;
+	spin_lock_bh(&atchan->lock);
+	at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask);
+	while (at_xdmac_read(atxdmac, AT_XDMAC_GS) & atchan->mask)
+		cpu_relax();
 
-	default:
-		dev_err(chan2dev(chan),
-			"unmanaged or unknown dma control cmd: %d\n", cmd);
-		ret = -ENXIO;
-	}
+	/* Cancel all pending transfers. */
+	list_for_each_entry_safe(desc, _desc, &atchan->xfers_list, xfer_node)
+		at_xdmac_remove_xfer(atchan, desc);
 
+	clear_bit(AT_XDMAC_CHAN_IS_CYCLIC, &atchan->status);
 	spin_unlock_bh(&atchan->lock);
 
-	return ret;
+	return 0;
 }
 
 static int at_xdmac_alloc_chan_resources(struct dma_chan *chan)
@@ -1270,7 +1287,7 @@ static int atmel_xdmac_suspend(struct device *dev)
 
 		if (at_xdmac_chan_is_cyclic(atchan)) {
 			if (!at_xdmac_chan_is_paused(atchan))
-				at_xdmac_control(chan, DMA_PAUSE, 0);
+				at_xdmac_device_pause(chan);
 			atchan->save_cim = at_xdmac_chan_read(atchan, AT_XDMAC_CIM);
 			atchan->save_cnda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA);
 			atchan->save_cndc = at_xdmac_chan_read(atchan, AT_XDMAC_CNDC);
@@ -1407,7 +1424,10 @@ static int at_xdmac_probe(struct platform_device *pdev)
 	atxdmac->dma.device_prep_dma_cyclic		= at_xdmac_prep_dma_cyclic;
 	atxdmac->dma.device_prep_dma_memcpy		= at_xdmac_prep_dma_memcpy;
 	atxdmac->dma.device_prep_slave_sg		= at_xdmac_prep_slave_sg;
-	atxdmac->dma.device_control			= at_xdmac_control;
+	atxdmac->dma.device_config			= at_xdmac_device_config;
+	atxdmac->dma.device_pause			= at_xdmac_device_pause;
+	atxdmac->dma.device_resume			= at_xdmac_device_resume;
+	atxdmac->dma.device_terminate_all		= at_xdmac_device_terminate_all;
 	atxdmac->dma.device_slave_caps			= at_xdmac_device_slave_caps;
 
 	/* Disable all chans and interrupts. */
-- 
2.0.3

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

* [PATCH 1/2] dmaengine: at_xdmac: correct destination abbreviation
  2014-11-13 14:14 ` [PATCH 1/2] dmaengine: at_xdmac: correct destination abbreviation Ludovic Desroches
@ 2014-11-13 14:25   ` Ludovic Desroches
  2014-11-13 14:30   ` Maxime Ripard
  1 sibling, 0 replies; 8+ messages in thread
From: Ludovic Desroches @ 2014-11-13 14:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Nov 13, 2014 at 03:14:55PM +0100, Ludovic Desroches wrote:
> TODO

No commit message since it will be merge into Maxime's patch :p

> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> ---
>  drivers/dma/at_xdmac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
> index b60d77a..ff67466 100644
> --- a/drivers/dma/at_xdmac.c
> +++ b/drivers/dma/at_xdmac.c
> @@ -1229,7 +1229,7 @@ static int at_xdmac_device_slave_caps(struct dma_chan *dchan,
>  {
>  
>  	caps->src_addr_widths = AT_XDMAC_DMA_BUSWIDTHS;
> -	caps->dstn_addr_widths = AT_XDMAC_DMA_BUSWIDTHS;
> +	caps->dst_addr_widths = AT_XDMAC_DMA_BUSWIDTHS;
>  	caps->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
>  	caps->cmd_pause = true;
>  	caps->cmd_terminate = true;
> -- 
> 2.0.3
> 

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

* [PATCH 1/2] dmaengine: at_xdmac: correct destination abbreviation
  2014-11-13 14:14 ` [PATCH 1/2] dmaengine: at_xdmac: correct destination abbreviation Ludovic Desroches
  2014-11-13 14:25   ` Ludovic Desroches
@ 2014-11-13 14:30   ` Maxime Ripard
  1 sibling, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2014-11-13 14:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Nov 13, 2014 at 03:14:55PM +0100, Ludovic Desroches wrote:
> TODO
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>

Folded in the relevant patch, thanks!

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141113/16ab32b2/attachment.sig>

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

* [PATCH] dmaengine: at_xdmac: Declare slave capabilities for the generic code
  2014-11-13 14:14 [PATCH 0/2] at_xdmac update for generic slave capabilities Ludovic Desroches
  2014-11-13 14:14 ` [PATCH 1/2] dmaengine: at_xdmac: correct destination abbreviation Ludovic Desroches
  2014-11-13 14:14 ` [PATCH 2/2] dmaengine: at_xdmac: split device_control Ludovic Desroches
@ 2014-11-13 15:11 ` Ludovic Desroches
  2014-11-13 16:40   ` Maxime Ripard
  2 siblings, 1 reply; 8+ messages in thread
From: Ludovic Desroches @ 2014-11-13 15:11 UTC (permalink / raw)
  To: linux-arm-kernel

Now that the generic slave caps code can make use of the device assigned
capabilities, instead of relying on a callback to be implemented.

Make use of this code.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/dma/at_xdmac.c | 33 +++++++++++----------------------
 1 file changed, 11 insertions(+), 22 deletions(-)

diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
index c7f3350..8c799f6 100644
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -174,6 +174,13 @@
 
 #define AT_XDMAC_MAX_CHAN	0x20
 
+#define AT_XDMAC_DMA_BUSWIDTHS\
+	(BIT(DMA_SLAVE_BUSWIDTH_UNDEFINED) |\
+	BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |\
+	BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |\
+	BIT(DMA_SLAVE_BUSWIDTH_4_BYTES) |\
+	BIT(DMA_SLAVE_BUSWIDTH_8_BYTES))
+
 enum atc_status {
 	AT_XDMAC_CHAN_IS_CYCLIC = 0,
 	AT_XDMAC_CHAN_IS_PAUSED,
@@ -1234,27 +1241,6 @@ static void at_xdmac_free_chan_resources(struct dma_chan *chan)
 	return;
 }
 
-#define AT_XDMAC_DMA_BUSWIDTHS\
-	(BIT(DMA_SLAVE_BUSWIDTH_UNDEFINED) |\
-	BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |\
-	BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |\
-	BIT(DMA_SLAVE_BUSWIDTH_4_BYTES) |\
-	BIT(DMA_SLAVE_BUSWIDTH_8_BYTES))
-
-static int at_xdmac_device_slave_caps(struct dma_chan *dchan,
-				      struct dma_slave_caps *caps)
-{
-
-	caps->src_addr_widths = AT_XDMAC_DMA_BUSWIDTHS;
-	caps->dst_addr_widths = AT_XDMAC_DMA_BUSWIDTHS;
-	caps->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
-	caps->cmd_pause = true;
-	caps->cmd_terminate = true;
-	caps->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
-
-	return 0;
-}
-
 #ifdef CONFIG_PM
 static int atmel_xdmac_prepare(struct device *dev)
 {
@@ -1428,7 +1414,10 @@ static int at_xdmac_probe(struct platform_device *pdev)
 	atxdmac->dma.device_pause			= at_xdmac_device_pause;
 	atxdmac->dma.device_resume			= at_xdmac_device_resume;
 	atxdmac->dma.device_terminate_all		= at_xdmac_device_terminate_all;
-	atxdmac->dma.device_slave_caps			= at_xdmac_device_slave_caps;
+	atxdmac->dma.src_addr_widths = AT_XDMAC_DMA_BUSWIDTHS;
+	atxdmac->dma.dst_addr_widths = AT_XDMAC_DMA_BUSWIDTHS;
+	atxdmac->dma.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
+	atxdmac->dma.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
 
 	/* Disable all chans and interrupts. */
 	at_xdmac_off(atxdmac);
-- 
2.0.3

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

* [PATCH] dmaengine: at_xdmac: Declare slave capabilities for the generic code
  2014-11-13 15:11 ` [PATCH] dmaengine: at_xdmac: Declare slave capabilities for the generic code Ludovic Desroches
@ 2014-11-13 16:40   ` Maxime Ripard
  0 siblings, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2014-11-13 16:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Nov 13, 2014 at 04:11:20PM +0100, Ludovic Desroches wrote:
> Now that the generic slave caps code can make use of the device assigned
> capabilities, instead of relying on a callback to be implemented.
> 
> Make use of this code.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>

Merged into my serie, thanks!

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141113/d653425b/attachment.sig>

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

* [PATCH 2/2] dmaengine: at_xdmac: split device_control
  2014-11-13 14:14 ` [PATCH 2/2] dmaengine: at_xdmac: split device_control Ludovic Desroches
@ 2014-11-13 16:41   ` Maxime Ripard
  0 siblings, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2014-11-13 16:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Nov 13, 2014 at 03:14:56PM +0100, Ludovic Desroches wrote:
> Use newly introduced callbacks.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>

Taken in my serie, thanks!

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141113/2d4981d0/attachment.sig>

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

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

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-13 14:14 [PATCH 0/2] at_xdmac update for generic slave capabilities Ludovic Desroches
2014-11-13 14:14 ` [PATCH 1/2] dmaengine: at_xdmac: correct destination abbreviation Ludovic Desroches
2014-11-13 14:25   ` Ludovic Desroches
2014-11-13 14:30   ` Maxime Ripard
2014-11-13 14:14 ` [PATCH 2/2] dmaengine: at_xdmac: split device_control Ludovic Desroches
2014-11-13 16:41   ` Maxime Ripard
2014-11-13 15:11 ` [PATCH] dmaengine: at_xdmac: Declare slave capabilities for the generic code Ludovic Desroches
2014-11-13 16:40   ` Maxime Ripard

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).