From: "Cédric Le Goater" <clg@redhat.com>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Jamin Lin" <jamin_lin@aspeedtech.com>,
"Cédric Le Goater" <clg@redhat.com>
Subject: [PULL 15/34] hw/arm/aspeed_ast1040: Add common realize function for AST1040/AST1080 SoCs
Date: Sat, 31 Oct 2026 07:58:04 +0100 [thread overview]
Message-ID: <20261031065823.191966-16-clg@redhat.com> (raw)
In-Reply-To: <20261031065823.191966-1-clg@redhat.com>
From: Jamin Lin <jamin_lin@aspeedtech.com>
AST1040 and AST1080 are the next-generation SoCs of AST1030 and AST1060,
respectively.
The AST1030 and AST1060 SoCs share common realization through
aspeed_soc_ast10x0_realize(). Similarly, introduce
aspeed_soc_ast10x0_g2_realize() to provide common realization for the
AST1040 and AST1080 SoCs.
Move the shared AST1040 realization into the new common function so that
it can be reused when adding AST1080 support. The PECI and eSPI
controllers are only available on the AST1040, so their realization is
kept in aspeed_soc_ast1040_realize().
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261015063625.186708-3-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/arm/aspeed_ast1040.c | 62 ++++++++++++++++++++++++-----------------
1 file changed, 37 insertions(+), 25 deletions(-)
diff --git a/hw/arm/aspeed_ast1040.c b/hw/arm/aspeed_ast1040.c
index 5d2713e8bb41..28abbe70104d 100644
--- a/hw/arm/aspeed_ast1040.c
+++ b/hw/arm/aspeed_ast1040.c
@@ -162,10 +162,9 @@ static void aspeed_soc_ast1040_init(Object *obj)
object_initialize_child(obj, "peci", &s->peci, TYPE_ASPEED_PECI);
}
-static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
+static bool aspeed_soc_ast10x0_g2_realize(Aspeed10x0SoCState *a, Error **errp)
{
- Aspeed10x0SoCState *a = ASPEED10X0_SOC(dev_soc);
- AspeedSoCState *s = ASPEED_SOC(dev_soc);
+ AspeedSoCState *s = ASPEED_SOC(a);
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
g_autofree char *hyperram_name = NULL;
g_autofree char *sram_name = NULL;
@@ -176,10 +175,10 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
if (!clock_has_source(s->sysclk)) {
error_setg(errp, "sysclk clock must be wired up by the board code");
- return;
+ return false;
}
- /* AST1040 CPU Core */
+ /* AST10x0 G2 CPU Core */
armv7m = DEVICE(&a->armv7m);
qdev_prop_set_uint32(armv7m, "num-irq", 256);
qdev_prop_set_string(armv7m, "cpu-type",
@@ -196,7 +195,7 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
sc->sram_size[0], &err);
if (err) {
error_propagate(errp, err);
- return;
+ return false;
}
memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SRAM0],
&s->sram[0]);
@@ -208,14 +207,14 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
sc->sram_size[1], &err);
if (err) {
error_propagate(errp, err);
- return;
+ return false;
}
memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SRAM1],
&s->sram[1]);
/* SCU */
if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
- return;
+ return false;
}
aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->scu), 0,
sc->memmap[ASPEED_DEV_SCU]);
@@ -224,7 +223,7 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
for (i = 0, uart = sc->uarts_base; i < sc->uarts_num; i++, uart++) {
if (!aspeed_soc_uart_realize(s->memory, &s->uart[i],
sc->memmap[uart], errp)) {
- return;
+ return false;
}
sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0,
aspeed_soc_ast1040_get_irq(s, uart));
@@ -232,25 +231,16 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
/* ADC */
if (!sysbus_realize(SYS_BUS_DEVICE(&s->adc), errp)) {
- return;
+ return false;
}
aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->adc), 0,
sc->memmap[ASPEED_DEV_ADC]);
sysbus_connect_irq(SYS_BUS_DEVICE(&s->adc), 0,
aspeed_soc_ast1040_get_irq(s, ASPEED_DEV_ADC));
- /* PECI */
- if (!sysbus_realize(SYS_BUS_DEVICE(&s->peci), errp)) {
- return;
- }
- aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->peci), 0,
- sc->memmap[ASPEED_DEV_PECI]);
- sysbus_connect_irq(SYS_BUS_DEVICE(&s->peci), 0,
- aspeed_soc_ast1040_get_irq(s, ASPEED_DEV_PECI));
-
/* GPIO */
if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) {
- return;
+ return false;
}
aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->gpio), 0,
sc->memmap[ASPEED_DEV_GPIO]);
@@ -260,7 +250,7 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
/* SGPIO */
for (i = 0; i < sc->sgpio_num; i++) {
if (!sysbus_realize(SYS_BUS_DEVICE(&s->sgpiom[i]), errp)) {
- return;
+ return false;
}
aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->sgpiom[i]), 0,
sc->memmap[ASPEED_DEV_SGPIOM0 + i]);
@@ -272,7 +262,7 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
object_property_set_link(OBJECT(&s->i2c), "dram", OBJECT(&s->sram[1]),
&error_abort);
if (!sysbus_realize(SYS_BUS_DEVICE(&s->i2c), errp)) {
- return;
+ return false;
}
aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->i2c), 0,
sc->memmap[ASPEED_DEV_I2C]);
@@ -291,7 +281,7 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
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;
+ return false;
}
aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->wdt[i]), 0, wdt_offset);
}
@@ -300,7 +290,7 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
object_property_set_link(OBJECT(&s->fmc), "dram", OBJECT(&s->sram[1]),
&error_abort);
if (!sysbus_realize(SYS_BUS_DEVICE(&s->fmc), errp)) {
- return;
+ return false;
}
aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->fmc), 0,
sc->memmap[ASPEED_DEV_FMC]);
@@ -314,7 +304,7 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
object_property_set_link(OBJECT(&s->spi[i]), "dram",
OBJECT(&s->sram[1]), &error_abort);
if (!sysbus_realize(SYS_BUS_DEVICE(&s->spi[i]), errp)) {
- return;
+ return false;
}
aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->spi[i]), 0,
sc->memmap[ASPEED_DEV_SPI0 + i]);
@@ -328,6 +318,28 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
create_unimplemented_devices(OBJECT(s), s->memory,
aspeed_soc_ast10x0_g2_unimp_devs);
create_unimplemented_devices(OBJECT(s), s->memory, sc->unimp_devs);
+
+ return true;
+}
+
+static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
+{
+ Aspeed10x0SoCState *a = ASPEED10X0_SOC(dev_soc);
+ AspeedSoCState *s = ASPEED_SOC(a);
+ AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+
+ if (!aspeed_soc_ast10x0_g2_realize(a, errp)) {
+ return;
+ }
+
+ /* PECI */
+ if (!sysbus_realize(SYS_BUS_DEVICE(&s->peci), errp)) {
+ return;
+ }
+ aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->peci), 0,
+ sc->memmap[ASPEED_DEV_PECI]);
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->peci), 0,
+ aspeed_soc_ast1040_get_irq(s, ASPEED_DEV_PECI));
}
static void aspeed_soc_ast1040_class_init(ObjectClass *klass, const void *data)
--
2.56.0
next prev parent reply other threads:[~2026-10-31 7:01 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 6:57 [PULL 00/34] aspeed queue Cédric Le Goater
2026-10-31 6:57 ` [PULL 01/34] hw/ssi/aspeed_smc: Fix AST2700 segment end address decoding Cédric Le Goater
2026-10-31 6:57 ` [PULL 02/34] hw/ssi/aspeed_smc: Fix AST2700 DMA flash address mask Cédric Le Goater
2026-10-31 6:57 ` [PULL 03/34] hw/block/m25p80: Add Winbond W25Q33PW flash Cédric Le Goater
2026-10-31 6:57 ` [PULL 04/34] hw/misc/aspeed_scu: Correct AST1040 A0 revision ID Cédric Le Goater
2026-10-31 6:57 ` [PULL 05/34] hw/ssi/aspeed_smc: Add AST1040 FMC and SPI controllers Cédric Le Goater
2026-10-31 6:57 ` [PULL 06/34] hw/arm/aspeed_ast1040: Add " Cédric Le Goater
2026-10-31 6:57 ` [PULL 07/34] hw/arm/aspeed_ast1040: Add FMC and SPI filters as unimplemented devices Cédric Le Goater
2026-10-31 6:57 ` [PULL 08/34] hw/arm/aspeed_ast1040: Add OTP as an unimplemented device Cédric Le Goater
2026-10-31 6:57 ` [PULL 09/34] hw/arm/aspeed_ast1040: Add Anti-Tamper Controller (ATC) " Cédric Le Goater
2026-10-31 6:57 ` [PULL 10/34] hw/arm/aspeed_ast1040: Add I3C " Cédric Le Goater
2026-10-31 6:58 ` [PULL 11/34] hw/arm/aspeed_ast1040: Add Caliptra " Cédric Le Goater
2026-10-31 6:58 ` [PULL 12/34] tests/qtest/aspeed_smc: Add AST1040 SMC tests Cédric Le Goater
2026-10-31 6:58 ` [PULL 13/34] tests/functional/arm/test_aspeed_ast1040: Update AST1040 image to aspeed-mcu-fw-hub v01.00 Cédric Le Goater
2026-10-31 6:58 ` [PULL 14/34] hw/arm/aspeed_ast1040: Add common init function for AST1040/AST1080 SoCs Cédric Le Goater
2026-10-31 6:58 ` Cédric Le Goater [this message]
2026-10-31 6:58 ` [PULL 16/34] hw/misc/aspeed_scu: Add AST1080 A0 silicon revision definition Cédric Le Goater
2026-10-31 6:58 ` [PULL 17/34] hw/arm/aspeed_ast1040: Add AST1080 SoC support Cédric Le Goater
2026-10-31 6:58 ` [PULL 18/34] hw/arm/aspeed_ast1040: Add AST1080 QSPI filters as unimplemented device Cédric Le Goater
2026-10-31 6:58 ` [PULL 19/34] hw/arm/aspeed_ast1040: Add AST1080 I2C filter as an " Cédric Le Goater
2026-10-31 6:58 ` [PULL 20/34] hw/arm/aspeed_ast1040_evb: Add AST1080 EVB machine support Cédric Le Goater
2026-10-31 6:58 ` [PULL 21/34] tests/functional/arm/aspeed: Add AST1080 test with ASPEED MCU FW Hub v01.00 Cédric Le Goater
2026-10-31 6:58 ` [PULL 22/34] docs/system/arm/aspeed: Add AST1080 Platform Root of Trust evaluation board Cédric Le Goater
2026-10-31 6:58 ` [PULL 23/34] docs/system/arm/aspeed: add the catalina-bmc machine Cédric Le Goater
2026-10-31 6:58 ` [PULL 24/34] docs/system/arm/aspeed: add the sanmiguel-bmc machine Cédric Le Goater
2026-10-31 6:58 ` [PULL 25/34] hw/arm: sanmiguel: remove the second SPI flash controller Cédric Le Goater
2026-10-31 6:58 ` [PULL 26/34] hw/i2c: pca954x: drop unused header inclusions Cédric Le Goater
2026-10-31 6:58 ` [PULL 27/34] hw/i2c: pca954x: add PCA9545 4-channel mux model Cédric Le Goater
2026-10-31 6:58 ` [PULL 28/34] hw/i2c: pca954x: migrate mux state Cédric Le Goater
2026-10-31 6:58 ` [PULL 29/34] tests/qtest: pca9545: add mux test Cédric Le Goater
2026-10-31 6:58 ` [PULL 30/34] hw/rtc: ds1338: move TYPE_DS1338 to a public header Cédric Le Goater
2026-10-31 6:58 ` [PULL 31/34] hw: ds1338: use the TYPE_DS1338 constant instead of the "ds1338" string Cédric Le Goater
2026-10-31 6:58 ` [PULL 32/34] hw/rtc: ds1338: implement Resettable reset Cédric Le Goater
2026-10-31 6:58 ` [PULL 33/34] hw/rtc: ds1338: prefix the file-local helpers with ds1338_ Cédric Le Goater
2026-10-31 6:58 ` [PULL 34/34] hw/rtc: ds1338: parameterise the register map via a device class Cédric Le Goater
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=20261031065823.191966-16-clg@redhat.com \
--to=clg@redhat.com \
--cc=jamin_lin@aspeedtech.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 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.