Re: [PATCH v3 11/15] dmaengine: sh: rz-dmac: Add cyclic DMA support
From: Claudiu Beznea
Date: Tue Apr 07 2026 - 11:15:47 EST
Hi, Biju,
On 4/7/26 17:36, Biju Das wrote:
Hi Claudiu,
Thanks for the patch.
-----Original Message-----
From: Claudiu <claudiu.beznea@xxxxxxxxx>
Sent: 07 April 2026 14:35
Subject: [PATCH v3 11/15] dmaengine: sh: rz-dmac: Add cyclic DMA support
From: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
Add cyclic DMA support to the RZ DMAC driver. A per-channel status bit is introduced to mark cyclic
channels and is set during the DMA prepare callback. The IRQ handler checks this status bit and calls
vchan_cyclic_callback() accordingly.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
---
Changes in v3:
- updated rz_dmac_lmdesc_recycle() to restore the lmdesc->nxla
- in rz_dmac_prepare_descs_for_cyclic() update directly the
desc->start_lmdesc with the descriptor pointer insted of the
descriptor address
- used rz_dmac_lmdesc_addr() to compute the descritor address
- set channel->status = 0 in rz_dmac_free_chan_resources()
- in rz_dmac_prep_dma_cyclic() check for invalid periods or buffer len
and limit the critical area protected by spinlock
- set channel->status = 0 in rz_dmac_terminate_all()
- updated rz_dmac_calculate_residue_bytes_in_vd() to use
rz_dmac_lmdesc_addr()
- dropped goto in rz_dmac_irq_handler_thread() as it is not needed
anymore; dropped also the local variable desc
Changes in v2:
- none
drivers/dma/sh/rz-dmac.c | 144 +++++++++++++++++++++++++++++++++++++--
1 file changed, 138 insertions(+), 6 deletions(-)
[ ... ]
@@ -500,6 +562,8 @@ static void rz_dmac_free_chan_resources(struct dma_chan *chan)
channel->mid_rid = -EINVAL;
}
+ channel->status = 0;
+
spin_unlock_irqrestore(&channel->vc.lock, flags);
Maybe create a patch to convert all the spin_{lock,unlock} with guard()
in this driver.
This series already has to many patches and I want to keep only what is necessary for the cyclic support. My plan is to do the guard conversion after cyclic support gets merged.
Thank you,
Claudiu