aboutsummaryrefslogtreecommitdiff
path: root/hw/xilinx_spips.c
diff options
context:
space:
mode:
authorPeter Crosthwaite <peter.crosthwaite@xilinx.com>2012-10-01 12:34:37 +1000
committerPeter Crosthwaite <peter.crosthwaite@xilinx.com>2012-10-10 11:13:32 +1000
commitb4ae3cfa57b8c1bdbbd7b7d420971e9171203ade (patch)
tree08fc675a0ce8db85b5096792f85d3bfc01daaade /hw/xilinx_spips.c
parentfcb5629d3eb208d84c0fe9aa1ef64a6af7de0139 (diff)
downloadqemu-b4ae3cfa57b8c1bdbbd7b7d420971e9171203ade.zip
qemu-b4ae3cfa57b8c1bdbbd7b7d420971e9171203ade.tar.gz
qemu-b4ae3cfa57b8c1bdbbd7b7d420971e9171203ade.tar.bz2
ssi: Add slave autoconnect helper
Added helper function to automatically connect SPI slaves based on the QOM child nodes of a device. A SSI master device can call this routine to automatically hook-up all child nodes to its SPI bus. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Acked-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/xilinx_spips.c')
-rw-r--r--hw/xilinx_spips.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/xilinx_spips.c b/hw/xilinx_spips.c
index a886c5d..f64a782 100644
--- a/hw/xilinx_spips.c
+++ b/hw/xilinx_spips.c
@@ -289,6 +289,9 @@ static int xilinx_spips_init(SysBusDevice *dev)
DB_PRINT("inited device model\n");
+ s->spi = ssi_create_bus(&dev->qdev, "spi");
+
+ ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi);
sysbus_init_irq(dev, &s->irq);
for (i = 0; i < NUM_CS_LINES; ++i) {
sysbus_init_irq(dev, &s->cs_lines[i]);
@@ -298,7 +301,6 @@ static int xilinx_spips_init(SysBusDevice *dev)
sysbus_init_mmio(dev, &s->iomem);
s->irqline = -1;
- s->spi = ssi_create_bus(&dev->qdev, "spi");
fifo8_create(&s->rx_fifo, RXFF_A);
fifo8_create(&s->tx_fifo, TXFF_A);