On Tue, Dec 23, 2025 at 5:42 PM Kane Chen <kane_chen@aspeedtech.com> wrote:
>
> From: Kane-Chen-AS <kane_chen@aspeedtech.com>
>
> Connect the ADC device to AST1700 model.
>
> Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
> Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Nabih Estefan <nabihestefan@google.com>
Tested-by: Nabih Estefan <nabihestefan@google.com>
> ---
> include/hw/arm/aspeed_ast1700.h | 2 ++
> hw/arm/aspeed_ast1700.c | 14 ++++++++++++++
> hw/arm/aspeed_ast27x0.c | 5 +++++
> 3 files changed, 21 insertions(+)
>
> diff --git a/include/hw/arm/aspeed_ast1700.h b/include/hw/arm/aspeed_ast1700.h
> index 5b120dd11a..0c1216c4ba 100644
> --- a/include/hw/arm/aspeed_ast1700.h
> +++ b/include/hw/arm/aspeed_ast1700.h
> @@ -9,6 +9,7 @@
> #define ASPEED_AST1700_H
>
> #include "hw/sysbus.h"
> +#include "hw/adc/aspeed_adc.h"
> #include "hw/misc/aspeed_ltpi.h"
> #include "hw/ssi/aspeed_smc.h"
> #include "hw/char/serial-mm.h"
> @@ -27,6 +28,7 @@ struct AspeedAST1700SoCState {
> SerialMM uart;
> MemoryRegion sram;
> AspeedSMCState spi;
> + AspeedADCState adc;
> };
>
> #endif /* ASPEED_AST1700_H */
> diff --git a/hw/arm/aspeed_ast1700.c b/hw/arm/aspeed_ast1700.c
> index fc09bb1aed..e4d206045f 100644
> --- a/hw/arm/aspeed_ast1700.c
> +++ b/hw/arm/aspeed_ast1700.c
> @@ -19,6 +19,7 @@
> enum {
> ASPEED_AST1700_DEV_SPI0,
> ASPEED_AST1700_DEV_SRAM,
> + ASPEED_AST1700_DEV_ADC,
> ASPEED_AST1700_DEV_UART12,
> ASPEED_AST1700_DEV_LTPI_CTRL,
> ASPEED_AST1700_DEV_SPI0_MEM,
> @@ -27,6 +28,7 @@ enum {
> static const hwaddr aspeed_ast1700_io_memmap[] = {
> [ASPEED_AST1700_DEV_SPI0] = 0x00030000,
> [ASPEED_AST1700_DEV_SRAM] = 0x00BC0000,
> + [ASPEED_AST1700_DEV_ADC] = 0x00C00000,
> [ASPEED_AST1700_DEV_UART12] = 0x00C33B00,
> [ASPEED_AST1700_DEV_LTPI_CTRL] = 0x00C34000,
> [ASPEED_AST1700_DEV_SPI0_MEM] = 0x04000000,
> @@ -76,6 +78,14 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
> aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SPI0_MEM],
> sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->spi), 1));
>
> + /* ADC */
> + if (!sysbus_realize(SYS_BUS_DEVICE(&s->adc), errp)) {
> + return;
> + }
> + memory_region_add_subregion(&s->iomem,
> + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_ADC],
> + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->adc), 0));
> +
> /* LTPI controller */
> if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) {
> return;
> @@ -97,6 +107,10 @@ static void aspeed_ast1700_instance_init(Object *obj)
> object_initialize_child(obj, "ioexp-spi[*]", &s->spi,
> "aspeed.spi0-ast2700");
>
> + /* ADC */
> + object_initialize_child(obj, "ioexp-adc[*]", &s->adc,
> + "aspeed.adc-ast2700");
> +
> /* LTPI controller */
> object_initialize_child(obj, "ltpi-ctrl",
> &s->ltpi, TYPE_ASPEED_LTPI);
> diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c
> index f2418e0e45..84ff8b5557 100644
> --- a/hw/arm/aspeed_ast27x0.c
> +++ b/hw/arm/aspeed_ast27x0.c
> @@ -1117,6 +1117,11 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
> sysbus_connect_irq(SYS_BUS_DEVICE(&a->intcioexp[i]), j,
> irq);
> }
> +
> + /* ADC */
> + sysbus_connect_irq(SYS_BUS_DEVICE(&s->ioexp[i].adc), 0,
> + aspeed_soc_ast2700_get_irq(s, ASPEED_DEV_ADC));
> +
> }
>
> aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu),
> --
> 2.43.0
>