Skip to content

Commit 8d2f59d

Browse files
fancervinodkoul
authored andcommitted
dmaengine: dw: Ignore burst setting for memory peripherals
According to the DW DMA controller Databook 2.18b (page 40 "3.5 Memory Peripherals") memory peripherals don't have handshaking interface connected to the controller, therefore they can never be a flow controller. Since the CTLx.SRC_MSIZE and CTLx.DEST_MSIZE are properties valid only for peripherals with a handshaking interface, we can freely zero these fields out if the memory peripheral is selected to be the source or the destination of the DMA transfers. Note according to the databook, length of burst transfers to memory is always equal to the number of data items available in a channel FIFO or data items required to complete the block transfer, whichever is smaller; length of burst transfers from memory is always equal to the space available in a channel FIFO or number of data items required to complete the block transfer, whichever is smaller. Signed-off-by: Serge Semin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 0ed725d commit 8d2f59d

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

drivers/dma/dw/dw.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ static size_t dw_dma_block2bytes(struct dw_dma_chan *dwc, u32 block, u32 width)
6767
static u32 dw_dma_prepare_ctllo(struct dw_dma_chan *dwc)
6868
{
6969
struct dma_slave_config *sconfig = &dwc->dma_sconfig;
70-
bool is_slave = is_slave_direction(dwc->direction);
71-
u8 smsize = is_slave ? sconfig->src_maxburst : DW_DMA_MSIZE_16;
72-
u8 dmsize = is_slave ? sconfig->dst_maxburst : DW_DMA_MSIZE_16;
70+
u8 smsize = (dwc->direction == DMA_DEV_TO_MEM) ? sconfig->src_maxburst : 0;
71+
u8 dmsize = (dwc->direction == DMA_MEM_TO_DEV) ? sconfig->dst_maxburst : 0;
7372
u8 p_master = dwc->dws.p_master;
7473
u8 m_master = dwc->dws.m_master;
7574
u8 dms = (dwc->direction == DMA_MEM_TO_DEV) ? p_master : m_master;

drivers/dma/dw/idma32.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ static size_t idma32_block2bytes(struct dw_dma_chan *dwc, u32 block, u32 width)
7373
static u32 idma32_prepare_ctllo(struct dw_dma_chan *dwc)
7474
{
7575
struct dma_slave_config *sconfig = &dwc->dma_sconfig;
76-
bool is_slave = is_slave_direction(dwc->direction);
77-
u8 smsize = is_slave ? sconfig->src_maxburst : IDMA32_MSIZE_8;
78-
u8 dmsize = is_slave ? sconfig->dst_maxburst : IDMA32_MSIZE_8;
76+
u8 smsize = (dwc->direction == DMA_DEV_TO_MEM) ? sconfig->src_maxburst : 0;
77+
u8 dmsize = (dwc->direction == DMA_MEM_TO_DEV) ? sconfig->dst_maxburst : 0;
7978

8079
return DWC_CTLL_LLP_D_EN | DWC_CTLL_LLP_S_EN |
8180
DWC_CTLL_DST_MSIZE(dmsize) | DWC_CTLL_SRC_MSIZE(smsize);

0 commit comments

Comments
 (0)