* [PATCH] dmaengine: at_hdmac: use dma_address to program DMA hardware
@ 2010-12-15 17:50 Nicolas Ferre
  2011-01-10 13:21 ` Nicolas Ferre
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Nicolas Ferre @ 2010-12-15 17:50 UTC (permalink / raw)
  To: linux-arm-kernel
In atc_prep_slave_sg() function we use dma_address field of scatterlist with
sg_dma_address() macro instead of sg_phys(). DMA address is already computed
by dma_map_sg() or another mapping function in calling driver.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index ea0ee81..ee7dacd 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -670,7 +670,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 			if (!desc)
 				goto err_desc_get;
 
-			mem = sg_phys(sg);
+			mem = sg_dma_address(sg);
 			len = sg_dma_len(sg);
 			mem_width = 2;
 			if (unlikely(mem & 3 || len & 3))
@@ -712,7 +712,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 			if (!desc)
 				goto err_desc_get;
 
-			mem = sg_phys(sg);
+			mem = sg_dma_address(sg);
 			len = sg_dma_len(sg);
 			mem_width = 2;
 			if (unlikely(mem & 3 || len & 3))
-- 
1.7.3
^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] dmaengine: at_hdmac: use dma_address to program DMA hardware
  2010-12-15 17:50 [PATCH] dmaengine: at_hdmac: use dma_address to program DMA hardware Nicolas Ferre
@ 2011-01-10 13:21 ` Nicolas Ferre
  2011-01-15  0:14   ` Dan Williams
  2011-01-12 14:39 ` [PATCH 2/6] dmaengine: at_hdmac: trivial add precision to unmapping comment Nicolas Ferre
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Nicolas Ferre @ 2011-01-10 13:21 UTC (permalink / raw)
  To: linux-arm-kernel
