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 SGPIOM 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 | 3 +++
> hw/arm/aspeed_ast1700.c | 21 +++++++++++++++++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/include/hw/arm/aspeed_ast1700.h b/include/hw/arm/aspeed_ast1700.h
> index 7292719dc2..490f2a3b05 100644
> --- a/include/hw/arm/aspeed_ast1700.h
> +++ b/include/hw/arm/aspeed_ast1700.h
> @@ -12,6 +12,7 @@
> #include "hw/misc/aspeed_scu.h"
> #include "hw/adc/aspeed_adc.h"
> #include "hw/gpio/aspeed_gpio.h"
> +#include "hw/gpio/aspeed_sgpio.h"
> #include "hw/i2c/aspeed_i2c.h"
> #include "hw/misc/aspeed_ltpi.h"
> #include "hw/misc/aspeed_pwm.h"
> @@ -19,6 +20,7 @@
> #include "hw/watchdog/wdt_aspeed.h"
> #include "hw/char/serial-mm.h"
>
> +#define AST1700_SGPIO_NUM 2
> #define AST1700_WDT_NUM 9
>
> #define TYPE_ASPEED_AST1700 "aspeed.ast1700"
> @@ -39,6 +41,7 @@ struct AspeedAST1700SoCState {
> AspeedADCState adc;
> AspeedSCUState scu;
> AspeedGPIOState gpio;
> + AspeedSGPIOState sgpiom[AST1700_SGPIO_NUM];
> AspeedI2CState i2c;
> AspeedPWMState pwm;
> AspeedWDTState wdt[AST1700_WDT_NUM];
> diff --git a/hw/arm/aspeed_ast1700.c b/hw/arm/aspeed_ast1700.c
> index 5a2552aa25..ca0ce4e2c2 100644
> --- a/hw/arm/aspeed_ast1700.c
> +++ b/hw/arm/aspeed_ast1700.c
> @@ -23,6 +23,8 @@ enum {
> ASPEED_AST1700_DEV_ADC,
> ASPEED_AST1700_DEV_SCU,
> ASPEED_AST1700_DEV_GPIO,
> + ASPEED_AST1700_DEV_SGPIOM0,
> + ASPEED_AST1700_DEV_SGPIOM1,
> ASPEED_AST1700_DEV_I2C,
> ASPEED_AST1700_DEV_UART12,
> ASPEED_AST1700_DEV_LTPI_CTRL,
> @@ -37,6 +39,8 @@ static const hwaddr aspeed_ast1700_io_memmap[] = {
> [ASPEED_AST1700_DEV_ADC] = 0x00C00000,
> [ASPEED_AST1700_DEV_SCU] = 0x00C02000,
> [ASPEED_AST1700_DEV_GPIO] = 0x00C0B000,
> + [ASPEED_AST1700_DEV_SGPIOM0] = 0x00C0C000,
> + [ASPEED_AST1700_DEV_SGPIOM1] = 0x00C0D000,
> [ASPEED_AST1700_DEV_I2C] = 0x00C0F000,
> [ASPEED_AST1700_DEV_UART12] = 0x00C33B00,
> [ASPEED_AST1700_DEV_LTPI_CTRL] = 0x00C34000,
> @@ -141,6 +145,17 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
> memory_region_add_subregion(&s->iomem,
> aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_LTPI_CTRL],
> sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->ltpi), 0));
> +
> + /* SGPIOM */
> + for (int i = 0; i < AST1700_SGPIO_NUM; i++) {
> + if (!sysbus_realize(SYS_BUS_DEVICE(&s->sgpiom[i]), errp)) {
> + return;
> + }
> + memory_region_add_subregion(&s->iomem,
> + aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SGPIOM0 + i],
> + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->sgpiom[i]), 0));
> + }
> +
> /* WDT */
> for (int i = 0; i < AST1700_WDT_NUM; i++) {
> AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
> @@ -194,6 +209,12 @@ static void aspeed_ast1700_instance_init(Object *obj)
> object_initialize_child(obj, "ltpi-ctrl",
> &s->ltpi, TYPE_ASPEED_LTPI);
>
> + /* SGPIOM */
> + for (int i = 0; i < AST1700_SGPIO_NUM; i++) {
> + object_initialize_child(obj, "ioexp-sgpiom[*]", &s->sgpiom[i],
> + "aspeed.sgpio-ast2700");
> + }
> +
> /* WDT */
> for (int i = 0; i < AST1700_WDT_NUM; i++) {
> object_initialize_child(obj, "ioexp-wdt[*]",
> --
> 2.43.0
>