mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
hw/sd/ssi-sd: Do not create SD card within controller's realize
ssi_sd_realize() creates an "sd-card" device. This is inappropriate, and marked FIXME. Move it to the boards that create these devices. Prior art: commiteb4f566bbb
for device "generic-sdhci", and commit26c607b86b
for device "pl181". The device remains not user-creatable, because its users should (and do) wire up its GPIO chip-select line. Cc: Peter Maydell <peter.maydell@linaro.org> Cc: Alistair Francis <Alistair.Francis@wdc.com> Cc: Bin Meng <bin.meng@windriver.com> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org> Cc: qemu-arm@nongnu.org Cc: qemu-riscv@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20211117163409.3587705-2-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
76b56fdfc9
commit
36aa285f48
3 changed files with 27 additions and 30 deletions
|
@ -46,6 +46,7 @@
|
|||
#include "hw/char/serial.h"
|
||||
#include "hw/cpu/cluster.h"
|
||||
#include "hw/misc/unimp.h"
|
||||
#include "hw/sd/sd.h"
|
||||
#include "hw/ssi/ssi.h"
|
||||
#include "target/riscv/cpu.h"
|
||||
#include "hw/riscv/riscv_hart.h"
|
||||
|
@ -536,7 +537,8 @@ static void sifive_u_machine_init(MachineState *machine)
|
|||
uint32_t fdt_load_addr;
|
||||
uint64_t kernel_entry;
|
||||
DriveInfo *dinfo;
|
||||
DeviceState *flash_dev, *sd_dev;
|
||||
BlockBackend *blk;
|
||||
DeviceState *flash_dev, *sd_dev, *card_dev;
|
||||
qemu_irq flash_cs, sd_cs;
|
||||
|
||||
/* Initialize SoC */
|
||||
|
@ -686,6 +688,15 @@ static void sifive_u_machine_init(MachineState *machine)
|
|||
|
||||
sd_cs = qdev_get_gpio_in_named(sd_dev, SSI_GPIO_CS, 0);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->soc.spi2), 1, sd_cs);
|
||||
|
||||
dinfo = drive_get(IF_SD, 0, 0);
|
||||
blk = dinfo ? blk_by_legacy_dinfo(dinfo) : NULL;
|
||||
card_dev = qdev_new(TYPE_SD_CARD);
|
||||
qdev_prop_set_drive_err(card_dev, "drive", blk, &error_fatal);
|
||||
qdev_prop_set_bit(card_dev, "spi", true);
|
||||
qdev_realize_and_unref(card_dev,
|
||||
qdev_get_child_bus(sd_dev, "sd-bus"),
|
||||
&error_fatal);
|
||||
}
|
||||
|
||||
static bool sifive_u_machine_get_start_in_flash(Object *obj, Error **errp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue