[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/11] hw/arm/omap1: Inline creation of MMC
From: |
Peter Maydell |
Subject: |
[PATCH 06/11] hw/arm/omap1: Inline creation of MMC |
Date: |
Tue, 28 Jan 2025 10:45:14 +0000 |
Our style for other conversions of OMAP devices to qdev has been to
inline the creation and wiring into omap310_mpu_init() -- see for
instance the handling of omap-intc, omap-gpio and omap_i2c. Do
the same for omap-mmc.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm/omap1.c | 15 +++++++++++----
hw/sd/omap_mmc.c | 22 ----------------------
2 files changed, 11 insertions(+), 26 deletions(-)
diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
index 15ba0a0d0c4..ca2eb0d1576 100644
--- a/hw/arm/omap1.c
+++ b/hw/arm/omap1.c
@@ -3981,10 +3981,17 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion
*dram,
if (!dinfo && !qtest_enabled()) {
warn_report("missing SecureDigital device");
}
- s->mmc = omap_mmc_init(0xfffb7800, system_memory,
- qdev_get_gpio_in(s->ih[1], OMAP_INT_OQN),
- &s->drq[OMAP_DMA_MMC_TX],
- omap_findclk(s, "mmc_ck"));
+
+ s->mmc = qdev_new(TYPE_OMAP_MMC);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(s->mmc), &error_fatal);
+ omap_mmc_set_clk(s->mmc, omap_findclk(s, "mmc_ck"));
+
+ memory_region_add_subregion(system_memory, 0xfffb7800,
+ sysbus_mmio_get_region(SYS_BUS_DEVICE(s->mmc),
0));
+ qdev_connect_gpio_out_named(s->mmc, "dma-tx", 0, s->drq[OMAP_DMA_MMC_TX]);
+ qdev_connect_gpio_out_named(s->mmc, "dma-rx", 0, s->drq[OMAP_DMA_MMC_RX]);
+ sysbus_connect_irq(SYS_BUS_DEVICE(s->mmc), 0,
+ qdev_get_gpio_in(s->ih[1], OMAP_INT_OQN));
if (dinfo) {
DeviceState *card = qdev_new(TYPE_SD_CARD);
diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c
index fcec2899afb..dacbea13aad 100644
--- a/hw/sd/omap_mmc.c
+++ b/hw/sd/omap_mmc.c
@@ -590,28 +590,6 @@ void omap_mmc_set_clk(DeviceState *dev, omap_clk clk)
s->clk = clk;
}
-DeviceState *omap_mmc_init(hwaddr base,
- MemoryRegion *sysmem,
- qemu_irq irq, qemu_irq dma[], omap_clk clk)
-{
- DeviceState *dev;
- OMAPMMCState *s;
-
- dev = qdev_new(TYPE_OMAP_MMC);
- s = OMAP_MMC(dev);
- sysbus_realize_and_unref(SYS_BUS_DEVICE(s), &error_fatal);
-
- omap_mmc_set_clk(dev, clk);
-
- memory_region_add_subregion(sysmem, base,
- sysbus_mmio_get_region(SYS_BUS_DEVICE(s), 0));
- qdev_connect_gpio_out_named(dev, "dma-tx", 0, dma[0]);
- qdev_connect_gpio_out_named(dev, "dma-rx", 0, dma[1]);
- sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq);
-
- return dev;
-}
-
static void omap_mmc_reset_hold(Object *obj, ResetType type)
{
OMAPMMCState *s = OMAP_MMC(obj);
--
2.34.1
- [PATCH 00/11] hw/sd: QOMify omap-mmc, remove legacy APIs, Peter Maydell, 2025/01/28
- [PATCH 01/11] hw/sd/omap_mmc: Do a minimal conversion to QDev, Peter Maydell, 2025/01/28
- [PATCH 02/11] hw/sd/omap_mmc: Convert remaining 'struct omap_mmc_s' uses to OMAPMMCState, Peter Maydell, 2025/01/28
- [PATCH 06/11] hw/arm/omap1: Inline creation of MMC,
Peter Maydell <=
- [PATCH 07/11] hw/sd/omap_mmc: Remove unused coverswitch qemu_irq, Peter Maydell, 2025/01/28
- [PATCH 11/11] hw/sd: Remove unused SDState::enable, Peter Maydell, 2025/01/28
- [PATCH 03/11] hw/sd/omap_mmc: Convert output qemu_irqs to gpio and sysbus IRQ APIs, Peter Maydell, 2025/01/28