qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Francisco Iglesias <frasse.iglesias@gmail.com>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Andrew Jeffery" <andrew@aj.id.au>,
	qemu-devel@nongnu.org, qemu-arm@nongnu.org,
	"Joel Stanley" <joel@jms.id.au>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PATCH v2 2/5] aspeed: Initialize the watchdog device models before the FMC models
Date: Thu, 21 Oct 2021 09:25:54 +0200	[thread overview]
Message-ID: <20211021072553.GH23846@fralle-msi> (raw)
In-Reply-To: <20211018132609.160008-3-clg@kaod.org>

On [2021 Oct 18] Mon 15:26:06, Cédric Le Goater wrote:
> Next changes will map the WDT2 registers in the AST2600 FMC memory
> region. Make sure the MemoryRegion pointers are correctly initialized
> before setting the object links.
> 
> Do the same in the Aspeed AST2400 and AST2500 SoC models for
> consistency.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>

> ---
>  hw/arm/aspeed_ast2600.c | 36 ++++++++++++++++++------------------
>  hw/arm/aspeed_soc.c     | 36 ++++++++++++++++++------------------
>  2 files changed, 36 insertions(+), 36 deletions(-)
> 
> diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
> index 0384357a9510..3a7aa910b157 100644
> --- a/hw/arm/aspeed_ast2600.c
> +++ b/hw/arm/aspeed_ast2600.c
> @@ -148,6 +148,11 @@ static void aspeed_soc_ast2600_init(Object *obj)
>      snprintf(typename, sizeof(typename), "aspeed.timer-%s", socname);
>      object_initialize_child(obj, "timerctrl", &s->timerctrl, typename);
>  
> +    for (i = 0; i < sc->wdts_num; i++) {
> +        snprintf(typename, sizeof(typename), "aspeed.wdt-%s", socname);
> +        object_initialize_child(obj, "wdt[*]", &s->wdt[i], typename);
> +    }
> +
>      snprintf(typename, sizeof(typename), "aspeed.adc-%s", socname);
>      object_initialize_child(obj, "adc", &s->adc, typename);
>  
> @@ -175,11 +180,6 @@ static void aspeed_soc_ast2600_init(Object *obj)
>      object_property_add_alias(obj, "max-ram-size", OBJECT(&s->sdmc),
>                                "max-ram-size");
>  
> -    for (i = 0; i < sc->wdts_num; i++) {
> -        snprintf(typename, sizeof(typename), "aspeed.wdt-%s", socname);
> -        object_initialize_child(obj, "wdt[*]", &s->wdt[i], typename);
> -    }
> -
>      for (i = 0; i < sc->macs_num; i++) {
>          object_initialize_child(obj, "ftgmac100[*]", &s->ftgmac100[i],
>                                  TYPE_FTGMAC100);
> @@ -325,6 +325,19 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
>          sysbus_connect_irq(SYS_BUS_DEVICE(&s->timerctrl), i, irq);
>      }
>  
> +    /* Watch dog */
> +    for (i = 0; i < sc->wdts_num; i++) {
> +        AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
> +
> +        object_property_set_link(OBJECT(&s->wdt[i]), "scu", OBJECT(&s->scu),
> +                                 &error_abort);
> +        if (!sysbus_realize(SYS_BUS_DEVICE(&s->wdt[i]), errp)) {
> +            return;
> +        }
> +        sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0,
> +                        sc->memmap[ASPEED_DEV_WDT] + i * awc->offset);
> +    }
> +
>      /* ADC */
>      if (!sysbus_realize(SYS_BUS_DEVICE(&s->adc), errp)) {
>          return;
> @@ -395,19 +408,6 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
>      }
>      sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdmc), 0, sc->memmap[ASPEED_DEV_SDMC]);
>  
> -    /* Watch dog */
> -    for (i = 0; i < sc->wdts_num; i++) {
> -        AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
> -
> -        object_property_set_link(OBJECT(&s->wdt[i]), "scu", OBJECT(&s->scu),
> -                                 &error_abort);
> -        if (!sysbus_realize(SYS_BUS_DEVICE(&s->wdt[i]), errp)) {
> -            return;
> -        }
> -        sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0,
> -                        sc->memmap[ASPEED_DEV_WDT] + i * awc->offset);
> -    }
> -
>      /* Net */
>      for (i = 0; i < sc->macs_num; i++) {
>          object_property_set_bool(OBJECT(&s->ftgmac100[i]), "aspeed", true,
> diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
> index 7d53cf2f5133..2eb30d14cf94 100644
> --- a/hw/arm/aspeed_soc.c
> +++ b/hw/arm/aspeed_soc.c
> @@ -162,6 +162,11 @@ static void aspeed_soc_init(Object *obj)
>      snprintf(typename, sizeof(typename), "aspeed.timer-%s", socname);
>      object_initialize_child(obj, "timerctrl", &s->timerctrl, typename);
>  
> +    for (i = 0; i < sc->wdts_num; i++) {
> +        snprintf(typename, sizeof(typename), "aspeed.wdt-%s", socname);
> +        object_initialize_child(obj, "wdt[*]", &s->wdt[i], typename);
> +    }
> +
>      snprintf(typename, sizeof(typename), "aspeed.adc-%s", socname);
>      object_initialize_child(obj, "adc", &s->adc, typename);
>  
> @@ -189,11 +194,6 @@ static void aspeed_soc_init(Object *obj)
>      object_property_add_alias(obj, "max-ram-size", OBJECT(&s->sdmc),
>                                "max-ram-size");
>  
> -    for (i = 0; i < sc->wdts_num; i++) {
> -        snprintf(typename, sizeof(typename), "aspeed.wdt-%s", socname);
> -        object_initialize_child(obj, "wdt[*]", &s->wdt[i], typename);
> -    }
> -
>      for (i = 0; i < sc->macs_num; i++) {
>          object_initialize_child(obj, "ftgmac100[*]", &s->ftgmac100[i],
>                                  TYPE_FTGMAC100);
> @@ -290,6 +290,19 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
>          sysbus_connect_irq(SYS_BUS_DEVICE(&s->timerctrl), i, irq);
>      }
>  
> +    /* Watch dog */
> +    for (i = 0; i < sc->wdts_num; i++) {
> +        AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
> +
> +        object_property_set_link(OBJECT(&s->wdt[i]), "scu", OBJECT(&s->scu),
> +                                 &error_abort);
> +        if (!sysbus_realize(SYS_BUS_DEVICE(&s->wdt[i]), errp)) {
> +            return;
> +        }
> +        sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0,
> +                        sc->memmap[ASPEED_DEV_WDT] + i * awc->offset);
> +    }
> +
>      /* ADC */
>      if (!sysbus_realize(SYS_BUS_DEVICE(&s->adc), errp)) {
>          return;
> @@ -354,19 +367,6 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
>      }
>      sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdmc), 0, sc->memmap[ASPEED_DEV_SDMC]);
>  
> -    /* Watch dog */
> -    for (i = 0; i < sc->wdts_num; i++) {
> -        AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
> -
> -        object_property_set_link(OBJECT(&s->wdt[i]), "scu", OBJECT(&s->scu),
> -                                 &error_abort);
> -        if (!sysbus_realize(SYS_BUS_DEVICE(&s->wdt[i]), errp)) {
> -            return;
> -        }
> -        sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0,
> -                        sc->memmap[ASPEED_DEV_WDT] + i * awc->offset);
> -    }
> -
>      /* Net */
>      for (i = 0; i < sc->macs_num; i++) {
>          object_property_set_bool(OBJECT(&s->ftgmac100[i]), "aspeed", true,
> -- 
> 2.31.1
> 
> 


  parent reply	other threads:[~2021-10-21  7:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18 13:26 [PATCH v2 0/5] aspeed/smc: Improve support for the alternate boot function Cédric Le Goater
2021-10-18 13:26 ` [PATCH v2 1/5] aspeed/wdt: Introduce a container for the MMIO region Cédric Le Goater
2021-10-20 21:57   ` Philippe Mathieu-Daudé
2021-10-21  7:25   ` Francisco Iglesias
2021-10-18 13:26 ` [PATCH v2 2/5] aspeed: Initialize the watchdog device models before the FMC models Cédric Le Goater
2021-10-20 21:58   ` Philippe Mathieu-Daudé
2021-10-21  7:25   ` Francisco Iglesias [this message]
2021-10-18 13:26 ` [PATCH v2 3/5] aspeed/smc: Improve support for the alternate boot function Cédric Le Goater
2021-10-18 13:26 ` [PATCH v2 4/5] aspeed/smc: Use a container for the flash mmio address space Cédric Le Goater
2021-10-20 22:00   ` Philippe Mathieu-Daudé
2021-10-21  7:26   ` Francisco Iglesias
2021-10-18 13:26 ` [PATCH v2 5/5] speed/sdhci: Add trace events Cédric Le Goater
2021-10-20 22:01   ` Philippe Mathieu-Daudé
2021-10-20 22:34   ` Francisco Iglesias
2021-10-20  4:57 ` [PATCH v2 0/5] aspeed/smc: Improve support for the alternate boot function Peter Delevoryas
2021-10-20  8:26   ` Cédric Le Goater
2021-10-22  6:11     ` Cédric Le Goater
2021-10-22  7:05       ` Peter Delevoryas

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=20211021072553.GH23846@fralle-msi \
    --to=frasse.iglesias@gmail.com \
    --cc=andrew@aj.id.au \
    --cc=clg@kaod.org \
    --cc=joel@jms.id.au \
    --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).