Project

General

Profile

Actions

Feature #523

closed

Add support for flash Winbond W25N01GV

Added by E T 3 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Normal
Category:
-
Target version:
Start date:
01/20/2024
Due date:
% Done:

0%

Estimated time:
Affected versions:
Needs backport to:
Affected hardware:
Affected OS:

Description

I'd like to try this (https://www.winbond.com/hq/product/code-storage-flash-memory/qspinand-flash/?__locale=en&partNo=W25N01GV) flash but I saw that there is no flashrom support, is it possible to add it?
At the moment I don't physically have a flash, I should have one soon so I can try.
In the meantime I developed this patch for flashrom is it ok?

diff --git a/flashchips.c b/flashchips.c
index 663b01b2..7abb95b4 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -20317,6 +20317,50 @@ const struct flashchip flashchips[] = {
                .decode_range   = DECODE_RANGE_SPI25,
        },

+       {
+               .vendor         = "Winbond",
+               .name           = "W25N01GV",
+               .bustype        = BUS_SPI,
+               .manufacture_id = WINBOND_NEX_ID,
+               .model_id       = WINBOND_NEX_W25N01GV,
+               .total_size     = 131072,
+               .page_size      = 256,
+               .feature_bits   = FEATURE_WRSR_WREN | FEATURE_OTP,
+               .tested         = TEST_UNTESTED,
+               .probe          = PROBE_SPI_RDID,
+               .probe_timing   = TIMING_ZERO,
+               .block_erasers  =
+               {
+                       {
+                               .eraseblocks = { {4 * 1024, 32768} },
+                               .block_erase = SPI_BLOCK_ERASE_21,
+                       }, {
+                               .eraseblocks = { {4 * 1024, 32768} },
+                               .block_erase = SPI_BLOCK_ERASE_20,
+                       }, {
+                               .eraseblocks = { {32 * 1024, 4096} },
+                               .block_erase = SPI_BLOCK_ERASE_5C,
+                       }, {
+                               .eraseblocks = { {32 * 1024, 4096} },
+                               .block_erase = SPI_BLOCK_ERASE_52,
+                       }, {
+                               .eraseblocks = { {64 * 1024, 2048} },
+                               .block_erase = SPI_BLOCK_ERASE_DC,
+                       }, {
+                               .eraseblocks = { {64 * 1024, 2048} },
+                               .block_erase = SPI_BLOCK_ERASE_D8,
+                       }, {
+                               .eraseblocks = { {65536 * 1024, 2} },
+                               .block_erase = SPI_BLOCK_ERASE_C4,
+                       }
+               },
+               .printlock      = SPI_PRETTYPRINT_STATUS_REGISTER_PLAIN,
+               .unlock         = SPI_DISABLE_BLOCKPROTECT,
+               .write          = SPI_CHIP_WRITE256, /* Multi I/O supported */
+               .read           = SPI_CHIP_READ,
+               .voltage        = {2700, 3600},
+       },
+
        /* W29EE011, W29EE012, W29C010M, W29C011A do not support probe_jedec according to the datasheet, but it works for newer(?) steppings. */
        {
                .vendor         = "Winbond",
diff --git a/include/flashchips.h b/include/flashchips.h
index d676cda4..fb7abae6 100644
--- a/include/flashchips.h
+++ b/include/flashchips.h
@@ -1007,6 +1007,7 @@
 #define WINBOND_NEX_W25Q128_DTR        0x8018  /* W25Q128JW_DTR */
 #define WINBOND_NEX_W25Q256_DTR        0x8019  /* W25Q256JW_DTR aka W25Q256256JW-IM */
 #define WINBOND_NEX_W25Q512NW_IM       0x8020 /* W25Q512NW-IM */
+#define WINBOND_NEX_W25N01GV   0xAA21  /* W25N01GV */

 #define WINBOND_ID             0xDA    /* Winbond */
 #define WINBOND_W19B160BB      0x49

I didn't understand if the FEATURE_WRSR_WREN feature bit can be enabled for these flashes.
Do I need to set the reg_bits?
I don't want to be unprepared when I get to try this flash.

Actions #1

Updated by E T 3 months ago

  • Assignee set to Anastasia Klimchuk
Actions #2

Updated by E T 3 months ago

I tested my code and doesn't work, so I'll wait someone implement a better support for this flash.

Actions #3

Updated by Anastasia Klimchuk 3 months ago

Hello! Just to check, have you seen the guidelines how to add new chip?
https://www.flashrom.org/contrib_howtos/how_to_add_new_chip.html

Also, what exactly doesn't work?

You can try send your code as a patch (after following the guidelines of course) and give the info on what exactly doesn't work?

Actions #4

Updated by E T 3 months ago

Hello, thanks for the suggestion, I hadn't read the guidelines. I will study them and try to develop the patch better, but already looking at the "Model ID and vendor ID" part, this flash has 4 bytes to identify it and the PROBE_SPI_RDID4 method requires the first byte to be 0x7f and not 0x00.

Actions #5

Updated by Anastasia Klimchuk 3 months ago

Why do want to use PROBE_SPI_RDID4 ?

From the datasheet, the chip supports 9fh which the most common way and it corresponds to PROBE_SPI_RDID ? It should identify as AA21h (I saw it on pages 23-24 in datasheet).

Actions #6

Updated by E T 2 months ago

  • Related links updated (diff)
Actions #7

Updated by E T 2 months ago

  • Related links updated (diff)

Sorry for the big delay

yes support JEDEC ID 9Fh, but the first byte is dummy

Commands OpCode Byte2 Byte3 Byte4 Byte5
JEDEC ID 9Fh    Dummy EFh   AAh   21h

If I try to read with PROBE_SPI_RDID vendor is 0x00 while CHIP ID is 0xEF 0xAA

Actions #8

Updated by E T 2 months ago

I abbandoned flashrom I found this project https://github.com/sele-nium/flash_w25n which resolve my issue.
I think flashrom is too complex to do a simple thing.
Also for read JEDEC ID I had to apply a patch.

Actions #9

Updated by E T 2 months ago

  • % Done changed from 0 to 100
Actions #10

Updated by E T 2 months ago

  • % Done changed from 100 to 0
Actions #11

Updated by E T 2 months ago

  • Status changed from New to Needs Testing
Actions #12

Updated by E T 2 months ago

  • Status changed from Needs Testing to Closed
Actions #13

Updated by Anastasia Klimchuk 2 months ago

Good to know you found something that works for you! That's good news.

Actions

Also available in: Atom PDF