1 From 12781d819224f6ef6af69ad5462b2591cd5cbcd7 Mon Sep 17 00:00:00 2001
2 From: Eric Long <eric.long@unisoc.com>
3 Date: Mon, 6 May 2019 15:28:31 +0800
4 Subject: dmaengine: sprd: Fix block length overflow
6 [ Upstream commit 89d03b3c126d683f7b2cd5b07178493993d12448 ]
8 The maximum value of block length is 0xffff, so if the configured transfer length
9 is more than 0xffff, that will cause block length overflow to lead a configuration
12 Thus we can set block length as the maximum burst length to avoid this issue, since
13 the maximum burst length will not be a big value which is more than 0xffff.
15 Signed-off-by: Eric Long <eric.long@unisoc.com>
16 Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
17 Signed-off-by: Vinod Koul <vkoul@kernel.org>
18 Signed-off-by: Sasha Levin <sashal@kernel.org>
20 drivers/dma/sprd-dma.c | 2 +-
21 1 file changed, 1 insertion(+), 1 deletion(-)
23 diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
24 index 55df0d41355b..1ed1c7efa288 100644
25 --- a/drivers/dma/sprd-dma.c
26 +++ b/drivers/dma/sprd-dma.c
27 @@ -663,7 +663,7 @@ static int sprd_dma_fill_desc(struct dma_chan *chan,
28 temp |= slave_cfg->src_maxburst & SPRD_DMA_FRG_LEN_MASK;
31 - hw->blk_len = len & SPRD_DMA_BLK_LEN_MASK;
32 + hw->blk_len = slave_cfg->src_maxburst & SPRD_DMA_BLK_LEN_MASK;
33 hw->trsc_len = len & SPRD_DMA_TRSC_LEN_MASK;
35 temp = (dst_step & SPRD_DMA_TRSF_STEP_MASK) << SPRD_DMA_DEST_TRSF_STEP_OFFSET;