[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V4 5/5] stellaris: Updated spi bus implementation
From: |
Peter A. G. Crosthwaite |
Subject: |
[Qemu-devel] [PATCH V4 5/5] stellaris: Updated spi bus implementation |
Date: |
Mon, 4 Jun 2012 18:08:24 +1000 |
Setup the stellaris_ssi_bus device to use a single multi-slave ssi bus instead
of two busses.
Signed-off-by: Peter A. G. Crosthwaite <address@hidden>
---
changed from v3:
This patch is new
hw/stellaris.c | 17 +++++++----------
1 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/hw/stellaris.c b/hw/stellaris.c
index e0600a1..07a4187 100644
--- a/hw/stellaris.c
+++ b/hw/stellaris.c
@@ -1164,22 +1164,21 @@ static int stellaris_adc_init(SysBusDevice *dev)
typedef struct {
SSISlave ssidev;
qemu_irq irq;
- int current_dev;
- SSIBus *bus[2];
+ SSIBus *bus;
} stellaris_ssi_bus_state;
static void stellaris_ssi_bus_select(void *opaque, int irq, int level)
{
stellaris_ssi_bus_state *s = (stellaris_ssi_bus_state *)opaque;
- s->current_dev = level;
+ ssi_select_slave(s->bus, (uint32_t)level);
}
static uint32_t stellaris_ssi_bus_transfer(SSISlave *dev, uint32_t val)
{
stellaris_ssi_bus_state *s = FROM_SSI_SLAVE(stellaris_ssi_bus_state, dev);
- return ssi_transfer(s->bus[s->current_dev], val);
+ return ssi_transfer(s->bus, val);
}
static const VMStateDescription vmstate_stellaris_ssi_bus = {
@@ -1188,7 +1187,6 @@ static const VMStateDescription vmstate_stellaris_ssi_bus
= {
.minimum_version_id = 1,
.minimum_version_id_old = 1,
.fields = (VMStateField[]) {
- VMSTATE_INT32(current_dev, stellaris_ssi_bus_state),
VMSTATE_END_OF_LIST()
}
};
@@ -1197,8 +1195,7 @@ static int stellaris_ssi_bus_init(SSISlave *dev)
{
stellaris_ssi_bus_state *s = FROM_SSI_SLAVE(stellaris_ssi_bus_state, dev);
- s->bus[0] = ssi_create_bus(&dev->qdev, "ssi0");
- s->bus[1] = ssi_create_bus(&dev->qdev, "ssi1");
+ s->bus = ssi_create_bus(&dev->qdev, "ssi");
qdev_init_gpio_in(&dev->qdev, stellaris_ssi_bus_select, 1);
vmstate_register(&dev->qdev, -1, &vmstate_stellaris_ssi_bus, s);
@@ -1312,11 +1309,11 @@ static void stellaris_init(const char *kernel_filename,
const char *cpu_model,
mux = ssi_create_slave(bus, "evb6965-ssi", 0);
gpio_out[GPIO_D][0] = qdev_get_gpio_in(mux, 0);
- bus = qdev_get_child_bus(mux, "ssi0");
+ bus = qdev_get_child_bus(mux, "ssi");
+
ssi_create_slave(bus, "ssi-sd", 0);
- bus = qdev_get_child_bus(mux, "ssi1");
- dev = ssi_create_slave(bus, "ssd0323", 0);
+ dev = ssi_create_slave(bus, "ssd0323", 1);
gpio_out[GPIO_C][7] = qdev_get_gpio_in(dev, 0);
/* Make sure the select pin is high. */
--
1.7.3.2
- [Qemu-devel] [PATCH V4 0/5] Ehnahced SSI bus support + M25P80 SPI flash + Xilinx SPI controller, Peter A. G. Crosthwaite, 2012/06/04
- [Qemu-devel] [PATCH V4 1/5] SSI: Built in multiple device support, Peter A. G. Crosthwaite, 2012/06/04
- [Qemu-devel] [PATCH V4 2/5] m25p80: initial verion, Peter A. G. Crosthwaite, 2012/06/04
- [Qemu-devel] [PATCH V4 4/5] petalogix-ml605: added spi controller with m25p80, Peter A. G. Crosthwaite, 2012/06/04
- [Qemu-devel] [PATCH V4 3/5] xilinx_spi: initial version, Peter A. G. Crosthwaite, 2012/06/04
- [Qemu-devel] [PATCH V4 5/5] stellaris: Updated spi bus implementation,
Peter A. G. Crosthwaite <=
- Re: [Qemu-devel] [PATCH V4 0/5] Ehnahced SSI bus support + M25P80 SPI flash + Xilinx SPI controller, Paul Brook, 2012/06/04