aboutsummaryrefslogtreecommitdiff
path: root/hw/ssi
diff options
context:
space:
mode:
authorCédric Le Goater <clg@kaod.org>2023-06-07 06:39:37 +0200
committerCédric Le Goater <clg@kaod.org>2023-09-01 11:40:04 +0200
commit27a2c66c92ec1f7a1e6456c8b274ae538d68ae7f (patch)
tree12f0ec755ce81f376d1b3f758599024dc5d367f6 /hw/ssi
parent8a211fa3b2189735177f3c529dabc8ebc37042fa (diff)
downloadqemu-27a2c66c92ec1f7a1e6456c8b274ae538d68ae7f.zip
qemu-27a2c66c92ec1f7a1e6456c8b274ae538d68ae7f.tar.gz
qemu-27a2c66c92ec1f7a1e6456c8b274ae538d68ae7f.tar.bz2
aspeed/smc: Wire CS lines at reset
Currently, a set of default flash devices is created at machine init and drives defined on the QEMU command line are associated to the FMC and SPI controllers in sequence : -drive file<file>,format=raw,if=mtd -drive file<file1>,format=raw,if=mtd The CS lines are wired in the same creation loop. This makes a strong assumption on the ordering and is not very flexible since only a limited set of flash devices can be defined : 1 FMC + 1 or 2 SPI, which is less than what the SoC really supports. A better alternative would be to define the flash devices on the command line using a blockdev attached to a CS line of a SSI bus : -blockdev node-name=fmc0,driver=file,filename=./flash.img -device mx66u51235f,cs=0x0,bus=ssi.0,drive=fmc0 However, user created flash devices are not correctly wired to their SPI controller and consequently can not be used by the machine. Fix that and wire the CS lines of all available devices when the SSI bus is reset. Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Diffstat (limited to 'hw/ssi')
-rw-r--r--hw/ssi/aspeed_smc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
index 7281169..2a4001b 100644
--- a/hw/ssi/aspeed_smc.c
+++ b/hw/ssi/aspeed_smc.c
@@ -692,6 +692,14 @@ static void aspeed_smc_reset(DeviceState *d)
memset(s->regs, 0, sizeof s->regs);
}
+ for (i = 0; i < asc->cs_num_max; i++) {
+ DeviceState *dev = ssi_get_cs(s->spi, i);
+ if (dev) {
+ qemu_irq cs_line = qdev_get_gpio_in_named(dev, SSI_GPIO_CS, 0);
+ qdev_connect_gpio_out_named(DEVICE(s), "cs", i, cs_line);
+ }
+ }
+
/* Unselect all peripherals */
for (i = 0; i < asc->cs_num_max; ++i) {
s->regs[s->r_ctrl0 + i] |= CTRL_CE_STOP_ACTIVE;