From: Kane-Chen-AS <[email protected]>

The AST2700 SoC can be integrated with multiple AST1700 IO expanders.
Without unique identifiers, the I2C bus object names for the primary
BMC SoC and multiple expander chips may collide in the QOM
(QEMU Object Model) tree.

To resolve this, introduce a bus-label property to the AST1700 SoC.
This allows the parent SoC (AST2700) to assign a unique prefix
(e.g., "ioexp0", "ioexp1") to each AST1700 instance. These labels
ensure that the bus naming hierarchy remains distinct and traceable
across different expanders.

Signed-off-by: Kane-Chen-AS <[email protected]>
---
 include/hw/arm/aspeed_ast1700.h | 1 +
 hw/arm/aspeed_ast1700.c         | 1 +
 hw/arm/aspeed_ast27x0.c         | 3 +++
 3 files changed, 5 insertions(+)

diff --git a/include/hw/arm/aspeed_ast1700.h b/include/hw/arm/aspeed_ast1700.h
index 63cfcb4c24..d364203175 100644
--- a/include/hw/arm/aspeed_ast1700.h
+++ b/include/hw/arm/aspeed_ast1700.h
@@ -27,6 +27,7 @@ struct AspeedAST1700SoCState {
     MemoryRegion *dram_mr;
     uint8_t board_idx;
     uint32_t silicon_rev;
+    char *bus_label;
 
     AspeedLTPIState ltpi;
     SerialMM uart;
diff --git a/hw/arm/aspeed_ast1700.c b/hw/arm/aspeed_ast1700.c
index c7eaf583e2..0f2d2c381d 100644
--- a/hw/arm/aspeed_ast1700.c
+++ b/hw/arm/aspeed_ast1700.c
@@ -156,6 +156,7 @@ static void aspeed_ast1700_instance_init(Object *obj)
 static const Property aspeed_ast1700_props[] = {
     DEFINE_PROP_UINT8("board-idx", AspeedAST1700SoCState, board_idx, 0),
     DEFINE_PROP_UINT32("silicon-rev", AspeedAST1700SoCState, silicon_rev, 0),
+    DEFINE_PROP_STRING("bus-label", AspeedAST1700SoCState, bus_label),
     DEFINE_PROP_LINK("dram", AspeedAST1700SoCState, dram_mr,
                      TYPE_MEMORY_REGION, MemoryRegion *),
 };
diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c
index 58977e2fa3..b4b5afe6d3 100644
--- a/hw/arm/aspeed_ast27x0.c
+++ b/hw/arm/aspeed_ast27x0.c
@@ -503,11 +503,14 @@ static void aspeed_soc_ast2700_init(Object *obj)
     }
 
     for (i = 0; i < sc->ioexp_num; i++) {
+        g_autofree char *bus_label = g_strdup_printf("ioexp%d", i);
         /* AST1700 IOEXP */
         object_initialize_child(obj, "ioexp[*]", &s->ioexp[i],
                                 TYPE_ASPEED_AST1700);
         qdev_prop_set_uint32(DEVICE(&s->ioexp[i]), "silicon-rev",
                              sc->silicon_rev);
+        qdev_prop_set_string(DEVICE(&s->ioexp[i]), "bus-label",
+                             bus_label);
     }
 
     object_initialize_child(obj, "dpmcu", &s->dpmcu,
-- 
2.43.0


Reply via email to