Le 15/12/2010 18:50, Nicolas Ferre :
> In atc_prep_slave_sg() function we use dma_address field of scatterlist with
> sg_dma_address() macro instead of sg_phys(). DMA address is already computed
> by dma_map_sg() or another mapping function in calling driver.
Ping?
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
>  drivers/dma/at_hdmac.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index ea0ee81..ee7dacd 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -670,7 +670,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
>  			if (!desc)
>  				goto err_desc_get;
>  
> -			mem = sg_phys(sg);
> +			mem = sg_dma_address(sg);
>  			len = sg_dma_len(sg);
>  			mem_width = 2;
>  			if (unlikely(mem & 3 || len & 3))
> @@ -712,7 +712,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
>  			if (!desc)
>  				goto err_desc_get;
>  
> -			mem = sg_phys(sg);
> +			mem = sg_dma_address(sg);
>  			len = sg_dma_len(sg);
>  			mem_width = 2;
>  			if (unlikely(mem & 3 || len & 3))
-- 
Nicolas Ferre
^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 2/6] dmaengine: at_hdmac: trivial add precision to unmapping comment
  2010-12-15 17:50 [PATCH] dmaengine: at_hdmac: use dma_address to program DMA hardware Nicolas Ferre
  2011-01-10 13:21 ` Nicolas Ferre
@ 2011-01-12 14:39 ` Nicolas Ferre
  2011-01-12 14:39 ` [PATCH 3/6] dmaengine: at_hdmac: no need set ACK in new descriptor Nicolas Ferre
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Nicolas Ferre @ 2011-01-12 14:39 UTC (permalink / raw)
  To: linux-arm-kernel
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Hi Dan,
I link this patch series to the previous single patch that I sent a few days
ago so that you will have the whole overview of current (little) improvements
on the Atmel at_hdmac driver.
Thanks, best regards,
Nicolas.
 drivers/dma/at_hdmac.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index ee7dacd..a4dd4bc 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -253,7 +253,7 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc)
 	/* move myself to free_list */
 	list_move(&desc->desc_node, &atchan->free_list);
 
-	/* unmap dma addresses */
+	/* unmap dma addresses (not on slave channels) */
 	if (!atchan->chan_common.private) {
 		struct device *parent = chan2parent(&atchan->chan_common);
 		if (!(txd->flags & DMA_COMPL_SKIP_DEST_UNMAP)) {
-- 
1.7.3
^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH 3/6] dmaengine: at_hdmac: no need set ACK in new descriptor
  2010-12-15 17:50 [PATCH] dmaengine: at_hdmac: use dma_address to program DMA hardware Nicolas Ferre
  2011-01-10 13:21 ` Nicolas Ferre
  2011-01-12 14:39 ` [PATCH 2/6] dmaengine: at_hdmac: trivial add precision to unmapping comment Nicolas Ferre
@ 2011-01-12 14:39 ` Nicolas Ferre
  2011-01-12 14:39 ` [PATCH 4/6] dmaengine: at_hdmac: use subsys_initcall instead of module_init Nicolas Ferre
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Nicolas Ferre @ 2011-01-12 14:39 UTC (permalink / raw)
  To: linux-arm-kernel
Following descriptor flow in at_hdmac driver, descriptor comming from
atc_desc_get() as already DMA_CTRL_ACK flag set. No need to set it again.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index a4dd4bc..4f83431 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -583,7 +583,6 @@ atc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
 		desc->lli.ctrlb = ctrlb;
 
 		desc->txd.cookie = 0;
-		async_tx_ack(&desc->txd);
 
 		if (!first) {
 			first = desc;
-- 
1.7.3
^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH 4/6] dmaengine: at_hdmac: use subsys_initcall instead of module_init
  2010-12-15 17:50 [PATCH] dmaengine: at_hdmac: use dma_address to program DMA hardware Nicolas Ferre
                   ` (2 preceding siblings ...)
  2011-01-12 14:39 ` [PATCH 3/6] dmaengine: at_hdmac: no need set ACK in new descriptor Nicolas Ferre
@ 2011-01-12 14:39 ` Nicolas Ferre
  2011-01-15  0:27   ` Dan Williams
  2011-01-12 14:39 ` [PATCH 5/6] dmaengine: at_hdmac: flags located in first descriptor Nicolas Ferre
  2011-01-12 14:39 ` [PATCH 6/6] dmaengine: at_hdmac: fix race while monitoring channel status Nicolas Ferre
  5 siblings, 1 reply; 9+ messages in thread
From: Nicolas Ferre @ 2011-01-12 14:39 UTC (permalink / raw)
  To: linux-arm-kernel
From: Eric Xu <hong.xu@atmel.com>
Use subsys_initcall instead of module_init in order to keep DMA engine rolling
before other peripheral drivers.
Signed-off-by: Eric Xu <hong.xu@atmel.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 4f83431..a1a0fc6 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1209,7 +1209,7 @@ static int __init at_dma_init(void)
 {
 	return platform_driver_probe(&at_dma_driver, at_dma_probe);
 }
-module_init(at_dma_init);
+subsys_initcall(at_dma_init);
 
 static void __exit at_dma_exit(void)
 {
-- 
1.7.3
^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH 5/6] dmaengine: at_hdmac: flags located in first descriptor
  2010-12-15 17:50 [PATCH] dmaengine: at_hdmac: use dma_address to program DMA hardware Nicolas Ferre
                   ` (3 preceding siblings ...)
  2011-01-12 14:39 ` [PATCH 4/6] dmaengine: at_hdmac: use subsys_initcall instead of module_init Nicolas Ferre
@ 2011-01-12 14:39 ` Nicolas Ferre
  2011-01-12 14:39 ` [PATCH 6/6] dmaengine: at_hdmac: fix race while monitoring channel status Nicolas Ferre
  5 siblings, 0 replies; 9+ messages in thread
From: Nicolas Ferre @ 2011-01-12 14:39 UTC (permalink / raw)
  To: linux-arm-kernel
Place flags on first descriptor of chain instead of last.
This is the one used by atc_chain_complete() function while unmapping.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index a1a0fc6..99942a5 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -603,7 +603,7 @@ atc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
 	/* set end-of-link to the last link descriptor of list*/
 	set_desc_eol(desc);
 
-	desc->txd.flags = flags; /* client is in control of this ack */
+	first->txd.flags = flags; /* client is in control of this ack */
 
 	return &first->txd;
 
@@ -748,8 +748,8 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 	first->txd.cookie = -EBUSY;
 	first->len = total_len;
 
-	/* last link descriptor of list is responsible of flags */
-	prev->txd.flags = flags; /* client is in control of this ack */
+	/* first link descriptor of list is responsible of flags */
+	first->txd.flags = flags; /* client is in control of this ack */
 
 	return &first->txd;
 
-- 
1.7.3
^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH 6/6] dmaengine: at_hdmac: fix race while monitoring channel status
  2010-12-15 17:50 [PATCH] dmaengine: at_hdmac: use dma_address to program DMA hardware Nicolas Ferre
                   ` (4 preceding siblings ...)
  2011-01-12 14:39 ` [PATCH 5/6] dmaengine: at_hdmac: flags located in first descriptor Nicolas Ferre
@ 2011-01-12 14:39 ` Nicolas Ferre
  5 siblings, 0 replies; 9+ messages in thread
