From: Chao Liu <[email protected]>

The flash clears the write enable latch when a WRSR2 command completes,
just like a WRSR write; otherwise a following program or erase could
proceed without a new WREN.

Fixes: 9785731ec4f7 ("hw/block:m25p80: Support write status register 2 command 
(0x31) for w25q01jvq")
Signed-off-by: Chao Liu <[email protected]>
Signed-off-by: Yifan Wang <[email protected]>
---
 hw/block/m25p80.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 2a882c392c..d0a8ecf1b8 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -853,6 +853,9 @@ static void complete_collecting_data(Flash *s)
         default:
             break;
         }
+        if (s->write_enable) {
+            s->write_enable = false;
+        }
         break;
     case BRWR:
     case EXTEND_ADDR_WRITE:
-- 
2.53.0


Reply via email to