[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/22] ppc/ppc405: Use an embedded PPCUIC model in SoC state
From: |
BALATON Zoltan |
Subject: |
[PATCH 14/22] ppc/ppc405: Use an embedded PPCUIC model in SoC state |
Date: |
Sat, 13 Aug 2022 17:34:41 +0200 (CEST) |
From: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/ppc/ppc405.h | 3 ++-
hw/ppc/ppc405_uc.c | 28 ++++++++++++++--------------
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/hw/ppc/ppc405.h b/hw/ppc/ppc405.h
index c0251f0894..5bcbce2893 100644
--- a/hw/ppc/ppc405.h
+++ b/hw/ppc/ppc405.h
@@ -27,6 +27,7 @@
#include "qom/object.h"
#include "hw/ppc/ppc4xx.h"
+#include "hw/intc/ppc-uic.h"
#define PPC405EP_SDRAM_BASE 0x00000000
#define PPC405EP_NVRAM_BASE 0xF0000000
@@ -208,7 +209,7 @@ struct Ppc405SoCState {
hwaddr ram_size;
PowerPCCPU cpu;
- DeviceState *uic;
+ PPCUIC uic;
Ppc405CpcState cpc;
Ppc405GptState gpt;
Ppc405OcmState ocm;
diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c
index 01625e3237..82830f52bf 100644
--- a/hw/ppc/ppc405_uc.c
+++ b/hw/ppc/ppc405_uc.c
@@ -1080,6 +1080,8 @@ static void ppc405_soc_instance_init(Object *obj)
object_initialize_child(obj, "cpu", &s->cpu,
POWERPC_CPU_TYPE_NAME("405ep"));
+ object_initialize_child(obj, "uic", &s->uic, TYPE_PPC_UIC);
+
object_initialize_child(obj, "cpc", &s->cpc, TYPE_PPC405_CPC);
object_property_add_alias(obj, "sys-clk", OBJECT(&s->cpc), "sys-clk");
@@ -1147,17 +1149,15 @@ static void ppc405_soc_realize(DeviceState *dev, Error
**errp)
sysbus_mmio_map(sbd, 0, 0xef600600);
/* Universal interrupt controller */
- s->uic = qdev_new(TYPE_PPC_UIC);
-
- object_property_set_link(OBJECT(s->uic), "cpu", OBJECT(&s->cpu),
+ object_property_set_link(OBJECT(&s->uic), "cpu", OBJECT(&s->cpu),
&error_fatal);
- if (!sysbus_realize(SYS_BUS_DEVICE(s->uic), errp)) {
+ sbd = SYS_BUS_DEVICE(&s->uic);
+ if (!sysbus_realize(sbd, errp)) {
return;
}
-
- sysbus_connect_irq(SYS_BUS_DEVICE(s->uic), PPCUIC_OUTPUT_INT,
+ sysbus_connect_irq(sbd, PPCUIC_OUTPUT_INT,
qdev_get_gpio_in(DEVICE(&s->cpu), PPC40x_INPUT_INT));
- sysbus_connect_irq(SYS_BUS_DEVICE(s->uic), PPCUIC_OUTPUT_CINT,
+ sysbus_connect_irq(sbd, PPCUIC_OUTPUT_CINT,
qdev_get_gpio_in(DEVICE(&s->cpu), PPC40x_INPUT_CINT));
/* SDRAM controller */
@@ -1168,7 +1168,7 @@ static void ppc405_soc_realize(DeviceState *dev, Error
**errp)
"ppc405.sdram0", s->dram_mr,
s->ram_bases[0], s->ram_sizes[0]);
- ppc4xx_sdram_init(env, qdev_get_gpio_in(s->uic, 17), 1,
+ ppc4xx_sdram_init(env, qdev_get_gpio_in(DEVICE(&s->uic), 17), 1,
s->ram_banks, s->ram_bases, s->ram_sizes,
s->do_dram_init);
@@ -1183,12 +1183,12 @@ static void ppc405_soc_realize(DeviceState *dev, Error
**errp)
}
sbd = SYS_BUS_DEVICE(&s->dma);
for (i = 0; i < ARRAY_SIZE(s->dma.irqs); i++) {
- sysbus_connect_irq(sbd, i, qdev_get_gpio_in(s->uic, 5 + i));
+ sysbus_connect_irq(sbd, i, qdev_get_gpio_in(DEVICE(&s->uic), 5 + i));
}
/* I2C controller */
sysbus_create_simple(TYPE_PPC4xx_I2C, 0xef600500,
- qdev_get_gpio_in(s->uic, 2));
+ qdev_get_gpio_in(DEVICE(&s->uic), 2));
/* GPIO */
sbd = SYS_BUS_DEVICE(&s->gpio);
@@ -1200,13 +1200,13 @@ static void ppc405_soc_realize(DeviceState *dev, Error
**errp)
/* Serial ports */
if (serial_hd(0) != NULL) {
serial_mm_init(get_system_memory(), 0xef600300, 0,
- qdev_get_gpio_in(s->uic, 0),
+ qdev_get_gpio_in(DEVICE(&s->uic), 0),
PPC_SERIAL_MM_BAUDBASE, serial_hd(0),
DEVICE_BIG_ENDIAN);
}
if (serial_hd(1) != NULL) {
serial_mm_init(get_system_memory(), 0xef600400, 0,
- qdev_get_gpio_in(s->uic, 1),
+ qdev_get_gpio_in(DEVICE(&s->uic), 1),
PPC_SERIAL_MM_BAUDBASE, serial_hd(1),
DEVICE_BIG_ENDIAN);
}
@@ -1223,7 +1223,7 @@ static void ppc405_soc_realize(DeviceState *dev, Error
**errp)
}
sysbus_mmio_map(sbd, 0, 0xef600000);
for (i = 0; i < ARRAY_SIZE(s->gpt.irqs); i++) {
- sysbus_connect_irq(sbd, i, qdev_get_gpio_in(s->uic, 19 + i));
+ sysbus_connect_irq(sbd, i, qdev_get_gpio_in(DEVICE(&s->uic), 19 + i));
}
/* MAL */
@@ -1234,7 +1234,7 @@ static void ppc405_soc_realize(DeviceState *dev, Error
**errp)
}
sbd = SYS_BUS_DEVICE(&s->mal);
for (i = 0; i < ARRAY_SIZE(s->mal.irqs); i++) {
- sysbus_connect_irq(sbd, i, qdev_get_gpio_in(s->uic, 11 + i));
+ sysbus_connect_irq(sbd, i, qdev_get_gpio_in(DEVICE(&s->uic), 11 + i));
}
/* Ethernet */
--
2.30.4
- [PATCH 05/22] ppc/ppc405: QOM'ify GPIO, (continued)
- [PATCH 05/22] ppc/ppc405: QOM'ify GPIO, BALATON Zoltan, 2022/08/13
- [PATCH 06/22] ppc/ppc405: QOM'ify DMA, BALATON Zoltan, 2022/08/13
- [PATCH 10/22] ppc/ppc405: QOM'ify PLB, BALATON Zoltan, 2022/08/13
- [PATCH 09/22] ppc/ppc405: QOM'ify POB, BALATON Zoltan, 2022/08/13
- [PATCH 11/22] ppc/ppc405: QOM'ify MAL, BALATON Zoltan, 2022/08/13
- [PATCH 13/22] ppc4xx: Move EBC model to ppc4xx_devs.c, BALATON Zoltan, 2022/08/13
- [PATCH 12/22] ppc4xx: Move PLB model to ppc4xx_devs.c, BALATON Zoltan, 2022/08/13
- [PATCH 14/22] ppc/ppc405: Use an embedded PPCUIC model in SoC state,
BALATON Zoltan <=
- [PATCH 15/22] hw/intc/ppc-uic: Convert ppc-uic to a PPC4xx DCR device, BALATON Zoltan, 2022/08/13
- [PATCH 16/22] ppc/ppc405: Use an explicit I2C object, BALATON Zoltan, 2022/08/13
- [PATCH 19/22] hw/ppc/Kconfig: Remove PPC405 dependency from sam460ex, BALATON Zoltan, 2022/08/13
- [PATCH 20/22] hw/ppc/Kconfig: Move imply before select, BALATON Zoltan, 2022/08/13
- [PATCH 17/22] ppc/ppc405: QOM'ify FPGA, BALATON Zoltan, 2022/08/13
- [PATCH 18/22] ppc405: Move machine specific code to ppc405_boards.c, BALATON Zoltan, 2022/08/13