From patchwork Wed Mar 26 15:00:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 3893961 X-Patchwork-Delegate: dan.j.williams@gmail.com Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E3C48BF540 for ; Wed, 26 Mar 2014 15:00:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C9E882021A for ; Wed, 26 Mar 2014 15:00:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E60FD20218 for ; Wed, 26 Mar 2014 15:00:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753545AbaCZPAr (ORCPT ); Wed, 26 Mar 2014 11:00:47 -0400 Received: from top.free-electrons.com ([176.31.233.9]:53764 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751803AbaCZPAr (ORCPT ); Wed, 26 Mar 2014 11:00:47 -0400 Received: by mail.free-electrons.com (Postfix, from userid 106) id 77E847D9; Wed, 26 Mar 2014 16:00:46 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from localhost.localdomain (unknown [190.2.108.71]) by mail.free-electrons.com (Postfix) with ESMTPSA id 7B6AA7AD; Wed, 26 Mar 2014 16:00:43 +0100 (CET) From: Ezequiel Garcia To: , Dan Williams , Vinod Koul Cc: Thomas Petazzoni , Gregory Clement , Nadav Haklai , Tawfik Bayouk , Ezequiel Garcia , Lior Amsalem Subject: [PATCH] dma: mv_xor: Flush descriptors before activating a channel Date: Wed, 26 Mar 2014 12:00:17 -0300 Message-Id: <1395846017-19422-1-git-send-email-ezequiel.garcia@free-electrons.com> X-Mailer: git-send-email 1.9.1 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Ezequiel Garcia --- 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(-) 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)