From: Nicolas Ferre @ 2011-01-12 14:39 UTC (permalink / raw)
  To: linux-arm-kernel
We were reading channel status then taking a lock. This lead to a race because
this lock may delay us and then make this channel not idle anymore.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 99942a5..3d7d705 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -853,11 +853,11 @@ static void atc_issue_pending(struct dma_chan *chan)
 
 	dev_vdbg(chan2dev(chan), "issue_pending\n");
 
+	spin_lock_bh(&atchan->lock);
 	if (!atc_chan_is_enabled(atchan)) {
-		spin_lock_bh(&atchan->lock);
 		atc_advance_work(atchan);
-		spin_unlock_bh(&atchan->lock);
 	}
+	spin_unlock_bh(&atchan->lock);
 }
 
 /**
-- 
1.7.3
^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] dmaengine: at_hdmac: use dma_address to program DMA hardware
  2011-01-10 13:21 ` Nicolas Ferre
@ 2011-01-15  0:14   ` Dan Williams
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Williams @ 2011-01-15  0:14 UTC (permalink / raw)
  To: linux-arm-kernel
On Mon, Jan 10, 2011 at 5:21 AM, Nicolas Ferre <nicolas.ferre@atmel.com> wrote:
> Le 15/12/2010 18:50, Nicolas Ferre :
>> In atc_prep_slave_sg() function we use dma_address field of scatterlist with
>> sg_dma_address() macro instead of sg_phys(). DMA address is already computed
>> by dma_map_sg() or another mapping function in calling driver.
>
> Ping?
>
Applied.
^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 4/6] dmaengine: at_hdmac: use subsys_initcall instead of module_init
  2011-01-12 14:39 ` [PATCH 4/6] dmaengine: at_hdmac: use subsys_initcall instead of module_init Nicolas Ferre
@ 2011-01-15  0:27   ` Dan Williams
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Williams @ 2011-01-15  0:27 UTC (permalink / raw)
  To: linux-arm-kernel
On Wed, Jan 12, 2011 at 6:39 AM, Nicolas Ferre <nicolas.ferre@atmel.com> wrote:
> From: Eric Xu <hong.xu@atmel.com>
>
> Use subsys_initcall instead of module_init in order to keep DMA engine rolling
> before other peripheral drivers.
>
> Signed-off-by: Eric Xu <hong.xu@atmel.com>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> ?drivers/dma/at_hdmac.c | ? ?2 +-
> ?1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index 4f83431..a1a0fc6 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1209,7 +1209,7 @@ static int __init at_dma_init(void)
> ?{
> ? ? ? ?return platform_driver_probe(&at_dma_driver, at_dma_probe);
> ?}
> -module_init(at_dma_init);
> +subsys_initcall(at_dma_init);
If this matters shouldn't we also do this?
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 1b61d3a..4d14626 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -90,7 +90,7 @@ config DW_DMAC
          can be integrated in chips such as the Atmel AT32ap7000.
 config AT_HDMAC
-       tristate "Atmel AHB DMA support"
+       bool "Atmel AHB DMA support"
        depends on ARCH_AT91SAM9RL || ARCH_AT91SAM9G45
        select DMA_ENGINE
        help
^ permalink raw reply related	[flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-01-15  0:27 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-15 17:50 [PATCH] dmaengine: at_hdmac: use dma_address to program DMA hardware Nicolas Ferre
2011-01-10 13:21 ` Nicolas Ferre
2011-01-15  0:14   ` Dan Williams
2011-01-12 14:39 ` [PATCH 2/6] dmaengine: at_hdmac: trivial add precision to unmapping comment Nicolas Ferre
2011-01-12 14:39 ` [PATCH 3/6] dmaengine: at_hdmac: no need set ACK in new descriptor Nicolas Ferre
2011-01-12 14:39 ` [PATCH 4/6] dmaengine: at_hdmac: use subsys_initcall instead of module_init Nicolas Ferre
2011-01-15  0:27   ` Dan Williams
2011-01-12 14:39 ` [PATCH 5/6] dmaengine: at_hdmac: flags located in first descriptor Nicolas Ferre
2011-01-12 14:39 ` [PATCH 6/6] dmaengine: at_hdmac: fix race while monitoring channel status Nicolas Ferre
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).