diff options
author | Sekhar Nori <nsekhar@ti.com> | 2014-03-19 01:55:50 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2014-04-13 23:59:55 -0400 |
commit | 5fc68a6cad658e45dca3e0a6607df3a8e5df4ef9 (patch) | |
tree | ab4dc89221cfeb0f7cf7c6c3551b5e2856bef6cf | |
parent | c9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff) |
dma: edma: fix incorrect SG list handling
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>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/dma/edma.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index cd04eb7b182e..926360c2db6a 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c | |||
@@ -182,11 +182,13 @@ static void edma_execute(struct edma_chan *echan) | |||
182 | echan->ecc->dummy_slot); | 182 | echan->ecc->dummy_slot); |
183 | } | 183 | } |
184 | 184 | ||
185 | edma_resume(echan->ch_num); | ||
186 | |||
187 | if (edesc->processed <= MAX_NR_SG) { | 185 | if (edesc->processed <= MAX_NR_SG) { |
188 | dev_dbg(dev, "first transfer starting %d\n", echan->ch_num); | 186 | dev_dbg(dev, "first transfer starting %d\n", echan->ch_num); |
189 | edma_start(echan->ch_num); | 187 | edma_start(echan->ch_num); |
188 | } else { | ||
189 | dev_dbg(dev, "chan: %d: completed %d elements, resuming\n", | ||
190 | echan->ch_num, edesc->processed); | ||
191 | edma_resume(echan->ch_num); | ||
190 | } | 192 | } |
191 | 193 | ||
192 | /* | 194 | /* |