* [v3,1/1] dmaengine: dw-axi-dmac: Support src_maxburst and dst_maxburst
@ 2023-11-06 9:50 Tan En De
2024-03-28 0:34 ` EnDe Tan
0 siblings, 1 reply; 3+ messages in thread
From: Tan En De @ 2023-11-06 9:50 UTC (permalink / raw)
To: dmaengine; +Cc: Eugeniy.Paltsev, vkoul, Tan En De
Current implementation has hardcoded CHx_CTL.SRC_MSIZE and
CHx_CTL.DST_MSIZE with a constant, namely DWAXIDMAC_BURST_TRANS_LEN_4.
However, to support hardware with different source/destination burst
transaction length, the aforementioned values shall be configurable
based on dma_slave_config set by client driver.
So, this commit is to allow client driver to configure
- CHx_CTL.SRC_MSIZE via dma_slave_config.src_maxburst
- CHx_CTL.DST_MSIZE via dma_slave_config.dst_maxburst
Signed-off-by: Tan En De <ende.tan@starfivetech.com>
---
v2 -> v3:
- Removed the use of dma_slave_config in dma_chan_prep_dma_memcpy.
---
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 18 +++++++++++++++---
drivers/dma/dw-axi-dmac/dw-axi-dmac.h | 3 ++-
2 files changed, 17 insertions(+), 4 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 a86a81ff0caa..2a4747917a3e 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -656,7 +656,7 @@ static int dw_axi_dma_set_hw_desc(struct axi_dma_chan *chan,
size_t axi_block_ts;
size_t block_ts;
u32 ctllo, ctlhi;
- u32 burst_len;
+ u32 burst_len, src_burst_trans_len, dst_burst_trans_len;
axi_block_ts = chan->chip->dw->hdata->block_size[chan->id];
@@ -720,8 +720,20 @@ static int dw_axi_dma_set_hw_desc(struct axi_dma_chan *chan,
hw_desc->lli->block_ts_lo = cpu_to_le32(block_ts - 1);
- ctllo |= DWAXIDMAC_BURST_TRANS_LEN_4 << CH_CTL_L_DST_MSIZE_POS |
- DWAXIDMAC_BURST_TRANS_LEN_4 << CH_CTL_L_SRC_MSIZE_POS;
+ dst_burst_trans_len = chan->config.dst_maxburst ?
+ __ffs(chan->config.dst_maxburst) - 1 :
+ DWAXIDMAC_BURST_TRANS_LEN_4;
+ if (dst_burst_trans_len > DWAXIDMAC_BURST_TRANS_LEN_MAX)
+ return -EINVAL;
+ ctllo |= dst_burst_trans_len << CH_CTL_L_DST_MSIZE_POS;
+
+ src_burst_trans_len = chan->config.src_maxburst ?
+ __ffs(chan->config.src_maxburst) - 1 :
+ DWAXIDMAC_BURST_TRANS_LEN_4;
+ if (src_burst_trans_len > DWAXIDMAC_BURST_TRANS_LEN_MAX)
+ return -EINVAL;
+ ctllo |= src_burst_trans_len << CH_CTL_L_SRC_MSIZE_POS;
+
hw_desc->lli->ctl_lo = cpu_to_le32(ctllo);
set_desc_src_master(hw_desc);
diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
index 454904d99654..652e983409ba 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
@@ -269,7 +269,8 @@ enum {
DWAXIDMAC_BURST_TRANS_LEN_128,
DWAXIDMAC_BURST_TRANS_LEN_256,
DWAXIDMAC_BURST_TRANS_LEN_512,
- DWAXIDMAC_BURST_TRANS_LEN_1024
+ DWAXIDMAC_BURST_TRANS_LEN_1024,
+ DWAXIDMAC_BURST_TRANS_LEN_MAX = DWAXIDMAC_BURST_TRANS_LEN_1024
};
#define CH_CTL_L_DST_WIDTH_POS 11
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [v3,1/1] dmaengine: dw-axi-dmac: Support src_maxburst and dst_maxburst
2023-11-06 9:50 [v3,1/1] dmaengine: dw-axi-dmac: Support src_maxburst and dst_maxburst Tan En De
@ 2024-03-28 0:34 ` EnDe Tan
2024-04-17 17:16 ` Vinod Koul
0 siblings, 1 reply; 3+ messages in thread
From: EnDe Tan @ 2024-03-28 0:34 UTC (permalink / raw)
To: EnDe Tan, dmaengine@vger.kernel.org
Cc: Eugeniy.Paltsev@synopsys.com, vkoul@kernel.org, Leyfoon Tan,
JeeHeng Sia
Hi, I see this v3 patch has been marked "Changes Requested".
Is there any part to be further modified?
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [v3,1/1] dmaengine: dw-axi-dmac: Support src_maxburst and dst_maxburst
2024-03-28 0:34 ` EnDe Tan
@ 2024-04-17 17:16 ` Vinod Koul
0 siblings, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2024-04-17 17:16 UTC (permalink / raw)
To: EnDe Tan
Cc: dmaengine@vger.kernel.org, Eugeniy.Paltsev@synopsys.com,
Leyfoon Tan, JeeHeng Sia
On 28-03-24, 00:34, EnDe Tan wrote:
> Hi, I see this v3 patch has been marked "Changes Requested".
> Is there any part to be further modified?
Can you pls rebase this on dmaengine/next and send again
--
~Vinod
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-17 17:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-06 9:50 [v3,1/1] dmaengine: dw-axi-dmac: Support src_maxburst and dst_maxburst Tan En De
2024-03-28 0:34 ` EnDe Tan
2024-04-17 17:16 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox