[PATCH v2 2/6] mtd: spi-nor: add erase die (chip) capability

Tudor Ambarus tudor.ambarus at linaro.org
Fri Nov 3 07:37:35 PDT 2023



On 03.11.2023 16:16, Fabio Estevam wrote:
> On 03/11/2023 10:48, Tudor Ambarus wrote:
> 
>> Yep, it's strange, we'll have to check what's happening. I found my
>> n25q00 flash, on my side all its 4 dice are erased in 5 sec.  SFDP
>> defines how long the erase die should take, see BFPT dword 11. You can
>> start with that.
> 
> Where does BFPT dword 11 reside inside SFDP?

BFPT stands for Basic Flash Parameter Table. BFPT is the first table of
SFDP. Please compare the standard with the dump. We haven't written yet
an utility to decode the SFDP data.
> 
> ~# hexdump -C
> /sys/devices/platform/soc at 0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0.0/spi-nor/sfdp
> 00000000  53 46 44 50 06 01 01 ff  00 06 01 10 30 00 00 ff 
> |SFDP........0...|
> 00000010  84 00 01 02 80 00 00 ff  ff ff ff ff ff ff ff ff 
> |................|
> 00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
> |................|
> 00000030  e5 20 fb ff ff ff ff 3f  29 eb 27 6b 27 3b 27 bb  |.
> .....?).'k';'.|
> 00000040  ff ff ff ff ff ff 27 bb  ff ff 29 eb 0c 20 10 d8 
> |......'...).. ..|
> 00000050  0f 52 00 00 24 4a 99 00  8b 8e 03 e1 ac 01 27 38 
> |.R..$J........'8|
> 00000060  7a 75 7a 75 fb bd d5 5c  4a 0f 82 ff 81 bd 3d 36 
> |zuzu...\J.....=6|
> 00000070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
> |................|
> 00000080  ff e7 ff ff 21 dc ff ff                           |....!...|
> 00000088
> 
> Do we need a fixup to tell the erase die to be faster?

no. We can retrieve the erase time from BFPT and use it to narrow the
wait time.
> 
> I haven't found the 'BFPT' term in the JEDEC spec.
> 
>> real    0m5.485s
>> user    0m0.000s
>> sys    0m5.461s
> 
> Before erasing, did the flash contain 128MB of random data on your test?

not everywhere

> 
> On my tests, when the flash contains 128MB of random data, the first erase
> takes 4 minutes. Subsequent erases take only 2 seconds.
> 

I confirm I see the same behavior on n25q00 flash.
Erased 134217728 bytes from address 0x00000000 in flash

real	3m49.082s
user	0m0.000s
sys	3m48.485s

I'll continue to investigate this at a best effort rate, expect for some
delays, I'm handling SPI NOR mostly in my spare time. Happy to guide you
though. You may join #mtd irc channel for short questions, see where it
is in the MAINTAINERS file.



More information about the linux-mtd mailing list