From: Peter Maydell <peter.maydell@linaro.org>
To: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Cc: blauwirbel@gmail.com, edgar.iglesias@gmail.com,
aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 06/14] stellaris: Removed SSI mux
Date: Fri, 5 Oct 2012 13:34:08 +0100 [thread overview]
Message-ID: <CAFEAcA9E8VSzc33S3VTgsZTWZ-crV08VM+0CfqPGDyYNWP-8Cg@mail.gmail.com> (raw)
In-Reply-To: <1349395739-26502-7-git-send-email-peter.crosthwaite@xilinx.com>
On 5 October 2012 01:08, Peter Crosthwaite
<peter.crosthwaite@petalogix.com> wrote:
> From: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
>
> Removed the explicit SSI mux and wired the CS line directly up to the SSI
> devices.
>
> Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
> ---
> hw/ssd0323.c | 1 +
> hw/ssi-sd.c | 1 +
> hw/stellaris.c | 98 ++++++++++----------------------------------------------
> 3 files changed, 19 insertions(+), 81 deletions(-)
>
> diff --git a/hw/ssd0323.c b/hw/ssd0323.c
> index 5d05a35..9c42d64 100644
> --- a/hw/ssd0323.c
> +++ b/hw/ssd0323.c
> @@ -354,6 +354,7 @@ static void ssd0323_class_init(ObjectClass *klass, void *data)
>
> k->init = ssd0323_init;
> k->transfer = ssd0323_transfer;
> + k->cs_polarity = SSI_CS_HIGH;
> }
>
> static TypeInfo ssd0323_info = {
> diff --git a/hw/ssi-sd.c b/hw/ssi-sd.c
> index cbbc645..c5505ee 100644
> --- a/hw/ssi-sd.c
> +++ b/hw/ssi-sd.c
> @@ -256,6 +256,7 @@ static void ssi_sd_class_init(ObjectClass *klass, void *data)
>
> k->init = ssi_sd_init;
> k->transfer = ssi_sd_transfer;
> + k->cs_polarity = SSI_CS_LOW;
> }
>
> static TypeInfo ssi_sd_info = {
> diff --git a/hw/stellaris.c b/hw/stellaris.c
> index a7b68f4..acb297b 100644
> --- a/hw/stellaris.c
> +++ b/hw/stellaris.c
> @@ -1154,58 +1154,6 @@ static int stellaris_adc_init(SysBusDevice *dev)
> return 0;
> }
>
> -/* Some boards have both an OLED controller and SD card connected to
> - the same SSI port, with the SD card chip select connected to a
> - GPIO pin. Technically the OLED chip select is connected to the SSI
> - Fss pin. We do not bother emulating that as both devices should
> - never be selected simultaneously, and our OLED controller ignores stray
> - 0xff commands that occur when deselecting the SD card. */
> -
> -typedef struct {
> - SSISlave ssidev;
> - qemu_irq irq;
> - int current_dev;
> - SSIBus *bus[2];
> -} 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;
> -}
> -
> -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);
> -}
> -
> -static const VMStateDescription vmstate_stellaris_ssi_bus = {
> - .name = "stellaris_ssi_bus",
> - .version_id = 2,
> - .minimum_version_id = 2,
> - .minimum_version_id_old = 2,
> - .fields = (VMStateField[]) {
> - VMSTATE_SSI_SLAVE(ssidev, stellaris_ssi_bus_state),
> - VMSTATE_INT32(current_dev, stellaris_ssi_bus_state),
> - VMSTATE_END_OF_LIST()
> - }
> -};
> -
> -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");
> - qdev_init_gpio_in(&dev->qdev, stellaris_ssi_bus_select, 1);
> -
> - vmstate_register(&dev->qdev, -1, &vmstate_stellaris_ssi_bus, s);
> - return 0;
> -}
> -
> /* Board init. */
> static stellaris_board_info stellaris_boards[] = {
> { "LM3S811EVB",
> @@ -1306,29 +1254,33 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
> if (board->dc2 & (1 << 4)) {
> dev = sysbus_create_simple("pl022", 0x40008000, pic[7]);
> if (board->peripherals & BP_OLED_SSI) {
> - DeviceState *mux;
> void *bus;
> - qemu_irq select_pin;
>
> + /* Some boards have both an OLED controller and SD card connected to
> + * the same SSI port, with the SD card chip select connected to a
> + * GPIO pin. Technically the OLED chip select is connected to the
> + * SSI Fss pin. We do not bother emulating that as both devices
> + * should never be selected simultaneously, and our OLED controller
> + * ignores stray 0xff commands that occur when deselecting the SD
> + * card.
> + */
> bus = qdev_get_child_bus(dev, "ssi");
> - mux = ssi_create_slave(bus, "evb6965-ssi");
> - select_pin = qdev_get_gpio_in(mux, 0);
> +
> + dev = ssi_create_slave(bus, "ssi-sd");
> if (gpio_dev[GPIO_D]) {
> - qdev_connect_gpio_out(gpio_dev[GPIO_D], 0, select_pin);
> + qdev_connect_gpio_out(gpio_dev[GPIO_D], 0,
> + qdev_get_gpio_in(dev, 0));
> }
>
> - 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");
> + if (gpio_dev[GPIO_D]) {
> + qdev_connect_gpio_out(gpio_dev[GPIO_D], 0,
> + qdev_get_gpio_in(dev, 0));
> + }
...this seems to be trying to wire up two devices to the same
GPIO output ?
-- PMM
next prev parent reply other threads:[~2012-10-05 12:34 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-05 0:08 [Qemu-devel] [PULL 0/14] Ehnahced SSI bus support + M25P80 SPI flash + Xilinx SPI controller Peter Crosthwaite
2012-10-05 0:08 ` [Qemu-devel] [PATCH 01/14] ssi: Support for multiple attached devices Peter Crosthwaite
2012-10-05 0:08 ` [Qemu-devel] [PATCH 02/14] ssi: Implemented CS behaviour Peter Crosthwaite
2012-10-05 0:08 ` [Qemu-devel] [PATCH 03/14] ssi: Added create_slave_no_init() Peter Crosthwaite
2012-10-05 0:08 ` [Qemu-devel] [PATCH 04/14] qdev: allow multiple qdev_init_gpio_in() calls Peter Crosthwaite
2012-10-05 8:50 ` Peter Maydell
2012-10-05 0:08 ` [Qemu-devel] [PATCH 05/14] hw/stellaris: Removed gpio_out init array Peter Crosthwaite
2012-10-05 12:31 ` Peter Maydell
2012-10-05 14:17 ` Peter Crosthwaite
2012-10-05 0:08 ` [Qemu-devel] [PATCH 06/14] stellaris: Removed SSI mux Peter Crosthwaite
2012-10-05 12:34 ` Peter Maydell [this message]
2012-10-05 14:14 ` Peter Crosthwaite
2012-10-05 0:08 ` [Qemu-devel] [PATCH 07/14] hw: Added generic FIFO API Peter Crosthwaite
2012-10-05 12:45 ` Peter Maydell
2012-10-05 0:08 ` [Qemu-devel] [PATCH 08/14] m25p80: Initial implementation of SPI flash device Peter Crosthwaite
2012-10-05 12:22 ` Peter Maydell
2012-10-05 0:08 ` [Qemu-devel] [PATCH 09/14] xilinx_spi: Initial impl. of Xilinx SPI controller Peter Crosthwaite
2012-10-05 12:42 ` Peter Maydell
2012-10-05 12:49 ` Peter Crosthwaite
2012-10-05 12:52 ` Peter Maydell
2012-10-05 0:08 ` [Qemu-devel] [PATCH 10/14] petalogix-ml605: added SPI controller with n25q128 Peter Crosthwaite
2012-10-05 0:08 ` [Qemu-devel] [PATCH 11/14] xilinx_spips: Xilinx Zynq SPI cntrlr device model Peter Crosthwaite
2012-10-05 0:08 ` [Qemu-devel] [PATCH 12/14] xilinx_zynq: Added SPI controllers + flashes Peter Crosthwaite
2012-10-05 0:08 ` [Qemu-devel] [PATCH 13/14] MAINTAINERS: Added maintainerships for SSI Peter Crosthwaite
2012-10-05 0:08 ` [Qemu-devel] [PATCH 14/14] ssi: Add slave autoconnect helper Peter Crosthwaite
2012-10-05 12:50 ` [Qemu-devel] [PULL 0/14] Ehnahced SSI bus support + M25P80 SPI flash + Xilinx SPI controller Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFEAcA9E8VSzc33S3VTgsZTWZ-crV08VM+0CfqPGDyYNWP-8Cg@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=aliguori@us.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=edgar.iglesias@gmail.com \
--cc=peter.crosthwaite@petalogix.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).