All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] dma: edma: fix incorrect SG list handling
@ 2014-03-19  5:55 Sekhar Nori
  2014-04-14  8:31 ` Sekhar Nori
  0 siblings, 1 reply; 4+ messages in thread
From: Sekhar Nori @ 2014-03-19  5:55 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul
  Cc: DMA Engine Mailing List, Linux DaVinci Mailing List, Jon Ringle,
	Alexander Holler, Linux OMAP Mailing List, Sekhar Nori,
	Joel Fernandes

The code to handle any length SG lists calls edma_resume()
even before edma_start() is called. This is incorrect
because edma_resume() enables edma events on the channel
after which CPU (in edma_start) cannot clear posted
events by writing to ECR (per the EDMA user's guide).

Because of this EDMA transfers fail to start if due
to some reason there is a pending EDMA event registered
even before EDMA transfers are started. This can happen if
an EDMA event is a byproduct of device initialization.

Fix this by calling edma_resume() only if it is not the
first batch of MAX_NR_SG elements.

Without this patch, MMC/SD fails to function on DA850 EVM
with DMA. The behaviour is triggered by specific IP and
this can explain why the issue was not reported before
(example with MMC/SD on AM335x).

Tested on DA850 EVM and AM335x EVM-SK using MMC/SD card.

Cc: stable@vger.kernel.org # v3.12.x+
Cc: Joel Fernandes <joelf@ti.com>
Acked-by: Joel Fernandes <joelf@ti.com>
Tested-by: Jon Ringle <jringle@gridpoint.com>
Tested-by: Alexander Holler <holler@ahsoftware.de>
Reported-by: Jon Ringle <jringle@gridpoint.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
Same as the version send previously (which did not make
into all mailing lists). Commit message updates with
tested-by and acks received.

 drivers/dma/edma.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index cd8da45..bf5ad0f 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -182,11 +182,13 @@ static void edma_execute(struct edma_chan *echan)
 				  echan->ecc->dummy_slot);
 	}
 
-	edma_resume(echan->ch_num);
-
 	if (edesc->processed <= MAX_NR_SG) {
 		dev_dbg(dev, "first transfer starting %d\n", echan->ch_num);
 		edma_start(echan->ch_num);
+	} else {
+		dev_dbg(dev, "chan: %d: completed %d elements, resuming\n",
+			echan->ch_num, edesc->processed);
+		edma_resume(echan->ch_num);
 	}
 
 	/*
-- 
1.7.10.1


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

* Re: [PATCH 1/1] dma: edma: fix incorrect SG list handling
  2014-03-19  5:55 [PATCH 1/1] dma: edma: fix incorrect SG list handling Sekhar Nori
@ 2014-04-14  8:31 ` Sekhar Nori
  2014-04-14  8:57   ` Vinod Koul
  0 siblings, 1 reply; 4+ messages in thread
From: Sekhar Nori @ 2014-04-14  8:31 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul
  Cc: DMA Engine Mailing List, Linux DaVinci Mailing List, Jon Ringle,
	Alexander Holler, Linux OMAP Mailing List, Joel Fernandes

Vinod,

On Wednesday 19 March 2014 11:25 AM, Sekhar Nori wrote:
> The code to handle any length SG lists calls edma_resume()
> even before edma_start() is called. This is incorrect
> because edma_resume() enables edma events on the channel
> after which CPU (in edma_start) cannot clear posted
> events by writing to ECR (per the EDMA user's guide).
> 
> Because of this EDMA transfers fail to start if due
> to some reason there is a pending EDMA event registered
> even before EDMA transfers are started. This can happen if
> an EDMA event is a byproduct of device initialization.
> 
> Fix this by calling edma_resume() only if it is not the
> first batch of MAX_NR_SG elements.
> 
> Without this patch, MMC/SD fails to function on DA850 EVM
> with DMA. The behaviour is triggered by specific IP and
> this can explain why the issue was not reported before
> (example with MMC/SD on AM335x).
> 
> Tested on DA850 EVM and AM335x EVM-SK using MMC/SD card.
> 
> Cc: stable@vger.kernel.org # v3.12.x+
> Cc: Joel Fernandes <joelf@ti.com>
> Acked-by: Joel Fernandes <joelf@ti.com>
> Tested-by: Jon Ringle <jringle@gridpoint.com>
> Tested-by: Alexander Holler <holler@ahsoftware.de>
> Reported-by: Jon Ringle <jringle@gridpoint.com>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>

Looks like this patch is not in mainline still?

Thanks,
Sekhar

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

* Re: [PATCH 1/1] dma: edma: fix incorrect SG list handling
  2014-04-14  8:31 ` Sekhar Nori
@ 2014-04-14  8:57   ` Vinod Koul
  2014-04-14  9:09     ` Sekhar Nori
  0 siblings, 1 reply; 4+ messages in thread
