The Aspeed boards have at least one EEPROM to hold the Vital Product
Data (VPD).
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
Changes since v1:
- fixed palmetto EEPROM size
- used smbus_eeprom_init_one()
hw/arm/aspeed.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 362b683e9021..462f8008cff5 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -17,6 +17,7 @@
#include "hw/arm/arm.h"
#include "hw/arm/aspeed_soc.h"
#include "hw/boards.h"
+#include "hw/i2c/smbus.h"
#include "qemu/log.h"
#include "sysemu/block-backend.h"
#include "sysemu/blockdev.h"
@@ -255,11 +256,15 @@ static void palmetto_bmc_i2c_init(AspeedBoardState *bmc)
{
AspeedSoCState *soc = &bmc->soc;
DeviceState *dev;
+ uint8_t *eeprom_buf = g_malloc0(32 * 1024);
/* The palmetto platform expects a ds3231 RTC but a ds1338 is
* enough to provide basic RTC features. Alarms will be missing */
i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 0), "ds1338", 0x68);
+ smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 0), 0x50,
+ eeprom_buf);
+
/* add a TMP423 temperature sensor */
dev = i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 2),
"tmp423", 0x4c);
@@ -297,6 +302,10 @@ static const TypeInfo palmetto_bmc_type = {
static void ast2500_evb_i2c_init(AspeedBoardState *bmc)
{
AspeedSoCState *soc = &bmc->soc;
+ uint8_t *eeprom_buf = g_malloc0(8 * 1024);
+
+ smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), 0x50,
+ eeprom_buf);
/* The AST2500 EVB expects a LM75 but a TMP105 is compatible */
i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 7), "tmp105", 0x4d);
@@ -368,6 +377,7 @@ static const TypeInfo romulus_bmc_type = {
static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc)
{
AspeedSoCState *soc = &bmc->soc;
+ uint8_t *eeprom_buf = g_malloc0(8 * 1024);
i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 4), "tmp423", 0x4c);
i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 5), "tmp423", 0x4c);
@@ -377,6 +387,9 @@ static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc)
/* The witherspoon board expects Epson RX8900 I2C RTC but a ds1338 is
* good enough */
i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", 0x32);
+
+ smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), 0x51,
+ eeprom_buf);
}
static void witherspoon_bmc_init(MachineState *machine)
--
2.13.5
On Wed, 2017-09-20 at 09:01 +0200, Cédric Le Goater wrote:
> The Aspeed boards have at least one EEPROM to hold the Vital Product
> Data (VPD).
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
> ---
>
> Changes since v1:
>
> - fixed palmetto EEPROM size
> - used smbus_eeprom_init_one()
>
> hw/arm/aspeed.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index 362b683e9021..462f8008cff5 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -17,6 +17,7 @@
> #include "hw/arm/arm.h"
> #include "hw/arm/aspeed_soc.h"
> #include "hw/boards.h"
> +#include "hw/i2c/smbus.h"
> #include "qemu/log.h"
> #include "sysemu/block-backend.h"
> #include "sysemu/blockdev.h"
> @@ -255,11 +256,15 @@ static void palmetto_bmc_i2c_init(AspeedBoardState *bmc)
> {
> AspeedSoCState *soc = &bmc->soc;
> DeviceState *dev;
> + uint8_t *eeprom_buf = g_malloc0(32 * 1024);
>
> /* The palmetto platform expects a ds3231 RTC but a ds1338 is
> * enough to provide basic RTC features. Alarms will be missing */
> i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 0), "ds1338", 0x68);
>
> + smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 0), 0x50,
> + eeprom_buf);
> +
> /* add a TMP423 temperature sensor */
> dev = i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 2),
> "tmp423", 0x4c);
> @@ -297,6 +302,10 @@ static const TypeInfo palmetto_bmc_type = {
> static void ast2500_evb_i2c_init(AspeedBoardState *bmc)
> {
> AspeedSoCState *soc = &bmc->soc;
> + uint8_t *eeprom_buf = g_malloc0(8 * 1024);
> +
> + smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), 0x50,
> + eeprom_buf);
>
> /* The AST2500 EVB expects a LM75 but a TMP105 is compatible */
> i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 7), "tmp105", 0x4d);
> @@ -368,6 +377,7 @@ static const TypeInfo romulus_bmc_type = {
> static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc)
> {
> AspeedSoCState *soc = &bmc->soc;
> + uint8_t *eeprom_buf = g_malloc0(8 * 1024);
>
> i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 4), "tmp423", 0x4c);
> i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 5), "tmp423", 0x4c);
> @@ -377,6 +387,9 @@ static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc)
> /* The witherspoon board expects Epson RX8900 I2C RTC but a ds1338 is
> * good enough */
> i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", 0x32);
> +
> + smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), 0x51,
> + eeprom_buf);
> }
>
> static void witherspoon_bmc_init(MachineState *machine)
© 2016 - 2026 Red Hat, Inc.