From: Kane-Chen-AS <[email protected]> Currently, the Aspeed I2C controller uses a static naming convention for its buses (e.g., "aspeed.i2c.bus.0"). This approach leads to object name conflicts in machine models that incorporate multiple I2C controllers, such as an Aspeed SoC paired with an external IO expander or a co-processor like the AST1700.
This patch series introduces a 'bus-label' property to the Aspeed I2C controller. By setting this property, higher-level platform code (e.g., the SoC realize function) can provide a unique prefix for the I2C buses. Changes in v1: Added bus-label property to AspeedI2CState. Added bus-name property to AspeedI2CBus. Modified aspeed_i2c_realize to generate bus names based on the label. Updated aspeed_i2c_bus_realize to use the customized name for bus initialization and memory region naming. Example usage: If a controller's bus-label is set to "ioexp0", its buses will be named "ioexp0.0", "ioexp0.1", etc., instead of the default "aspeed.i2c.bus.0". Any feedback or suggestions are appreciated. Best Regards, Kane Kane-Chen-AS (1): hw/i2c/aspeed: Introduce 'bus-label' to customize bus naming include/hw/i2c/aspeed_i2c.h | 2 ++ hw/i2c/aspeed_i2c.c | 27 +++++++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) -- 2.43.0
