[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] hw:w25p80: Add STATE_STANDBY to handle incorrect command
From: |
Dan Zhang |
Subject: |
[PATCH] hw:w25p80: Add STATE_STANDBY to handle incorrect command |
Date: |
Tue, 14 Jun 2022 09:02:46 -0700 |
---
hw/block/m25p80.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index b6bd430a99..3bb0466dca 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -423,6 +423,7 @@ typedef enum {
STATE_COLLECTING_DATA,
STATE_COLLECTING_VAR_LEN_DATA,
STATE_READING_DATA,
+ STATE_STANDBY,
} CMDState;
typedef enum {
@@ -1218,6 +1219,9 @@ static void decode_new_cmd(Flash *s, uint32_t value)
|| !s->write_enable) {
qemu_log_mask(LOG_GUEST_ERROR,
"M25P80: Status register write is disabled!\n");
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "M25P80: switch to standby, re-aseert CS to
reactivate \n");
+ s->state = STATE_STANDBY;
break;
}
@@ -1472,6 +1476,9 @@ static uint32_t m25p80_transfer8(SSIPeripheral *ss,
uint32_t tx)
s->cur_addr, (uint8_t)tx);
switch (s->state) {
+ case STATE_STANDBY:
+ r = 0xFFFFFFFF; /* StandBy state SO shall be HiZ */
+ break;
case STATE_PAGE_PROGRAM:
trace_m25p80_page_program(s, s->cur_addr, (uint8_t)tx);
--
2.34.3