From: Frank Li <Frank.li@nxp.com>
To: Claudiu <claudiu.beznea@tuxon.dev>
Cc: vkoul@kernel.org, geert+renesas@glider.be,
biju.das.jz@bp.renesas.com, fabrizio.castro.jz@renesas.com,
prabhakar.mahadev-lad.rj@bp.renesas.com,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH v8 8/8] dmaengine: sh: rz-dmac: Add device_{pause,resume}() callbacks
Date: Wed, 25 Feb 2026 11:49:19 -0500 [thread overview]
Message-ID: <aZ8oD_kcEE6lrTDC@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260120133330.3738850-9-claudiu.beznea.uj@bp.renesas.com>
On Tue, Jan 20, 2026 at 03:33:30PM +0200, Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> Add support for device_{pause, resume}() callbacks. These are required by
> the RZ/G2L SCIFA driver.
"These are required by the RZ/G2L SCIFA driver", is not good enough. Can
you descript why RZ/G2L SCIFA require it?
Frank
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> ---
>
> Changes in v8:
> - reported residue for paused channels as well
>
> Changes in v7:
> - use guard() instead of scoped_guard()
> - in rz_dmac_device_pause() checked the channel is enabled
> before suspending it to avoid read poll timeouts
> - added a comment in rz_dmac_device_resume()
>
> Changes in v6:
> - set CHCTRL_SETSUS for pause and CHCTRL_CLRSUS for resume
> - dropped read-modify-update approach for CHCTRL updates as the
> HW returns zero when reading CHCTRL
> - moved the read_poll_timeout_atomic() under spin lock to
> ensure avoid any races b/w pause and resume functionalities
>
> Changes in v5:
> - used suspend capability of the controller to pause/resume
> the transfers
>
> drivers/dma/sh/rz-dmac.c | 49 +++++++++++++++++++++++++++++++++++++---
> 1 file changed, 46 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
> index 27c963083e29..caa3335bf95d 100644
> --- a/drivers/dma/sh/rz-dmac.c
> +++ b/drivers/dma/sh/rz-dmac.c
> @@ -141,10 +141,12 @@ struct rz_dmac {
> #define CHANNEL_8_15_COMMON_BASE 0x0700
>
> #define CHSTAT_ER BIT(4)
> +#define CHSTAT_SUS BIT(3)
> #define CHSTAT_EN BIT(0)
>
> #define CHCTRL_CLRINTMSK BIT(17)
> #define CHCTRL_CLRSUS BIT(9)
> +#define CHCTRL_SETSUS BIT(8)
> #define CHCTRL_CLRTC BIT(6)
> #define CHCTRL_CLREND BIT(5)
> #define CHCTRL_CLRRQ BIT(4)
> @@ -814,11 +816,18 @@ static enum dma_status rz_dmac_tx_status(struct dma_chan *chan,
> if (status == DMA_COMPLETE || !txstate)
> return status;
>
> - scoped_guard(spinlock_irqsave, &channel->vc.lock)
> + scoped_guard(spinlock_irqsave, &channel->vc.lock) {
> + u32 val;
> +
> residue = rz_dmac_chan_get_residue(channel, cookie);
>
> - /* if there's no residue, the cookie is complete */
> - if (!residue)
> + val = rz_dmac_ch_readl(channel, CHSTAT, 1);
> + if (val & CHSTAT_SUS)
> + status = DMA_PAUSED;
> + }
> +
> + /* if there's no residue and no paused, the cookie is complete */
> + if (!residue && status != DMA_PAUSED)
> return DMA_COMPLETE;
>
> dma_set_residue(txstate, residue);
> @@ -826,6 +835,38 @@ static enum dma_status rz_dmac_tx_status(struct dma_chan *chan,
> return status;
> }
>
> +static int rz_dmac_device_pause(struct dma_chan *chan)
> +{
> + struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
> + u32 val;
> +
> + guard(spinlock_irqsave)(&channel->vc.lock);
> +
> + val = rz_dmac_ch_readl(channel, CHSTAT, 1);
> + if (!(val & CHSTAT_EN))
> + return 0;
> +
> + rz_dmac_ch_writel(channel, CHCTRL_SETSUS, CHCTRL, 1);
> + return read_poll_timeout_atomic(rz_dmac_ch_readl, val,
> + (val & CHSTAT_SUS), 1, 1024,
> + false, channel, CHSTAT, 1);
> +}
> +
> +static int rz_dmac_device_resume(struct dma_chan *chan)
> +{
> + struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
> + u32 val;
> +
> + guard(spinlock_irqsave)(&channel->vc.lock);
> +
> + /* Do not check CHSTAT_SUS but rely on HW capabilities. */
> +
> + rz_dmac_ch_writel(channel, CHCTRL_CLRSUS, CHCTRL, 1);
> + return read_poll_timeout_atomic(rz_dmac_ch_readl, val,
> + !(val & CHSTAT_SUS), 1, 1024,
> + false, channel, CHSTAT, 1);
> +}
> +
> /*
> * -----------------------------------------------------------------------------
> * IRQ handling
> @@ -1164,6 +1205,8 @@ static int rz_dmac_probe(struct platform_device *pdev)
> engine->device_terminate_all = rz_dmac_terminate_all;
> engine->device_issue_pending = rz_dmac_issue_pending;
> engine->device_synchronize = rz_dmac_device_synchronize;
> + engine->device_pause = rz_dmac_device_pause;
> + engine->device_resume = rz_dmac_device_resume;
>
> engine->copy_align = DMAENGINE_ALIGN_1_BYTE;
> dma_set_max_seg_size(engine->dev, U32_MAX);
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-02-25 16:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-20 13:33 [PATCH v8 0/8] dmaengine: sh: rz-dmac: Add tx_status and pause/resume support Claudiu
2026-01-20 13:33 ` [PATCH v8 1/8] dmaengine: sh: rz-dmac: Protect the driver specific lists Claudiu
2026-02-25 16:17 ` Frank Li
2026-01-20 13:33 ` [PATCH v8 2/8] dmaengine: sh: rz-dmac: Move CHCTRL updates under spinlock Claudiu
2026-02-25 16:19 ` Frank Li
2026-01-20 13:33 ` [PATCH v8 3/8] dmaengine: sh: rz-dmac: Drop read of CHCTRL register Claudiu
2026-02-25 16:20 ` Frank Li
2026-01-20 13:33 ` [PATCH v8 4/8] dmaengine: sh: rz-dmac: Drop goto instruction and label Claudiu
2026-02-25 16:23 ` Frank Li
2026-01-20 13:33 ` [PATCH v8 5/8] dmaengine: sh: rz-dmac: Drop unnecessary local_irq_save() call Claudiu
2026-02-25 16:23 ` Frank Li
2026-01-20 13:33 ` [PATCH v8 6/8] dmaengine: sh: rz-dmac: Add rz_dmac_invalidate_lmdesc() Claudiu
2026-02-25 16:26 ` Frank Li
2026-01-20 13:33 ` [PATCH v8 7/8] dmaengine: sh: rz-dmac: Add device_tx_status() callback Claudiu
2026-02-25 16:43 ` Frank Li
2026-03-02 13:49 ` Claudiu Beznea
2026-03-04 16:37 ` Frank Li
2026-01-20 13:33 ` [PATCH v8 8/8] dmaengine: sh: rz-dmac: Add device_{pause,resume}() callbacks Claudiu
2026-02-25 16:49 ` Frank Li [this message]
2026-03-02 13:50 ` Claudiu Beznea
2026-01-29 9:44 ` [PATCH v8 0/8] dmaengine: sh: rz-dmac: Add tx_status and pause/resume support Claudiu Beznea
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=aZ8oD_kcEE6lrTDC@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=dmaengine@vger.kernel.org \
--cc=fabrizio.castro.jz@renesas.com \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=vkoul@kernel.org \
/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
all inboxes | Powered by JetHome®