mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
hw/arm/fsl-imx8mp: Add USDHC storage controllers
The USDHC emulation allows for running real-world images such as those generated by Buildroot. Convert the board documentation accordingly instead of running a Linux kernel with ephemeral storage. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Bernhard Beschow <shentey@gmail.com> Message-id: 20250223114708.1780-8-shentey@gmail.com [PMM: drop 'static const' from usdhc_table[] for GCC 7.5] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
487967bed6
commit
a81193c3e9
5 changed files with 66 additions and 6 deletions
|
@ -11,6 +11,7 @@
|
|||
#include "hw/arm/boot.h"
|
||||
#include "hw/arm/fsl-imx8mp.h"
|
||||
#include "hw/boards.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "system/qtest.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qapi/error.h"
|
||||
|
@ -40,6 +41,23 @@ static void imx8mp_evk_init(MachineState *machine)
|
|||
memory_region_add_subregion(get_system_memory(), FSL_IMX8MP_RAM_START,
|
||||
machine->ram);
|
||||
|
||||
for (int i = 0; i < FSL_IMX8MP_NUM_USDHCS; i++) {
|
||||
BusState *bus;
|
||||
DeviceState *carddev;
|
||||
BlockBackend *blk;
|
||||
DriveInfo *di = drive_get(IF_SD, i, 0);
|
||||
|
||||
if (!di) {
|
||||
continue;
|
||||
}
|
||||
|
||||
blk = blk_by_legacy_dinfo(di);
|
||||
bus = qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus");
|
||||
carddev = qdev_new(TYPE_SD_CARD);
|
||||
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
|
||||
qdev_realize_and_unref(carddev, bus, &error_fatal);
|
||||
}
|
||||
|
||||
if (!qtest_enabled()) {
|
||||
arm_load_kernel(&s->cpu[0], machine, &boot_info);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue