From cf7155da296d7dacb64ffe8fd8923f36c42fb944 Mon Sep 17 00:00:00 2001 From: Jamin Lin Date: Tue, 4 Nov 2025 11:12:42 +0800 Subject: [PATCH] hw/arm/aspeed: Rename and export create_pca9554() as aspeed_create_pca9554() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 I2C 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 Reviewed-by: Cédric Le Goater Link: https://lore.kernel.org/qemu-devel/20251104031325.146374-5-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater --- hw/arm/aspeed.c | 8 ++++---- include/hw/arm/aspeed.h | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) 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); diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h index 9b765295d9..16b24e6887 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 I2C bus index to attach the device. + * @addr: the I2C address of the PCA9554 device. + * + * Create and attach a PCA9554 I/O expander to the specified I2C 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 -- 2.47.3