[PATCH v3 06/15] dmaengine: sh: rz-dmac: Add helper to check if the channel is enabled

From: Claudiu

Date: Tue Apr 07 2026 - 09:42:14 EST


From: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>

Add a helper to check if the channel is enabled. This will be reused in
subsequent patches.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
---

Changes in v3:
- none, this patch is new

drivers/dma/sh/rz-dmac.c | 10 ++++++++--

1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
index cd639aa9186a..083e81c07aff 100644
--- a/drivers/dma/sh/rz-dmac.c
+++ b/drivers/dma/sh/rz-dmac.c
@@ -279,6 +279,13 @@ static u32 rz_dmac_lmdesc_addr(struct rz_dmac_chan *channel, struct rz_lmdesc *l
(sizeof(struct rz_lmdesc) * (lmdesc - channel->lmdesc.base));
}

+static bool rz_dmac_chan_is_enabled(struct rz_dmac_chan *chan)
+{
+ u32 val = rz_dmac_ch_readl(chan, CHSTAT, 1);
+
+ return !!(val & CHSTAT_EN);
+}
+
static void rz_dmac_enable_hw(struct rz_dmac_chan *channel)
{
struct dma_chan *chan = &channel->vc.chan;
@@ -840,8 +847,7 @@ static int rz_dmac_device_pause(struct dma_chan *chan)

guard(spinlock_irqsave)(&channel->vc.lock);

- val = rz_dmac_ch_readl(channel, CHSTAT, 1);
- if (!(val & CHSTAT_EN))
+ if (!rz_dmac_chan_is_enabled(channel))
return 0;

rz_dmac_ch_writel(channel, CHCTRL_SETSUS, CHCTRL, 1);
--
2.43.0