diff mbox series

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

Message ID 20201124094941.485767-3-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 SoC (using an unique name).

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

Comments

Alistair Francis Dec. 1, 2020, 1:51 a.m. UTC | #1
On Tue, Nov 24, 2020 at 1:55 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 SoC (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/exynos4210.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
> index ced2769b102..a60f08d372a 100644
> --- a/hw/arm/exynos4210.c
> +++ b/hw/arm/exynos4210.c
> @@ -408,6 +408,7 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
>
>      /*** SD/MMC host controllers ***/
>      for (n = 0; n < EXYNOS4210_SDHCI_NUMBER; n++) {
> +        g_autofree char *bus_name = NULL;
>          DeviceState *carddev;
>          BlockBackend *blk;
>          DriveInfo *di;
> @@ -432,6 +433,10 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
>          sysbus_mmio_map(busdev, 0, EXYNOS4210_SDHCI_ADDR(n));
>          sysbus_connect_irq(busdev, 0, s->irq_table[exynos4210_get_irq(29, n)]);
>
> +        /* Alias controller SD bus to the SoC itself */
> +        bus_name = g_strdup_printf("sd-bus%d", n);
> +        object_property_add_alias(OBJECT(s), bus_name, OBJECT(dev), "sd-bus");
> +
>          di = drive_get(IF_SD, 0, n);
>          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/exynos4210.c b/hw/arm/exynos4210.c
index ced2769b102..a60f08d372a 100644
--- a/hw/arm/exynos4210.c
+++ b/hw/arm/exynos4210.c
@@ -408,6 +408,7 @@  static void exynos4210_realize(DeviceState *socdev, Error **errp)
 
     /*** SD/MMC host controllers ***/
     for (n = 0; n < EXYNOS4210_SDHCI_NUMBER; n++) {
+        g_autofree char *bus_name = NULL;
         DeviceState *carddev;
         BlockBackend *blk;
         DriveInfo *di;
@@ -432,6 +433,10 @@  static void exynos4210_realize(DeviceState *socdev, Error **errp)
         sysbus_mmio_map(busdev, 0, EXYNOS4210_SDHCI_ADDR(n));
         sysbus_connect_irq(busdev, 0, s->irq_table[exynos4210_get_irq(29, n)]);
 
+        /* Alias controller SD bus to the SoC itself */
+        bus_name = g_strdup_printf("sd-bus%d", n);
+        object_property_add_alias(OBJECT(s), bus_name, OBJECT(dev), "sd-bus");
+
         di = drive_get(IF_SD, 0, n);
         blk = di ? blk_by_legacy_dinfo(di) : NULL;
         carddev = qdev_new(TYPE_SD_CARD);