From nobody Fri May 17 09:38:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=git.sr.ht Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676385603557537.4897528158888; Tue, 14 Feb 2023 06:40:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRwA5-0004V8-OO; Tue, 14 Feb 2023 09:20:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRs10-0007oA-Hn; Tue, 14 Feb 2023 04:54:22 -0500 Received: from mail-b.sr.ht ([173.195.146.151]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRs0y-0001mk-4E; Tue, 14 Feb 2023 04:54:21 -0500 Received: from git.sr.ht (unknown [173.195.146.142]) by mail-b.sr.ht (Postfix) with ESMTPSA id 6CC7211F0CD; Tue, 14 Feb 2023 09:54:18 +0000 (UTC) Authentication-Results: mail-b.sr.ht; dkim=none From: ~ssinprem Date: Fri, 10 Feb 2023 13:20:56 +0700 Subject: [PATCH qemu 1/2] hw/at24c : modify at24c to support 1 byte address mode Message-ID: <167636845806.2107.2382940753543768501-1@git.sr.ht> X-Mailer: git.sr.ht In-Reply-To: <167636845806.2107.2382940753543768501-0@git.sr.ht> To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, srikanth@celestica.com, kgengan@celestica.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=173.195.146.151; envelope-from=outgoing@sr.ht; helo=mail-b.sr.ht X-Spam_score_int: 15 X-Spam_score: 1.5 X-Spam_bar: + X-Spam_report: (1.5 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 14 Feb 2023 09:19:57 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ~ssinprem Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1676385603832100001 From: Sittisak Sinprem Reviewed-by: Peter Delevoryas --- hw/nvram/eeprom_at24c.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c index 2d4d8b952f..693212b661 100644 --- a/hw/nvram/eeprom_at24c.c +++ b/hw/nvram/eeprom_at24c.c @@ -87,7 +87,7 @@ uint8_t at24c_eeprom_recv(I2CSlave *s) EEPROMState *ee =3D AT24C_EE(s); uint8_t ret; =20 - if (ee->haveaddr =3D=3D 1) { + if (ee->rsize > 256 && ee->haveaddr =3D=3D 1) { return 0xff; } =20 @@ -104,11 +104,13 @@ int at24c_eeprom_send(I2CSlave *s, uint8_t data) { EEPROMState *ee =3D AT24C_EE(s); =20 - if (ee->haveaddr < 2) { + if ((ee->rsize > 256 && ee->haveaddr < 2) || + (ee->rsize <=3D 256 && ee->haveaddr < 1)) { ee->cur <<=3D 8; ee->cur |=3D data; ee->haveaddr++; - if (ee->haveaddr =3D=3D 2) { + if ((ee->rsize > 256 && ee->haveaddr =3D=3D 2) || + (ee->rsize <=3D 256 && ee->haveaddr =3D=3D 1)) { ee->cur %=3D ee->rsize; DPRINTK("Set pointer %04x\n", ee->cur); } --=20 2.34.6 From nobody Fri May 17 09:38:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=git.sr.ht Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676385333462612.9591134079468; Tue, 14 Feb 2023 06:35:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRwA6-0004X4-NI; Tue, 14 Feb 2023 09:20:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRs10-0007oB-K0; Tue, 14 Feb 2023 04:54:23 -0500 Received: from mail-b.sr.ht ([173.195.146.151]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRs0y-0001ml-4F; Tue, 14 Feb 2023 04:54:21 -0500 Received: from git.sr.ht (unknown [173.195.146.142]) by mail-b.sr.ht (Postfix) with ESMTPSA id 8D5D811F0F4; Tue, 14 Feb 2023 09:54:18 +0000 (UTC) Authentication-Results: mail-b.sr.ht; dkim=none From: ~ssinprem Date: Tue, 14 Feb 2023 16:06:49 +0700 Subject: [PATCH qemu 2/2] aspeed/fuji : correct the eeprom size Message-ID: <167636845806.2107.2382940753543768501-2@git.sr.ht> X-Mailer: git.sr.ht In-Reply-To: <167636845806.2107.2382940753543768501-0@git.sr.ht> To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, srikanth@celestica.com, kgengan@celestica.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=173.195.146.151; envelope-from=outgoing@sr.ht; helo=mail-b.sr.ht X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 14 Feb 2023 09:19:57 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ~ssinprem Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1676385335391100001 From: Sittisak Sinprem Device 24C64 the size is 64 kilobits Device 24C02 the size is 2 kilobits Reviewed-by: Peter Delevoryas --- hw/arm/aspeed.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 55f114ef72..8e6a1579e4 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -846,42 +846,42 @@ static void fuji_bmc_i2c_init(AspeedMachineState *bmc) i2c_slave_create_simple(i2c[17], TYPE_LM75, 0x4c); i2c_slave_create_simple(i2c[17], TYPE_LM75, 0x4d); =20 - aspeed_eeprom_init(i2c[19], 0x52, 64 * KiB); - aspeed_eeprom_init(i2c[20], 0x50, 2 * KiB); - aspeed_eeprom_init(i2c[22], 0x52, 2 * KiB); + aspeed_eeprom_init(i2c[19], 0x52, 64 * KiB / 8); + aspeed_eeprom_init(i2c[20], 0x50, 2 * KiB / 8); + aspeed_eeprom_init(i2c[22], 0x52, 2 * KiB / 8); =20 i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x48); i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x49); i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x4a); i2c_slave_create_simple(i2c[3], TYPE_TMP422, 0x4c); =20 - aspeed_eeprom_init(i2c[8], 0x51, 64 * KiB); + aspeed_eeprom_init(i2c[8], 0x51, 64 * KiB / 8); i2c_slave_create_simple(i2c[8], TYPE_LM75, 0x4a); =20 i2c_slave_create_simple(i2c[50], TYPE_LM75, 0x4c); - aspeed_eeprom_init(i2c[50], 0x52, 64 * KiB); + aspeed_eeprom_init(i2c[50], 0x52, 64 * KiB / 8); i2c_slave_create_simple(i2c[51], TYPE_TMP75, 0x48); i2c_slave_create_simple(i2c[52], TYPE_TMP75, 0x49); =20 i2c_slave_create_simple(i2c[59], TYPE_TMP75, 0x48); i2c_slave_create_simple(i2c[60], TYPE_TMP75, 0x49); =20 - aspeed_eeprom_init(i2c[65], 0x53, 64 * KiB); + aspeed_eeprom_init(i2c[65], 0x53, 64 * KiB / 8); i2c_slave_create_simple(i2c[66], TYPE_TMP75, 0x49); i2c_slave_create_simple(i2c[66], TYPE_TMP75, 0x48); - aspeed_eeprom_init(i2c[68], 0x52, 64 * KiB); - aspeed_eeprom_init(i2c[69], 0x52, 64 * KiB); - aspeed_eeprom_init(i2c[70], 0x52, 64 * KiB); - aspeed_eeprom_init(i2c[71], 0x52, 64 * KiB); + aspeed_eeprom_init(i2c[68], 0x52, 64 * KiB / 8); + aspeed_eeprom_init(i2c[69], 0x52, 64 * KiB / 8); + aspeed_eeprom_init(i2c[70], 0x52, 64 * KiB / 8); + aspeed_eeprom_init(i2c[71], 0x52, 64 * KiB / 8); =20 - aspeed_eeprom_init(i2c[73], 0x53, 64 * KiB); + aspeed_eeprom_init(i2c[73], 0x53, 64 * KiB / 8); i2c_slave_create_simple(i2c[74], TYPE_TMP75, 0x49); i2c_slave_create_simple(i2c[74], TYPE_TMP75, 0x48); - aspeed_eeprom_init(i2c[76], 0x52, 64 * KiB); - aspeed_eeprom_init(i2c[77], 0x52, 64 * KiB); - aspeed_eeprom_init(i2c[78], 0x52, 64 * KiB); - aspeed_eeprom_init(i2c[79], 0x52, 64 * KiB); - aspeed_eeprom_init(i2c[28], 0x50, 2 * KiB); + aspeed_eeprom_init(i2c[76], 0x52, 64 * KiB / 8); + aspeed_eeprom_init(i2c[77], 0x52, 64 * KiB / 8); + aspeed_eeprom_init(i2c[78], 0x52, 64 * KiB / 8); + aspeed_eeprom_init(i2c[79], 0x52, 64 * KiB / 8); + aspeed_eeprom_init(i2c[28], 0x50, 2 * KiB / 8); =20 for (int i =3D 0; i < 8; i++) { aspeed_eeprom_init(i2c[81 + i * 8], 0x56, 64 * KiB); --=20 2.34.6