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 WDT 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 | 4 ++++
> hw/arm/aspeed_ast1700.c | 24 ++++++++++++++++++++++++
> 2 files changed, 28 insertions(+)
>
> diff --git a/include/hw/arm/aspeed_ast1700.h b/include/hw/arm/aspeed_ast1700.h
> index d4b7abee7d..f43c0c5475 100644
> --- a/include/hw/arm/aspeed_ast1700.h
> +++ b/include/hw/arm/aspeed_ast1700.h
> @@ -15,8 +15,11 @@
> #include "hw/i2c/aspeed_i2c.h"
> #include "hw/misc/aspeed_ltpi.h"
> #include "hw/ssi/aspeed_smc.h"
> +#include "hw/watchdog/wdt_aspeed.h"
> #include "hw/char/serial-mm.h"
>
> +#define AST1700_WDT_NUM 9
> +
> #define TYPE_ASPEED_AST1700 "aspeed.ast1700"
>
> OBJECT_DECLARE_SIMPLE_TYPE(AspeedAST1700SoCState, ASPEED_AST1700)
> @@ -36,6 +39,7 @@ struct AspeedAST1700SoCState {
> AspeedSCUState scu;
> AspeedGPIOState gpio;
> AspeedI2CState i2c;
> + AspeedWDTState wdt[AST1700_WDT_NUM];
> };
>
> #endif /* ASPEED_AST1700_H */
> diff --git a/hw/arm/aspeed_ast1700.c b/hw/arm/aspeed_ast1700.c
> index fad3b86e8d..9fb84dd159 100644
> --- a/hw/arm/aspeed_ast1700.c
> +++ b/hw/arm/aspeed_ast1700.c
> @@ -25,6 +25,7 @@ enum {
> ASPEED_AST1700_DEV_I2C,
> ASPEED_AST1700_DEV_UART12,
> ASPEED_AST1700_DEV_LTPI_CTRL,
> + ASPEED_AST1700_DEV_WDT,
> ASPEED_AST1700_DEV_SPI0_MEM,
> };
>
> @@ -37,6 +38,7 @@ static const hwaddr aspeed_ast1700_io_memmap[] = {
> [ASPEED_AST1700_DEV_I2C] = 0x00C0F000,
> [ASPEED_AST1700_DEV_UART12] = 0x00C33B00,
> [ASPEED_AST1700_DEV_LTPI_CTRL] = 0x00C34000,
> + [ASPEED_AST1700_DEV_WDT] = 0x00C37000,
> [ASPEED_AST1700_DEV_SPI0_MEM] = 0x04000000,
> };
>
> @@ -129,6 +131,22 @@ 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));
> + /* WDT */
> + for (int i = 0; i < AST1700_WDT_NUM; i++) {
> + AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
> + hwaddr wdt_offset = aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_WDT] +
> + i * awc->iosize;
> +
> + object_property_set_link(OBJECT(&s->wdt[i]), "scu", OBJECT(&s->scu),
> + errp);
> + if (!sysbus_realize(SYS_BUS_DEVICE(&s->wdt[i]), errp)) {
> + return;
> + }
> + memory_region_add_subregion(&s->iomem,
> + wdt_offset,
> + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->wdt[i]), 0));
> + }
> +
> }
>
> static void aspeed_ast1700_instance_init(Object *obj)
> @@ -163,6 +181,12 @@ static void aspeed_ast1700_instance_init(Object *obj)
> object_initialize_child(obj, "ltpi-ctrl",
> &s->ltpi, TYPE_ASPEED_LTPI);
>
> + /* WDT */
> + for (int i = 0; i < AST1700_WDT_NUM; i++) {
> + object_initialize_child(obj, "ioexp-wdt[*]",
> + &s->wdt[i], "aspeed.wdt-ast2700");
> + }
> +
> return;
> }
>
> --
> 2.43.0
>