From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Vinod Koul <vkoul@kernel.org>, Rob Herring <robh+dt@kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
Phong Hoang <phong.hoang.wz@renesas.com>,
dmaengine@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH 3/4] dmaengine: rcar-dmac: Add helpers for clearing DMA channel status
Date: Thu, 7 Jan 2021 19:15:23 +0100 [thread overview]
Message-ID: <20210107181524.1947173-4-geert+renesas@glider.be> (raw)
In-Reply-To: <20210107181524.1947173-1-geert+renesas@glider.be>
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 <geert+renesas@glider.be>
---
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 71cdaf446fcaeba5..990d78849a7de704 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -337,6 +337,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
*/
@@ -452,7 +463,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);
@@ -1567,7 +1578,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
next prev parent reply other threads:[~2021-01-07 18:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-07 18:15 [PATCH 0/4] dmaengine: rcar-dmac: Add support for R-Car V3U Geert Uytterhoeven
2021-01-07 18:15 ` [PATCH 1/4] dt-bindings: renesas,rcar-dmac: Add r8a779a0 support Geert Uytterhoeven
2021-01-13 3:23 ` Rob Herring
2021-01-07 18:15 ` [PATCH 2/4] dmaengine: rcar-dmac: Add for_each_rcar_dmac_chan() helper Geert Uytterhoeven
2021-01-12 10:19 ` Vinod Koul
2021-01-12 10:26 ` Geert Uytterhoeven
2021-01-12 10:38 ` Vinod Koul
2021-01-12 10:48 ` Geert Uytterhoeven
2021-01-07 18:15 ` Geert Uytterhoeven [this message]
2021-01-07 18:15 ` [PATCH 4/4] dmaengine: rcar-dmac: Add support for R-Car V3U Geert Uytterhoeven
2021-01-12 10:36 ` Vinod Koul
2021-01-12 15:54 ` Geert Uytterhoeven
2021-01-12 17:04 ` Vinod Koul
2021-01-25 14:20 ` Geert Uytterhoeven
2021-01-12 15:55 ` [PATCH 0/4] " Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210107181524.1947173-4-geert+renesas@glider.be \
--to=geert+renesas@glider.be \
--cc=dan.j.williams@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=phong.hoang.wz@renesas.com \
--cc=robh+dt@kernel.org \
--cc=vkoul@kernel.org \
--cc=yoshihiro.shimoda.uh@renesas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).