From: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
To: "Markus Armbruster" <armbru@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>, "Max Reitz" <mreitz@redhat.com>,
"Vladimir Sementsov-Ogievskiy" <vsementsov@virtuozzo.com>,
"Eric Blake" <eblake@redhat.com>, "Joel Stanley" <joel@jms.id.au>,
"Cédric Le Goater" <clg@kaod.org>,
"Vincent Palatin" <vpalatin@chromium.org>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Edgar E. Iglesias" <edgar.iglesias@xilinx.com>,
"Luc Michel" <luc.michel@greensocs.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: [PATCH v3 19/21] arm: xlnx-versal: Add emmc to versal
Date: Mon, 1 Mar 2021 01:03:25 +0530 [thread overview]
Message-ID: <1614540807-30686-20-git-send-email-sai.pavan.boddu@xilinx.com> (raw)
In-Reply-To: <1614540807-30686-1-git-send-email-sai.pavan.boddu@xilinx.com>
Configuring SDHCI-0 to act as eMMC controller.
Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
---
include/hw/arm/xlnx-versal.h | 1 +
hw/arm/xlnx-versal-virt.c | 29 +++++++++++++++++++++++++----
hw/arm/xlnx-versal.c | 14 ++++++++++++--
3 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
index 2b76885..440f3b4 100644
--- a/include/hw/arm/xlnx-versal.h
+++ b/include/hw/arm/xlnx-versal.h
@@ -76,6 +76,7 @@ struct Versal {
struct {
MemoryRegion *mr_ddr;
uint32_t psci_conduit;
+ bool has_emmc;
} cfg;
};
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
index 8482cd6..053a322 100644
--- a/hw/arm/xlnx-versal-virt.c
+++ b/hw/arm/xlnx-versal-virt.c
@@ -46,6 +46,7 @@ struct VersalVirt {
struct {
bool secure;
+ bool has_emmc;
} cfg;
};
@@ -333,6 +334,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 (s->cfg.has_emmc && 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);
}
}
@@ -524,11 +532,17 @@ static void sd_plugin_card(SDHCIState *sd, DriveInfo *di)
&error_fatal);
}
+static void versal_virt_set_emmc(Object *obj, bool value, Error **errp)
+{
+ VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(obj);
+
+ s->cfg.has_emmc = value;
+}
+
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
@@ -560,6 +574,8 @@ static void versal_virt_init(MachineState *machine)
&error_abort);
object_property_set_int(OBJECT(&s->soc), "psci-conduit", psci_conduit,
&error_abort);
+ object_property_set_bool(OBJECT(&s->soc), "has-emmc", s->cfg.has_emmc,
+ &error_abort);
sysbus_realize(SYS_BUS_DEVICE(&s->soc), &error_fatal);
fdt_create(s);
@@ -581,10 +597,12 @@ static void versal_virt_init(MachineState *machine)
memory_region_add_subregion_overlap(get_system_memory(),
0, &s->soc.fpd.apu.mr, 0);
- /* 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));
+ if (!s->cfg.has_emmc) {
+ sd_plugin_card(&s->soc.pmc.iou.sd[0],
+ drive_get_next(IF_SD));
}
+ /* Plugin SD cards. */
+ sd_plugin_card(&s->soc.pmc.iou.sd[1], drive_get_next(IF_SD));
s->binfo.ram_size = machine->ram_size;
s->binfo.loader_start = 0x0;
@@ -621,6 +639,9 @@ static void versal_virt_machine_class_init(ObjectClass *oc, void *data)
mc->default_cpus = XLNX_VERSAL_NR_ACPUS;
mc->no_cdrom = true;
mc->default_ram_id = "ddr";
+ object_class_property_add_bool(oc, "emmc",
+ NULL, versal_virt_set_emmc);
+
}
static const TypeInfo versal_virt_machine_init_typeinfo = {
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
index 628e77e..6ca2c8f 100644
--- a/hw/arm/xlnx-versal.c
+++ b/hw/arm/xlnx-versal.c
@@ -230,6 +230,9 @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
}
#define SDHCI_CAPABILITIES 0x280737ec6481 /* Same as on ZynqMP. */
+#define SDHCI_EMMC_CAPS ((SDHCI_CAPABILITIES & ~(3 << 30)) | \
+ (1 << 30))
+
static void versal_create_sds(Versal *s, qemu_irq *pic)
{
int i;
@@ -242,11 +245,17 @@ static void versal_create_sds(Versal *s, qemu_irq *pic)
TYPE_SYSBUS_SDHCI);
dev = DEVICE(&s->pmc.iou.sd[i]);
+ dev->id = g_strdup_printf("sdhci%d", i);
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", SDHCI_EMMC_CAPS,
&error_fatal);
- object_property_set_uint(OBJECT(dev), "uhs", UHS_I, &error_fatal);
+ /*
+ * UHS is not applicable for eMMC
+ */
+ if (!s->cfg.has_emmc || 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);
@@ -386,6 +395,7 @@ static Property versal_properties[] = {
DEFINE_PROP_LINK("ddr", Versal, cfg.mr_ddr, TYPE_MEMORY_REGION,
MemoryRegion *),
DEFINE_PROP_UINT32("psci-conduit", Versal, cfg.psci_conduit, 0),
+ DEFINE_PROP_BOOL("has-emmc", Versal, cfg.has_emmc, false),
DEFINE_PROP_END_OF_LIST()
};
--
2.7.4
next prev parent reply other threads:[~2021-02-28 19:40 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-28 19:33 [PATCH v3 00/21] eMMC support Sai Pavan Boddu
2021-02-28 19:33 ` [PATCH v3 01/21] sd: sd: Remove usage of tabs in the file Sai Pavan Boddu
2021-02-28 19:33 ` [PATCH v3 02/21] sd: emmc: Add support for eMMC cards Sai Pavan Boddu
2021-03-01 11:02 ` Cédric Le Goater
2021-03-03 3:57 ` Sai Pavan Boddu
2021-02-28 19:33 ` [PATCH v3 03/21] sd: emmc: Update SET_RELATIVE_ADDR command Sai Pavan Boddu
2021-02-28 19:33 ` [PATCH v3 04/21] sd: emmc: update OCR fields for eMMC Sai Pavan Boddu
2021-03-01 11:04 ` Cédric Le Goater
2021-02-28 19:33 ` [PATCH v3 05/21] sd: emmc: Add support for EXT_CSD & CSD " Sai Pavan Boddu
2021-03-01 11:08 ` Cédric Le Goater
2021-02-28 19:33 ` [PATCH v3 06/21] sd: emmc: Update CMD8 to send EXT_CSD register Sai Pavan Boddu
2021-03-01 12:02 ` Cédric Le Goater
2021-02-28 19:33 ` [PATCH v3 07/21] sd: sdmmc-internal: Add command string for SEND_OP_CMD Sai Pavan Boddu
2021-03-01 12:03 ` Cédric Le Goater
2021-02-28 19:33 ` [PATCH v3 08/21] sd: emmc: Dont not update CARD_CAPACITY for eMMC cards Sai Pavan Boddu
2021-02-28 19:33 ` [PATCH v3 09/21] sd: emmc: Update CMD1 definition for eMMC Sai Pavan Boddu
2021-02-28 19:33 ` [PATCH v3 10/21] sd: emmc: support idle state in CMD2 Sai Pavan Boddu
2021-02-28 19:33 ` [PATCH v3 11/21] sd: emmc: Add mmc switch function support Sai Pavan Boddu
2021-02-28 19:33 ` [PATCH v3 12/21] sd: emmc: add CMD21 tuning sequence Sai Pavan Boddu
2021-03-01 10:42 ` Dr. David Alan Gilbert
2021-03-03 3:53 ` Sai Pavan Boddu
2021-03-03 9:15 ` Dr. David Alan Gilbert
2021-02-28 19:33 ` [PATCH v3 13/21] sd: emmc: Make ACMD41 illegal for mmc Sai Pavan Boddu
2021-02-28 19:33 ` [PATCH v3 14/21] sd: emmc: Add support for emmc erase Sai Pavan Boddu
2021-02-28 19:33 ` [PATCH v3 15/21] sd: emmc: Update CID structure for eMMC Sai Pavan Boddu
2021-03-01 12:09 ` Cédric Le Goater
2021-02-28 19:33 ` [PATCH v3 16/21] sd: emmc: Support boot area in emmc image Sai Pavan Boddu
2021-03-01 12:07 ` Cédric Le Goater
2021-02-28 19:33 ` [PATCH v3 17/21] sd: emmc: Subtract bootarea size from blk Sai Pavan Boddu
2021-02-28 19:33 ` [PATCH v3 18/21] sd: sdhci: Support eMMC devices Sai Pavan Boddu
2021-02-28 19:33 ` Sai Pavan Boddu [this message]
2021-02-28 19:33 ` [PATCH v3 20/21] docs: devel: emmc: Add a doc for emmc card emulation Sai Pavan Boddu
2021-02-28 19:33 ` [PATCH v3 21/21] docs: arm: xlnx-versal-virt: Add eMMC support documentation Sai Pavan Boddu
2021-03-02 9:52 ` [PATCH v3 00/21] eMMC support Cédric Le Goater
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=1614540807-30686-20-git-send-email-sai.pavan.boddu@xilinx.com \
--to=sai.pavan.boddu@xilinx.com \
--cc=alistair.francis@wdc.com \
--cc=armbru@redhat.com \
--cc=clg@kaod.org \
--cc=dgilbert@redhat.com \
--cc=eblake@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=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).