All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH qemu] hw/block/m25p80: correct dummy bytes for GD flash
@ 2021-04-28  3:33 ~igrr
  0 siblings, 0 replies; only message in thread
From: ~igrr @ 2021-04-28  3:33 UTC (permalink / raw)
  To: qemu-devel
  Cc: Martin Johnson, Alistair Francis, Kevin Wolf, Hanna Reitz, qemu-block

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-21 20:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28  3:33 [PATCH qemu] hw/block/m25p80: correct dummy bytes for GD flash ~igrr

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.