qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Align Raspberry Pi DMA interrupts with Linux DTS


From: Peter Maydell
Subject: Re: [PATCH] Align Raspberry Pi DMA interrupts with Linux DTS
Date: Sun, 26 Jun 2022 11:16:18 +0100

On Fri, 24 Jun 2022 at 21:54, Andrey Makarov <ph.makarov@gmail.com> wrote:
>
> All Raspberry Pi models 1-3 (based on bcm2835) have
> Linux device tree (arch/arm/boot/dts/bcm2835-common.dtsi +25):
>
>     /* dma channel 11-14 share one irq */
>
> which mismatched the Qemu model.
> In this patch channels 0--10 and 11--14 are handled separately.

Is there any hardware documentation that says whether QEMU or
the DTB is correct? The device tree is at best a secondary source...

> Signed-off-by: Andrey Makarov <andrey.makarov@auriga.com>
> ---
>  hw/arm/bcm2835_peripherals.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c
> index 48538c9360..3d808b0e31 100644
> --- a/hw/arm/bcm2835_peripherals.c
> +++ b/hw/arm/bcm2835_peripherals.c
> @@ -322,13 +322,21 @@ static void bcm2835_peripherals_realize(DeviceState 
> *dev, Error **errp)
>      memory_region_add_subregion(&s->peri_mr, DMA15_OFFSET,
>                  sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->dma), 1));
>
> -    for (n = 0; n <= 12; n++) {
> +    for (n = 0; n <= 10; n++) {
>          sysbus_connect_irq(SYS_BUS_DEVICE(&s->dma), n,
>                             qdev_get_gpio_in_named(DEVICE(&s->ic),
>                                                    BCM2835_IC_GPU_IRQ,
>                                                    INTERRUPT_DMA0 + n));
>      }
>
> +    /* According to DTS, dma channels 11-14 share one irq */
> +    for (n = 11; n <= 14; n++) {
> +        sysbus_connect_irq(SYS_BUS_DEVICE(&s->dma), n,
> +                           qdev_get_gpio_in_named(DEVICE(&s->ic),
> +                                                  BCM2835_IC_GPU_IRQ,
> +                                                  INTERRUPT_DMA0 + 11));

You can't connect multiple qemu_irq lines to one like this.
If the hardware behaves this way then you need to create
an OR gate, wire all the lines from the devices to the
OR gate inputs, and wire the OR gate output to the destination.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]