qemu-arm
[Top][All Lists]
Advanced

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

Re: [Qemu-arm] [PATCH v6 5/6] xlnx-zynqmp: Connect the SPI devices


From: Peter Maydell
Subject: Re: [Qemu-arm] [PATCH v6 5/6] xlnx-zynqmp: Connect the SPI devices
Date: Thu, 7 Jan 2016 15:55:37 +0000

On 20 December 2015 at 05:43, Peter Crosthwaite
<address@hidden> wrote:
> From: Alistair Francis <address@hidden>
>
> Connect the Xilinx SPI devices to the ZynqMP model.
>
> Signed-off-by: Alistair Francis <address@hidden>
> [ PC changes
>  * Use QOM alias for bus connectivity on SoC level
> ]
> Signed-off-by: Peter Crosthwaite <address@hidden>

> @@ -286,6 +300,22 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error 
> **errp)
>          sysbus_connect_irq(SYS_BUS_DEVICE(&s->sdhci[i]), 0,
>                             gic_spi[sdhci_intr[i]]);
>      }
> +
> +    for (i = 0; i < XLNX_ZYNQMP_NUM_SPIS; i++) {
> +        char bus_name[6];
> +
> +        object_property_set_bool(OBJECT(&s->spi[i]), true, "realized", &err);
> +
> +        sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, spi_addr[i]);
> +        sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0,
> +                           gic_spi[spi_intr[i]]);
> +
> +        /* Alias controller SPI bus to the SoC itself */
> +        snprintf(bus_name, 6, "spi%d", i);

I don't much like these hard coded 6s. This is in init which
isn't a hot path, so the simplest thing is to use g_strdup_printf()
and then g_free() it when we're done.

Similarly in patch 6.

Otherwise I like this; I did a quick tweak to my sd card patchset
to use this approach and it seems to at least compile and do
the right thing in info qtree (I don't have a xilinx test image
to do more).

Haven't looked at the detail of how we're doing this in patch 1 yet.

thanks
-- PMM



reply via email to

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