Re: [Qemu-devel] [PATCH v2 2/3] aspeed: initialize the SCU controller first

2018-06-24 Thread Andrew Jeffery
On Fri, 22 Jun 2018, at 17:26, Cédric Le Goater wrote:
> The System Control Unit should be initialized first as it drives all
> the configuration of the SoC and other device models.
> 
> Signed-off-by: Cédric Le Goater 
> Reviewed-by: Joel Stanley 

Acked-by: Andrew Jeffery 

> ---
>  hw/arm/aspeed_soc.c | 40 
>  1 file changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
> index 1955a892f4a4..7cc05ee27ea4 100644
> --- a/hw/arm/aspeed_soc.c
> +++ b/hw/arm/aspeed_soc.c
> @@ -109,18 +109,6 @@ static void aspeed_soc_init(Object *obj)
>  object_initialize(>cpu, sizeof(s->cpu), sc->info->cpu_type);
>  object_property_add_child(obj, "cpu", OBJECT(>cpu), NULL);
>  
> -object_initialize(>vic, sizeof(s->vic), TYPE_ASPEED_VIC);
> -object_property_add_child(obj, "vic", OBJECT(>vic), NULL);
> -qdev_set_parent_bus(DEVICE(>vic), sysbus_get_default());
> -
> -object_initialize(>timerctrl, sizeof(s->timerctrl), 
> TYPE_ASPEED_TIMER);
> -object_property_add_child(obj, "timerctrl", OBJECT(>timerctrl), NULL);
> -qdev_set_parent_bus(DEVICE(>timerctrl), sysbus_get_default());
> -
> -object_initialize(>i2c, sizeof(s->i2c), TYPE_ASPEED_I2C);
> -object_property_add_child(obj, "i2c", OBJECT(>i2c), NULL);
> -qdev_set_parent_bus(DEVICE(>i2c), sysbus_get_default());
> -
>  object_initialize(>scu, sizeof(s->scu), TYPE_ASPEED_SCU);
>  object_property_add_child(obj, "scu", OBJECT(>scu), NULL);
>  qdev_set_parent_bus(DEVICE(>scu), sysbus_get_default());
> @@ -133,6 +121,18 @@ static void aspeed_soc_init(Object *obj)
>  object_property_add_alias(obj, "hw-prot-key", OBJECT(>scu),
>"hw-prot-key", _abort);
>  
> +object_initialize(>vic, sizeof(s->vic), TYPE_ASPEED_VIC);
> +object_property_add_child(obj, "vic", OBJECT(>vic), NULL);
> +qdev_set_parent_bus(DEVICE(>vic), sysbus_get_default());
> +
> +object_initialize(>timerctrl, sizeof(s->timerctrl), 
> TYPE_ASPEED_TIMER);
> +object_property_add_child(obj, "timerctrl", OBJECT(>timerctrl), 
> NULL);
> +qdev_set_parent_bus(DEVICE(>timerctrl), sysbus_get_default());
> +
> +object_initialize(>i2c, sizeof(s->i2c), TYPE_ASPEED_I2C);
> +object_property_add_child(obj, "i2c", OBJECT(>i2c), NULL);
> +qdev_set_parent_bus(DEVICE(>i2c), sysbus_get_default());
> +
>  object_initialize(>fmc, sizeof(s->fmc), sc->info->fmc_typename);
>  object_property_add_child(obj, "fmc", OBJECT(>fmc), NULL);
>  qdev_set_parent_bus(DEVICE(>fmc), sysbus_get_default());
> @@ -195,6 +195,14 @@ static void aspeed_soc_realize(DeviceState *dev, 
> Error **errp)
>  memory_region_add_subregion(get_system_memory(), 
> ASPEED_SOC_SRAM_BASE,
>  >sram);
>  
> +/* SCU */
> +object_property_set_bool(OBJECT(>scu), true, "realized", );
> +if (err) {
> +error_propagate(errp, err);
> +return;
> +}
> +sysbus_mmio_map(SYS_BUS_DEVICE(>scu), 0, ASPEED_SOC_SCU_BASE);
> +
>  /* VIC */
>  object_property_set_bool(OBJECT(>vic), true, "realized", );
>  if (err) {
> @@ -219,14 +227,6 @@ static void aspeed_soc_realize(DeviceState *dev, 
> Error **errp)
>  sysbus_connect_irq(SYS_BUS_DEVICE(>timerctrl), i, irq);
>  }
>  
> -/* SCU */
> -object_property_set_bool(OBJECT(>scu), true, "realized", );
> -if (err) {
> -error_propagate(errp, err);
> -return;
> -}
> -sysbus_mmio_map(SYS_BUS_DEVICE(>scu), 0, ASPEED_SOC_SCU_BASE);
> -
>  /* UART - attach an 8250 to the IO space as our UART5 */
>  if (serial_hd(0)) {
>  qemu_irq uart5 = qdev_get_gpio_in(DEVICE(>vic), uart_irqs[4]);
> -- 
> 2.13.6
> 



[Qemu-devel] [PATCH v2 2/3] aspeed: initialize the SCU controller first

2018-06-22 Thread Cédric Le Goater
The System Control Unit should be initialized first as it drives all
the configuration of the SoC and other device models.

Signed-off-by: Cédric Le Goater 
Reviewed-by: Joel Stanley 
---
 hw/arm/aspeed_soc.c | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
index 1955a892f4a4..7cc05ee27ea4 100644
--- a/hw/arm/aspeed_soc.c
+++ b/hw/arm/aspeed_soc.c
@@ -109,18 +109,6 @@ static void aspeed_soc_init(Object *obj)
 object_initialize(>cpu, sizeof(s->cpu), sc->info->cpu_type);
 object_property_add_child(obj, "cpu", OBJECT(>cpu), NULL);
 
-object_initialize(>vic, sizeof(s->vic), TYPE_ASPEED_VIC);
-object_property_add_child(obj, "vic", OBJECT(>vic), NULL);
-qdev_set_parent_bus(DEVICE(>vic), sysbus_get_default());
-
-object_initialize(>timerctrl, sizeof(s->timerctrl), TYPE_ASPEED_TIMER);
-object_property_add_child(obj, "timerctrl", OBJECT(>timerctrl), NULL);
-qdev_set_parent_bus(DEVICE(>timerctrl), sysbus_get_default());
-
-object_initialize(>i2c, sizeof(s->i2c), TYPE_ASPEED_I2C);
-object_property_add_child(obj, "i2c", OBJECT(>i2c), NULL);
-qdev_set_parent_bus(DEVICE(>i2c), sysbus_get_default());
-
 object_initialize(>scu, sizeof(s->scu), TYPE_ASPEED_SCU);
 object_property_add_child(obj, "scu", OBJECT(>scu), NULL);
 qdev_set_parent_bus(DEVICE(>scu), sysbus_get_default());
@@ -133,6 +121,18 @@ static void aspeed_soc_init(Object *obj)
 object_property_add_alias(obj, "hw-prot-key", OBJECT(>scu),
   "hw-prot-key", _abort);
 
+object_initialize(>vic, sizeof(s->vic), TYPE_ASPEED_VIC);
+object_property_add_child(obj, "vic", OBJECT(>vic), NULL);
+qdev_set_parent_bus(DEVICE(>vic), sysbus_get_default());
+
+object_initialize(>timerctrl, sizeof(s->timerctrl), TYPE_ASPEED_TIMER);
+object_property_add_child(obj, "timerctrl", OBJECT(>timerctrl), NULL);
+qdev_set_parent_bus(DEVICE(>timerctrl), sysbus_get_default());
+
+object_initialize(>i2c, sizeof(s->i2c), TYPE_ASPEED_I2C);
+object_property_add_child(obj, "i2c", OBJECT(>i2c), NULL);
+qdev_set_parent_bus(DEVICE(>i2c), sysbus_get_default());
+
 object_initialize(>fmc, sizeof(s->fmc), sc->info->fmc_typename);
 object_property_add_child(obj, "fmc", OBJECT(>fmc), NULL);
 qdev_set_parent_bus(DEVICE(>fmc), sysbus_get_default());
@@ -195,6 +195,14 @@ static void aspeed_soc_realize(DeviceState *dev, Error 
**errp)
 memory_region_add_subregion(get_system_memory(), ASPEED_SOC_SRAM_BASE,
 >sram);
 
+/* SCU */
+object_property_set_bool(OBJECT(>scu), true, "realized", );
+if (err) {
+error_propagate(errp, err);
+return;
+}
+sysbus_mmio_map(SYS_BUS_DEVICE(>scu), 0, ASPEED_SOC_SCU_BASE);
+
 /* VIC */
 object_property_set_bool(OBJECT(>vic), true, "realized", );
 if (err) {
@@ -219,14 +227,6 @@ static void aspeed_soc_realize(DeviceState *dev, Error 
**errp)
 sysbus_connect_irq(SYS_BUS_DEVICE(>timerctrl), i, irq);
 }
 
-/* SCU */
-object_property_set_bool(OBJECT(>scu), true, "realized", );
-if (err) {
-error_propagate(errp, err);
-return;
-}
-sysbus_mmio_map(SYS_BUS_DEVICE(>scu), 0, ASPEED_SOC_SCU_BASE);
-
 /* UART - attach an 8250 to the IO space as our UART5 */
 if (serial_hd(0)) {
 qemu_irq uart5 = qdev_get_gpio_in(DEVICE(>vic), uart_irqs[4]);
-- 
2.13.6