From: Jamin Lin <[email protected]> Before this change, the I3C unimplemented device of AST1700 needed its own field in AspeedAST1700SoCState and was created and mapped with open-coded calls.
Describe it in a table and use create_unimplemented_devices() to create and map it in the AST1700 memory region. This makes the code easier to maintain and read. No functional change. Signed-off-by: Jamin Lin <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Cédric Le Goater <[email protected]> Link: https://lore.kernel.org/qemu-devel/[email protected] Signed-off-by: Cédric Le Goater <[email protected]> --- hw/arm/aspeed_ast1700.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/hw/arm/aspeed_ast1700.c b/hw/arm/aspeed_ast1700.c index 5af5da5b8a73..e5d5bf405623 100644 --- a/hw/arm/aspeed_ast1700.c +++ b/hw/arm/aspeed_ast1700.c @@ -15,7 +15,6 @@ #define AST2700_SOC_LTPI_SIZE 0x01000000 #define AST1700_SOC_SRAM_SIZE 0x00040000 -#define AST1700_SOC_I3C_SIZE 0x00010000 enum { ASPEED_AST1700_DEV_SPI0, @@ -51,6 +50,11 @@ static const hwaddr aspeed_ast1700_io_memmap[] = { [ASPEED_AST1700_DEV_SPI0_MEM] = 0x04000000, }; +static const UnimplementedDeviceConfig aspeed_ast1700_unimp_devs[] = { + { "ioexp-i3c", "ioexp-i3c", 0x00C20000, 0x00010000, -1000 }, + { } +}; + static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) { AspeedAST1700SoCState *s = ASPEED_AST1700(dev); @@ -181,14 +185,9 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->wdt[i]), 0)); } - /* I3C */ - qdev_prop_set_string(DEVICE(&s->i3c), "name", "ioexp-i3c"); - qdev_prop_set_uint64(DEVICE(&s->i3c), "size", AST1700_SOC_I3C_SIZE); - sysbus_realize(SYS_BUS_DEVICE(&s->i3c), errp); - memory_region_add_subregion_overlap(&s->iomem, - aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_I3C], - sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->i3c), 0), - -1000); + /* Unimplemented devices */ + create_unimplemented_devices(OBJECT(s), &s->iomem, + aspeed_ast1700_unimp_devs); } static void aspeed_ast1700_instance_init(Object *obj) @@ -238,10 +237,6 @@ static void aspeed_ast1700_instance_init(Object *obj) &s->wdt[i], "aspeed.wdt-ast2700"); } - /* I3C */ - object_initialize_child(obj, "ioexp-i3c", &s->i3c, - TYPE_UNIMPLEMENTED_DEVICE); - return; } -- 2.56.0
