[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 07/10] hw/sd/pl181: Do not create SD card within the SDHCI
From: |
Peter Maydell |
Subject: |
Re: [PATCH v4 07/10] hw/sd/pl181: Do not create SD card within the SDHCI controller |
Date: |
Thu, 9 Jul 2020 19:20:01 +0100 |
On Sun, 5 Jul 2020 at 21:46, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> SDHCI controllers provide a SD Bus to plug SD cards, but don't
> come with SD card plugged in :) Let the machine/board object
> create and plug the SD cards when required.
Nit on the commit message: the PL181 isn't an SDHCI controller
(which is a theoretically standard controller as regards
register interface etc, and which in QEMU we model in hw/sd/sdhci.c);
it's just a plain old MMC/SD card controller.
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/arm/integratorcp.c | 13 +++++++++++++
> hw/arm/realview.c | 12 ++++++++++++
> hw/arm/versatilepb.c | 26 ++++++++++++++++++++++++--
> hw/arm/vexpress.c | 11 +++++++++++
> hw/sd/pl181.c | 19 +------------------
> 5 files changed, 61 insertions(+), 20 deletions(-)
> @@ -649,6 +651,17 @@ static void integratorcp_init(MachineState *machine)
> qdev_get_gpio_in_named(icp, ICP_GPIO_MMC_WPROT,
> 0));
> qdev_connect_gpio_out_named(dev, "card-inserted", 0,
> qdev_get_gpio_in_named(icp, ICP_GPIO_MMC_CARDIN,
> 0));
> + dinfo = drive_get_next(IF_SD);
> + if (dinfo) {
> + DeviceState *card;
> +
> + card = qdev_new(TYPE_SD_CARD);
> + qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
> + &error_fatal);
> + qdev_realize_and_unref(card, qdev_get_child_bus(dev, "sd-bus"),
> + &error_fatal);
> + }
So instead of the pl181 creating the card object, the board
now does it, and only if there actually is an IF_SD drive to
use with it. I guess that makes sense. (If it turns out that
something depends on the existence of the card-without-backing
we could do what xlnx-zcu102.c for instance does, and create
the card in the board wtih a NULL backing drive, but let's not
do that unless we're obliged to.)
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
- Re: [PATCH v4 02/10] hw/sd/pl181: Rename pl181_send_command() as pl181_do_command(), (continued)
- [PATCH v4 03/10] hw/sd/pl181: Add TODO to use Fifo32 API, Philippe Mathieu-Daudé, 2020/07/05
- [PATCH v4 04/10] hw/arm/versatilepb: Comment to remember some IRQs lines are left unwired, Philippe Mathieu-Daudé, 2020/07/05
- [PATCH v4 05/10] hw/sd/pl181: Use named GPIOs, Philippe Mathieu-Daudé, 2020/07/05
- [PATCH v4 06/10] hw/sd/pl181: Expose a SDBus and connect the SDCard to it, Philippe Mathieu-Daudé, 2020/07/05
- [PATCH v4 07/10] hw/sd/pl181: Do not create SD card within the SDHCI controller, Philippe Mathieu-Daudé, 2020/07/05
- [PATCH v4 08/10] hw/sd/pl181: Replace disabled fprintf()s by trace events, Philippe Mathieu-Daudé, 2020/07/05
- [PATCH v4 09/10] hw/sd/sdcard: make sd_data_ready() static, Philippe Mathieu-Daudé, 2020/07/05
- [PATCH v4 10/10] hw/sd: move sdcard legacy API to 'hw/sd/sdcard_legacy.h', Philippe Mathieu-Daudé, 2020/07/05
- Re: [PATCH v4 00/10] hw/sd: convert legacy SDHCI devices to the SDBus API, Peter Maydell, 2020/07/09