diff mbox series

[PATCH-for-5.2?,4/4] hw/arm/xilinx_zynq: Add SD bus QOM alias on the machine

Message ID 20201124094941.485767-5-f4bug@amsat.org
State New
Headers show
Series hw/arm: Add SD bus QOM alias on the machine/soc | expand

Commit Message

Philippe Mathieu-Daudé Nov. 24, 2020, 9:49 a.m. UTC
To be able to select a particular SD bus from the command
line, add a QOM alias on the machine (using an unique name).

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/arm/xilinx_zynq.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Alistair Francis Dec. 1, 2020, 1:55 a.m. UTC | #1
On Tue, Nov 24, 2020 at 1:50 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> To be able to select a particular SD bus from the command
> line, add a QOM alias on the machine (using an unique name).
>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/arm/xilinx_zynq.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
> index b72772bc824..6a4a1de88cf 100644
> --- a/hw/arm/xilinx_zynq.c
> +++ b/hw/arm/xilinx_zynq.c
> @@ -286,6 +286,7 @@ static void zynq_init(MachineState *machine)
>          DriveInfo *di;
>          BlockBackend *blk;
>          DeviceState *carddev;
> +        g_autofree char *bus_name = NULL;
>
>          /* Compatible with:
>           * - SD Host Controller Specification Version 2.0 Part A2
> @@ -299,6 +300,11 @@ static void zynq_init(MachineState *machine)
>          sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, hci_addr);
>          sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[hci_irq - IRQ_OFFSET]);
>
> +        /* Alias controller SD bus to the machine itself */
> +        bus_name = g_strdup_printf("sd-bus%d", n);
> +        object_property_add_alias(OBJECT(machine), bus_name,
> +                                  OBJECT(dev), "sd-bus");
> +
>          di = drive_get_next(IF_SD);
>          blk = di ? blk_by_legacy_dinfo(di) : NULL;
>          carddev = qdev_new(TYPE_SD_CARD);
> --
> 2.26.2
>
>
diff mbox series

Patch

diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index b72772bc824..6a4a1de88cf 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -286,6 +286,7 @@  static void zynq_init(MachineState *machine)
         DriveInfo *di;
         BlockBackend *blk;
         DeviceState *carddev;
+        g_autofree char *bus_name = NULL;
 
         /* Compatible with:
          * - SD Host Controller Specification Version 2.0 Part A2
@@ -299,6 +300,11 @@  static void zynq_init(MachineState *machine)
         sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, hci_addr);
         sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[hci_irq - IRQ_OFFSET]);
 
+        /* Alias controller SD bus to the machine itself */
+        bus_name = g_strdup_printf("sd-bus%d", n);
+        object_property_add_alias(OBJECT(machine), bus_name,
+                                  OBJECT(dev), "sd-bus");
+
         di = drive_get_next(IF_SD);
         blk = di ? blk_by_legacy_dinfo(di) : NULL;
         carddev = qdev_new(TYPE_SD_CARD);