hw/arm/aspeed_ast1040: Reuse AST2700 ADC model
Instead of introducing a dedicated TYPE_ASPEED_1040_ADC model, initialize the existing AST2700 ADC device directly for AST1040. This avoids unnecessary duplication and keeps the codebase simpler and easier to maintain. Add ADC device initialization and realization support to the AST1040 SoC model using TYPE_ASPEED_2700_ADC. 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-4-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
Jamin Lin committed
Jun 3, 2026 at 04:00 UTC
d792a2a8982de2d4bf2f301e064983ae7f945546
1 file changed
+11
hw/arm/aspeed_ast1040.c
+11
@@ -107,6 +107,8 @@ static void aspeed_soc_ast1040_init(Object *obj)
107
object_initialize_child(obj, "uart[*]", &s->uart[i], TYPE_SERIAL_MM);
108
}
109
110
+ object_initialize_child(obj, "adc", &s->adc, TYPE_ASPEED_2700_ADC);
111
+
112
object_initialize_child(obj, "pwm", &s->pwm, TYPE_UNIMPLEMENTED_DEVICE);
113
object_initialize_child(obj, "espi", &s->espi, TYPE_UNIMPLEMENTED_DEVICE);
114
object_initialize_child(obj, "udc", &s->udc, TYPE_UNIMPLEMENTED_DEVICE);
@@ -188,6 +190,15 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
190
aspeed_soc_ast1040_get_irq(s, uart));
191
}
192
193
+ /* ADC */
194
+ if (!sysbus_realize(SYS_BUS_DEVICE(&s->adc), errp)) {
195
+ return;
196
+ }
197
+ aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->adc), 0,
198
+ sc->memmap[ASPEED_DEV_ADC]);
199
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->adc), 0,
200
+ aspeed_soc_ast1040_get_irq(s, ASPEED_DEV_ADC));
201
+
202
/* Unimplemented peripherals */
203
aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->pwm),
204
"aspeed.pwm",