From: Vinod Koul @ 2014-04-14  8:57 UTC (permalink / raw)
  To: Sekhar Nori
  Cc: Dan Williams, DMA Engine Mailing List,
	Linux DaVinci Mailing List, Jon Ringle, Alexander Holler,
	Linux OMAP Mailing List, Joel Fernandes

On Mon, Apr 14, 2014 at 02:01:11PM +0530, Sekhar Nori wrote:
> Vinod,
> 
> On Wednesday 19 March 2014 11:25 AM, Sekhar Nori wrote:
> > The code to handle any length SG lists calls edma_resume()
> > even before edma_start() is called. This is incorrect
> > because edma_resume() enables edma events on the channel
> > after which CPU (in edma_start) cannot clear posted
> > events by writing to ECR (per the EDMA user's guide).
> > 
> > Because of this EDMA transfers fail to start if due
> > to some reason there is a pending EDMA event registered
> > even before EDMA transfers are started. This can happen if
> > an EDMA event is a byproduct of device initialization.
> > 
> > Fix this by calling edma_resume() only if it is not the
> > first batch of MAX_NR_SG elements.
> > 
> > Without this patch, MMC/SD fails to function on DA850 EVM
> > with DMA. The behaviour is triggered by specific IP and
> > this can explain why the issue was not reported before
> > (example with MMC/SD on AM335x).
> > 
> > Tested on DA850 EVM and AM335x EVM-SK using MMC/SD card.
> > 
> > Cc: stable@vger.kernel.org # v3.12.x+
> > Cc: Joel Fernandes <joelf@ti.com>
> > Acked-by: Joel Fernandes <joelf@ti.com>
> > Tested-by: Jon Ringle <jringle@gridpoint.com>
> > Tested-by: Alexander Holler <holler@ahsoftware.de>
> > Reported-by: Jon Ringle <jringle@gridpoint.com>
> > Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> 
> Looks like this patch is not in mainline still?

Sorry looks like I have missed sending the email. I had applied it last week and
today rebased after rc1. It would be part of rc2...

-- 
~Vinod
> 
> Thanks,
> Sekhar

-- 

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

* Re: [PATCH 1/1] dma: edma: fix incorrect SG list handling
  2014-04-14  8:57   ` Vinod Koul
@ 2014-04-14  9:09     ` Sekhar Nori
  0 siblings, 0 replies; 4+ messages in thread
From: Sekhar Nori @ 2014-04-14  9:09 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Dan Williams, DMA Engine Mailing List,
	Linux DaVinci Mailing List, Jon Ringle, Alexander Holler,
	Linux OMAP Mailing List, Joel Fernandes

On Monday 14 April 2014 02:27 PM, Vinod Koul wrote:
> On Mon, Apr 14, 2014 at 02:01:11PM +0530, Sekhar Nori wrote:
>> Vinod,
>>
>> On Wednesday 19 March 2014 11:25 AM, Sekhar Nori wrote:
>>> The code to handle any length SG lists calls edma_resume()
>>> even before edma_start() is called. This is incorrect
>>> because edma_resume() enables edma events on the channel
>>> after which CPU (in edma_start) cannot clear posted
>>> events by writing to ECR (per the EDMA user's guide).
>>>
>>> Because of this EDMA transfers fail to start if due
>>> to some reason there is a pending EDMA event registered
>>> even before EDMA transfers are started. This can happen if
>>> an EDMA event is a byproduct of device initialization.
>>>
>>> Fix this by calling edma_resume() only if it is not the
>>> first batch of MAX_NR_SG elements.
>>>
>>> Without this patch, MMC/SD fails to function on DA850 EVM
>>> with DMA. The behaviour is triggered by specific IP and
>>> this can explain why the issue was not reported before
>>> (example with MMC/SD on AM335x).
>>>
>>> Tested on DA850 EVM and AM335x EVM-SK using MMC/SD card.
>>>
>>> Cc: stable@vger.kernel.org # v3.12.x+
>>> Cc: Joel Fernandes <joelf@ti.com>
>>> Acked-by: Joel Fernandes <joelf@ti.com>
>>> Tested-by: Jon Ringle <jringle@gridpoint.com>
>>> Tested-by: Alexander Holler <holler@ahsoftware.de>
>>> Reported-by: Jon Ringle <jringle@gridpoint.com>
>>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>>
>> Looks like this patch is not in mainline still?
> 
> Sorry looks like I have missed sending the email. I had applied it last week and
> today rebased after rc1. It would be part of rc2...

Thank you!

Regards,
Sekhar

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

end of thread, other threads:[~2014-04-14  9:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-19  5:55 [PATCH 1/1] dma: edma: fix incorrect SG list handling Sekhar Nori
2014-04-14  8:31 ` Sekhar Nori
2014-04-14  8:57   ` Vinod Koul
2014-04-14  9:09     ` Sekhar Nori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.