Skip to content

Commit 0f9d5f0

Browse files
fancervinodkoul
authored andcommitted
dmaengine: dw: Initialize max_sg_burst capability
Multi-block support provides a way to map the kernel-specific SG-table so the DW DMA device would handle it as a whole instead of handling the SG-list items or so called LLP block items one by one. So if true LLP list isn't supported by the DW DMA engine, then soft-LLP mode will be utilized to load and execute each LLP-block one by one. The soft-LLP mode of the DMA transactions execution might not work well for some DMA consumers like SPI due to its Tx and Rx buffers inter-dependency. Let's initialize the max_sg_burst DMA channels capability based on the nollp flag state. If it's true, no hardware accelerated LLP is available and max_sg_burst should be set with 1, which means that the DMA engine can handle only a single SG list entry at a time. If noLLP is set to false, then hardware accelerated LLP is supported and the DMA engine can handle infinite number of SG entries in a single DMA transaction. Signed-off-by: Serge Semin <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent ca7f285 commit 0f9d5f0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/dma/dw/core.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,18 @@ static void dwc_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
10591059
struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
10601060

10611061
caps->max_burst = dwc->max_burst;
1062+
1063+
/*
1064+
* It might be crucial for some devices to have the hardware
1065+
* accelerated multi-block transfers supported, aka LLPs in DW DMAC
1066+
* notation. So if LLPs are supported then max_sg_burst is set to
1067+
* zero which means unlimited number of SG entries can be handled in a
1068+
* single DMA transaction, otherwise it's just one SG entry.
1069+
*/
1070+
if (dwc->nollp)
1071+
caps->max_sg_burst = 1;
1072+
else
1073+
caps->max_sg_burst = 0;
10621074
}
10631075

10641076
int do_dma_probe(struct dw_dma_chip *chip)

0 commit comments

Comments
 (0)