qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Francis <alistair23@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm <qemu-arm@nongnu.org>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	"Alistair Francis" <alistair@alistair23.me>
Subject: Re: [PATCH 03/17] hw/arm/spitz: Keep pointers to MPU and SSI devices in SpitzMachineState
Date: Mon, 29 Jun 2020 12:36:59 -0700	[thread overview]
Message-ID: <CAKmqyKPDvjXoS_mrBv3MUwtVPbzHA7sHu2+W2D7Ak8Fh0Bzpdg@mail.gmail.com> (raw)
In-Reply-To: <20200628142429.17111-4-peter.maydell@linaro.org>

On Sun, Jun 28, 2020 at 7:24 AM Peter Maydell <peter.maydell@linaro.org> wrote:
>
> Keep pointers to the MPU and the SSI devices in SpitzMachineState.
> We're going to want to make GPIO connections between some of the
> SSI devices and the SCPs, so we want to keep hold of a pointer to
> those; putting the MPU into the struct allows us to pass just
> one thing to spitz_ssp_attach() rather than two.
>
> We have to retain the setting of the global "max1111" variable
> for the moment as it is used in spitz_adc_temp_on(); later in
> this series of commits we will be able to remove it.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/arm/spitz.c | 50 ++++++++++++++++++++++++++++----------------------
>  1 file changed, 28 insertions(+), 22 deletions(-)
>
> diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
> index c70e912a33d..f48e966c047 100644
> --- a/hw/arm/spitz.c
> +++ b/hw/arm/spitz.c
> @@ -43,6 +43,11 @@ typedef struct {
>
>  typedef struct {
>      MachineState parent;
> +    PXA2xxState *mpu;
> +    DeviceState *mux;
> +    DeviceState *lcdtg;
> +    DeviceState *ads7846;
> +    DeviceState *max1111;
>  } SpitzMachineState;
>
>  #define TYPE_SPITZ_MACHINE "spitz-common"
> @@ -709,34 +714,33 @@ static void corgi_ssp_realize(SSISlave *d, Error **errp)
>      s->bus[2] = ssi_create_bus(dev, "ssi2");
>  }
>
> -static void spitz_ssp_attach(PXA2xxState *cpu)
> +static void spitz_ssp_attach(SpitzMachineState *sms)
>  {
> -    DeviceState *mux;
> -    DeviceState *dev;
>      void *bus;
>
> -    mux = ssi_create_slave(cpu->ssp[CORGI_SSP_PORT - 1], "corgi-ssp");
> +    sms->mux = ssi_create_slave(sms->mpu->ssp[CORGI_SSP_PORT - 1], "corgi-ssp");
>
> -    bus = qdev_get_child_bus(mux, "ssi0");
> -    ssi_create_slave(bus, "spitz-lcdtg");
> +    bus = qdev_get_child_bus(sms->mux, "ssi0");
> +    sms->lcdtg = ssi_create_slave(bus, "spitz-lcdtg");
>
> -    bus = qdev_get_child_bus(mux, "ssi1");
> -    dev = ssi_create_slave(bus, "ads7846");
> -    qdev_connect_gpio_out(dev, 0,
> -                          qdev_get_gpio_in(cpu->gpio, SPITZ_GPIO_TP_INT));
> +    bus = qdev_get_child_bus(sms->mux, "ssi1");
> +    sms->ads7846 = ssi_create_slave(bus, "ads7846");
> +    qdev_connect_gpio_out(sms->ads7846, 0,
> +                          qdev_get_gpio_in(sms->mpu->gpio, SPITZ_GPIO_TP_INT));
>
> -    bus = qdev_get_child_bus(mux, "ssi2");
> -    max1111 = ssi_create_slave(bus, "max1111");
> -    max111x_set_input(max1111, MAX1111_BATT_VOLT, SPITZ_BATTERY_VOLT);
> -    max111x_set_input(max1111, MAX1111_BATT_TEMP, 0);
> -    max111x_set_input(max1111, MAX1111_ACIN_VOLT, SPITZ_CHARGEON_ACIN);
> +    bus = qdev_get_child_bus(sms->mux, "ssi2");
> +    sms->max1111 = ssi_create_slave(bus, "max1111");
> +    max1111 = sms->max1111;
> +    max111x_set_input(sms->max1111, MAX1111_BATT_VOLT, SPITZ_BATTERY_VOLT);
> +    max111x_set_input(sms->max1111, MAX1111_BATT_TEMP, 0);
> +    max111x_set_input(sms->max1111, MAX1111_ACIN_VOLT, SPITZ_CHARGEON_ACIN);
>
> -    qdev_connect_gpio_out(cpu->gpio, SPITZ_GPIO_LCDCON_CS,
> -                        qdev_get_gpio_in(mux, 0));
> -    qdev_connect_gpio_out(cpu->gpio, SPITZ_GPIO_ADS7846_CS,
> -                        qdev_get_gpio_in(mux, 1));
> -    qdev_connect_gpio_out(cpu->gpio, SPITZ_GPIO_MAX1111_CS,
> -                        qdev_get_gpio_in(mux, 2));
> +    qdev_connect_gpio_out(sms->mpu->gpio, SPITZ_GPIO_LCDCON_CS,
> +                        qdev_get_gpio_in(sms->mux, 0));
> +    qdev_connect_gpio_out(sms->mpu->gpio, SPITZ_GPIO_ADS7846_CS,
> +                        qdev_get_gpio_in(sms->mux, 1));
> +    qdev_connect_gpio_out(sms->mpu->gpio, SPITZ_GPIO_MAX1111_CS,
> +                        qdev_get_gpio_in(sms->mux, 2));
>  }
>
>  /* CF Microdrive */
> @@ -936,6 +940,7 @@ static struct arm_boot_info spitz_binfo = {
>  static void spitz_common_init(MachineState *machine)
>  {
>      SpitzMachineClass *smc = SPITZ_MACHINE_GET_CLASS(machine);
> +    SpitzMachineState *sms = SPITZ_MACHINE(machine);
>      enum spitz_model_e model = smc->model;
>      PXA2xxState *mpu;
>      DeviceState *scp0, *scp1 = NULL;
> @@ -945,6 +950,7 @@ static void spitz_common_init(MachineState *machine)
>      /* Setup CPU & memory */
>      mpu = pxa270_init(address_space_mem, spitz_binfo.ram_size,
>                        machine->cpu_type);
> +    sms->mpu = mpu;
>
>      sl_flash_register(mpu, (model == spitz) ? FLASH_128M : FLASH_1024M);
>
> @@ -954,7 +960,7 @@ static void spitz_common_init(MachineState *machine)
>      /* Setup peripherals */
>      spitz_keyboard_register(mpu);
>
> -    spitz_ssp_attach(mpu);
> +    spitz_ssp_attach(sms);
>
>      scp0 = sysbus_create_simple("scoop", 0x10800000, NULL);
>      if (model != akita) {
> --
> 2.20.1
>
>


  reply	other threads:[~2020-06-29 19:47 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-28 14:24 [PATCH 00/17] spitz: fix hacks, fix CID 1421913, various cleanups Peter Maydell
2020-06-28 14:24 ` [PATCH 01/17] hw/arm/spitz: Detabify Peter Maydell
2020-06-29  8:49   ` Philippe Mathieu-Daudé
2020-06-29 19:30   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 02/17] hw/arm/spitz: Create SpitzMachineClass abstract base class Peter Maydell
2020-06-29  8:55   ` Philippe Mathieu-Daudé
2020-06-29 14:03     ` Peter Maydell
2020-06-28 14:24 ` [PATCH 03/17] hw/arm/spitz: Keep pointers to MPU and SSI devices in SpitzMachineState Peter Maydell
2020-06-29 19:36   ` Alistair Francis [this message]
2020-06-28 14:24 ` [PATCH 04/17] hw/arm/spitz: Keep pointers to scp0, scp1 " Peter Maydell
2020-06-29 19:38   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 05/17] hw/arm/spitz: Implement inbound GPIO lines for bit5 and power signals Peter Maydell
2020-06-30 20:45   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 06/17] hw/misc/max111x: provide QOM properties for setting initial values Peter Maydell
2020-06-29  9:01   ` Philippe Mathieu-Daudé
2020-06-30 20:51   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 07/17] hw/misc/max111x: Don't use vmstate_register() Peter Maydell
2020-06-29  9:01   ` Philippe Mathieu-Daudé
2020-06-30 20:52   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 08/17] ssi: Add ssi_realize_and_unref() Peter Maydell
2020-06-29  9:02   ` Philippe Mathieu-Daudé
2020-06-30 20:55   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 09/17] hw/arm/spitz: Use max111x properties to set initial values Peter Maydell
2020-06-29  9:09   ` Philippe Mathieu-Daudé
2020-06-29 14:05     ` Peter Maydell
2020-06-28 14:24 ` [PATCH 10/17] hw/misc/max111x: Use GPIO lines rather than max111x_set_input() Peter Maydell
2020-07-01  0:37   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 11/17] hw/misc/max111x: Create header file for documentation, TYPE_ macros Peter Maydell
2020-06-29  8:29   ` Philippe Mathieu-Daudé
2020-06-29 12:07     ` Peter Maydell
2020-06-29 14:57       ` Philippe Mathieu-Daudé
2020-06-28 14:24 ` [PATCH 12/17] hw/arm/spitz: Encapsulate misc GPIO handling in a device Peter Maydell
2020-06-29  9:12   ` Philippe Mathieu-Daudé
2020-07-02 17:39   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 13/17] hw/gpio/zaurus.c: Use LOG_GUEST_ERROR for bad guest register accesses Peter Maydell
2020-06-29  9:13   ` Philippe Mathieu-Daudé
2020-07-01  0:38   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 14/17] hw/arm/spitz: " Peter Maydell
2020-06-29  9:14   ` Philippe Mathieu-Daudé
2020-07-01  0:52   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 15/17] hw/arm/pxa2xx_pic: " Peter Maydell
2020-06-29  9:14   ` Philippe Mathieu-Daudé
2020-07-01  0:52   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 16/17] hw/arm/spitz: Provide usual QOM macros for corgi-ssp and spitz-lcdtg Peter Maydell
2020-06-29  9:17   ` Philippe Mathieu-Daudé
2020-07-02 17:51   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 17/17] Replace uses of FROM_SSI_SLAVE() macro with QOM casts Peter Maydell
2020-06-29  9:18   ` Philippe Mathieu-Daudé
2020-07-02 18:23   ` Alistair Francis
2020-06-28 14:43 ` [PATCH 00/17] spitz: fix hacks, fix CID 1421913, various cleanups no-reply

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=CAKmqyKPDvjXoS_mrBv3MUwtVPbzHA7sHu2+W2D7Ak8Fh0Bzpdg@mail.gmail.com \
    --to=alistair23@gmail.com \
    --cc=alistair@alistair23.me \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --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).