From: "Cédric Le Goater" <clg@kaod.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org,
"Andrew Jeffery" <andrew@aj.id.au>,
"Joel Stanley" <joel@jms.id.au>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Cédric Le Goater" <clg@kaod.org>
Subject: [Qemu-devel] [PATCH v6 6/8] aspeed: Add EEPROM I2C devices
Date: Thu, 19 Oct 2017 18:35:44 +0200 [thread overview]
Message-ID: <20171019163546.2039-7-clg@kaod.org> (raw)
In-Reply-To: <20171019163546.2039-1-clg@kaod.org>
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>
---
hw/arm/aspeed.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 124a0e5240b5..df7f266800ba 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"
@@ -276,11 +277,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);
@@ -317,6 +322,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);
@@ -386,6 +395,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);
@@ -396,6 +406,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.6
next prev parent reply other threads:[~2017-10-19 16:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-19 16:35 [Qemu-devel] [PATCH v6 0/8] aspeed: add a witherspoon-bmc machine Cédric Le Goater
2017-10-19 16:35 ` [Qemu-devel] [PATCH v6 1/8] aspeed: use a ROM memory region to catch invalid writes Cédric Le Goater
2017-10-19 16:35 ` [Qemu-devel] [PATCH v6 2/8] aspeed: remove ignore_memory_transaction_failures on all boards Cédric Le Goater
2017-10-19 16:35 ` [Qemu-devel] [PATCH v6 3/8] aspeed: add support for the witherspoon-bmc board Cédric Le Goater
2017-10-19 16:35 ` [Qemu-devel] [PATCH v6 4/8] aspeed: add an I2C RTC device to all machines Cédric Le Goater
2017-10-19 16:35 ` [Qemu-devel] [PATCH v6 5/8] smbus: add a smbus_eeprom_init_one() routine Cédric Le Goater
2017-10-19 16:35 ` Cédric Le Goater [this message]
2017-10-19 16:35 ` [Qemu-devel] [PATCH v6 7/8] misc: add pca9552 LED blinker model Cédric Le Goater
2017-10-20 2:58 ` Philippe Mathieu-Daudé
2017-10-20 6:11 ` Cédric Le Goater
2017-10-19 16:35 ` [Qemu-devel] [PATCH v6 8/8] aspeed: add the pc9552 chips to the witherspoon machine Cédric Le Goater
2017-10-20 2:59 ` Philippe Mathieu-Daudé
2017-10-20 6:15 ` Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171019163546.2039-7-clg@kaod.org \
--to=clg@kaod.org \
--cc=andrew@aj.id.au \
--cc=f4bug@amsat.org \
--cc=joel@jms.id.au \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).