diff options
Diffstat (limited to 'hw/lm32/milkymist.c')
-rw-r--r-- | hw/lm32/milkymist.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index 469e3c4322..9f8fe9fef1 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -34,6 +34,7 @@ #include "elf.h" #include "milkymist-hw.h" #include "hw/display/milkymist_tmu2.h" +#include "hw/sd/sd.h" #include "lm32.h" #include "exec/address-spaces.h" #include "qemu/cutils.h" @@ -83,11 +84,23 @@ static void main_cpu_reset(void *opaque) static DeviceState *milkymist_memcard_create(hwaddr base) { DeviceState *dev; + DriveInfo *dinfo; dev = qdev_new("milkymist-memcard"); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); + dinfo = drive_get_next(IF_SD); + if (dinfo) { + DeviceState *card; + + card = qdev_new(TYPE_SD_CARD); + qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo), + &error_fatal); + qdev_realize_and_unref(card, qdev_get_child_bus(dev, "sd-bus"), + &error_fatal); + } + return dev; } |