[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 04/11] hw/sd/omap_mmc: Convert to SDBus API
From: |
Peter Maydell |
Subject: |
Re: [PATCH 04/11] hw/sd/omap_mmc: Convert to SDBus API |
Date: |
Fri, 31 Jan 2025 10:22:15 +0000 |
On Thu, 30 Jan 2025 at 22:26, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> On 28/1/25 11:45, Peter Maydell wrote:
> > Convert the OMAP MMC controller to the new SDBus API:
> > * the controller creates an SDBus bus
> > * instead of sd_foo functions on the SDState object, call
> > sdbus_foo functions on the SDBus
> > * the board code creates a proper TYPE_SD_CARD object and attaches
> > it to the controller's SDBus, instead of the controller creating
> > a card directly via sd_init() that never gets attached to any bus
> > * because the SD card object is on a bus, it gets reset automatically
> > by the "traverse the qbus tree resetting things" code, and we don't
> > need to manually reset the card from the controller reset function
> >
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> > ---
> > include/hw/arm/omap.h | 1 -
> > hw/arm/omap1.c | 10 +++++++++-
> > hw/sd/omap_mmc.c | 30 ++++++++++--------------------
> > 3 files changed, 19 insertions(+), 22 deletions(-)
>
>
> > @@ -643,6 +630,9 @@ static void omap_mmc_initfn(Object *obj)
> >
> > static void omap_mmc_realize(DeviceState *dev, Error **errp)
> > {
> > + OMAPMMCState *s = OMAP_MMC(dev);
> > +
> > + qbus_init(&s->sdbus, sizeof(s->sdbus), TYPE_SD_BUS, dev, "sd-bus");
>
> Why you don't create the bus in omap_mmc_initfn()?
Good question. I think I was using hw/sd/ssi-sd.c as a guide
(since it's the only other device that directly creates a
TYPE_SD_BUS rather than needing to subclass the bus), and
that put it in realize. But it's probably better in init.
> Anyhow,
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
thanks
-- PMM
- Re: [PATCH 11/11] hw/sd: Remove unused SDState::enable, (continued)
- [PATCH 03/11] hw/sd/omap_mmc: Convert output qemu_irqs to gpio and sysbus IRQ APIs, Peter Maydell, 2025/01/28
- [PATCH 08/11] hw/sd/omap_mmc: Untabify, Peter Maydell, 2025/01/28
- [PATCH 04/11] hw/sd/omap_mmc: Convert to SDBus API, Peter Maydell, 2025/01/28
- [PATCH 05/11] hw/sd/omap_mmc: Use similar API for "wire up omap_clk" to other OMAP devices, Peter Maydell, 2025/01/28
- [PATCH 10/11] hw/sd: Remove unused legacy functions, stop killing mammoths, Peter Maydell, 2025/01/28
- [PATCH 09/11] hw/sd: Remove unused 'enable' method from SDCardClass, Peter Maydell, 2025/01/28