[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 05/14] hw/stellaris: Removed gpio_out init array.
From: |
Peter Crosthwaite |
Subject: |
[Qemu-devel] [PATCH v8 05/14] hw/stellaris: Removed gpio_out init array. |
Date: |
Wed, 3 Oct 2012 17:48:33 +1000 |
From: Peter A. G. Crosthwaite <address@hidden>
stellaris_init() defines arrays of qemu_irq to decides what each of the GPIO
pins are connected to. This is ok for inputs (as an input can only have one
source) but is flawed for outputs as an output can connect to any number of
sinks. Removed the gpio_out array completely and just replaced its setters with
direct calls to qdev_connect_gpio_out().
Signed-off-by: Peter A. G. Crosthwaite <address@hidden>
---
hw/stellaris.c | 26 ++++++++++++--------------
1 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/hw/stellaris.c b/hw/stellaris.c
index 01050d1..a7b68f4 100644
--- a/hw/stellaris.c
+++ b/hw/stellaris.c
@@ -1244,7 +1244,6 @@ static void stellaris_init(const char *kernel_filename,
const char *cpu_model,
qemu_irq *pic;
DeviceState *gpio_dev[7];
qemu_irq gpio_in[7][8];
- qemu_irq gpio_out[7][8];
qemu_irq adc;
int sram_size;
int flash_size;
@@ -1284,8 +1283,9 @@ static void stellaris_init(const char *kernel_filename,
const char *cpu_model,
pic[gpio_irq[i]]);
for (j = 0; j < 8; j++) {
gpio_in[i][j] = qdev_get_gpio_in(gpio_dev[i], j);
- gpio_out[i][j] = NULL;
}
+ } else {
+ gpio_dev[i] = NULL;
}
}
@@ -1308,20 +1308,27 @@ static void stellaris_init(const char *kernel_filename,
const char *cpu_model,
if (board->peripherals & BP_OLED_SSI) {
DeviceState *mux;
void *bus;
+ qemu_irq select_pin;
bus = qdev_get_child_bus(dev, "ssi");
mux = ssi_create_slave(bus, "evb6965-ssi");
- gpio_out[GPIO_D][0] = qdev_get_gpio_in(mux, 0);
+ select_pin = qdev_get_gpio_in(mux, 0);
+ if (gpio_dev[GPIO_D]) {
+ qdev_connect_gpio_out(gpio_dev[GPIO_D], 0, select_pin);
+ }
bus = qdev_get_child_bus(mux, "ssi0");
ssi_create_slave(bus, "ssi-sd");
bus = qdev_get_child_bus(mux, "ssi1");
dev = ssi_create_slave(bus, "ssd0323");
- gpio_out[GPIO_C][7] = qdev_get_gpio_in(dev, 0);
+ if (gpio_dev[GPIO_C]) {
+ qdev_connect_gpio_out(gpio_dev[GPIO_C], 7,
+ qdev_get_gpio_in(dev, 0));
+ }
/* Make sure the select pin is high. */
- qemu_irq_raise(gpio_out[GPIO_D][0]);
+ qemu_irq_raise(select_pin);
}
}
if (board->dc4 & (1 << 28)) {
@@ -1347,15 +1354,6 @@ static void stellaris_init(const char *kernel_filename,
const char *cpu_model,
stellaris_gamepad_init(5, gpad_irq, gpad_keycode);
}
- for (i = 0; i < 7; i++) {
- if (board->dc4 & (1 << i)) {
- for (j = 0; j < 8; j++) {
- if (gpio_out[i][j]) {
- qdev_connect_gpio_out(gpio_dev[i], j, gpio_out[i][j]);
- }
- }
- }
- }
}
/* FIXME: Figure out how to generate these from stellaris_boards. */
--
1.7.0.4
- [Qemu-devel] [PATCH v8 00/14] Ehnahced SSI bus support + M25P80 SPI flash + Xilinx SPI controller, Peter Crosthwaite, 2012/10/03
- [Qemu-devel] [PATCH v8 01/14] ssi: Support for multiple attached devices, Peter Crosthwaite, 2012/10/03
- [Qemu-devel] [PATCH v8 02/14] ssi: Implemented CS behaviour, Peter Crosthwaite, 2012/10/03
- [Qemu-devel] [PATCH v8 03/14] ssi: Added create_slave_no_init(), Peter Crosthwaite, 2012/10/03
- [Qemu-devel] [PATCH v8 04/14] qdev: allow multiple qdev_init_gpio_in() calls, Peter Crosthwaite, 2012/10/03
- [Qemu-devel] [PATCH v8 05/14] hw/stellaris: Removed gpio_out init array.,
Peter Crosthwaite <=
- [Qemu-devel] [PATCH v8 07/14] hw: Added generic FIFO API., Peter Crosthwaite, 2012/10/03
- [Qemu-devel] [PATCH v8 06/14] stellaris: Removed SSI mux, Peter Crosthwaite, 2012/10/03
- [Qemu-devel] [PATCH v8 08/14] m25p80: Initial implementation of SPI flash device, Peter Crosthwaite, 2012/10/03
- [Qemu-devel] [PATCH v8 09/14] xilinx_spi: Initial impl. of Xilinx SPI controller, Peter Crosthwaite, 2012/10/03
- [Qemu-devel] [PATCH v8 13/14] MAINTAINERS: Added maintainerships for SSI, Peter Crosthwaite, 2012/10/03
- [Qemu-devel] [PATCH v8 14/14] ssi: Add slave autoconnect helper, Peter Crosthwaite, 2012/10/03
- [Qemu-devel] [PATCH v8 10/14] petalogix-ml605: added SPI controller with n25q128, Peter Crosthwaite, 2012/10/03
- [Qemu-devel] [PATCH v8 12/14] xilinx_zynq: Added SPI controllers + flashes, Peter Crosthwaite, 2012/10/03
- [Qemu-devel] [PATCH v8 11/14] xilinx_spips: Xilinx Zynq SPI cntrlr device model, Peter Crosthwaite, 2012/10/03