On 11/3/25 10:27, Jamin Lin wrote:
The helper function create_pca9554() has been renamed to
aspeed_create_pca9554() and made globally available.

Previously, the function was declared static inside aspeed.c, restricting
its visibility to that file. As more Aspeed machine implementations
require PCA9554 I²C expander setup, it makes sense to rename it with the
aspeed_ prefix and export its declaration in aspeed.h for shared use.

No functional changes.

Signed-off-by: Jamin Lin <[email protected]>
---
  include/hw/arm/aspeed.h | 14 ++++++++++++++
  hw/arm/aspeed.c         |  8 ++++----
  2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
index 3afb964088..d2d9e49a39 100644
--- a/include/hw/arm/aspeed.h
+++ b/include/hw/arm/aspeed.h
@@ -80,4 +80,18 @@ void aspeed_machine_class_init_cpus_defaults(MachineClass 
*mc);
   */
  void aspeed_create_pca9552(AspeedSoCState *soc, int bus_id, int addr);
+/*
+ * aspeed_create_pca9554:
+ * @soc: pointer to the #AspeedSoCState.
+ * @bus_id: the I²C bus index to attach the device.
+ * @addr: the I²C address of the PCA9554 device.

I will change I²C to I2C.

Reviewed-by: Cédric Le Goater <[email protected]>

Thanks,

C.





+ *
+ * Create and attach a PCA9554 I/O expander to the specified I²C bus
+ * of the given Aspeed SoC. The device is created via
+ * i2c_slave_create_simple() and returned as an #I2CSlave pointer.
+ *
+ * Returns: a pointer to the newly created #I2CSlave instance.
+ */
+I2CSlave *aspeed_create_pca9554(AspeedSoCState *soc, int bus_id, int addr);
+
  #endif
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index c6f272d986..59416eb5ae 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -543,7 +543,7 @@ void aspeed_create_pca9552(AspeedSoCState *soc, int bus_id, 
int addr)
                              TYPE_PCA9552, addr);
  }
-static I2CSlave *create_pca9554(AspeedSoCState *soc, int bus_id, int addr)
+I2CSlave *aspeed_create_pca9554(AspeedSoCState *soc, int bus_id, int addr)
  {
      return i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, bus_id),
                              TYPE_PCA9554, addr);
@@ -1142,7 +1142,7 @@ static void gb200nvl_bmc_i2c_init(AspeedMachineState *bmc)
      }
/* Bus 5 Expander */
-    create_pca9554(soc, 4, 0x21);
+    aspeed_create_pca9554(soc, 4, 0x21);
/* Mux I2c Expanders */
      i2c_slave_create_simple(i2c[5], "pca9546", 0x71);
@@ -1153,12 +1153,12 @@ static void gb200nvl_bmc_i2c_init(AspeedMachineState 
*bmc)
      i2c_slave_create_simple(i2c[5], "pca9546", 0x77);
/* Bus 10 */
-    dev = DEVICE(create_pca9554(soc, 9, 0x20));
+    dev = DEVICE(aspeed_create_pca9554(soc, 9, 0x20));
/* Set FPGA_READY */
      object_property_set_str(OBJECT(dev), "pin1", "high", &error_fatal);
- create_pca9554(soc, 9, 0x21);
+    aspeed_create_pca9554(soc, 9, 0x21);
      at24c_eeprom_init(i2c[9], 0x50, 64 * KiB);
      at24c_eeprom_init(i2c[9], 0x51, 64 * KiB);


Reply via email to