diff mbox

dma: mv_xor: Flush descriptors before activating a channel

Message ID 1395846017-19422-1-git-send-email-ezequiel.garcia@free-electrons.com (mailing list archive)
State Awaiting Upstream
Commit b9bf6d2e84b736eeed2cf0f387771c7793a1c465
Delegated to: Dan Williams
Headers show

Commit Message

Ezequiel Garcia March 26, 2014, 3 p.m. UTC
We need to use writel() instead of writel_relaxed() when starting
a channel, to ensure all the descriptors have been flushed before
the activation.

While at it, remove the unneeded read-modify-write and make the
code simpler.

Signed-off-by: Lior Amsalem <alior@marvell.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
This fix applies cleanly since commit:
5733c38 mv_xor: use {readl, writel}_relaxed instead of __raw_{readl, writel}

Given the fix is applicable since the introduction of the driver,
in v2.6.27, it should be marked accordingly. I can provide a backport
in due time.

 drivers/dma/mv_xor.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Ezequiel Garcia April 3, 2014, 3:37 p.m. UTC | #1
On Mar 26, Ezequiel Garcia wrote:
> We need to use writel() instead of writel_relaxed() when starting
> a channel, to ensure all the descriptors have been flushed before
> the activation.
> 
> While at it, remove the unneeded read-modify-write and make the
> code simpler.
> 
> Signed-off-by: Lior Amsalem <alior@marvell.com>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> This fix applies cleanly since commit:
> 5733c38 mv_xor: use {readl, writel}_relaxed instead of __raw_{readl, writel}
> 
> Given the fix is applicable since the introduction of the driver,
> in v2.6.27, it should be marked accordingly. I can provide a backport
> in due time.
> 

Dan, Vinod, any comments? We'd like to have this fix merged so it lands stable
as soon as possible.

Thanks!
diff mbox

Patch

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 766b68e..394cbc5 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -191,12 +191,10 @@  static void mv_set_mode(struct mv_xor_chan *chan,
 
 static void mv_chan_activate(struct mv_xor_chan *chan)
 {
-	u32 activation;
-
 	dev_dbg(mv_chan_to_devp(chan), " activate chan.\n");
-	activation = readl_relaxed(XOR_ACTIVATION(chan));
-	activation |= 0x1;
-	writel_relaxed(activation, XOR_ACTIVATION(chan));
+
+	/* writel ensures all descriptors are flushed before activation */
+	writel(BIT(0), XOR_ACTIVATION(chan));
 }
 
 static char mv_chan_is_busy(struct mv_xor_chan *chan)