diff mbox series

[v1,04/16] hw/block/m25p80: Add SFDP table for w25q80bl flash

Message ID 20241018053112.1886173-5-jamin_lin@aspeedtech.com (mailing list archive)
State New
Headers show
Series Fix write incorrect data into flash in user mode | expand

Commit Message

Jamin Lin Oct. 18, 2024, 5:31 a.m. UTC
Add the SFDP table for the Windbond w25q80bl flash.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/block/m25p80.c      |  3 ++-
 hw/block/m25p80_sfdp.c | 36 ++++++++++++++++++++++++++++++++++++
 hw/block/m25p80_sfdp.h |  2 +-
 3 files changed, 39 insertions(+), 2 deletions(-)

Comments

Cédric Le Goater Oct. 21, 2024, 9:05 a.m. UTC | #1
On 10/18/24 07:31, Jamin Lin wrote:
> Add the SFDP table for the Windbond w25q80bl flash.
>
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>

capabilities exposed to Linux look correct :
     
     root@ast2600-default:~# cat  /sys/kernel/debug/spi-nor/spi0.1/*
     Supported read modes by the flash
      1S-1S-1S
       opcode	0x03
       mode cycles	0
       dummy cycles	0
      1S-1S-1S (fast read)
       opcode	0x0b
       mode cycles	0
       dummy cycles	8
      1S-1S-2S
       opcode	0x3b
       mode cycles	0
       dummy cycles	8
      1S-2S-2S
       opcode	0xbb
       mode cycles	2
       dummy cycles	2
      1S-1S-4S
       opcode	0x6b
       mode cycles	0
       dummy cycles	8
      1S-4S-4S
       opcode	0xeb
       mode cycles	2
       dummy cycles	4
     
     Supported page program modes by the flash
      1S-1S-1S
       opcode	0x02
     name		s25fl008k
     id		ef 40 14 00 00 00
     size		1.00 MiB
     write size	1
     page size	256
     address nbytes	3
     flags		HAS_16BIT_SR | NO_READ_CR | SOFT_RESET
     
     opcodes
      read		0x6b
       dummy cycles	8
      erase		0xd8
      program	0x02
      8D extension	none
     
     protocols
      read		1S-1S-4S
      write		1S-1S-1S
      register	1S-1S-1S
     
     erase commands
      20 (4.00 KiB) [1]
      52 (32.0 KiB) [2]
      d8 (64.0 KiB) [3]
      c7 (1.00 MiB)
     
     sector map
      region (in hex)   | erase mask | flags
      ------------------+------------+----------
      00000000-000fffff |     [ 123] |
     
Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.


