From: Alistair Francis <alistair23@gmail.com>
To: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Thomas Huth" <thuth@redhat.com>,
"Vladimir Sementsov-Ogievskiy" <vsementsov@virtuozzo.com>,
"Vincent Palatin" <vpalatin@chromium.org>,
"Edgar E. Iglesias" <edgar.iglesias@xilinx.com>,
Qemu-block <qemu-block@nongnu.org>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
"Markus Armbruster" <armbru@redhat.com>,
"Max Reitz" <mreitz@redhat.com>,
"Sai Pavan Boddu" <saipava@xilinx.com>,
"Luc Michel" <luc.michel@greensocs.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Joel Stanley" <joel@jms.id.au>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Cédric Le Goater" <clg@kaod.org>
Subject: Re: [RFC PATCH 15/15] arm: xlnx-versal: Add emmc to versal
Date: Fri, 12 Feb 2021 13:37:18 -0800 [thread overview]
Message-ID: <CAKmqyKMx7aLD9zz5TvHfvL2bfrfe3Emo44p4s+SZeKndrAE8qA@mail.gmail.com> (raw)
In-Reply-To: <1613031446-22154-16-git-send-email-sai.pavan.boddu@xilinx.com>
On Thu, Feb 11, 2021 at 12:36 AM Sai Pavan Boddu
<sai.pavan.boddu@xilinx.com> wrote:
>
> Configuring SDHCI-0 to act as eMMC controller.
>
> Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> hw/arm/xlnx-versal-virt.c | 16 +++++++++++-----
> hw/arm/xlnx-versal.c | 14 ++++++++++++--
> 2 files changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
> index 8482cd6..18489e4 100644
> --- a/hw/arm/xlnx-versal-virt.c
> +++ b/hw/arm/xlnx-versal-virt.c
> @@ -333,6 +333,13 @@ static void fdt_add_sd_nodes(VersalVirt *s)
> qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
> 2, addr, 2, MM_PMC_SD0_SIZE);
> qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat));
> + /*
> + * eMMC specific properties
> + */
> + if (i == 0) {
> + qemu_fdt_setprop(s->fdt, name, "non-removable", NULL, 0);
> + qemu_fdt_setprop_sized_cells(s->fdt, name, "bus-width", 1, 8);
> + }
> g_free(name);
> }
> }
> @@ -512,7 +519,7 @@ static void create_virtio_regions(VersalVirt *s)
> }
> }
>
> -static void sd_plugin_card(SDHCIState *sd, DriveInfo *di)
> +static void sd_plugin_card(SDHCIState *sd, DriveInfo *di, bool emmc)
> {
> BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL;
> DeviceState *card;
> @@ -520,6 +527,7 @@ static void sd_plugin_card(SDHCIState *sd, DriveInfo *di)
> card = qdev_new(TYPE_SD_CARD);
> object_property_add_child(OBJECT(sd), "card[*]", OBJECT(card));
> qdev_prop_set_drive_err(card, "drive", blk, &error_fatal);
> + object_property_set_bool(OBJECT(card), "emmc", emmc, &error_fatal);
> qdev_realize_and_unref(card, qdev_get_child_bus(DEVICE(sd), "sd-bus"),
> &error_fatal);
> }
> @@ -528,7 +536,6 @@ static void versal_virt_init(MachineState *machine)
> {
> VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(machine);
> int psci_conduit = QEMU_PSCI_CONDUIT_DISABLED;
> - int i;
>
> /*
> * If the user provides an Operating System to be loaded, we expect them
> @@ -581,10 +588,9 @@ static void versal_virt_init(MachineState *machine)
> memory_region_add_subregion_overlap(get_system_memory(),
> 0, &s->soc.fpd.apu.mr, 0);
>
> + sd_plugin_card(&s->soc.pmc.iou.sd[0], drive_get_next(IF_EMMC), true);
> /* Plugin SD cards. */
> - for (i = 0; i < ARRAY_SIZE(s->soc.pmc.iou.sd); i++) {
> - sd_plugin_card(&s->soc.pmc.iou.sd[i], drive_get_next(IF_SD));
> - }
> + sd_plugin_card(&s->soc.pmc.iou.sd[1], drive_get_next(IF_SD), false);
>
> s->binfo.ram_size = machine->ram_size;
> s->binfo.loader_start = 0x0;
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index b077716..3498dd9 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -230,9 +230,14 @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
> }
>
> #define SDHCI_CAPABILITIES 0x280737ec6481 /* Same as on ZynqMP. */
> +#define SDHCI0_CAPS ((SDHCI_CAPABILITIES & ~(3 << 30)) | \
> + (1 << 30))
> +#define SDHCI1_CAPS SDHCI_CAPABILITIES
> +
> static void versal_create_sds(Versal *s, qemu_irq *pic)
> {
> int i;
> + uint64_t caps[] = {SDHCI0_CAPS, SDHCI1_CAPS};
>
> for (i = 0; i < ARRAY_SIZE(s->pmc.iou.sd); i++) {
> DeviceState *dev;
> @@ -244,9 +249,14 @@ static void versal_create_sds(Versal *s, qemu_irq *pic)
>
> object_property_set_uint(OBJECT(dev), "sd-spec-version", 3,
> &error_fatal);
> - object_property_set_uint(OBJECT(dev), "capareg", SDHCI_CAPABILITIES,
> + object_property_set_uint(OBJECT(dev), "capareg", caps[i],
> &error_fatal);
> - object_property_set_uint(OBJECT(dev), "uhs", UHS_I, &error_fatal);
> + /*
> + * UHS is not applicable for eMMC
> + */
> + if (i == 1) {
> + object_property_set_uint(OBJECT(dev), "uhs", UHS_I, &error_fatal);
> + }
> sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal);
>
> mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
> --
> 2.7.4
>
>
next prev parent reply other threads:[~2021-02-12 21:39 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-11 8:17 [RFC PATCH 00/15] eMMC support Sai Pavan Boddu
2021-02-11 8:17 ` [RFC PATCH 01/15] block: add eMMC block device type Sai Pavan Boddu
2021-02-12 21:29 ` Alistair Francis
2021-02-11 8:17 ` [RFC PATCH 02/15] sd: add eMMC support Sai Pavan Boddu
2021-02-13 13:18 ` Luc Michel
2021-02-11 8:17 ` [RFC PATCH 03/15] sd: emmc: Dont not update CARD_CAPACITY for eMMC cards Sai Pavan Boddu
2021-02-12 21:34 ` Alistair Francis
2021-02-11 8:17 ` [RFC PATCH 04/15] sd: emmc: Update CMD1 definition for eMMC Sai Pavan Boddu
2021-02-12 22:06 ` Alistair Francis
2021-02-11 8:17 ` [RFC PATCH 05/15] sd: emmc: support idle state in CMD2 Sai Pavan Boddu
2021-02-12 22:07 ` Alistair Francis
2021-02-11 8:17 ` [RFC PATCH 06/15] sd: emmc: Add mmc switch function support Sai Pavan Boddu
2021-02-11 8:17 ` [RFC PATCH 07/15] sd: emmc: add CMD21 tuning sequence Sai Pavan Boddu
2021-02-11 8:17 ` [RFC PATCH 08/15] sd: emmc: Make ACMD41 illegal for mmc Sai Pavan Boddu
2021-02-11 8:17 ` [RFC PATCH 09/15] sd: emmc: Add support for emmc erase Sai Pavan Boddu
2021-02-12 22:08 ` Alistair Francis
2021-02-16 10:03 ` Sai Pavan Boddu
2021-02-11 8:17 ` [RFC PATCH 10/15] sd: emmc: Update CID structure for eMMC Sai Pavan Boddu
2021-02-12 22:10 ` Alistair Francis
2021-02-16 10:51 ` Sai Pavan Boddu
2021-02-11 8:17 ` [RFC PATCH 11/15] sd: emmc: Add Extended CSD register definitions Sai Pavan Boddu
2021-02-13 12:56 ` Luc Michel
2021-02-16 11:11 ` Sai Pavan Boddu
2021-02-22 9:38 ` Cédric Le Goater
2021-02-11 8:17 ` [RFC PATCH 12/15] sd: emmc: Support boot area in emmc image Sai Pavan Boddu
2021-02-12 22:16 ` Alistair Francis
2021-02-11 8:17 ` [RFC PATCH 13/15] sd: emmc: Subtract bootarea size from blk Sai Pavan Boddu
2021-02-12 22:11 ` Alistair Francis
2021-02-11 8:17 ` [RFC PATCH 14/15] sd: sdhci: Support eMMC devices Sai Pavan Boddu
2021-02-12 22:12 ` Alistair Francis
2021-02-11 8:17 ` [RFC PATCH 15/15] arm: xlnx-versal: Add emmc to versal Sai Pavan Boddu
2021-02-12 21:37 ` Alistair Francis [this message]
2021-02-13 7:25 ` Edgar E. Iglesias
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKmqyKMx7aLD9zz5TvHfvL2bfrfe3Emo44p4s+SZeKndrAE8qA@mail.gmail.com \
--to=alistair23@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=armbru@redhat.com \
--cc=clg@kaod.org \
--cc=dgilbert@redhat.com \
--cc=edgar.iglesias@xilinx.com \
--cc=joel@jms.id.au \
--cc=kwolf@redhat.com \
--cc=luc.michel@greensocs.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sai.pavan.boddu@xilinx.com \
--cc=saipava@xilinx.com \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
--cc=vpalatin@chromium.org \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).