summary refs log tree commit diff stats
path: root/hw/arm/imx25_pdk.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2020-03-10 14:51:45 -0700
committerPeter Maydell <peter.maydell@linaro.org>2020-03-12 16:27:33 +0000
commitbfae1772c4377fdaa1b33ca361edf8d70a7ae820 (patch)
treef8b362f9eb791d196765d6e4e97e867598fe0df6 /hw/arm/imx25_pdk.c
parentd6f33c557ce9e4a9c5c7285e7aa71b5884241629 (diff)
downloadfocaccia-qemu-bfae1772c4377fdaa1b33ca361edf8d70a7ae820.tar.gz
focaccia-qemu-bfae1772c4377fdaa1b33ca361edf8d70a7ae820.zip
hw/arm/fsl-imx25: Wire up eSDHC controllers
Wire up eSDHC controllers in fsl-imx25. For imx25-pdk, connect drives
provided on the command line to available eSDHC controllers.

This patch enables booting the imx25-pdk emulation from SD card.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Message-id: 20200310215146.19688-2-linux@roeck-us.net
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: made commit subject consistent with other patch]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/arm/imx25_pdk.c')
-rw-r--r--hw/arm/imx25_pdk.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c
index 26713d9a7e..b3ca82bafa 100644
--- a/hw/arm/imx25_pdk.c
+++ b/hw/arm/imx25_pdk.c
@@ -26,6 +26,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "cpu.h"
+#include "hw/qdev-properties.h"
 #include "hw/arm/fsl-imx25.h"
 #include "hw/boards.h"
 #include "qemu/error-report.h"
@@ -120,6 +121,21 @@ static void imx25_pdk_init(MachineState *machine)
     imx25_pdk_binfo.board_id = 1771,
     imx25_pdk_binfo.nb_cpus = 1;
 
+    for (i = 0; i < FSL_IMX25_NUM_ESDHCS; i++) {
+        BusState *bus;
+        DeviceState *carddev;
+        DriveInfo *di;
+        BlockBackend *blk;
+
+        di = drive_get_next(IF_SD);
+        blk = di ? blk_by_legacy_dinfo(di) : NULL;
+        bus = qdev_get_child_bus(DEVICE(&s->soc.esdhc[i]), "sd-bus");
+        carddev = qdev_create(bus, TYPE_SD_CARD);
+        qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
+        object_property_set_bool(OBJECT(carddev), true,
+                                 "realized", &error_fatal);
+    }
+
     /*
      * We test explicitly for qtest here as it is not done (yet?) in
      * arm_load_kernel(). Without this the "make check" command would