> ---
>   hw/block/m25p80.c      |  3 ++-
>   hw/block/m25p80_sfdp.c | 36 ++++++++++++++++++++++++++++++++++++
>   hw/block/m25p80_sfdp.h |  2 +-
>   3 files changed, 39 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> index 411d810d3b..e2e84f8b5f 100644
> --- a/hw/block/m25p80.c
> +++ b/hw/block/m25p80.c
> @@ -356,7 +356,8 @@ static const FlashPartInfo known_devices[] = {
>       { INFO("w25x64",      0xef3017,      0,  64 << 10, 128, ER_4K) },
>       { INFO("w25q64",      0xef4017,      0,  64 << 10, 128, ER_4K) },
>       { INFO("w25q80",      0xef5014,      0,  64 << 10,  16, ER_4K) },
> -    { INFO("w25q80bl",    0xef4014,      0,  64 << 10,  16, ER_4K) },
> +    { INFO("w25q80bl",    0xef4014,      0,  64 << 10,  16, ER_4K),
> +      .sfdp_read = m25p80_sfdp_w25q80bl },
>       { INFO("w25q256",     0xef4019,      0,  64 << 10, 512, ER_4K),
>         .sfdp_read = m25p80_sfdp_w25q256 },
>       { INFO("w25q512jv",   0xef4020,      0,  64 << 10, 1024, ER_4K),
> diff --git a/hw/block/m25p80_sfdp.c b/hw/block/m25p80_sfdp.c
> index 82d84cc21f..a03a291a09 100644
> --- a/hw/block/m25p80_sfdp.c
> +++ b/hw/block/m25p80_sfdp.c
> @@ -404,6 +404,42 @@ static const uint8_t sfdp_w25q01jvq[] = {
>   };
>   define_sfdp_read(w25q01jvq);
>   
> +static const uint8_t sfdp_w25q80bl[] = {
> +    0x53, 0x46, 0x44, 0x50, 0x05, 0x01, 0x00, 0xff,
> +    0x00, 0x05, 0x01, 0x10, 0x80, 0x00, 0x00, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xe5, 0x20, 0xf1, 0xff, 0xff, 0xff, 0x7f, 0x00,
> +    0x44, 0xeb, 0x08, 0x6b, 0x08, 0x3b, 0x42, 0xbb,
> +    0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
> +    0xff, 0xff, 0x00, 0x00, 0x0c, 0x20, 0x0f, 0x52,
> +    0x10, 0xd8, 0x00, 0x00, 0x23, 0x02, 0xa6, 0x00,
> +    0x81, 0x6c, 0x14, 0xa7, 0xed, 0x61, 0x76, 0x33,
> +    0x7a, 0x75, 0x7a, 0x75, 0xf7, 0xa2, 0xd5, 0x5c,
> +    0x00, 0xf7, 0x1d, 0xff, 0xe9, 0x30, 0xc0, 0x80,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +};
> +define_sfdp_read(w25q80bl);
> +
>   /*
>    * Integrated Silicon Solution (ISSI)
>    */
> diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.h
> index 89c2d8f72d..35785686a0 100644
> --- a/hw/block/m25p80_sfdp.h
> +++ b/hw/block/m25p80_sfdp.h
> @@ -25,7 +25,7 @@ uint8_t m25p80_sfdp_mx66l1g45g(uint32_t addr);
>   
>   uint8_t m25p80_sfdp_w25q256(uint32_t addr);
>   uint8_t m25p80_sfdp_w25q512jv(uint32_t addr);
> -
> +uint8_t m25p80_sfdp_w25q80bl(uint32_t addr);
>   uint8_t m25p80_sfdp_w25q01jvq(uint32_t addr);
>   
>   uint8_t m25p80_sfdp_is25wp256(uint32_t addr);
diff mbox series

Patch

diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 411d810d3b..e2e84f8b5f 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -356,7 +356,8 @@  static const FlashPartInfo known_devices[] = {
     { INFO("w25x64",      0xef3017,      0,  64 << 10, 128, ER_4K) },
     { INFO("w25q64",      0xef4017,      0,  64 << 10, 128, ER_4K) },
     { INFO("w25q80",      0xef5014,      0,  64 << 10,  16, ER_4K) },
-    { INFO("w25q80bl",    0xef4014,      0,  64 << 10,  16, ER_4K) },
+    { INFO("w25q80bl",    0xef4014,      0,  64 << 10,  16, ER_4K),
+      .sfdp_read = m25p80_sfdp_w25q80bl },
     { INFO("w25q256",     0xef4019,      0,  64 << 10, 512, ER_4K),
       .sfdp_read = m25p80_sfdp_w25q256 },
     { INFO("w25q512jv",   0xef4020,      0,  64 << 10, 1024, ER_4K),
diff --git a/hw/block/m25p80_sfdp.c b/hw/block/m25p80_sfdp.c
index 82d84cc21f..a03a291a09 100644
--- a/hw/block/m25p80_sfdp.c
+++ b/hw/block/m25p80_sfdp.c
@@ -404,6 +404,42 @@  static const uint8_t sfdp_w25q01jvq[] = {
 };
 define_sfdp_read(w25q01jvq);
 
+static const uint8_t sfdp_w25q80bl[] = {
+    0x53, 0x46, 0x44, 0x50, 0x05, 0x01, 0x00, 0xff,
+    0x00, 0x05, 0x01, 0x10, 0x80, 0x00, 0x00, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xe5, 0x20, 0xf1, 0xff, 0xff, 0xff, 0x7f, 0x00,
+    0x44, 0xeb, 0x08, 0x6b, 0x08, 0x3b, 0x42, 0xbb,
+    0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
+    0xff, 0xff, 0x00, 0x00, 0x0c, 0x20, 0x0f, 0x52,
+    0x10, 0xd8, 0x00, 0x00, 0x23, 0x02, 0xa6, 0x00,
+    0x81, 0x6c, 0x14, 0xa7, 0xed, 0x61, 0x76, 0x33,
+    0x7a, 0x75, 0x7a, 0x75, 0xf7, 0xa2, 0xd5, 0x5c,
+    0x00, 0xf7, 0x1d, 0xff, 0xe9, 0x30, 0xc0, 0x80,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+};
+define_sfdp_read(w25q80bl);
+
 /*
  * Integrated Silicon Solution (ISSI)
  */
diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.h
index 89c2d8f72d..35785686a0 100644
--- a/hw/block/m25p80_sfdp.h
+++ b/hw/block/m25p80_sfdp.h
@@ -25,7 +25,7 @@  uint8_t m25p80_sfdp_mx66l1g45g(uint32_t addr);
 
 uint8_t m25p80_sfdp_w25q256(uint32_t addr);
 uint8_t m25p80_sfdp_w25q512jv(uint32_t addr);
-
+uint8_t m25p80_sfdp_w25q80bl(uint32_t addr);
 uint8_t m25p80_sfdp_w25q01jvq(uint32_t addr);
 
 uint8_t m25p80_sfdp_is25wp256(uint32_t addr);