[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 03/12] hw/arm: Attach MMC to quanta-gbs-bmc
From: |
Richard Henderson |
Subject: |
[PULL v2 03/12] hw/arm: Attach MMC to quanta-gbs-bmc |
Date: |
Tue, 2 Nov 2021 14:25:10 -0400 |
From: Shengtan Mao <stmao@google.com>
Signed-off-by: Shengtan Mao <stmao@google.com>
Signed-off-by: Hao Wu <wuhaotsh@google.com>
Reviewed-by: Hao Wu <wuhaotsh@google.com>
Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20211008002628.1958285-4-wuhaotsh@google.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/arm/npcm7xx_boards.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c
index a656169f61..dec7d16ae5 100644
--- a/hw/arm/npcm7xx_boards.c
+++ b/hw/arm/npcm7xx_boards.c
@@ -27,6 +27,9 @@
#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
@@ -81,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)
{
@@ -355,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.25.1
- [PULL v2 00/12] target/arm patch queue, Richard Henderson, 2021/11/02
- [PULL v2 05/12] target/arm: Advertise MVE to gdb when present, Richard Henderson, 2021/11/02
- [PULL v2 06/12] target/arm: Use tcg_constant_i32() in op_smlad(), Richard Henderson, 2021/11/02
- [PULL v2 03/12] hw/arm: Attach MMC to quanta-gbs-bmc,
Richard Henderson <=
- [PULL v2 01/12] hw/sd: add nuvoton MMC, Richard Henderson, 2021/11/02
- [PULL v2 02/12] hw/arm: Add Nuvoton SD module to board, Richard Henderson, 2021/11/02
- [PULL v2 04/12] tests/qtest/libqos: add SDHCI commands, Richard Henderson, 2021/11/02
- [PULL v2 08/12] target/arm: Use the constant variant of store_cpu_field() when possible, Richard Henderson, 2021/11/02
- [PULL v2 10/12] target/arm: Use tcg_constant_i32() in gen_rev16(), Richard Henderson, 2021/11/02
- [PULL v2 11/12] hw/arm/virt: Rename default_bus_bypass_iommu, Richard Henderson, 2021/11/02
- [PULL v2 09/12] target/arm: Use tcg_constant_i64() in do_sat_addsub_64(), Richard Henderson, 2021/11/02
- [PULL v2 12/12] hvf: arm: Ignore cache operations on MMIO, Richard Henderson, 2021/11/02
- [PULL v2 07/12] target/arm: Introduce store_cpu_field_constant() helper, Richard Henderson, 2021/11/02