Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp831487pxb; Thu, 28 Jan 2021 00:58:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHEgDK1aSeCQSBYvuZPjtpkuk6Iz1Hd/ZuExDrrIkwdz0qyR5u88oXNt6GBXOztgn4Wi94 X-Received: by 2002:a17:906:5958:: with SMTP id g24mr9926109ejr.377.1611824314641; Thu, 28 Jan 2021 00:58:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611824314; cv=none; d=google.com; s=arc-20160816; b=NyEkJ/csFtKPPK3aSPmg08qWi+Ypp9xjYIXnQnVWV9VeWmmcLN6b2UKSqcvFxRJMLC N6V+AQdoZdG8g6LFf/QkpcKmTU/s88acetH/PkP2cp+tdTlyvaK72SOnoc0vQ62+0HRD gWGORBx+0a0s87F8wuiJKMebl7yCuWfYDSIS+k5F/o9OrFjHlU7E4nBnFI8eXtJlqt0J f7uhbfaA79jvCpGFqIaWGTBF0tvYj7eaAj2rrtiM/dWCcC06CInwdG+iBSpBjzRA6X6y WbbqL/fbr7bQQRsJX+MNhpgeZl2fg35CAxoma420XOkhXdYI6Fs2Zd+SeoW3G3EJHLEc A1WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Elt44hAg4hPx36NnicoDGPo9TBSQ0XAk3IIWUWwNm3Y=; b=yeI5tRmfa/MEGIyL2LK5yPb5YXrG0tHOJJ+L5F3iC0gvBgdyEoFdgdq4VbFM9pAFu6 Ppld+hE4+1ZQW5qppWgSbCWga9TPtmWC5lY3uPuAcjG7mtsjb6q8UACVonPtOd/JyhIy MC9VZQIbtD9ithT43ega1gv5NpfVXIgroDiR6U5DaS5jih+ESCxWBnmyv5kIRWuY94VI sSI616QKAvI4dfIQvAx2dDmWWNyJHgV/kudttIyJaA3ni9Xk6cAUHFaL6cMi7hVUokOK pcL9pSTsPCEAz0WxLjIG3kMpFMgou+ECRPksZpFdNmGmIEG26iuZvgeyyFfLJPlzhz0m OZPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qc5si2105156ejb.193.2021.01.28.00.58.10; Thu, 28 Jan 2021 00:58:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231733AbhA1IzT (ORCPT + 99 others); Thu, 28 Jan 2021 03:55:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231739AbhA1Ip3 (ORCPT ); Thu, 28 Jan 2021 03:45:29 -0500 Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be [IPv6:2a02:1800:120:4::f00:13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B66D2C061793 for ; Thu, 28 Jan 2021 00:45:01 -0800 (PST) Received: from ramsan.of.borg ([84.195.186.194]) by baptiste.telenet-ops.be with bizsmtp id N8kx2400T4C55Sk018kx74; Thu, 28 Jan 2021 09:44:59 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1l52vB-001JYR-E9; Thu, 28 Jan 2021 09:44:57 +0100 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1l52vB-009O1q-0i; Thu, 28 Jan 2021 09:44:57 +0100 From: Geert Uytterhoeven To: Vinod Koul Cc: Rob Herring , Dan Williams , Laurent Pinchart , Wolfram Sang , Yoshihiro Shimoda , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v3 3/4] dmaengine: rcar-dmac: Add helpers for clearing DMA channel status Date: Thu, 28 Jan 2021 09:44:54 +0100 Message-Id: <20210128084455.2237256-4-geert+renesas@glider.be> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210128084455.2237256-1-geert+renesas@glider.be> References: <20210128084455.2237256-1-geert+renesas@glider.be> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Extract the code to clear the status of one or all channels into their own helpers, to prepare for the different handling of the R-Car V3U SoC. Signed-off-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Reviewed-by: Laurent Pinchart Tested-by: Wolfram Sang --- v3: - Add Reviewed-by, Tested-by, v2: - No changes. --- drivers/dma/sh/rcar-dmac.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c index 83c9a5bd1077db3a..37e3c6890f8670da 100644 --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -336,6 +336,17 @@ static void rcar_dmac_chan_write(struct rcar_dmac_chan *chan, u32 reg, u32 data) writel(data, chan->iomem + reg); } +static void rcar_dmac_chan_clear(struct rcar_dmac *dmac, + struct rcar_dmac_chan *chan) +{ + rcar_dmac_write(dmac, RCAR_DMACHCLR, BIT(chan->index)); +} + +static void rcar_dmac_chan_clear_all(struct rcar_dmac *dmac) +{ + rcar_dmac_write(dmac, RCAR_DMACHCLR, dmac->channels_mask); +} + /* ----------------------------------------------------------------------------- * Initialization and configuration */ @@ -451,7 +462,7 @@ static int rcar_dmac_init(struct rcar_dmac *dmac) u16 dmaor; /* Clear all channels and enable the DMAC globally. */ - rcar_dmac_write(dmac, RCAR_DMACHCLR, dmac->channels_mask); + rcar_dmac_chan_clear_all(dmac); rcar_dmac_write(dmac, RCAR_DMAOR, RCAR_DMAOR_PRI_FIXED | RCAR_DMAOR_DME); @@ -1566,7 +1577,7 @@ static irqreturn_t rcar_dmac_isr_channel(int irq, void *dev) * because channel is already stopped in error case. * We need to clear register and check DE bit as recovery. */ - rcar_dmac_write(dmac, RCAR_DMACHCLR, 1 << chan->index); + rcar_dmac_chan_clear(dmac, chan); rcar_dmac_chcr_de_barrier(chan); reinit = true; goto spin_lock_end; -- 2.25.1