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

dmaengine: rcar-dmac: Add helpers for clearing DMA channel status

Extract the code to clear the status of one or all channels into their
own helpers, to prepare for the different handling of the R-Car V3U SoC.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/r/20210128084455.2237256-4-geert+renesas@glider.be
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Geert Uytterhoeven and committed by
Vinod Koul
245bbd16 d249b5fb

+13 -2
+13 -2
drivers/dma/sh/rcar-dmac.c
··· 336 336 writel(data, chan->iomem + reg); 337 337 } 338 338 339 + static void rcar_dmac_chan_clear(struct rcar_dmac *dmac, 340 + struct rcar_dmac_chan *chan) 341 + { 342 + rcar_dmac_write(dmac, RCAR_DMACHCLR, BIT(chan->index)); 343 + } 344 + 345 + static void rcar_dmac_chan_clear_all(struct rcar_dmac *dmac) 346 + { 347 + rcar_dmac_write(dmac, RCAR_DMACHCLR, dmac->channels_mask); 348 + } 349 + 339 350 /* ----------------------------------------------------------------------------- 340 351 * Initialization and configuration 341 352 */ ··· 462 451 u16 dmaor; 463 452 464 453 /* Clear all channels and enable the DMAC globally. */ 465 - rcar_dmac_write(dmac, RCAR_DMACHCLR, dmac->channels_mask); 454 + rcar_dmac_chan_clear_all(dmac); 466 455 rcar_dmac_write(dmac, RCAR_DMAOR, 467 456 RCAR_DMAOR_PRI_FIXED | RCAR_DMAOR_DME); 468 457 ··· 1577 1566 * because channel is already stopped in error case. 1578 1567 * We need to clear register and check DE bit as recovery. 1579 1568 */ 1580 - rcar_dmac_write(dmac, RCAR_DMACHCLR, 1 << chan->index); 1569 + rcar_dmac_chan_clear(dmac, chan); 1581 1570 rcar_dmac_chcr_de_barrier(chan); 1582 1571 reinit = true; 1583 1572 goto spin_lock_end;