From: Kane-Chen-AS <[email protected]> Connect the LTPI controller to the AST1700 model by mapping its MMIO region and wiring its interrupt line.
Signed-off-by: Kane-Chen-AS <[email protected]> --- include/hw/misc/aspeed_ast1700.h | 2 ++ hw/misc/aspeed_ast1700.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/hw/misc/aspeed_ast1700.h b/include/hw/misc/aspeed_ast1700.h index 624ef61eda..c2bea11346 100644 --- a/include/hw/misc/aspeed_ast1700.h +++ b/include/hw/misc/aspeed_ast1700.h @@ -28,6 +28,8 @@ struct AspeedAST1700SoCState { SysBusDevice parent_obj; MemoryRegion iomem; + + AspeedLTPIState ltpi; }; #endif /* ASPEED_AST1700_H */ diff --git a/hw/misc/aspeed_ast1700.c b/hw/misc/aspeed_ast1700.c index 3125bec795..0ca2b90ff0 100644 --- a/hw/misc/aspeed_ast1700.c +++ b/hw/misc/aspeed_ast1700.c @@ -16,6 +16,14 @@ #include "hw/misc/aspeed_ast1700.h" #define AST2700_SOC_LTPI_SIZE 0x01000000 + +enum { + ASPEED_AST1700_DEV_LTPI_CTRL, +}; + +static const hwaddr aspeed_ast1700_io_memmap[] = { + [ASPEED_AST1700_DEV_LTPI_CTRL] = 0x00C34000, +}; static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) { AspeedAST1700SoCState *s = ASPEED_AST1700(dev); @@ -26,10 +34,23 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) AST2700_SOC_LTPI_SIZE); sysbus_init_mmio(sbd, &s->iomem); + /* LTPI controller */ + if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) { + return; + } + 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)); } static void aspeed_ast1700_instance_init(Object *obj) { + AspeedAST1700SoCState *s = ASPEED_AST1700(obj); + + /* LTPI controller */ + object_initialize_child(obj, "ltpi-ctrl", + &s->ltpi, TYPE_ASPEED_LTPI); + return; } -- 2.43.0
