[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220627090939.1775717-1-emil.renner.berthing@canonical.com>
Date: Mon, 27 Jun 2022 11:09:39 +0200
From: Emil Renner Berthing <emil.renner.berthing@...onical.com>
To: Eugeniy Paltsev <Eugeniy.Paltsev@...opsys.com>,
dmaengine@...r.kernel.org
Cc: Emil Renner Berthing <kernel@...il.dk>,
Vinod Koul <vkoul@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Pandith N <pandith.n@...el.com>,
Michael Zhu <michael.zhu@...rfivetech.com>,
linux-kernel@...r.kernel.org,
Samin Guo <samin.guo@...rfivetech.com>
Subject: [PATCH] dmaengine: dw-axi-dmac: Fix RMW on channel suspend register
From: Emil Renner Berthing <kernel@...il.dk>
When the DMA is configured for more than 8 channels the bits controlling
suspend moves to another register. However when adding support for this
the new register would be completely overwritten in one case and
overwritten with values from the old register in another case.
Found by comparing the parallel implementation of more than 8 channel
support for the StarFive JH7100 SoC by Samin.
Fixes: 824351668a41 ("dmaengine: dw-axi-dmac: support DMAX_NUM_CHANNELS > 8")
Co-developed-by: Samin Guo <samin.guo@...rfivetech.com>
Signed-off-by: Samin Guo <samin.guo@...rfivetech.com>
Signed-off-by: Emil Renner Berthing <kernel@...il.dk>
---
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
index e9c9bcb1f5c2..c741da02b67e 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -1164,8 +1164,9 @@ static int dma_chan_pause(struct dma_chan *dchan)
BIT(chan->id) << DMAC_CHAN_SUSP_WE_SHIFT;
axi_dma_iowrite32(chan->chip, DMAC_CHEN, val);
} else {
- val = BIT(chan->id) << DMAC_CHAN_SUSP2_SHIFT |
- BIT(chan->id) << DMAC_CHAN_SUSP2_WE_SHIFT;
+ val = axi_dma_ioread32(chan->chip, DMAC_CHSUSPREG);
+ val |= BIT(chan->id) << DMAC_CHAN_SUSP2_SHIFT |
+ BIT(chan->id) << DMAC_CHAN_SUSP2_WE_SHIFT;
axi_dma_iowrite32(chan->chip, DMAC_CHSUSPREG, val);
}
@@ -1190,12 +1191,13 @@ static inline void axi_chan_resume(struct axi_dma_chan *chan)
{
u32 val;
- val = axi_dma_ioread32(chan->chip, DMAC_CHEN);
if (chan->chip->dw->hdata->reg_map_8_channels) {
+ val = axi_dma_ioread32(chan->chip, DMAC_CHEN);
val &= ~(BIT(chan->id) << DMAC_CHAN_SUSP_SHIFT);
val |= (BIT(chan->id) << DMAC_CHAN_SUSP_WE_SHIFT);
axi_dma_iowrite32(chan->chip, DMAC_CHEN, val);
} else {
+ val = axi_dma_ioread32(chan->chip, DMAC_CHSUSPREG);
val &= ~(BIT(chan->id) << DMAC_CHAN_SUSP2_SHIFT);
val |= (BIT(chan->id) << DMAC_CHAN_SUSP2_WE_SHIFT);
axi_dma_iowrite32(chan->chip, DMAC_CHSUSPREG, val);
--
2.36.1
Powered by blists - more mailing lists