From nobody Sat Apr 27 21:54:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507905079761217.96454623022032; Fri, 13 Oct 2017 07:31:19 -0700 (PDT) Received: from localhost ([::1]:50572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e30zc-00068r-1n for importer@patchew.org; Fri, 13 Oct 2017 10:31:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e30y0-00056N-AM for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:29:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e30xw-0000Zl-4K for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:29:36 -0400 Received: from 20.mo4.mail-out.ovh.net ([46.105.33.73]:59864) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e30xv-0000W9-UP for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:29:32 -0400 Received: from player159.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id 4CD92E60E4 for ; Fri, 13 Oct 2017 16:29:22 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player159.ha.ovh.net (Postfix) with ESMTPSA id 74164480095; Fri, 13 Oct 2017 16:29:14 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Date: Fri, 13 Oct 2017 16:28:47 +0200 Message-Id: <20171013142852.916-2-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171013142852.916-1-clg@kaod.org> References: <20171013142852.916-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 14826412925235596049 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrtdeigdejkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.33.73 Subject: [Qemu-devel] [PATCH v3 1/6] aspeed: add support for the witherspoon-bmc board X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Joel Stanley Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The Witherspoon boards are OpenPOWER system hosting POWER9 Processors. Let's add support for their BMC including a couple of I2C devices as found on real HW. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Andrew Jeffery --- Changes since v2: - removed 'ignore_memory_transaction_failures' flag on the machine. Will require a couple of fixes in the legacy U-Boot accessing wrongly the bss before the DRAM is initialized. The HW drops the write access surely because the SMC controller is configured in autoread mode by default. I don't know how to model this behavior in QEMU. I think we would need suppport to boot from a MMIO region. - Added a comment on the I2C device used. hw/arm/aspeed.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index ab895ad490af..5e0b9a184b9c 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -46,6 +46,7 @@ enum { PALMETTO_BMC, AST2500_EVB, ROMULUS_BMC, + WITHERSPOON_BMC, }; =20 /* Palmetto hardware value: 0x120CE416 */ @@ -83,8 +84,12 @@ enum { SCU_AST2500_HW_STRAP_ACPI_ENABLE | \ SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER)) =20 +/* Witherspoon hardware value: 0xF10AD216 (but use romulus definition) */ +#define WITHERSPOON_BMC_HW_STRAP1 ROMULUS_BMC_HW_STRAP1 + static void palmetto_bmc_i2c_init(AspeedBoardState *bmc); static void ast2500_evb_i2c_init(AspeedBoardState *bmc); +static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc); =20 static const AspeedBoardConfig aspeed_boards[] =3D { [PALMETTO_BMC] =3D { @@ -110,6 +115,14 @@ static const AspeedBoardConfig aspeed_boards[] =3D { .spi_model =3D "mx66l1g45g", .num_cs =3D 2, }, + [WITHERSPOON_BMC] =3D { + .soc_name =3D "ast2500-a1", + .hw_strap1 =3D WITHERSPOON_BMC_HW_STRAP1, + .fmc_model =3D "mx25l25635e", + .spi_model =3D "mx66l1g45g", + .num_cs =3D 2, + .i2c_init =3D witherspoon_bmc_i2c_init, + }, }; =20 #define FIRMWARE_ADDR 0x0 @@ -337,11 +350,47 @@ static const TypeInfo romulus_bmc_type =3D { .class_init =3D romulus_bmc_class_init, }; =20 +static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc) +{ + AspeedSoCState *soc =3D &bmc->soc; + + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 4), "tmp423", 0= x4c); + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 5), "tmp423", 0= x4c); + + /* The Witherspoon expects a TMP275 but a TMP105 is compatible */ + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), "tmp105", 0= x4a); +} + +static void witherspoon_bmc_init(MachineState *machine) +{ + aspeed_board_init(machine, &aspeed_boards[WITHERSPOON_BMC]); +} + +static void witherspoon_bmc_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + + mc->desc =3D "OpenPOWER Witherspoon BMC (ARM1176)"; + mc->init =3D witherspoon_bmc_init; + mc->max_cpus =3D 1; + mc->no_sdcard =3D 1; + mc->no_floppy =3D 1; + mc->no_cdrom =3D 1; + mc->no_parallel =3D 1; +} + +static const TypeInfo witherspoon_bmc_type =3D { + .name =3D MACHINE_TYPE_NAME("witherspoon-bmc"), + .parent =3D TYPE_MACHINE, + .class_init =3D witherspoon_bmc_class_init, +}; + static void aspeed_machine_init(void) { type_register_static(&palmetto_bmc_type); type_register_static(&ast2500_evb_type); type_register_static(&romulus_bmc_type); + type_register_static(&witherspoon_bmc_type); } =20 type_init(aspeed_machine_init) --=20 2.13.6 From nobody Sat Apr 27 21:54:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507905276293642.9300508985752; Fri, 13 Oct 2017 07:34:36 -0700 (PDT) Received: from localhost ([::1]:50583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e312b-0008Ku-7k for importer@patchew.org; Fri, 13 Oct 2017 10:34:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e30y1-00057F-MT for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:29:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e30xx-0000ai-OL for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:29:37 -0400 Received: from 12.mo4.mail-out.ovh.net ([178.33.104.253]:39429) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e30xx-0000ZC-HO for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:29:33 -0400 Received: from player159.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id 723B1E7560 for ; Fri, 13 Oct 2017 16:29:30 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player159.ha.ovh.net (Postfix) with ESMTPSA id 4522A48007D; Fri, 13 Oct 2017 16:29:22 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Date: Fri, 13 Oct 2017 16:28:48 +0200 Message-Id: <20171013142852.916-3-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171013142852.916-1-clg@kaod.org> References: <20171013142852.916-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 14828664725426637585 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrtdeigdejkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.104.253 Subject: [Qemu-devel] [PATCH v3 2/6] aspeed: add an I2C RTC device to all machines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Joel Stanley Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The AST2500 EVB does not have an RTC but we can pretend that one is plugged on the I2C bus header. The romulus and witherspoon boards expects an Epson RX8900 I2C RTC but a ds1338 is good enough for the basic features we need. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Andrew Jeffery --- hw/arm/aspeed.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 5e0b9a184b9c..032fd61d452f 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -89,6 +89,7 @@ enum { =20 static void palmetto_bmc_i2c_init(AspeedBoardState *bmc); static void ast2500_evb_i2c_init(AspeedBoardState *bmc); +static void romulus_bmc_i2c_init(AspeedBoardState *bmc); static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc); =20 static const AspeedBoardConfig aspeed_boards[] =3D { @@ -114,6 +115,7 @@ static const AspeedBoardConfig aspeed_boards[] =3D { .fmc_model =3D "n25q256a", .spi_model =3D "mx66l1g45g", .num_cs =3D 2, + .i2c_init =3D romulus_bmc_i2c_init, }, [WITHERSPOON_BMC] =3D { .soc_name =3D "ast2500-a1", @@ -298,6 +300,10 @@ static void ast2500_evb_i2c_init(AspeedBoardState *bmc) =20 /* The AST2500 EVB expects a LM75 but a TMP105 is compatible */ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 7), "tmp105", 0= x4d); + + /* The AST2500 EVB does not have an RTC. Let's pretend that one is + * plugged on the I2C bus header */ + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", = 0x32); } =20 static void ast2500_evb_init(MachineState *machine) @@ -325,6 +331,15 @@ static const TypeInfo ast2500_evb_type =3D { .class_init =3D ast2500_evb_class_init, }; =20 +static void romulus_bmc_i2c_init(AspeedBoardState *bmc) +{ + AspeedSoCState *soc =3D &bmc->soc; + + /* The romulus 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); +} + static void romulus_bmc_init(MachineState *machine) { aspeed_board_init(machine, &aspeed_boards[ROMULUS_BMC]); @@ -359,6 +374,10 @@ static void witherspoon_bmc_i2c_init(AspeedBoardState = *bmc) =20 /* The Witherspoon expects a TMP275 but a TMP105 is compatible */ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), "tmp105", 0= x4a); + + /* 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); } =20 static void witherspoon_bmc_init(MachineState *machine) --=20 2.13.6 From nobody Sat Apr 27 21:54:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507905391765580.088578151592; Fri, 13 Oct 2017 07:36:31 -0700 (PDT) Received: from localhost ([::1]:50600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e314c-0001bn-40 for importer@patchew.org; Fri, 13 Oct 2017 10:36:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e30y8-0005DI-Bq for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:29:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e30y4-0000hN-4E for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:29:44 -0400 Received: from 7.mo4.mail-out.ovh.net ([178.33.253.54]:43706) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e30y3-0000fJ-TX for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:29:40 -0400 Received: from player159.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id A4155E7681 for ; Fri, 13 Oct 2017 16:29:38 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player159.ha.ovh.net (Postfix) with ESMTPSA id 7303B48009C; Fri, 13 Oct 2017 16:29:30 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Date: Fri, 13 Oct 2017 16:28:49 +0200 Message-Id: <20171013142852.916-4-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171013142852.916-1-clg@kaod.org> References: <20171013142852.916-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 14830916523426286353 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrtdeigdejkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.253.54 Subject: [Qemu-devel] [PATCH v3 3/6] smbus: add a smbus_eeprom_init_one() routine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Joel Stanley Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This is an helper routine to add a single EEPROM on an I2C bus. It can be directly used by smbus_eeprom_init() which adds a certain number of EEPROMs on mips and x86 machines. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i2c/smbus_eeprom.c | 16 +++++++++++----- include/hw/i2c/smbus.h | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c index b13ec0fe7a2a..2d24a4cd59bf 100644 --- a/hw/i2c/smbus_eeprom.c +++ b/hw/i2c/smbus_eeprom.c @@ -140,6 +140,16 @@ static void smbus_eeprom_register_types(void) =20 type_init(smbus_eeprom_register_types) =20 +void smbus_eeprom_init_one(I2CBus *smbus, uint8_t address, uint8_t *eeprom= _buf) +{ + DeviceState *dev; + + dev =3D qdev_create((BusState *) smbus, "smbus-eeprom"); + qdev_prop_set_uint8(dev, "address", address); + qdev_prop_set_ptr(dev, "data", eeprom_buf); + qdev_init_nofail(dev); +} + void smbus_eeprom_init(I2CBus *smbus, int nb_eeprom, const uint8_t *eeprom_spd, int eeprom_spd_size) { @@ -150,10 +160,6 @@ void smbus_eeprom_init(I2CBus *smbus, int nb_eeprom, } =20 for (i =3D 0; i < nb_eeprom; i++) { - DeviceState *eeprom; - eeprom =3D qdev_create((BusState *)smbus, "smbus-eeprom"); - qdev_prop_set_uint8(eeprom, "address", 0x50 + i); - qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256)); - qdev_init_nofail(eeprom); + smbus_eeprom_init_one(smbus, 0x50 + i, eeprom_buf + (i * 256)); } } diff --git a/include/hw/i2c/smbus.h b/include/hw/i2c/smbus.h index 544bbc19574f..666cdeb04c07 100644 --- a/include/hw/i2c/smbus.h +++ b/include/hw/i2c/smbus.h @@ -77,6 +77,7 @@ int smbus_read_block(I2CBus *bus, uint8_t addr, uint8_t c= ommand, uint8_t *data); int smbus_write_block(I2CBus *bus, uint8_t addr, uint8_t command, uint8_t = *data, int len); =20 +void smbus_eeprom_init_one(I2CBus *smbus, uint8_t address, uint8_t *eeprom= _buf); void smbus_eeprom_init(I2CBus *smbus, int nb_eeprom, const uint8_t *eeprom_spd, int size); =20 --=20 2.13.6 From nobody Sat Apr 27 21:54:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507905379360128.870140557568; Fri, 13 Oct 2017 07:36:19 -0700 (PDT) Received: from localhost ([::1]:50598 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e314J-0001Oy-K0 for importer@patchew.org; Fri, 13 Oct 2017 10:36:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e30yG-0005JY-4Z for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:29:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e30yC-0000qy-6g for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:29:52 -0400 Received: from 8.mo4.mail-out.ovh.net ([188.165.33.112]:36555) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e30yC-0000qF-0H for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:29:48 -0400 Received: from player159.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id A855FE764A for ; Fri, 13 Oct 2017 16:29:46 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player159.ha.ovh.net (Postfix) with ESMTPSA id A400248009F; Fri, 13 Oct 2017 16:29:38 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Date: Fri, 13 Oct 2017 16:28:50 +0200 Message-Id: <20171013142852.916-5-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171013142852.916-1-clg@kaod.org> References: <20171013142852.916-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 14833168326777015057 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrtdeigdejkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 188.165.33.112 Subject: [Qemu-devel] [PATCH v3 4/6] aspeed: Add EEPROM I2C devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Joel Stanley Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The Aspeed boards have at least one EEPROM to hold the Vital Product Data (VPD). Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Andrew Jeffery --- hw/arm/aspeed.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 032fd61d452f..2a6ca58527f8 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 *b= mc) { AspeedSoCState *soc =3D &bmc->soc; DeviceState *dev; + uint8_t *eeprom_buf =3D g_malloc0(32 * 1024); =20 /* 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", 0= x68); =20 + smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 0), 0x50, + eeprom_buf); + /* add a TMP423 temperature sensor */ dev =3D i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 2), "tmp423", 0x4c); @@ -297,6 +302,10 @@ static const TypeInfo palmetto_bmc_type =3D { static void ast2500_evb_i2c_init(AspeedBoardState *bmc) { AspeedSoCState *soc =3D &bmc->soc; + uint8_t *eeprom_buf =3D g_malloc0(8 * 1024); + + smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), 0x50, + eeprom_buf); =20 /* The AST2500 EVB expects a LM75 but a TMP105 is compatible */ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 7), "tmp105", 0= x4d); @@ -368,6 +377,7 @@ static const TypeInfo romulus_bmc_type =3D { static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc) { AspeedSoCState *soc =3D &bmc->soc; + uint8_t *eeprom_buf =3D g_malloc0(8 * 1024); =20 i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 4), "tmp423", 0= x4c); i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 5), "tmp423", 0= x4c); @@ -378,6 +388,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); } =20 static void witherspoon_bmc_init(MachineState *machine) --=20 2.13.6 From nobody Sat Apr 27 21:54:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507905478710417.38396027301224; Fri, 13 Oct 2017 07:37:58 -0700 (PDT) Received: from localhost ([::1]:50610 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e315v-0002a5-QY for importer@patchew.org; Fri, 13 Oct 2017 10:37:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e30yO-0005Oe-5W for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:30:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e30yK-0000vs-2f for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:30:00 -0400 Received: from 16.mo4.mail-out.ovh.net ([188.165.55.104]:43811) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e30yJ-0000u8-Pf for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:29:56 -0400 Received: from player159.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id 5E0A5E777B for ; Fri, 13 Oct 2017 16:29:54 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player159.ha.ovh.net (Postfix) with ESMTPSA id A15CB48009F; Fri, 13 Oct 2017 16:29:46 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Date: Fri, 13 Oct 2017 16:28:51 +0200 Message-Id: <20171013142852.916-6-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171013142852.916-1-clg@kaod.org> References: <20171013142852.916-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 14835420124623112977 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrtdeigdejkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 188.165.55.104 Subject: [Qemu-devel] [PATCH v3 5/6] misc: add pca9552 LED blinker model X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Joel Stanley Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Specs are available here : https://www.nxp.com/docs/en/data-sheet/PCA9552.pdf This is a simple model supporting the basic registers for led and GPIO mode. The device also supports two blinking rates but not the model yet. Signed-off-by: C=C3=A9dric Le Goater --- Changes since v2: - removed comments on the I2C buffer size, but kept the array. I did not want to rewrite the buffer handling default-configs/arm-softmmu.mak | 1 + hw/misc/Makefile.objs | 1 + hw/misc/pca9552.c | 212 ++++++++++++++++++++++++++++++++++++= ++++ include/hw/misc/pca9552.h | 32 ++++++ 4 files changed, 246 insertions(+) create mode 100644 hw/misc/pca9552.c create mode 100644 include/hw/misc/pca9552.h diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.= mak index 5059d134c816..d868d1095a6c 100644 --- a/default-configs/arm-softmmu.mak +++ b/default-configs/arm-softmmu.mak @@ -16,6 +16,7 @@ CONFIG_TSC2005=3Dy CONFIG_LM832X=3Dy CONFIG_TMP105=3Dy CONFIG_TMP421=3Dy +CONFIG_PCA9552=3Dy CONFIG_STELLARIS=3Dy CONFIG_STELLARIS_INPUT=3Dy CONFIG_STELLARIS_ENET=3Dy diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs index e8f0a02f35af..e4e22880dbbc 100644 --- a/hw/misc/Makefile.objs +++ b/hw/misc/Makefile.objs @@ -7,6 +7,7 @@ common-obj-$(CONFIG_SGA) +=3D sga.o common-obj-$(CONFIG_ISA_TESTDEV) +=3D pc-testdev.o common-obj-$(CONFIG_PCI_TESTDEV) +=3D pci-testdev.o common-obj-$(CONFIG_EDU) +=3D edu.o +common-obj-$(CONFIG_PCA9552) +=3D pca9552.o =20 common-obj-y +=3D unimp.o =20 diff --git a/hw/misc/pca9552.c b/hw/misc/pca9552.c new file mode 100644 index 000000000000..22460f4c14fe --- /dev/null +++ b/hw/misc/pca9552.c @@ -0,0 +1,212 @@ +/* + * PCA9552 I2C LED blinker + * + * Copyright (c) 2017, IBM Corporation. + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * later. See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "hw/hw.h" +#include "hw/misc/pca9552.h" + +#define PCA9552_INPUT0 0 /* read only input register 0 */ +#define PCA9552_INPUT1 1 /* read only input register 1 */ +#define PCA9552_PSC0 2 /* read/write frequency prescaler 0 */ +#define PCA9552_PWM0 3 /* read/write PWM register 0 */ +#define PCA9552_PSC1 4 /* read/write frequency prescaler 1 */ +#define PCA9552_PWM1 5 /* read/write PWM register 1 */ +#define PCA9552_LS0 6 /* read/write LED0 to LED3 selector */ +#define PCA9552_LS1 7 /* read/write LED4 to LED7 selector */ +#define PCA9552_LS2 8 /* read/write LED8 to LED11 selector */ +#define PCA9552_LS3 9 /* read/write LED12 to LED15 selector */ + +#define PCA9552_LED_ON 0x0 +#define PCA9552_LED_OFF 0x1 +#define PCA9552_LED_PWM0 0x2 +#define PCA9552_LED_PWM1 0x3 + +static uint8_t pca9552_pin_get_config(PCA9552State *s, int pin) +{ + uint8_t reg =3D PCA9552_LS0 + (pin / 4); + uint8_t shift =3D (pin % 4) << 1; + + return (s->regs[reg] >> shift) & 0x3; +} + +static void pca9552_update_pin_input(PCA9552State *s) +{ + int i; + + for (i =3D 0; i < 16; i++) { + uint8_t input_reg =3D PCA9552_INPUT0 + (i / 8); + uint8_t input_shift =3D (i % 8); + uint8_t config =3D pca9552_pin_get_config(s, i); + + switch (config) { + case PCA9552_LED_ON: + s->regs[input_reg] |=3D 1 << input_shift; + break; + case PCA9552_LED_OFF: + s->regs[input_reg] &=3D ~(1 << input_shift); + break; + case PCA9552_LED_PWM0: + case PCA9552_LED_PWM1: + /* ??? */ + default: + break; + } + } +} + +static void pca9552_read(PCA9552State *s) +{ + uint8_t reg =3D s->pointer & 0xf; + + s->len =3D 0; + + switch (reg) { + case PCA9552_INPUT0: + case PCA9552_INPUT1: + case PCA9552_PSC0: + case PCA9552_PWM0: + case PCA9552_PSC1: + case PCA9552_PWM1: + case PCA9552_LS0: + case PCA9552_LS1: + case PCA9552_LS2: + case PCA9552_LS3: + s->buf[s->len++] =3D s->regs[reg]; + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, "%s: unexpected read to register %d= \n", + __func__, reg); + } +} + +static void pca9552_write(PCA9552State *s) +{ + uint8_t reg =3D s->pointer & 0xf; + + switch (reg) { + case PCA9552_PSC0: + case PCA9552_PWM0: + case PCA9552_PSC1: + case PCA9552_PWM1: + s->regs[reg] =3D s->buf[0]; + break; + + case PCA9552_LS0: + case PCA9552_LS1: + case PCA9552_LS2: + case PCA9552_LS3: + s->regs[reg] =3D s->buf[0]; + pca9552_update_pin_input(s); + break; + + case PCA9552_INPUT0: + case PCA9552_INPUT1: + default: + qemu_log_mask(LOG_GUEST_ERROR, "%s: unexpected write to register %= d\n", + __func__, reg); + } +} + +static int pca9552_recv(I2CSlave *i2c) +{ + PCA9552State *s =3D PCA9552(i2c); + + if (s->len < sizeof(s->buf)) { + return s->buf[s->len++]; + } else { + return 0xff; + } +} + +static int pca9552_send(I2CSlave *i2c, uint8_t data) +{ + PCA9552State *s =3D PCA9552(i2c); + + if (s->len =3D=3D 0) { + s->pointer =3D data; + s->len++; + } else { + if (s->len <=3D sizeof(s->buf)) { + s->buf[s->len - 1] =3D data; + } + s->len++; + pca9552_write(s); + } + + return 0; +} + +static int pca9552_event(I2CSlave *i2c, enum i2c_event event) +{ + PCA9552State *s =3D PCA9552(i2c); + + if (event =3D=3D I2C_START_RECV) { + pca9552_read(s); + } + + s->len =3D 0; + return 0; +} + +static const VMStateDescription pca9552_vmstate =3D { + .name =3D "PCA9552", + .version_id =3D 0, + .minimum_version_id =3D 0, + .fields =3D (VMStateField[]) { + VMSTATE_UINT8(len, PCA9552State), + VMSTATE_UINT8(pointer, PCA9552State), + VMSTATE_UINT8_ARRAY(buf, PCA9552State, 1), + VMSTATE_UINT8_ARRAY(regs, PCA9552State, PCA9552_NR_REGS), + VMSTATE_I2C_SLAVE(i2c, PCA9552State), + VMSTATE_END_OF_LIST() + } +}; + +static void pca9552_reset(DeviceState *dev) +{ + PCA9552State *s =3D PCA9552(dev); + + s->regs[PCA9552_PSC0] =3D 0xFF; + s->regs[PCA9552_PWM0] =3D 0x80; + s->regs[PCA9552_PSC1] =3D 0xFF; + s->regs[PCA9552_PWM1] =3D 0x80; + s->regs[PCA9552_LS0] =3D 0x55; /* all OFF */ + s->regs[PCA9552_LS1] =3D 0x55; + s->regs[PCA9552_LS2] =3D 0x55; + s->regs[PCA9552_LS3] =3D 0x55; + + pca9552_update_pin_input(s); +} + +static void pca9552_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + I2CSlaveClass *k =3D I2C_SLAVE_CLASS(klass); + + k->event =3D pca9552_event; + k->recv =3D pca9552_recv; + k->send =3D pca9552_send; + dc->reset =3D pca9552_reset; + dc->vmsd =3D &pca9552_vmstate; +} + +static const TypeInfo pca9552_info =3D { + .name =3D TYPE_PCA9552, + .parent =3D TYPE_I2C_SLAVE, + .instance_size =3D sizeof(PCA9552State), + .class_init =3D pca9552_class_init, +}; + +static void pca9552_register_types(void) +{ + type_register_static(&pca9552_info); +} + +type_init(pca9552_register_types) diff --git a/include/hw/misc/pca9552.h b/include/hw/misc/pca9552.h new file mode 100644 index 000000000000..6c66d4f69e9e --- /dev/null +++ b/include/hw/misc/pca9552.h @@ -0,0 +1,32 @@ +/* + * PCA9552 I2C LED blinker + * + * Copyright (c) 2017, IBM Corporation. + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * later. See the COPYING file in the top-level directory. + */ +#ifndef PCA9552_H +#define PCA9552_H + +#include "hw/i2c/i2c.h" + +#define TYPE_PCA9552 "pca9552" +#define PCA9552(obj) OBJECT_CHECK(PCA9552State, (obj), TYPE_PCA9552) + + +#define PCA9552_NR_REGS 10 + +typedef struct PCA9552State { + /*< private >*/ + I2CSlave i2c; + /*< public >*/ + + uint8_t len; + uint8_t pointer; + uint8_t buf[1]; + + uint8_t regs[PCA9552_NR_REGS]; +} PCA9552State; + +#endif --=20 2.13.6 From nobody Sat Apr 27 21:54:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507905124302475.4586135622459; Fri, 13 Oct 2017 07:32:04 -0700 (PDT) Received: from localhost ([::1]:50573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3108-0006a2-Jv for importer@patchew.org; Fri, 13 Oct 2017 10:31:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e30yX-0005Z9-BR for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:30:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e30yR-00012Z-Ol for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:30:09 -0400 Received: from 1.mo4.mail-out.ovh.net ([178.33.248.196]:55564) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e30yR-00012E-Iw for qemu-devel@nongnu.org; Fri, 13 Oct 2017 10:30:03 -0400 Received: from player159.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id 915D4E7BA5 for ; Fri, 13 Oct 2017 16:30:02 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player159.ha.ovh.net (Postfix) with ESMTPSA id 5F9BF480099; Fri, 13 Oct 2017 16:29:54 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Date: Fri, 13 Oct 2017 16:28:52 +0200 Message-Id: <20171013142852.916-7-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171013142852.916-1-clg@kaod.org> References: <20171013142852.916-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 14837671923274451729 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrtdeigdejkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.248.196 Subject: [Qemu-devel] [PATCH v3 6/6] aspeed: add the pc9552 chips to the witherspoon machine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Joel Stanley Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The pca9552 LED blinkers on the Witherspoon machine are used for leds but also as GPIOs to control fans and GPUs. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Andrew Jeffery --- hw/arm/aspeed.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 2a6ca58527f8..f3c279cfcd3f 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -379,6 +379,8 @@ static void witherspoon_bmc_i2c_init(AspeedBoardState *= bmc) AspeedSoCState *soc =3D &bmc->soc; uint8_t *eeprom_buf =3D g_malloc0(8 * 1024); =20 + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), "pca9552", = 0x60); + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 4), "tmp423", 0= x4c); i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 5), "tmp423", 0= x4c); =20 @@ -391,6 +393,8 @@ static void witherspoon_bmc_i2c_init(AspeedBoardState *= bmc) =20 smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), 0x51, eeprom_buf); + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "pca9552", + 0x60); } =20 static void witherspoon_bmc_init(MachineState *machine) --=20 2.13.6