Commit 16bf0e0e authored by Peter Maydell's avatar Peter Maydell
Browse files

hw/sd/milkymist-memcard: Reset SD card on controller reset



Since milkymist-memcard is still using the legacy SD card API,
the SD card created by sd_init() is not plugged into any bus.
This means that the controller has to reset it manually.

Failing to do this mostly didn't affect the guest since the
guest typically does a programmed SD card reset as part of
its SD controller driver initialization, but meant that
migration failed because it's only in sd_reset() that we
set up the wpgrps_size field.

Cc: qemu-stable@nongnu.org
Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 1515506513-31961-3-git-send-email-peter.maydell@linaro.org
parent 0cb57cc7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -248,6 +248,10 @@ static void milkymist_memcard_reset(DeviceState *d)
    for (i = 0; i < R_MAX; i++) {
        s->regs[i] = 0;
    }
    /* Since we're still using the legacy SD API the card is not plugged
     * into any bus, and we must reset it manually.
     */
    device_reset(DEVICE(s->card));
}

static int milkymist_memcard_init(SysBusDevice *dev)