[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v9 01/13] ssi: Support for multiple attached devices
From: |
Peter Crosthwaite |
Subject: |
[Qemu-devel] [PATCH v9 01/13] ssi: Support for multiple attached devices |
Date: |
Mon, 8 Oct 2012 14:18:15 +1000 |
From: Peter A. G. Crosthwaite <address@hidden>
Removed assertion that only one device is attached to the SSI bus.
When multiple devices are attached, all slaves have their transfer function
called for transfers. Each device is responsible for knowing whether or not its
CS is active, and if not returning 0. The returned data is the logical or of
all responses from the (mulitple) devices.
Signed-off-by: Peter A. G. Crosthwaite <address@hidden>
Acked-by: Peter Maydell <address@hidden>
---
hw/ssi.c | 24 +++++++++---------------
1 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/hw/ssi.c b/hw/ssi.c
index e5f14a0..35d0a04 100644
--- a/hw/ssi.c
+++ b/hw/ssi.c
@@ -2,6 +2,8 @@
* QEMU Synchronous Serial Interface support
*
* Copyright (c) 2009 CodeSourcery.
+ * Copyright (c) 2012 Peter A.G. Crosthwaite (address@hidden)
+ * Copyright (c) 2012 PetaLogix Pty Ltd.
* Written by Paul Brook
*
* This code is licensed under the GNU GPL v2.
@@ -29,14 +31,6 @@ static int ssi_slave_init(DeviceState *dev)
{
SSISlave *s = SSI_SLAVE(dev);
SSISlaveClass *ssc = SSI_SLAVE_GET_CLASS(s);
- SSIBus *bus;
- BusChild *kid;
-
- bus = FROM_QBUS(SSIBus, qdev_get_parent_bus(dev));
- kid = QTAILQ_FIRST(&bus->qbus.children);
- if (kid->child != dev || QTAILQ_NEXT(kid, sibling) != NULL) {
- hw_error("Too many devices on SSI bus");
- }
return ssc->init(s);
}
@@ -74,16 +68,16 @@ SSIBus *ssi_create_bus(DeviceState *parent, const char
*name)
uint32_t ssi_transfer(SSIBus *bus, uint32_t val)
{
BusChild *kid;
- SSISlave *slave;
SSISlaveClass *ssc;
+ uint32_t r = 0;
- kid = QTAILQ_FIRST(&bus->qbus.children);
- if (!kid) {
- return 0;
+ QTAILQ_FOREACH(kid, &bus->qbus.children, sibling) {
+ SSISlave *slave = SSI_SLAVE(kid->child);
+ ssc = SSI_SLAVE_GET_CLASS(slave);
+ r |= ssc->transfer(slave, val);
}
- slave = SSI_SLAVE(kid->child);
- ssc = SSI_SLAVE_GET_CLASS(slave);
- return ssc->transfer(slave, val);
+
+ return r;
}
static void ssi_slave_register_types(void)
--
1.7.0.4
- [Qemu-devel] [PATCH v9 00/13] Ehnahced SSI bus support + M25P80 SPI flash + Xilinx SPI controller, Peter Crosthwaite, 2012/10/08
- [Qemu-devel] [PATCH v9 01/13] ssi: Support for multiple attached devices,
Peter Crosthwaite <=
- [Qemu-devel] [PATCH v9 02/13] ssi: Implemented CS behaviour, Peter Crosthwaite, 2012/10/08
- [Qemu-devel] [PATCH v9 03/13] ssi: Added create_slave_no_init(), Peter Crosthwaite, 2012/10/08
- [Qemu-devel] [PATCH v9 04/13] qdev: allow multiple qdev_init_gpio_in() calls, Peter Crosthwaite, 2012/10/08
- [Qemu-devel] [PATCH v9 05/13] stellaris: Removed SSI mux, Peter Crosthwaite, 2012/10/08
- [Qemu-devel] [PATCH v9 06/13] hw: Added generic FIFO API., Peter Crosthwaite, 2012/10/08
- [Qemu-devel] [PATCH v9 07/13] m25p80: Initial implementation of SPI flash device, Peter Crosthwaite, 2012/10/08
- [Qemu-devel] [PATCH v9 10/13] xilinx_spips: Xilinx Zynq SPI cntrlr device model, Peter Crosthwaite, 2012/10/08
- [Qemu-devel] [PATCH v9 12/13] MAINTAINERS: Added maintainerships for SSI, Peter Crosthwaite, 2012/10/08
- [Qemu-devel] [PATCH v9 13/13] ssi: Add slave autoconnect helper, Peter Crosthwaite, 2012/10/08
- [Qemu-devel] [PATCH v9 08/13] xilinx_spi: Initial impl. of Xilinx SPI controller, Peter Crosthwaite, 2012/10/08