Re: [PATCH v2 02/19] dmaengine: dw-edma: Add dw_edma_core_ll_clear() to clear LL control-word

Frank Li <[email protected]>
Newsgroups org.kernel.vger.dmaengine,org.kernel.vger.linux-kernel
Message-ID <amJjRVO-eXqMdhi9@SMW015318>
On Thu, Jul 23, 2026 at 05:41:33PM +0900, Koichiro Den wrote:
> Add a core operation for clearing the control word of one linked-list
> entry. A later patch uses the operation to invalidate stale CB when
> resetting a circular LL ring.
>
> No functional change.
>
> Signed-off-by: Koichiro Den <[email protected]>
> ---

Reviewed-by: Frank Li <[email protected]>

> Changes in v2:
>   - Split the provider operation from "Clear LL data entries on reset".
>
>  drivers/dma/dw-edma/dw-edma-core.h    |  6 ++++++
>  drivers/dma/dw-edma/dw-edma-v0-core.c | 16 ++++++++++++++++
>  drivers/dma/dw-edma/dw-hdma-v0-core.c | 16 ++++++++++++++++
>  3 files changed, 38 insertions(+)
>
> diff --git a/drivers/dma/dw-edma/dw-edma-core.h b/drivers/dma/dw-edma/dw-edma-core.h
> index e50fa7965778..089f913fd247 100644
> --- a/drivers/dma/dw-edma/dw-edma-core.h
> +++ b/drivers/dma/dw-edma/dw-edma-core.h
> @@ -138,6 +138,7 @@ struct dw_edma_core_ops {
>  	void (*ll_data)(struct dw_edma_chan *chan, struct dw_edma_burst *burst,
>  			u32 idx, bool cb, bool irq);
>  	void (*ll_link)(struct dw_edma_chan *chan, u32 idx, bool cb, u64 addr);
> +	void (*ll_clear)(struct dw_edma_chan *chan, u32 idx);
>  	int (*ll_cur_idx)(struct dw_edma_chan *chan);
>  	void (*ch_doorbell)(struct dw_edma_chan *chan);
>  	void (*ch_enable)(struct dw_edma_chan *chan);
> @@ -255,6 +256,11 @@ dw_edma_core_ll_link(struct dw_edma_chan *chan, u32 idx, bool cb, u64 addr)
>  	chan->dw->core->ll_link(chan, idx, cb, addr);
>  }
>
> +static inline void dw_edma_core_ll_clear(struct dw_edma_chan *chan, u32 idx)
> +{
> +	chan->dw->core->ll_clear(chan, idx);
> +}
> +
>  static inline void dw_edma_core_ch_doorbell(struct dw_edma_chan *chan)
>  {
>  	chan->dw->core->ch_doorbell(chan);
> diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c
> index ba84811234e1..c31fff095b4f 100644
> --- a/drivers/dma/dw-edma/dw-edma-v0-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c
> @@ -605,6 +605,21 @@ dw_edma_v0_core_ll_link(struct dw_edma_chan *chan, u32 idx, bool cb, u64 addr)
>  	dw_edma_v0_write_ll_link(chan, idx, control, addr);
>  }
>
> +static void dw_edma_v0_core_ll_clear(struct dw_edma_chan *chan, u32 idx)
> +{
> +	ptrdiff_t ofs = idx * sizeof(struct dw_edma_v0_lli);
> +
> +	if (chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL) {
> +		struct dw_edma_v0_lli *lli = chan->ll_region.vaddr.mem + ofs;
> +
> +		lli->control = 0;
> +	} else {
> +		struct dw_edma_v0_lli __iomem *lli = chan->ll_region.vaddr.io + ofs;
> +
> +		writel(0, &lli->control);
> +	}
> +}
> +
>  static void dw_edma_v0_core_ch_doorbell(struct dw_edma_chan *chan)
>  {
>  	struct dw_edma *dw = chan->dw;
> @@ -668,6 +683,7 @@ static const struct dw_edma_core_ops dw_edma_v0_core = {
>  	.handle_int = dw_edma_v0_core_handle_int,
>  	.ll_data = dw_edma_v0_core_ll_data,
>  	.ll_link = dw_edma_v0_core_ll_link,
> +	.ll_clear = dw_edma_v0_core_ll_clear,
>  	.ll_cur_idx = dw_edma_v0_core_ll_cur_idx,
>  	.ch_doorbell = dw_edma_v0_core_ch_doorbell,
>  	.ch_enable = dw_edma_v0_core_ch_enable,
> diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c b/drivers/dma/dw-edma/dw-hdma-v0-core.c
> index 2fc7f8e85b43..b2d35f0b7b6d 100644
> --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c
> +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c
> @@ -374,6 +374,21 @@ dw_hdma_v0_core_ll_link(struct dw_edma_chan *chan, u32 idx, bool cb, u64 addr)
>  	dw_hdma_v0_write_ll_link(chan, idx, control, addr);
>  }
>
> +static void dw_hdma_v0_core_ll_clear(struct dw_edma_chan *chan, u32 idx)
> +{
> +	ptrdiff_t ofs = idx * sizeof(struct dw_hdma_v0_lli);
> +
> +	if (chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL) {
> +		struct dw_hdma_v0_lli *lli = chan->ll_region.vaddr.mem + ofs;
> +
> +		lli->control = 0;
> +	} else {
> +		struct dw_hdma_v0_lli __iomem *lli = chan->ll_region.vaddr.io + ofs;
> +
> +		writel(0, &lli->control);
> +	}
> +}
> +
>  static void dw_hdma_v0_core_ch_doorbell(struct dw_edma_chan *chan)
>  {
>  	struct dw_edma *dw = chan->dw;
> @@ -424,6 +439,7 @@ static const struct dw_edma_core_ops dw_hdma_v0_core = {
>  	.non_ll_start = dw_hdma_v0_core_non_ll_start,
>  	.ll_data = dw_hdma_v0_core_ll_data,
>  	.ll_link = dw_hdma_v0_core_ll_link,
> +	.ll_clear = dw_hdma_v0_core_ll_clear,
>  	.ll_cur_idx = dw_hdma_v0_core_ll_cur_idx,
>  	.ch_doorbell = dw_hdma_v0_core_ch_doorbell,
>  	.ch_enable = dw_hdma_v0_core_ch_enable,
> --
> 2.51.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.