qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-arm] [PATCH v2 6/9] hw/block/pflash_cfi01: Simplify CFI_QUERY


From: Alistair Francis
Subject: Re: [Qemu-arm] [PATCH v2 6/9] hw/block/pflash_cfi01: Simplify CFI_QUERY processing
Date: Tue, 2 Jul 2019 09:03:51 -0700

On Mon, Jul 1, 2019 at 5:15 PM Philippe Mathieu-Daudé <address@hidden> wrote:
>
> The current code does:
>
> if (write_cycle == 0)
>   if (command == CFI_QUERY)
>     break
>   write_cycle += 1
>   last_command = command
>
> if (write_cycle == 1)
>   if (last_command == CFI_QUERY)
>     if (command == READ_ARRAY
>       write_cycle = 0
>       last_command = READ_ARRAY
>
> Simplify by not increasing the write_cycle on CFI_QUERY,
> the next command are processed as normal wcycle=0.
>
> This matches the hardware datasheet (we do not enter the WRITE
> state machine, thus no write cycle involved).
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>

Reviewed-by: Alistair Francis <address@hidden>

Alistair

> ---
>  hw/block/pflash_cfi01.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
> index 8d632ea941..c1b02219b2 100644
> --- a/hw/block/pflash_cfi01.c
> +++ b/hw/block/pflash_cfi01.c
> @@ -492,7 +492,8 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset,
>              return;
>          case 0x98: /* CFI query */
>              DPRINTF("%s: CFI query\n", __func__);
> -            break;
> +            pfl->cmd = cmd;
> +            return;
>          case 0xe8: /* Write to buffer */
>              DPRINTF("%s: Write to buffer\n", __func__);
>              /* FIXME should save @offset, @width for case 1+ */
> @@ -566,13 +567,6 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset,
>                  goto mode_read_array;
>              }
>              break;
> -        case 0x98:
> -            if (cmd == 0xff) {
> -                goto mode_read_array;
> -            } else {
> -                DPRINTF("%s: leaving query mode\n", __func__);
> -            }
> -            break;
>          default:
>              goto error_flash;
>          }
> --
> 2.20.1
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]