hw/arm/aspeed_ast1040: Reuse AST2700 GPIO controller model
The AST1040 GPIO controller is compatible with the AST2700 GPIO controller implementation. Reuse the existing "aspeed.gpio-ast2700" device model for AST1040 instead of introducing a separate implementation. Add the GPIO device initialization, MMIO mapping, and IRQ wiring for the AST1040 SoC model. 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/20260603040027.938816-6-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
Jamin Lin committed
Jun 3, 2026 at 04:00 UTC
b97dae9e11c0b15be57566af7077c05a51dde947
1 file changed
+10
hw/arm/aspeed_ast1040.c
+10
@@ -111,6 +111,7 @@ static void aspeed_soc_ast1040_init(Object *obj)
111
112
object_initialize_child(obj, "adc", &s->adc, TYPE_ASPEED_2700_ADC);
113
object_initialize_child(obj, "peci", &s->peci, TYPE_ASPEED_PECI);
114
+ object_initialize_child(obj, "gpio", &s->gpio, "aspeed.gpio-ast2700");
115
116
object_initialize_child(obj, "pwm", &s->pwm, TYPE_UNIMPLEMENTED_DEVICE);
117
object_initialize_child(obj, "espi", &s->espi, TYPE_UNIMPLEMENTED_DEVICE);
@@ -211,6 +212,15 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
212
sysbus_connect_irq(SYS_BUS_DEVICE(&s->peci), 0,
213
aspeed_soc_ast1040_get_irq(s, ASPEED_DEV_PECI));
214
215
+ /* GPIO */
216
+ if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) {
217
+ return;
218
+ }
219
+ aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->gpio), 0,
220
+ sc->memmap[ASPEED_DEV_GPIO]);
221
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio), 0,
222
+ aspeed_soc_ast1040_get_irq(s, ASPEED_DEV_GPIO));
223
+
224
/* Unimplemented peripherals */
225
aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->pwm),
226
"aspeed.pwm",