summaryrefslogtreecommitdiffstats
path: root/hw/m25p80.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/m25p80.c')
-rw-r--r--hw/m25p80.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/hw/m25p80.c b/hw/m25p80.c
index 788c196..461b41c 100644
--- a/hw/m25p80.c
+++ b/hw/m25p80.c
@@ -184,6 +184,7 @@ static const FlashPartInfo known_devices[] = {
typedef enum {
NOP = 0,
+ WRSR = 0x1,
WRDI = 0x4,
RDSR = 0x5,
WREN = 0x6,
@@ -379,6 +380,11 @@ static void complete_collecting_data(Flash *s)
case ERASE_SECTOR:
flash_erase(s, s->cur_addr, s->cmd_in_progress);
break;
+ case WRSR:
+ if (s->write_enable) {
+ s->write_enable = false;
+ }
+ break;
default:
break;
}
@@ -443,6 +449,15 @@ static void decode_new_cmd(Flash *s, uint32_t value)
s->state = STATE_COLLECTING_DATA;
break;
+ case WRSR:
+ if (s->write_enable) {
+ s->needed_bytes = 1;
+ s->pos = 0;
+ s->len = 0;
+ s->state = STATE_COLLECTING_DATA;
+ }
+ break;
+
case WRDI:
s->write_enable = false;
break;
OpenPOWER on IntegriCloud