On Fri, Oct 27, 2017 at 7:56 AM, Francisco Iglesias
<frasse.igles...@gmail.com> wrote:
> Add support for SST READ ID 0x90/0xAB commands for reading out the flash
> manufacuter ID and device ID.
>
> Signed-off-by: Francisco Iglesias <frasse.igles...@gmail.com>

Acked-by: Alistair Francis <alistair.fran...@xilinx.com>

Alistair

> ---
>  hw/block/m25p80.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>
> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> index 2971519..7a5c137 100644
> --- a/hw/block/m25p80.c
> +++ b/hw/block/m25p80.c
> @@ -355,6 +355,8 @@ typedef enum {
>      DPP = 0xa2,
>      QPP = 0x32,
>      QPP_4 = 0x34,
> +    RDID_90 = 0x90,
> +    RDID_AB = 0xab,
>
>      ERASE_4K = 0x20,
>      ERASE4_4K = 0x21,
> @@ -405,6 +407,7 @@ typedef enum {
>      MAN_MACRONIX,
>      MAN_NUMONYX,
>      MAN_WINBOND,
> +    MAN_SST,
>      MAN_GENERIC,
>  } Manufacturer;
>
> @@ -476,6 +479,8 @@ static inline Manufacturer get_man(Flash *s)
>          return MAN_SPANSION;
>      case 0xC2:
>          return MAN_MACRONIX;
> +    case 0xBF:
> +        return MAN_SST;
>      default:
>          return MAN_GENERIC;
>      }
> @@ -711,6 +716,22 @@ static void complete_collecting_data(Flash *s)
>      case WEVCR:
>          s->enh_volatile_cfg = s->data[0];
>          break;
> +    case RDID_90:
> +    case RDID_AB:
> +        if (get_man(s) == MAN_SST && s->cur_addr <= 1) {
> +            if (s->cur_addr) {
> +                s->data[0] = s->pi->id[2];
> +                s->data[1] = s->pi->id[0];
> +            } else {
> +                s->data[0] = s->pi->id[0];
> +                s->data[1] = s->pi->id[2];
> +            }
> +            s->pos = 0;
> +            s->len = 2;
> +            s->data_read_loop = true;
> +            s->state = STATE_READING_DATA;
> +        }
> +        break;
>      default:
>          break;
>      }
> @@ -926,6 +947,8 @@ static void decode_new_cmd(Flash *s, uint32_t value)
>      case PP4:
>      case PP4_4:
>      case DIE_ERASE:
> +    case RDID_90:
> +    case RDID_AB:
>          s->needed_bytes = get_addr_length(s);
>          s->pos = 0;
>          s->len = 0;
> --
> 2.9.3
>
>

Reply via email to