From nobody Mon Feb 9 10:57:45 2026 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 1658434432131490.39579574247125; Thu, 21 Jul 2022 13:13:52 -0700 (PDT) Received: from localhost ([::1]:50948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEcYQ-000697-SH for importer@patchew.org; Thu, 21 Jul 2022 16:13:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEXjK-0002Vn-RL; Thu, 21 Jul 2022 11:04:46 -0400 Received: from mail-b.sr.ht ([173.195.146.151]:51688) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEXjJ-0006OD-3S; Thu, 21 Jul 2022 11:04:46 -0400 Received: from git.sr.ht (unknown [173.195.146.142]) by mail-b.sr.ht (Postfix) with ESMTPSA id BA21011EEAC; Thu, 21 Jul 2022 15:04:42 +0000 (UTC) Authentication-Results: mail-b.sr.ht; dkim=none From: ~igrr Date: Wed, 28 Apr 2021 15:33:30 +1200 Subject: [PATCH qemu] hw/block/m25p80: correct dummy bytes for GD flash MIME-Version: 1.0 Message-ID: <165841588259.32254.13711058338366500866-0@git.sr.ht> X-Mailer: git.sr.ht To: qemu-devel@nongnu.org Cc: Martin Johnson , Alistair Francis , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: 36 X-Spam_score: 3.6 X-Spam_bar: +++ X-Spam_report: (3.6 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, FREEMAIL_FORGED_REPLYTO=2.095, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 21 Jul 2022 16:12:41 -0400 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: ~igrr Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1658434432840100001 From: Martin Johnson Gigadevice flash chips supported in m25p80.c (GD25Q32, GD25Q64) require a dummy bytes in DIO and QIO modes, similar to Winbond W25Q32 and W25Q64. This patch fixes this behavior. Signed-off-by: Ivan Grokhotkov Signed-off-by: Martin Johnson --- This patch was submitted into our fork at https://github.com/espressif/qemu/pull/18. The patch seems applicable to the upstream project, so I am submitting it on behalf of the author. hw/block/m25p80.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index a8d2519141..72a209b031 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -168,6 +168,7 @@ typedef struct FlashPartInfo { =20 #define SPANSION_CONTINUOUS_READ_MODE_CMD_LEN 1 #define WINBOND_CONTINUOUS_READ_MODE_CMD_LEN 1 +#define GIGADEVICE_CONTINUOUS_READ_MODE_CMD_LEN 1 =20 static const FlashPartInfo known_devices[] =3D { /* Atmel -- some are (confusingly) marketed as "DataFlash" */ @@ -430,6 +431,7 @@ typedef enum { MAN_WINBOND, MAN_SST, MAN_ISSI, + MAN_GIGADEVICE, MAN_GENERIC, } Manufacturer; =20 @@ -514,6 +516,8 @@ static inline Manufacturer get_man(Flash *s) return MAN_SST; case 0x9D: return MAN_ISSI; + case 0xC8: + return MAN_GIGADEVICE; default: return MAN_GENERIC; } @@ -992,6 +996,9 @@ static void decode_dio_read_cmd(Flash *s) case MAN_WINBOND: s->needed_bytes +=3D WINBOND_CONTINUOUS_READ_MODE_CMD_LEN; break; + case MAN_GIGADEVICE: + s->needed_bytes +=3D GIGADEVICE_CONTINUOUS_READ_MODE_CMD_LEN; + break; case MAN_SPANSION: s->needed_bytes +=3D SPANSION_CONTINUOUS_READ_MODE_CMD_LEN; s->needed_bytes +=3D extract32(s->spansion_cr2v, @@ -1042,6 +1049,10 @@ static void decode_qio_read_cmd(Flash *s) s->needed_bytes +=3D WINBOND_CONTINUOUS_READ_MODE_CMD_LEN; s->needed_bytes +=3D 4; break; + case MAN_GIGADEVICE: + s->needed_bytes +=3D GIGADEVICE_CONTINUOUS_READ_MODE_CMD_LEN; + s->needed_bytes +=3D 4; + break; case MAN_SPANSION: s->needed_bytes +=3D SPANSION_CONTINUOUS_READ_MODE_CMD_LEN; s->needed_bytes +=3D extract32(s->spansion_cr2v, --=20 2.34.2