From: Hao Wu <wuhaotsh@google.com>
To: peter.maydell@linaro.org
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, wuhaotsh@google.com,
venture@google.com, Avi.Fishman@nuvoton.com, kfting@nuvoton.com,
hskinnemoen@google.com, f4bug@amsat.org, bin.meng@windriver.com,
qemu-block@nongnu.org, Shengtan Mao <stmao@google.com>
Subject: [PATCH 3/4] hw/arm: Attach MMC to quanta-gbs-bmc
Date: Tue, 7 Sep 2021 16:25:54 -0700 [thread overview]
Message-ID: <20210907232555.3268967-4-wuhaotsh@google.com> (raw)
In-Reply-To: <20210907232555.3268967-1-wuhaotsh@google.com>
From: Shengtan Mao <stmao@google.com>
Signed-off-by: Shengtan Mao <stmao@google.com>
Reviewed-by: Hao Wu <wuhaotsh@google.com>
Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
---
hw/arm/npcm7xx_boards.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c
index e5a3243995..7205483280 100644
--- a/hw/arm/npcm7xx_boards.c
+++ b/hw/arm/npcm7xx_boards.c
@@ -27,6 +27,10 @@
#include "qemu-common.h"
#include "qemu/datadir.h"
#include "qemu/units.h"
+#include "sysemu/blockdev.h"
+#include "sysemu/sysemu.h"
+#include "sysemu/block-backend.h"
+
#define NPCM750_EVB_POWER_ON_STRAPS 0x00001ff7
#define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff
@@ -80,6 +84,22 @@ static void npcm7xx_connect_dram(NPCM7xxState *soc, MemoryRegion *dram)
&error_abort);
}
+static void sdhci_attach_drive(SDHCIState *sdhci)
+{
+ DriveInfo *di = drive_get_next(IF_SD);
+ BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL;
+
+ BusState *bus = qdev_get_child_bus(DEVICE(sdhci), "sd-bus");
+ if (bus == NULL) {
+ error_report("No SD bus found in SOC object");
+ exit(1);
+ }
+
+ DeviceState *carddev = qdev_new(TYPE_SD_CARD);
+ qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
+ qdev_realize_and_unref(carddev, bus, &error_fatal);
+}
+
static NPCM7xxState *npcm7xx_create_soc(MachineState *machine,
uint32_t hw_straps)
{
@@ -354,6 +374,7 @@ static void quanta_gbs_init(MachineState *machine)
drive_get(IF_MTD, 0, 0));
quanta_gbs_i2c_init(soc);
+ sdhci_attach_drive(&soc->mmc.sdhci);
npcm7xx_load_kernel(machine, soc);
}
--
2.33.0.153.gba50c8fa24-goog
next prev parent reply other threads:[~2021-09-07 23:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-07 23:25 [PATCH 0/4] hw/arm: Add MMC device for NPCM7XX boards Hao Wu
2021-09-07 23:25 ` [PATCH 1/4] tests/qtest/libqos: add SDHCI commands Hao Wu
2021-09-13 14:48 ` Peter Maydell
2021-09-07 23:25 ` [PATCH 2/4] hw/sd: add nuvoton MMC Hao Wu
2021-09-13 14:16 ` Peter Maydell
2021-09-07 23:25 ` Hao Wu [this message]
2021-09-13 14:40 ` [PATCH 3/4] hw/arm: Attach MMC to quanta-gbs-bmc Peter Maydell
2021-09-07 23:25 ` [PATCH 4/4] tests/qtest: add qtests for npcm7xx sdhci Hao Wu
2021-09-13 14:47 ` Peter Maydell
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=20210907232555.3268967-4-wuhaotsh@google.com \
--to=wuhaotsh@google.com \
--cc=Avi.Fishman@nuvoton.com \
--cc=bin.meng@windriver.com \
--cc=f4bug@amsat.org \
--cc=hskinnemoen@google.com \
--cc=kfting@nuvoton.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stmao@google.com \
--cc=venture@google.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).