From: Marcin Krzeminski <marcin.krzemin...@nokia.com>

This patch handles dummy cycles.

Signed-off-by: Marcin Krzeminski <marcin.krzemin...@nokia.com>
---
 hw/block/m25p80.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 3949cc5..5a1abfd 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -530,6 +530,10 @@ static void decode_new_cmd(Flash *s, uint32_t value)
     case DOR:
     case QOR:
         s->needed_bytes = get_addr_length(s);
+        if (((s->pi->jedec >> 16) & 0xFF) == JEDEC_NUMONYX) {
+            /* Dummy cycles modeled with bytes writes instead of bits */
+            s->needed_bytes += extract32(s->volatile_cfg, 4, 4);
+        }
         s->pos = 0;
         s->len = 0;
         s->state = STATE_COLLECTING_DATA;
@@ -543,6 +547,8 @@ static void decode_new_cmd(Flash *s, uint32_t value)
             break;
         case JEDEC_NUMONYX:
             s->needed_bytes = get_addr_length(s);
+            /* Dummy cycles modeled with bytes writes instead of bits */
+            s->needed_bytes += extract32(s->volatile_cfg, 4, 4);
             break;
         default:
             s->needed_bytes = 5;
@@ -560,6 +566,8 @@ static void decode_new_cmd(Flash *s, uint32_t value)
             break;
         case JEDEC_NUMONYX:
             s->needed_bytes = get_addr_length(s);
+            /* Dummy cycles modeled with bytes writes instead of bits */
+            s->needed_bytes += extract32(s->volatile_cfg, 4, 4);
             break;
         default:
             s->needed_bytes = 8;
-- 
2.5.0


Reply via email to