qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH qemu] hw/block/m25p80: correct dummy bytes for GD flash


From: ~igrr
Subject: [PATCH qemu] hw/block/m25p80: correct dummy bytes for GD flash
Date: Thu, 21 Jul 2022 15:04:47 -0000

From: Martin Johnson <M.J.Johnson@massey.ac.nz>

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 <ivan@espressif.com>
Signed-off-by: Martin Johnson <M.J.Johnson@massey.ac.nz>
---
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 {
 
 #define SPANSION_CONTINUOUS_READ_MODE_CMD_LEN 1
 #define WINBOND_CONTINUOUS_READ_MODE_CMD_LEN 1
+#define GIGADEVICE_CONTINUOUS_READ_MODE_CMD_LEN 1
 
 static const FlashPartInfo known_devices[] = {
     /* Atmel -- some are (confusingly) marketed as "DataFlash" */
@@ -430,6 +431,7 @@ typedef enum {
     MAN_WINBOND,
     MAN_SST,
     MAN_ISSI,
+    MAN_GIGADEVICE,
     MAN_GENERIC,
 } Manufacturer;
 
@@ -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 += WINBOND_CONTINUOUS_READ_MODE_CMD_LEN;
         break;
+    case MAN_GIGADEVICE:
+        s->needed_bytes += GIGADEVICE_CONTINUOUS_READ_MODE_CMD_LEN;
+        break;
     case MAN_SPANSION:
         s->needed_bytes += SPANSION_CONTINUOUS_READ_MODE_CMD_LEN;
         s->needed_bytes += extract32(s->spansion_cr2v,
@@ -1042,6 +1049,10 @@ static void decode_qio_read_cmd(Flash *s)
         s->needed_bytes += WINBOND_CONTINUOUS_READ_MODE_CMD_LEN;
         s->needed_bytes += 4;
         break;
+    case MAN_GIGADEVICE:
+        s->needed_bytes += GIGADEVICE_CONTINUOUS_READ_MODE_CMD_LEN;
+        s->needed_bytes += 4;
+        break;
     case MAN_SPANSION:
         s->needed_bytes += SPANSION_CONTINUOUS_READ_MODE_CMD_LEN;
         s->needed_bytes += extract32(s->spansion_cr2v,
-- 
2.34.2



reply via email to

[Prev in Thread] Current Thread [Next in Thread]