diff options
author | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2020-07-05 23:03:34 +0200 |
---|---|---|
committer | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2020-08-21 16:22:43 +0200 |
commit | a8c73ca21a6f86daa53c2dbeeb8abf06dd1aeec9 (patch) | |
tree | 74467b8df68f685fcd3a7db1d6503df15bb74494 /hw/lm32 | |
parent | ae7ba8e04a4faccfb515c9e6a72892307c4bab1e (diff) |
hw/sd/milkymist: Do not create SD card within the SD host controller
SD/MMC host controllers provide a SD Bus to plug SD cards,
but don't come with SD card plugged in :) Let the machine/board
model create and plug the SD cards when required.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20200705211016.15241-5-f4bug@amsat.org>
Diffstat (limited to 'hw/lm32')
-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; } |