From: Jisheng Zhang <jszhang@kernel.org>
To: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>,
Vinod Koul <vkoul@kernel.org>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 11/11] dmaengine: dw-axi-dmac: support polled mode
Date: Sun, 21 May 2023 18:12:16 +0800 [thread overview]
Message-ID: <20230521101216.4084-12-jszhang@kernel.org> (raw)
In-Reply-To: <20230521101216.4084-1-jszhang@kernel.org>
Run in polled mode if the DMA_PREP_INTERRUPT flag is not provided.
Signed-off-by: Jisheng Zhang <jszhang@kernel.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 091c15c2ec31..37ab9a03d94b 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -390,7 +390,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;
@@ -721,6 +724,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;
@@ -803,6 +807,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) {
@@ -866,6 +871,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;
@@ -1146,6 +1152,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 1f9772e9be30..33ae4280dacc 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
@@ -55,6 +55,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.40.0
prev parent reply other threads:[~2023-05-21 11:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-21 10:12 [PATCH v3 00/11] dmaengine: dw-axi_dmac: bug fix clean up and more features Jisheng Zhang
2023-05-21 10:12 ` [PATCH v3 01/11] dmaengine: dw-axi-dmac: fix reading register when runtime suspended Jisheng Zhang
2023-05-21 10:12 ` [PATCH v3 02/11] dmaengine: dw-axi-dmac: remove unnecessary devm_free_irq() calling Jisheng Zhang
2023-05-21 10:12 ` [PATCH v3 03/11] dmaengine: dw-axi-dmac: remove unnecessary axi_dma_enable() calling Jisheng Zhang
2023-05-21 10:12 ` [PATCH v3 04/11] dmaengine: dw-axi-dmac: remove redundant axi_dma_disable() calling Jisheng Zhang
2023-05-21 10:12 ` [PATCH v3 05/11] dmaengine: dw-axi-dmac: delay irq getting until request_irq Jisheng Zhang
2023-05-21 10:12 ` [PATCH v3 06/11] dmaengine: dw-axi-dmac: move ch irq handling into common routine Jisheng Zhang
2023-05-21 10:12 ` [PATCH v3 07/11] dmaengine: dw-axi-dmac: support per channel irq Jisheng Zhang
2023-05-21 10:12 ` [PATCH v3 08/11] dmaengine: dw-axi-dmac: support dma-channel-mask Jisheng Zhang
2023-05-21 10:12 ` [PATCH v3 09/11] dmaengine: dw-axi-dmac: try best to get residue when tx is running Jisheng Zhang
2023-05-21 10:12 ` [PATCH v3 10/11] dmaengine: dw-axi-dmac: move dma_chan_tx_status() Jisheng Zhang
2023-05-21 10:12 ` Jisheng Zhang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230521101216.4084-12-jszhang@kernel.org \
--to=jszhang@kernel.org \
--cc=Eugeniy.Paltsev@synopsys.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.