All of lore.kernel.org
 help / color / mirror / Atom feed
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 05/14] hw/stellaris: Removed gpio_out init array.
Date: Fri, 5 Oct 2012 13:31:18 +0100	[thread overview]
Message-ID: <CAFEAcA9WTBvoXNA7d_=+9Q6r+QOyaxF6Fq6OtPCEv52CKqpnHw@mail.gmail.com> (raw)
In-Reply-To: <1349395739-26502-6-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>
>
> 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().

You can only connect an output to one sink. (If you want to wire it to
multiple places you need to use a qemu_irq_split() somewhere.) What
bug is this patch fixing?

-- PMM

> Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
> ---
>  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
>
>

  reply	other threads:[~2012-10-05 12:31 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 [this message]
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
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='CAFEAcA9WTBvoXNA7d_=+9Q6r+QOyaxF6Fq6OtPCEv52CKqpnHw@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.