[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] hw:w25p80: Add STATE_STANDBY to handle incorrect command
From: |
Dan Zhang |
Subject: |
Re: [PATCH] hw:w25p80: Add STATE_STANDBY to handle incorrect command |
Date: |
Tue, 14 Jun 2022 10:15:35 -0700 |
Hi Cedric,
I am sorry that accidently submit a pre-view code change as a patch using the
git-sendmail.
I originally mean to copy the following code in email reply and let
commnity get better understand my proposal.
Let me submit a formal patch in seperate thread. And will remove the
code using this STATE_STANDBY state, as those code shall be in @iris WP#
patch.
BRs
Dan
On Tue, Jun 14, 2022 at 09:02:46AM -0700, Dan Zhang wrote:
> ---
> 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
>