[PATCH for-9.2 41/53] hw/sd: Remove omap2_mmc device

Peter Maydell posted 53 patches 2 months, 3 weeks ago
[PATCH for-9.2 41/53] hw/sd: Remove omap2_mmc device
Posted by Peter Maydell 2 months, 3 weeks ago
Remove the OMAP2 specific code from omap_mmc.c.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/hw/arm/omap.h |  5 ----
 hw/sd/omap_mmc.c      | 63 -------------------------------------------
 2 files changed, 68 deletions(-)

diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
index 67bb83dff5d..b0bd1e6f540 100644
--- a/include/hw/arm/omap.h
+++ b/include/hw/arm/omap.h
@@ -797,12 +797,7 @@ struct omap_mmc_s *omap_mmc_init(hwaddr base,
                 MemoryRegion *sysmem,
                 BlockBackend *blk,
                 qemu_irq irq, qemu_irq dma[], omap_clk clk);
-struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,
-                BlockBackend *blk, qemu_irq irq, qemu_irq dma[],
-                omap_clk fclk, omap_clk iclk);
 void omap_mmc_reset(struct omap_mmc_s *s);
-void omap_mmc_handlers(struct omap_mmc_s *s, qemu_irq ro, qemu_irq cover);
-void omap_mmc_enable(struct omap_mmc_s *s, int enable);
 
 /* omap_i2c.c */
 I2CBus *omap_i2c_bus(DeviceState *omap_i2c);
diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c
index edd3cf2a1eb..91e9a3f1c6a 100644
--- a/hw/sd/omap_mmc.c
+++ b/hw/sd/omap_mmc.c
@@ -573,24 +573,6 @@ static const MemoryRegionOps omap_mmc_ops = {
     .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
-static void omap_mmc_cover_cb(void *opaque, int line, int level)
-{
-    struct omap_mmc_s *host = opaque;
-
-    if (!host->cdet_state && level) {
-        host->status |= 0x0002;
-        omap_mmc_interrupts_update(host);
-        if (host->cdet_wakeup) {
-            /* TODO: Assert wake-up */
-        }
-    }
-
-    if (host->cdet_state != level) {
-        qemu_set_irq(host->coverswitch, level);
-        host->cdet_state = level;
-    }
-}
-
 struct omap_mmc_s *omap_mmc_init(hwaddr base,
                 MemoryRegion *sysmem,
                 BlockBackend *blk,
@@ -617,48 +599,3 @@ struct omap_mmc_s *omap_mmc_init(hwaddr base,
 
     return s;
 }
-
-struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,
-                BlockBackend *blk, qemu_irq irq, qemu_irq dma[],
-                omap_clk fclk, omap_clk iclk)
-{
-    struct omap_mmc_s *s = g_new0(struct omap_mmc_s, 1);
-
-    s->irq = irq;
-    s->dma = dma;
-    s->clk = fclk;
-    s->lines = 4;
-    s->rev = 2;
-
-    memory_region_init_io(&s->iomem, NULL, &omap_mmc_ops, s, "omap.mmc",
-                          omap_l4_region_size(ta, 0));
-    omap_l4_attach(ta, 0, &s->iomem);
-
-    /* Instantiate the storage */
-    s->card = sd_init(blk, false);
-    if (s->card == NULL) {
-        exit(1);
-    }
-
-    s->cdet = qemu_allocate_irq(omap_mmc_cover_cb, s, 0);
-    sd_set_cb(s->card, NULL, s->cdet);
-
-    omap_mmc_reset(s);
-
-    return s;
-}
-
-void omap_mmc_handlers(struct omap_mmc_s *s, qemu_irq ro, qemu_irq cover)
-{
-    if (s->cdet) {
-        sd_set_cb(s->card, ro, s->cdet);
-        s->coverswitch = cover;
-        qemu_set_irq(cover, s->cdet_state);
-    } else
-        sd_set_cb(s->card, ro, cover);
-}
-
-void omap_mmc_enable(struct omap_mmc_s *s, int enable)
-{
-    sd_enable(s->card, enable);
-}
-- 
2.34.1
Re: [PATCH for-9.2 41/53] hw/sd: Remove omap2_mmc device
Posted by Philippe Mathieu-Daudé 2 months, 3 weeks ago
On 3/9/24 18:07, Peter Maydell wrote:
> Remove the OMAP2 specific code from omap_mmc.c.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   include/hw/arm/omap.h |  5 ----
>   hw/sd/omap_mmc.c      | 63 -------------------------------------------
>   2 files changed, 68 deletions(-)


> -struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,
> -                BlockBackend *blk, qemu_irq irq, qemu_irq dma[],
> -                omap_clk fclk, omap_clk iclk)
> -{
> -    struct omap_mmc_s *s = g_new0(struct omap_mmc_s, 1);
> -
> -    s->irq = irq;
> -    s->dma = dma;
> -    s->clk = fclk;
> -    s->lines = 4;
> -    s->rev = 2;
> -
> -    memory_region_init_io(&s->iomem, NULL, &omap_mmc_ops, s, "omap.mmc",
> -                          omap_l4_region_size(ta, 0));
> -    omap_l4_attach(ta, 0, &s->iomem);
> -
> -    /* Instantiate the storage */
> -    s->card = sd_init(blk, false);
> -    if (s->card == NULL) {
> -        exit(1);
> -    }
> -
> -    s->cdet = qemu_allocate_irq(omap_mmc_cover_cb, s, 0);
> -    sd_set_cb(s->card, NULL, s->cdet);
> -
> -    omap_mmc_reset(s);
> -
> -    return s;
> -}
> -
> -void omap_mmc_handlers(struct omap_mmc_s *s, qemu_irq ro, qemu_irq cover)
> -{
> -    if (s->cdet) {
> -        sd_set_cb(s->card, ro, s->cdet);
> -        s->coverswitch = cover;
> -        qemu_set_irq(cover, s->cdet_state);
> -    } else
> -        sd_set_cb(s->card, ro, cover);
> -}
> -
> -void omap_mmc_enable(struct omap_mmc_s *s, int enable)
> -{
> -    sd_enable(s->card, enable);
> -}

Yeah, few less legacy users \o/

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>