[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230313170450.897-12-jszhang@kernel.org>
Date: Tue, 14 Mar 2023 01:04:50 +0800
From: Jisheng Zhang <jszhang@...nel.org>
To: Eugeniy Paltsev <Eugeniy.Paltsev@...opsys.com>,
Vinod Koul <vkoul@...nel.org>
Cc: dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 11/11] dmaengine: dw-axi-dmac: support polled mode
Run in polled mode if the DMA_PREP_INTERRUPT flag is not provided.
Signed-off-by: Jisheng Zhang <jszhang@...nel.org>
---
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 11 ++++++++++-
drivers/dma/dw-axi-dmac/dw-axi-dmac.h | 1 +
2 files changed, 11 insertions(+), 1 deletion(-)
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 1d00793a83bf..8daeb22d4560 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -383,7 +383,10 @@ static void axi_chan_block_xfer_start(struct axi_dma_chan *chan,
write_chan_llp(chan, first->hw_desc[0].llp | lms);
irq_mask = DWAXIDMAC_IRQ_DMA_TRF | DWAXIDMAC_IRQ_ALL_ERR;
- axi_chan_irq_sig_set(chan, irq_mask);
+ if (chan->polled)
+ axi_chan_irq_sig_set(chan, DWAXIDMAC_IRQ_NONE);
+ else
+ axi_chan_irq_sig_set(chan, irq_mask);
/* Generate 'suspend' status but don't generate interrupt */
irq_mask |= DWAXIDMAC_IRQ_SUSPENDED;
@@ -714,6 +717,7 @@ dw_axi_dma_chan_prep_cyclic(struct dma_chan *dchan, dma_addr_t dma_addr,
if (unlikely(!desc))
goto err_desc_get;
+ chan->polled = !(flags & DMA_PREP_INTERRUPT);
chan->direction = direction;
desc->chan = chan;
chan->cyclic = true;
@@ -796,6 +800,7 @@ dw_axi_dma_chan_prep_slave_sg(struct dma_chan *dchan, struct scatterlist *sgl,
desc->chan = chan;
desc->length = 0;
+ chan->polled = !(flags & DMA_PREP_INTERRUPT);
chan->direction = direction;
for_each_sg(sgl, sg, sg_len, i) {
@@ -859,6 +864,7 @@ dma_chan_prep_dma_memcpy(struct dma_chan *dchan, dma_addr_t dst_adr,
if (unlikely(!desc))
goto err_desc_get;
+ chan->polled = !(flags & DMA_PREP_INTERRUPT);
desc->chan = chan;
num = 0;
desc->length = 0;
@@ -1139,6 +1145,9 @@ dma_chan_tx_status(struct dma_chan *dchan, dma_cookie_t cookie,
u32 length;
u32 len;
+ if (chan->polled)
+ dw_axi_dma_handle_ch(chan);
+
status = dma_cookie_status(dchan, cookie, txstate);
if (status == DMA_COMPLETE || !txstate)
return status;
diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
index f57961620d2d..e4fbc38446ec 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
@@ -54,6 +54,7 @@ struct axi_dma_chan {
bool cyclic;
/* these other elements are all protected by vc.lock */
bool is_paused;
+ bool polled;
};
struct dw_axi_dma {
--
2.39.2
Powered by blists - more mailing lists