From: Dan Zhang <dz4list@gmail.com>
To: clg@kaod.org
Cc: alistair@alistair23.me, andrew@aj.id.au, dz4list@gmail.com,
frasse.iglesias@gmail.com, hreitz@redhat.com, irischenlj@fb.com,
irischenlj@gmail.com, joel@jms.id.au, kwolf@redhat.com,
lvivier@redhat.com, patrick@stwcx.xyz, pbonzini@redhat.com,
pdel@fb.com, peter.maydell@linaro.org, qemu-arm@nongnu.org,
qemu-block@nongnu.org, qemu-devel@nongnu.org, thuth@redhat.com
Subject: [PATCH] hw:w25p80: Add STATE_STANDBY to handle incorrect command
Date: Tue, 14 Jun 2022 09:02:46 -0700 [thread overview]
Message-ID: <20220614160246.2888751-1-dz4list@gmail.com> (raw)
In-Reply-To: <673b4b6c-b107-ab03-fe51-752ec45e6a04@kaod.org>
---
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
next prev parent reply other threads:[~2022-06-14 16:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-09 3:13 [PATCH v2 1/2] hw: m25p80: add WP# pin and SRWD bit for write protection Iris Chen
2022-06-09 3:13 ` [PATCH v2 2/2] hw: m25p80: add tests for write protect Iris Chen
2022-06-09 6:24 ` Thomas Huth
2022-06-09 11:32 ` [PATCH v2 1/2] hw: m25p80: add WP# pin and SRWD bit for write protection Cédric Le Goater
2022-06-09 19:22 ` Francisco Iglesias
2022-06-09 20:06 ` Peter Delevoryas
2022-06-14 5:45 ` Dan Zhang
2022-06-14 6:19 ` Dan Zhang
2022-06-14 7:13 ` Cédric Le Goater
2022-06-14 16:02 ` Dan Zhang [this message]
2022-06-14 17:15 ` [PATCH] hw:w25p80: Add STATE_STANDBY to handle incorrect command Dan Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220614160246.2888751-1-dz4list@gmail.com \
--to=dz4list@gmail.com \
--cc=alistair@alistair23.me \
--cc=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=frasse.iglesias@gmail.com \
--cc=hreitz@redhat.com \
--cc=irischenlj@fb.com \
--cc=irischenlj@gmail.com \
--cc=joel@jms.id.au \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=patrick@stwcx.xyz \
--cc=pbonzini@redhat.com \
--cc=pdel@fb.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.