qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dan Zhang <dz4list@gmail.com>
To: qemu-devel@nongnu.org
Cc: clg@kaod.org, 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, thuth@redhat.com
Subject: [PATCH] hw:m25p80: Add STATE_STANDBY command state
Date: Tue, 14 Jun 2022 13:02:05 -0700	[thread overview]
Message-ID: <20220614200205.2945065-1-dz4list@gmail.com> (raw)

HW normally will switch it to stand by mode when receive incorrect
command.
i.e. Macronix MX66L1G45G data sheet section 8 DEVICE OPERATION described
```
2. When an incorrect command is written to this device, it enters
standby mode and stays in standby mode until the next CS# falling edge.
In standby mode, This device's SO pin should be High-Z.
```
Add STATE_STANDBY CMDState and let the device ignore all input and keep
SO as HIZ (output 1)

Signed-off-by: Dan Zhang <dz4list@gmail.com>
---
A usage of this new state can be aborting in HPM checking 
or unknown command code received.

 hw/block/m25p80.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index b6bd430a99..9f89773b11 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 {
@@ -1472,6 +1473,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



             reply	other threads:[~2022-06-14 20:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 20:02 Dan Zhang [this message]
2022-06-20 11:22 ` [PATCH] hw:m25p80: Add STATE_STANDBY command state Francisco Iglesias

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=20220614200205.2945065-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).