* [PATCH v2 1/2] bcm2835_dma: Fix the ylen loop in TD mode
@ 2020-02-03 15:40 Rene Stange
2020-02-03 16:27 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 2+ messages in thread
From: Rene Stange @ 2020-02-03 15:40 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Peter Maydell, qemu-arm, qemu-devel, Andrew Baumann
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>
---
hw/dma/bcm2835_dma.c | 4 ++--
1 file 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;
--
2.16.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v2 1/2] bcm2835_dma: Fix the ylen loop in TD mode
2020-02-03 15:40 [PATCH v2 1/2] bcm2835_dma: Fix the ylen loop in TD mode Rene Stange
@ 2020-02-03 16:27 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-03 16:27 UTC (permalink / raw)
To: Rene Stange; +Cc: Peter Maydell, qemu-arm, qemu-devel, Andrew Baumann
On 2/3/20 4:40 PM, Rene Stange wrote:
> 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>
> ---
> hw/dma/bcm2835_dma.c | 4 ++--
> 1 file 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;
>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-03 16:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-03 15:40 [PATCH v2 1/2] bcm2835_dma: Fix the ylen loop in TD mode Rene Stange
2020-02-03 16:27 ` Philippe Mathieu-Daudé
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.