mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53: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
|
@ -207,6 +207,11 @@ static void fsl_imx8mp_init(Object *obj)
|
|||
g_autofree char *name = g_strdup_printf("uart%d", i + 1);
|
||||
object_initialize_child(obj, name, &s->uart[i], TYPE_IMX_SERIAL);
|
||||
}
|
||||
|
||||
for (i = 0; i < FSL_IMX8MP_NUM_USDHCS; i++) {
|
||||
g_autofree char *name = g_strdup_printf("usdhc%d", i + 1);
|
||||
object_initialize_child(obj, name, &s->usdhc[i], TYPE_IMX_USDHC);
|
||||
}
|
||||
}
|
||||
|
||||
static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
|
||||
|
@ -346,6 +351,28 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
|
|||
qdev_get_gpio_in(gicdev, serial_table[i].irq));
|
||||
}
|
||||
|
||||
/* USDHCs */
|
||||
for (i = 0; i < FSL_IMX8MP_NUM_USDHCS; i++) {
|
||||
struct {
|
||||
hwaddr addr;
|
||||
unsigned int irq;
|
||||
} usdhc_table[FSL_IMX8MP_NUM_USDHCS] = {
|
||||
{ fsl_imx8mp_memmap[FSL_IMX8MP_USDHC1].addr, FSL_IMX8MP_USDHC1_IRQ },
|
||||
{ fsl_imx8mp_memmap[FSL_IMX8MP_USDHC2].addr, FSL_IMX8MP_USDHC2_IRQ },
|
||||
{ fsl_imx8mp_memmap[FSL_IMX8MP_USDHC3].addr, FSL_IMX8MP_USDHC3_IRQ },
|
||||
};
|
||||
|
||||
object_property_set_uint(OBJECT(&s->usdhc[i]), "vendor",
|
||||
SDHCI_VENDOR_IMX, &error_abort);
|
||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->usdhc[i]), errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(&s->usdhc[i]), 0, usdhc_table[i].addr);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->usdhc[i]), 0,
|
||||
qdev_get_gpio_in(gicdev, usdhc_table[i].irq));
|
||||
}
|
||||
|
||||
/* SNVS */
|
||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->snvs), errp)) {
|
||||
return;
|
||||
|
@ -363,6 +390,7 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
|
|||
case FSL_IMX8MP_RAM:
|
||||
case FSL_IMX8MP_SNVS_HP:
|
||||
case FSL_IMX8MP_UART1 ... FSL_IMX8MP_UART4:
|
||||
case FSL_IMX8MP_USDHC1 ... FSL_IMX8MP_USDHC3:
|
||||
/* device implemented and treated above */
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue