Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dmaengine: sh: rz-dmac: Drop read of CHCTRL register

The CHCTRL register has 11 bits that can be updated by software. The
documentation for all these bits states the following:
- A read operation results in 0 being read
- Writing zero does not affect the operation

All bits in the CHCTRL register accessible by software are set and clear
bits.

The documentation for the CLREND bit of CHCTRL states:
Setting this bit to 1 can clear the END bit of the CHSTAT_n/nS register.
Also, the DMA transfer end interrupt is cleared. An attempt to read this
bit results in 0 being read.
1: Clears the END bit.
0: Does not affect the operation.

Since writing zero to any bit in this register does not affect controller
operation and reads always return zero, there is no need to perform
read-modify-write accesses to set the CLREND bit. Drop the read of the
CHCTRL register.

Also, since setting the CLREND bit does not interact with other
functionalities exposed through this register and only clears the END
interrupt, there is no need to lock around this operation. Add a comment
to document this.

Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20260316133252.240348-4-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Claudiu Beznea and committed by
Vinod Koul
be342fb7 6fa935ce

+6 -3
+6 -3
drivers/dma/sh/rz-dmac.c
··· 696 696 { 697 697 struct dma_chan *chan = &channel->vc.chan; 698 698 struct rz_dmac *dmac = to_rz_dmac(chan->device); 699 - u32 chstat, chctrl; 699 + u32 chstat; 700 700 701 701 chstat = rz_dmac_ch_readl(channel, CHSTAT, 1); 702 702 if (chstat & CHSTAT_ER) { ··· 708 708 goto done; 709 709 } 710 710 711 - chctrl = rz_dmac_ch_readl(channel, CHCTRL, 1); 712 - rz_dmac_ch_writel(channel, chctrl | CHCTRL_CLREND, CHCTRL, 1); 711 + /* 712 + * No need to lock. This just clears the END interrupt. Writing 713 + * zeros to CHCTRL is just ignored by HW. 714 + */ 715 + rz_dmac_ch_writel(channel, CHCTRL_CLREND, CHCTRL, 1); 713 716 done: 714 717 return; 715 718 }