summary refs log tree commit diff stats
path: root/hw/dma/bcm2835_dma.c
diff options
context:
space:
mode:
authorRene Stange <rsta2@o2online.de>2020-02-07 14:04:27 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-02-07 14:04:27 +0000
commiteb87ff05eab2a39bc0fcd8b4ec51433c4e7fbe42 (patch)
tree457bc59d7ea9df52e6dcea742add7c02399bc87b /hw/dma/bcm2835_dma.c
parentd63d0ec59d87a698de5ed843288f90a23470cf2e (diff)
downloadfocaccia-qemu-eb87ff05eab2a39bc0fcd8b4ec51433c4e7fbe42.tar.gz
focaccia-qemu-eb87ff05eab2a39bc0fcd8b4ec51433c4e7fbe42.zip
bcm2835_dma: Fix the ylen loop in TD mode
In TD (two dimensions) DMA mode ylen has to be increased by one after
reading it from the TXFR_LEN register, because a value of zero has to
result in one run through of the ylen loop. This has been tested on a
real Raspberry Pi 3 Model B+. In the previous implementation the ylen
loop was not passed at all for a value of zero.

Signed-off-by: Rene Stange <rsta2@o2online.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/dma/bcm2835_dma.c')
-rw-r--r--hw/dma/bcm2835_dma.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c
index 1e458d7fba..667d951a6f 100644
--- a/hw/dma/bcm2835_dma.c
+++ b/hw/dma/bcm2835_dma.c
@@ -70,14 +70,14 @@ static void bcm2835_dma_update(BCM2835DMAState *s, unsigned c)
         ch->stride = ldl_le_phys(&s->dma_as, ch->conblk_ad + 16);
         ch->nextconbk = ldl_le_phys(&s->dma_as, ch->conblk_ad + 20);
 
+        ylen = 1;
         if (ch->ti & BCM2708_DMA_TDMODE) {
             /* 2D transfer mode */
-            ylen = (ch->txfr_len >> 16) & 0x3fff;
+            ylen += (ch->txfr_len >> 16) & 0x3fff;
             xlen = ch->txfr_len & 0xffff;
             dst_stride = ch->stride >> 16;
             src_stride = ch->stride & 0xffff;
         } else {
-            ylen = 1;
             xlen = ch->txfr_len;
             dst_stride = 0;
             src_stride = 0;