[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2] aspeed: qcom: add block backed FRU devices
From: |
Jae Hyun Yoo |
Subject: |
[PATCH v2] aspeed: qcom: add block backed FRU devices |
Date: |
Mon, 18 Jul 2022 10:52:14 -0700 |
From: Graeme Gregory <quic_ggregory@quicinc.com>
The FRU devices for dc-scm-v1 and firework on bus IF_NONE.
-drive file=$DC_SCM_FRU,format=raw,if=none,unit=0
-drive file=$FIREWORK_FRU,format=raw,if=none,unit=1
file must match FRU size of 128k
Signed-off-by: Graeme Gregory <quic_ggregory@quicinc.com>
Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
Reviewed-by: C�dric Le Goater <clg@kaod.org>
---
Changes in v2:
* Changed 'qcom_dc_scm_fru_init' to a generic one so that it can be used
by other machines too. (Patrick)
Discussions on v1:
https://lore.kernel.org/qemu-devel/20220622172830.101210-4-quic_jaehyoo@quicinc.com/
This single patch was dropped from the series so I'm sending it again as a
separate patch.
hw/arm/aspeed.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 4193a3d23d1d..aa9efd4c9723 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -440,6 +440,23 @@ static void at24c_eeprom_init(I2CBus *bus, uint8_t addr,
uint32_t rsize)
i2c_slave_realize_and_unref(i2c_dev, bus, &error_abort);
}
+static void at24c_eeprom_init_from_drive(I2CBus *i2c_bus, uint8_t addr,
+ uint32_t rsize, int drv_bus,
+ int drv_unit)
+{
+ I2CSlave *i2c_dev = i2c_slave_new("at24c-eeprom", addr);
+ DeviceState *dev = DEVICE(i2c_dev);
+ DriveInfo *dinfo = drive_get(IF_NONE, drv_bus, drv_unit);
+
+ qdev_prop_set_uint32(dev, "rom-size", rsize);
+
+ if (dinfo) {
+ qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo));
+ }
+
+ i2c_slave_realize_and_unref(i2c_dev, i2c_bus, &error_abort);
+}
+
static void palmetto_bmc_i2c_init(AspeedMachineState *bmc)
{
AspeedSoCState *soc = &bmc->soc;
@@ -975,6 +992,9 @@ static void qcom_dc_scm_bmc_i2c_init(AspeedMachineState
*bmc)
AspeedSoCState *soc = &bmc->soc;
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 15), "tmp105", 0x4d);
+
+ at24c_eeprom_init_from_drive(aspeed_i2c_get_bus(&soc->i2c, 15), 0x53,
+ 128 * 1024, 0, 0);
}
static void qcom_dc_scm_firework_i2c_init(AspeedMachineState *bmc)
@@ -987,6 +1007,10 @@ static void
qcom_dc_scm_firework_i2c_init(AspeedMachineState *bmc)
/* Now create the Firework specific hardware */
+ /* I2C4 */
+ at24c_eeprom_init_from_drive(aspeed_i2c_get_bus(&soc->i2c, 4), 0x50,
+ 128 * 1024, 0, 1);
+
/* I2C7 CPUVR MUX */
cpuvr_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 7),
"pca9546", 0x70);
--
2.25.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH v2] aspeed: qcom: add block backed FRU devices,
Jae Hyun Yoo <=