Skip to content

Commit 689379c

Browse files
wangbaolin719vinodkoul
authored andcommitted
dmaengine: sprd: Fix the DMA link-list configuration
For the Spreadtrum DMA link-list mode, when the DMA engine got a slave hardware request, which will trigger the DMA engine to load the DMA configuration from the link-list memory automatically. But before the slave hardware request, the slave will get an incorrect residue due to the first node used to trigger the link-list was configured as the last source address and destination address. Thus we should make sure the first node was configured the start source address and destination address, which can fix this issue. Fixes: 4ac6954 ("dmaengine: sprd: Support DMA link-list mode") Signed-off-by: Baolin Wang <[email protected]> Link: https://lore.kernel.org/r/77868edb7aff9d5cb12ac3af8827ef2e244441a6.1567150471.git.baolin.wang@linaro.org Signed-off-by: Vinod Koul <[email protected]>
1 parent 962411b commit 689379c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/dma/sprd-dma.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ sprd_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
908908
struct sprd_dma_chn *schan = to_sprd_dma_chan(chan);
909909
struct dma_slave_config *slave_cfg = &schan->slave_cfg;
910910
dma_addr_t src = 0, dst = 0;
911+
dma_addr_t start_src = 0, start_dst = 0;
911912
struct sprd_dma_desc *sdesc;
912913
struct scatterlist *sg;
913914
u32 len = 0;
@@ -954,6 +955,11 @@ sprd_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
954955
dst = sg_dma_address(sg);
955956
}
956957

958+
if (!i) {
959+
start_src = src;
960+
start_dst = dst;
961+
}
962+
957963
/*
958964
* The link-list mode needs at least 2 link-list
959965
* configurations. If there is only one sg, it doesn't
@@ -970,8 +976,8 @@ sprd_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
970976
}
971977
}
972978

973-
ret = sprd_dma_fill_desc(chan, &sdesc->chn_hw, 0, 0, src, dst, len,
974-
dir, flags, slave_cfg);
979+
ret = sprd_dma_fill_desc(chan, &sdesc->chn_hw, 0, 0, start_src,
980+
start_dst, len, dir, flags, slave_cfg);
975981
if (ret) {
976982
kfree(sdesc);
977983
return NULL;

0 commit comments

Comments
 (0)