Commit 67e13e8
dmaengine: stm32-dma: fix residue in case of MDMA chaining
In case of MDMA chaining, DMA is configured in Double-Buffer Mode (DBM)
with two periods, but if transfer has been prepared with _prep_slave_sg(),
the transfer is not marked cyclic (=!chan->desc->cyclic). However, as DBM
is activated for MDMA chaining, residue computation must take into account
cyclic constraints.
With only two periods in MDMA chaining, and no update due to Transfer
Complete interrupt masked, n_sg is always 0. If DMA current memory address
(depending on SxCR.CT and SxM0AR/SxM1AR) does not correspond, it means n_sg
should be increased.
Then, the residue of the current period is the one read from SxNDTR and
should not be overwritten with the full period length.
Fixes: 7237951 ("dmaengine: stm32-dma: add support to trigger STM32 MDMA")
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20231004155024.2609531-2-amelie.delaunay@foss.st.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>1 parent 2df467e commit 67e13e8
1 file changed
+4
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1389 | 1389 | | |
1390 | 1390 | | |
1391 | 1391 | | |
1392 | | - | |
| 1392 | + | |
1393 | 1393 | | |
1394 | 1394 | | |
1395 | 1395 | | |
1396 | | - | |
| 1396 | + | |
| 1397 | + | |
1397 | 1398 | | |
1398 | 1399 | | |
1399 | 1400 | | |
| |||
1403 | 1404 | | |
1404 | 1405 | | |
1405 | 1406 | | |
1406 | | - | |
| 1407 | + | |
1407 | 1408 | | |
1408 | 1409 | | |
1409 | 1410 | | |
| |||
0 commit comments