]>
Commit | Line | Data |
---|---|---|
1 | From 4fdf8876020075dd12ca890ca77ad70eb66f4b99 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 | |
5 | ||
6 | [ Upstream commit 89d03b3c126d683f7b2cd5b07178493993d12448 ] | |
7 | ||
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 | |
10 | error. | |
11 | ||
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. | |
14 | ||
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> | |
19 | --- | |
20 | drivers/dma/sprd-dma.c | 2 +- | |
21 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
22 | ||
23 | diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c | |
24 | index 0f92e60529d1..a01c23246632 100644 | |
25 | --- a/drivers/dma/sprd-dma.c | |
26 | +++ b/drivers/dma/sprd-dma.c | |
27 | @@ -778,7 +778,7 @@ static int sprd_dma_fill_desc(struct dma_chan *chan, | |
28 | temp |= slave_cfg->src_maxburst & SPRD_DMA_FRG_LEN_MASK; | |
29 | hw->frg_len = temp; | |
30 | ||
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; | |
34 | ||
35 | temp = (dst_step & SPRD_DMA_TRSF_STEP_MASK) << SPRD_DMA_DEST_TRSF_STEP_OFFSET; | |
36 | -- | |
37 | 2.20.1 | |
38 |