From nobody Mon Apr 29 07:08:37 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 1508432566165553.1545635464141; Thu, 19 Oct 2017 10:02:46 -0700 (PDT) Received: from localhost ([::1]:50286 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5EDG-0006mH-Cm for importer@patchew.org; Thu, 19 Oct 2017 13:02:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5Dnl-00017z-G7 for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5Dng-0003O4-QL for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:09 -0400 Received: from 4.mo5.mail-out.ovh.net ([178.33.111.247]:42757) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e5Dng-0003Mx-Kn for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:04 -0400 Received: from player786.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id 48CF71461E6 for ; Thu, 19 Oct 2017 18:36:03 +0200 (CEST) Received: from zorba.kaod.org (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player786.ha.ovh.net (Postfix) with ESMTPSA id 1362680072; Thu, 19 Oct 2017 18:35:56 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Date: Thu, 19 Oct 2017 18:35:39 +0200 Message-Id: <20171019163546.2039-2-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171019163546.2039-1-clg@kaod.org> References: <20171019163546.2039-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 15308579559762135825 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrudekgddutdehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm 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.111.247 Subject: [Qemu-devel] [PATCH v6 1/8] aspeed: use a ROM memory region to catch invalid writes 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" Some legacy firmwares access unimplemented addresses on the Aspeed SoC (old U-Boot code using variables in the bss when it shouldn't do). Let's use a ROM memory region to catch the invalid writes and support new boards without using the 'ignore_memory_transaction_failures' flag. This change is breaking migration compatibility for the Aspeed machines. Signed-off-by: C=C3=A9dric Le Goater --- Changes since v5 : - added a comment on migration compatibility - created the ROM memory region even if there is no file backend specified by the user Changes since v4 : - use a ROM memory region hw/arm/aspeed.c | 51 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index ab895ad490af..e6a890659a97 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -166,12 +166,31 @@ static void aspeed_board_init_flashes(AspeedSMCState = *s, const char *flashtype, } } =20 +/* + * This is to track invalid writes done in the ROM by some legacy + * firmwares + */ +static void boot_rom_write(void *opaque, hwaddr offset, uint64_t value, + unsigned size) +{ + qemu_log_mask(LOG_GUEST_ERROR, + "%s: 0x%" HWADDR_PRIx " <- 0x%" PRIx64 " [%u]\n", + __func__, offset, value, size); +} + +static const MemoryRegionOps boot_rom_ops =3D { + .write =3D boot_rom_write, + .endianness =3D DEVICE_NATIVE_ENDIAN, +}; + static void aspeed_board_init(MachineState *machine, const AspeedBoardConfig *cfg) { AspeedBoardState *bmc; AspeedSoCClass *sc; DriveInfo *drive0 =3D drive_get(IF_MTD, 0, 0); + MemoryRegion *boot_rom; + size_t boot_rom_size; =20 bmc =3D g_new0(AspeedBoardState, 1); object_initialize(&bmc->soc, (sizeof(bmc->soc)), cfg->soc_name); @@ -205,22 +224,24 @@ static void aspeed_board_init(MachineState *machine, aspeed_board_init_flashes(&bmc->soc.fmc, cfg->fmc_model, &error_abort); aspeed_board_init_flashes(&bmc->soc.spi[0], cfg->spi_model, &error_abo= rt); =20 - /* Install first FMC flash content as a boot rom. */ + /* + * create a ROM region using the default mapping window size of + * the FMC CS0 flash module. The window size is 64MB for the + * AST2400 SoC and 128MB for the AST2500 SoC, which is twice as + * big as needed by the flash modules of the Aspeed machines. + */ + boot_rom =3D g_new(MemoryRegion, 1); + boot_rom_size =3D bmc->soc.fmc.flashes[0].size; + + memory_region_init_rom_device(boot_rom, OBJECT(bmc), &boot_rom_ops, + NULL, "aspeed.boot_rom", boot_rom_size, + &error_abort); + memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR, + boot_rom); + + /* Install first FMC flash content (if any) as a boot rom. */ if (drive0) { - AspeedSMCFlash *fl =3D &bmc->soc.fmc.flashes[0]; - MemoryRegion *boot_rom =3D g_new(MemoryRegion, 1); - - /* - * create a ROM region using the default mapping window size of - * the flash module. The window size is 64MB for the AST2400 - * SoC and 128MB for the AST2500 SoC, which is twice as big as - * needed by the flash modules of the Aspeed machines. - */ - memory_region_init_rom_nomigrate(boot_rom, OBJECT(bmc), "aspeed.bo= ot_rom", - fl->size, &error_abort); - memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR, - boot_rom); - write_boot_rom(drive0, FIRMWARE_ADDR, fl->size, &error_abort); + write_boot_rom(drive0, FIRMWARE_ADDR, boot_rom_size, &error_abort); } =20 aspeed_board_binfo.kernel_filename =3D machine->kernel_filename; --=20 2.13.6 From nobody Mon Apr 29 07:08:37 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) 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 1508432679793180.48439456453661; Thu, 19 Oct 2017 10:04:39 -0700 (PDT) Received: from localhost ([::1]:50293 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5EEy-00089y-TK for importer@patchew.org; Thu, 19 Oct 2017 13:04:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5Dnq-00019O-LH for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5Dnn-0003Ta-QJ for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:14 -0400 Received: from 4.mo5.mail-out.ovh.net ([178.33.111.247]:56878) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e5Dnn-0003Su-K5 for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:11 -0400 Received: from player786.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id 754C91461FC for ; Thu, 19 Oct 2017 18:36:10 +0200 (CEST) Received: from zorba.kaod.org (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player786.ha.ovh.net (Postfix) with ESMTPSA id 4289580083; Thu, 19 Oct 2017 18:36:03 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Date: Thu, 19 Oct 2017 18:35:40 +0200 Message-Id: <20171019163546.2039-3-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171019163546.2039-1-clg@kaod.org> References: <20171019163546.2039-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 15310549884493400849 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrudekgddutdehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm 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.111.247 Subject: [Qemu-devel] [PATCH v6 2/8] aspeed: remove ignore_memory_transaction_failures on all boards 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_6 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now that we have a ROM memory region catching the invalid writes, we can remove this flag and work on fixing the current firwmares still accessing unimplemented addresses. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Peter Maydell --- hw/arm/aspeed.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index e6a890659a97..ff486b172104 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -291,7 +291,6 @@ static void palmetto_bmc_class_init(ObjectClass *oc, vo= id *data) mc->no_floppy =3D 1; mc->no_cdrom =3D 1; mc->no_parallel =3D 1; - mc->ignore_memory_transaction_failures =3D true; } =20 static const TypeInfo palmetto_bmc_type =3D { @@ -324,7 +323,6 @@ static void ast2500_evb_class_init(ObjectClass *oc, voi= d *data) mc->no_floppy =3D 1; mc->no_cdrom =3D 1; mc->no_parallel =3D 1; - mc->ignore_memory_transaction_failures =3D true; } =20 static const TypeInfo ast2500_evb_type =3D { @@ -349,7 +347,6 @@ static void romulus_bmc_class_init(ObjectClass *oc, voi= d *data) mc->no_floppy =3D 1; mc->no_cdrom =3D 1; mc->no_parallel =3D 1; - mc->ignore_memory_transaction_failures =3D true; } =20 static const TypeInfo romulus_bmc_type =3D { --=20 2.13.6 From nobody Mon Apr 29 07:08:37 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 1508432716126226.22941262161112; Thu, 19 Oct 2017 10:05:16 -0700 (PDT) Received: from localhost ([::1]:50295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5EFt-0000Nb-Be for importer@patchew.org; Thu, 19 Oct 2017 13:05:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5Dnz-0001Ht-DJ for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5Dnv-0003Z7-80 for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:23 -0400 Received: from 20.mo5.mail-out.ovh.net ([91.121.55.239]:57206) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e5Dnv-0003Ye-10 for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:19 -0400 Received: from player786.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id A55DE1461FE for ; Thu, 19 Oct 2017 18:36:17 +0200 (CEST) Received: from zorba.kaod.org (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player786.ha.ovh.net (Postfix) with ESMTPSA id 7265F80086; Thu, 19 Oct 2017 18:36:10 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Date: Thu, 19 Oct 2017 18:35:41 +0200 Message-Id: <20171019163546.2039-4-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171019163546.2039-1-clg@kaod.org> References: <20171019163546.2039-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 15312520208142011153 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrudekgddutdehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm 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: 91.121.55.239 Subject: [Qemu-devel] [PATCH v6 3/8] 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. - 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 ff486b172104..93eda2082e7d 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 @@ -355,11 +368,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 Mon Apr 29 07:08:37 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) 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 1508432882517704.372379851136; Thu, 19 Oct 2017 10:08:02 -0700 (PDT) Received: from localhost ([::1]:50315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5EIX-0002p0-O5 for importer@patchew.org; Thu, 19 Oct 2017 13:07:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5Do6-0001O6-IW for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5Do2-0003d7-D3 for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:30 -0400 Received: from 13.mo5.mail-out.ovh.net ([87.98.182.191]:59899) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e5Do2-0003cW-7K for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:26 -0400 Received: from player786.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id D52A5146205 for ; Thu, 19 Oct 2017 18:36:24 +0200 (CEST) Received: from zorba.kaod.org (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player786.ha.ovh.net (Postfix) with ESMTPSA id A1D7E80086; Thu, 19 Oct 2017 18:36:17 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Date: Thu, 19 Oct 2017 18:35:42 +0200 Message-Id: <20171019163546.2039-5-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171019163546.2039-1-clg@kaod.org> References: <20171019163546.2039-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 15314490535656917777 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrudekgddutdehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm 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: 87.98.182.191 Subject: [Qemu-devel] [PATCH v6 4/8] 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_6 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 93eda2082e7d..124a0e5240b5 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", @@ -318,6 +320,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) @@ -344,6 +350,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]); @@ -377,6 +392,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 Mon Apr 29 07:08:37 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 150843272111157.36868664756116; Thu, 19 Oct 2017 10:05:21 -0700 (PDT) Received: from localhost ([::1]:50294 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5EFj-0000GI-ED for importer@patchew.org; Thu, 19 Oct 2017 13:05:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5DoD-0001U6-PV for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5Do9-0003gj-Ja for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:37 -0400 Received: from 3.mo5.mail-out.ovh.net ([46.105.40.108]:55892) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e5Do9-0003fx-Dj for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:33 -0400 Received: from player786.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id 0C28E1461FC for ; Thu, 19 Oct 2017 18:36:32 +0200 (CEST) Received: from zorba.kaod.org (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player786.ha.ovh.net (Postfix) with ESMTPSA id D0A2980086; Thu, 19 Oct 2017 18:36:24 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Date: Thu, 19 Oct 2017 18:35:43 +0200 Message-Id: <20171019163546.2039-6-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171019163546.2039-1-clg@kaod.org> References: <20171019163546.2039-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 15316742336289934097 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrudekgddutdehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm 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.40.108 Subject: [Qemu-devel] [PATCH v6 5/8] 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 Mon Apr 29 07:08:37 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 1508432877448235.01513638331062; Thu, 19 Oct 2017 10:07:57 -0700 (PDT) Received: from localhost ([::1]:50313 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5EIM-0002dl-ED for importer@patchew.org; Thu, 19 Oct 2017 13:07:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5DoK-0001at-RE for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5DoG-0003lA-Lv for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:44 -0400 Received: from 9.mo5.mail-out.ovh.net ([178.32.96.204]:58891) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e5DoG-0003kM-FN for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:40 -0400 Received: from player786.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id 3F3B81461FC for ; Thu, 19 Oct 2017 18:36:39 +0200 (CEST) Received: from zorba.kaod.org (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player786.ha.ovh.net (Postfix) with ESMTPSA id 0BBE480072; Thu, 19 Oct 2017 18:36:32 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Date: Thu, 19 Oct 2017 18:35:44 +0200 Message-Id: <20171019163546.2039-7-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171019163546.2039-1-clg@kaod.org> References: <20171019163546.2039-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 15318712660860046097 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrudekgddutdehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm 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.32.96.204 Subject: [Qemu-devel] [PATCH v6 6/8] 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 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 *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); @@ -317,6 +322,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); @@ -386,6 +395,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); @@ -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); } =20 static void witherspoon_bmc_init(MachineState *machine) --=20 2.13.6 From nobody Mon Apr 29 07:08:37 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) 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 1508431549755764.3599830071701; Thu, 19 Oct 2017 09:45:49 -0700 (PDT) Received: from localhost ([::1]:50185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5Dwh-0008Rf-Mh for importer@patchew.org; Thu, 19 Oct 2017 12:45:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5DoS-0001fa-3F for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5DoO-0003or-40 for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:52 -0400 Received: from 8.mo5.mail-out.ovh.net ([178.32.116.78]:44359) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e5DoN-0003oB-QD for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:48 -0400 Received: from player786.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id 731BE14622A for ; Thu, 19 Oct 2017 18:36:46 +0200 (CEST) Received: from zorba.kaod.org (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player786.ha.ovh.net (Postfix) with ESMTPSA id 3DE8380080; Thu, 19 Oct 2017 18:36:39 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Date: Thu, 19 Oct 2017 18:35:45 +0200 Message-Id: <20171019163546.2039-8-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171019163546.2039-1-clg@kaod.org> References: <20171019163546.2039-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 15320682984384727825 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrudekgddutdehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm 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.32.116.78 Subject: [Qemu-devel] [PATCH v6 7/8] 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_6 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Specs are available here : https://www.nxp.com/docs/en/application-note/AN264.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 Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- Changes since v3: - introduced auto-increment support - removed the buffer collecting bytes on the bus - improved reset - used extract32 - added a unit test 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 | 259 ++++++++++++++++++++++++++++++++++++= ++++ include/hw/misc/pca9552.h | 33 +++++ tests/Makefile.include | 2 + tests/pca9552-test.c | 131 ++++++++++++++++++++ 6 files changed, 427 insertions(+) create mode 100644 hw/misc/pca9552.c create mode 100644 include/hw/misc/pca9552.h create mode 100644 tests/pca9552-test.c 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..70ce6f038da2 --- /dev/null +++ b/hw/misc/pca9552.c @@ -0,0 +1,259 @@ +/* + * PCA9552 I2C LED blinker + * + * https://www.nxp.com/docs/en/application-note/AN264.pdf + * + * 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" + +/* + * Bits [0:3] are used to address a specific register. + */ +#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 */ + +/* + * Bit [4] is used to activate the Auto-Increment option of the + * register address + */ +#define PCA9552_AUTOINC (1 << 4) + +#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 extract32(s->regs[reg], shift, 2); +} + +static void pca9552_update_pin_input(PCA9552State *s) +{ + int i; + + for (i =3D 0; i < s->nr_leds; 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: + /* TODO */ + default: + break; + } + } +} + +static uint8_t pca9552_read(PCA9552State *s, uint8_t reg) +{ + 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: + return s->regs[reg]; + default: + qemu_log_mask(LOG_GUEST_ERROR, "%s: unexpected read to register %d= \n", + __func__, reg); + return 0xFF; + } +} + +static void pca9552_write(PCA9552State *s, uint8_t reg, uint8_t data) +{ + switch (reg) { + case PCA9552_PSC0: + case PCA9552_PWM0: + case PCA9552_PSC1: + case PCA9552_PWM1: + s->regs[reg] =3D data; + break; + + case PCA9552_LS0: + case PCA9552_LS1: + case PCA9552_LS2: + case PCA9552_LS3: + s->regs[reg] =3D data; + 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); + } +} + +/* + * When Auto-Increment is on, the register address is incremented + * after each byte is sent to or received by the device. The index + * rollovers to 0 when the maximum register address is reached. + */ +static void pca9552_autoinc(PCA9552State *s) +{ + if (s->pointer !=3D 0xFF && s->pointer & PCA9552_AUTOINC) { + uint8_t reg =3D s->pointer & 0xf; + + reg =3D (reg + 1) % (s->max_reg + 1); + s->pointer =3D reg | PCA9552_AUTOINC; + } +} + +static int pca9552_recv(I2CSlave *i2c) +{ + PCA9552State *s =3D PCA9552(i2c); + uint8_t ret; + + ret =3D pca9552_read(s, s->pointer & 0xf); + + /* + * From the Specs: + * + * Important Note: When a Read sequence is initiated and the + * AI bit is set to Logic Level 1, the Read Sequence MUST + * start by a register different from 0. + * + * I don't know what should be done in this case, so throw an + * error. + */ + if (s->pointer =3D=3D PCA9552_AUTOINC) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Autoincrement read starting with register 0\n", + __func__); + } + + pca9552_autoinc(s); + + return ret; +} + +static int pca9552_send(I2CSlave *i2c, uint8_t data) +{ + PCA9552State *s =3D PCA9552(i2c); + + /* First byte sent by is the register address */ + if (s->len =3D=3D 0) { + s->pointer =3D data; + s->len++; + } else { + pca9552_write(s, s->pointer & 0xf, data); + + pca9552_autoinc(s); + } + + return 0; +} + +static int pca9552_event(I2CSlave *i2c, enum i2c_event event) +{ + PCA9552State *s =3D PCA9552(i2c); + + 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(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); + + s->pointer =3D 0xFF; + s->len =3D 0; +} + +static void pca9552_initfn(Object *obj) +{ + PCA9552State *s =3D PCA9552(obj); + + /* If support for the other PCA955X devices are implemented, these + * constant values might be part of class structure describing the + * PCA955X device + */ + s->max_reg =3D PCA9552_LS3; + s->nr_leds =3D 16; +} + +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_init =3D pca9552_initfn, + .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..5df8d6407ca7 --- /dev/null +++ b/include/hw/misc/pca9552.h @@ -0,0 +1,33 @@ +/* + * 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 regs[PCA9552_NR_REGS]; + uint8_t max_reg; + uint8_t nr_leds; +} PCA9552State; + +#endif diff --git a/tests/Makefile.include b/tests/Makefile.include index 4ca15e681703..8ac2595c8512 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -347,6 +347,7 @@ check-qtest-sparc64-y =3D tests/endianness-test$(EXESUF) check-qtest-sparc64-y +=3D tests/prom-env-test$(EXESUF) =20 check-qtest-arm-y =3D tests/tmp105-test$(EXESUF) +check-qtest-arm-y +=3D tests/pca9552-test$(EXESUF) check-qtest-arm-y +=3D tests/ds1338-test$(EXESUF) check-qtest-arm-y +=3D tests/m25p80-test$(EXESUF) gcov-files-arm-y +=3D hw/misc/tmp105.c @@ -739,6 +740,7 @@ tests/bios-tables-test$(EXESUF): tests/bios-tables-test= .o \ tests/boot-sector.o tests/acpi-utils.o $(libqos-obj-y) tests/pxe-test$(EXESUF): tests/pxe-test.o tests/boot-sector.o $(libqos-obj= -y) tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y) +tests/pca9552-test$(EXESUF): tests/pca9552-test.o $(libqos-omap-obj-y) tests/ds1338-test$(EXESUF): tests/ds1338-test.o $(libqos-imx-obj-y) tests/m25p80-test$(EXESUF): tests/m25p80-test.o tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y) diff --git a/tests/pca9552-test.c b/tests/pca9552-test.c new file mode 100644 index 000000000000..53414452a12e --- /dev/null +++ b/tests/pca9552-test.c @@ -0,0 +1,131 @@ +/* + * QTest testcase for the PCA9552 LED blinker + * + * Copyright (c) 2017, IBM Corporation. + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" + +#include "libqtest.h" +#include "libqos/i2c.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_AUTOINC (1 << 4) + + +#define OMAP2_I2C_1_BASE 0x48070000 + +#define PCA9552_TEST_ID "pca9552-test" +#define PCA9552_TEST_ADDR 0x60 + +static I2CAdapter *i2c; + +static uint8_t pca9552_get8(I2CAdapter *i2c, uint8_t addr, uint8_t reg) +{ + uint8_t resp[1]; + i2c_send(i2c, addr, ®, 1); + i2c_recv(i2c, addr, resp, 1); + return resp[0]; +} + +static void pca9552_set8(I2CAdapter *i2c, uint8_t addr, uint8_t reg, + uint8_t value) +{ + uint8_t cmd[2]; + uint8_t resp[1]; + + cmd[0] =3D reg; + cmd[1] =3D value; + i2c_send(i2c, addr, cmd, 2); + i2c_recv(i2c, addr, resp, 1); + g_assert_cmphex(resp[0], =3D=3D, cmd[1]); +} + +static void receive_autoinc(void) +{ + uint8_t resp; + uint8_t reg =3D PCA9552_LS0 | PCA9552_AUTOINC; + + i2c_send(i2c, PCA9552_TEST_ADDR, ®, 1); + + /* PCA9552_LS0 */ + i2c_recv(i2c, PCA9552_TEST_ADDR, &resp, 1); + g_assert_cmphex(resp, =3D=3D, 0x54); + + /* PCA9552_LS1 */ + i2c_recv(i2c, PCA9552_TEST_ADDR, &resp, 1); + g_assert_cmphex(resp, =3D=3D, 0x55); + + /* PCA9552_LS2 */ + i2c_recv(i2c, PCA9552_TEST_ADDR, &resp, 1); + g_assert_cmphex(resp, =3D=3D, 0x55); + + /* PCA9552_LS3 */ + i2c_recv(i2c, PCA9552_TEST_ADDR, &resp, 1); + g_assert_cmphex(resp, =3D=3D, 0x54); +} + +static void send_and_receive(void) +{ + uint8_t value; + + value =3D pca9552_get8(i2c, PCA9552_TEST_ADDR, PCA9552_LS0); + g_assert_cmphex(value, =3D=3D, 0x55); + + value =3D pca9552_get8(i2c, PCA9552_TEST_ADDR, PCA9552_INPUT0); + g_assert_cmphex(value, =3D=3D, 0x0); + + /* Switch on LED 0 */ + pca9552_set8(i2c, PCA9552_TEST_ADDR, PCA9552_LS0, 0x54); + value =3D pca9552_get8(i2c, PCA9552_TEST_ADDR, PCA9552_LS0); + g_assert_cmphex(value, =3D=3D, 0x54); + + value =3D pca9552_get8(i2c, PCA9552_TEST_ADDR, PCA9552_INPUT0); + g_assert_cmphex(value, =3D=3D, 0x01); + + /* Switch on LED 12 */ + pca9552_set8(i2c, PCA9552_TEST_ADDR, PCA9552_LS3, 0x54); + value =3D pca9552_get8(i2c, PCA9552_TEST_ADDR, PCA9552_LS3); + g_assert_cmphex(value, =3D=3D, 0x54); + + value =3D pca9552_get8(i2c, PCA9552_TEST_ADDR, PCA9552_INPUT1); + g_assert_cmphex(value, =3D=3D, 0x10); +} + +int main(int argc, char **argv) +{ + QTestState *s =3D NULL; + int ret; + + g_test_init(&argc, &argv, NULL); + + s =3D qtest_start("-machine n800 " + "-device pca9552,bus=3Di2c-bus.0,id=3D" PCA9552_TEST_ID + ",address=3D0x60"); + i2c =3D omap_i2c_create(OMAP2_I2C_1_BASE); + + qtest_add_func("/pca9552/tx-rx", send_and_receive); + qtest_add_func("/pca9552/rx-autoinc", receive_autoinc); + + ret =3D g_test_run(); + + if (s) { + qtest_quit(s); + } + g_free(i2c); + + return ret; +} --=20 2.13.6 From nobody Mon Apr 29 07:08:37 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 1508433024572235.13849806151848; Thu, 19 Oct 2017 10:10:24 -0700 (PDT) Received: from localhost ([::1]:50325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5EKp-0004oC-RB for importer@patchew.org; Thu, 19 Oct 2017 13:10:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5DoZ-0001my-0h for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:37:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5DoU-0003sN-Rp for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:59 -0400 Received: from 2.mo5.mail-out.ovh.net ([178.33.109.111]:56157) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e5DoU-0003s7-LF for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:36:54 -0400 Received: from player786.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id A0A7E14622E for ; Thu, 19 Oct 2017 18:36:53 +0200 (CEST) Received: from zorba.kaod.org (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player786.ha.ovh.net (Postfix) with ESMTPSA id 6D7E68006F; Thu, 19 Oct 2017 18:36:46 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Date: Thu, 19 Oct 2017 18:35:46 +0200 Message-Id: <20171019163546.2039-9-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171019163546.2039-1-clg@kaod.org> References: <20171019163546.2039-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 15322653309537520401 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrudekgddutdehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm 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.109.111 Subject: [Qemu-devel] [PATCH v6 8/8] 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/aspeed.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index df7f266800ba..0e2a4fa62c26 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -397,6 +397,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 @@ -409,6 +411,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