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

Tudor Ambarus tudor.ambarus at linaro.org
Fri Nov 3 06:48:36 PDT 2023



On 03.11.2023 15:37, Fabio Estevam wrote:
> On 03/11/2023 10:26, Tudor Ambarus wrote:
> 
>> Which version of mtd-utils are you using? I guess the flash-erase
> 
> mtd-utils 2.1.5
> 
>> utility is written in a bad way. Please use the following while I check
>> what flash_erase is doing:
>>
>> time mtd_debug erase /dev/mtd0 0 134217728
> 
> "mtd_debug erase" gives the same time as well:
> 
> root at mcde3000a:~# time mtd_debug erase /dev/mtd0 0 134217728
> [ 4322.114967] spi-nor spi0.0: ***** nor->reg_proto = 0x00010101
> [ 4322.120861] spi-nor spi0.0: *****
> [ 4322.124210] spi-nor spi0.0: ***** op.cmd.nbytes = 0x01
> [ 4322.129478] spi-nor spi0.0: ***** op.cmd.buswidth = 0x01
> [ 4322.134903] spi-nor spi0.0: ***** op.cmd.opcode = 0xc4
> [ 4322.140154] spi-nor spi0.0: *****
> [ 4322.143491] spi-nor spi0.0: ***** op.addr.nbytes = 0x04
> [ 4322.148831] spi-nor spi0.0: ***** op.addr.buswidth = 0x01
> [ 4322.154341] spi-nor spi0.0: ***** op.addr.buswidth = 0x0
> [ 4322.159761] spi-nor spi0.0: *****
> [ 4322.163098] spi-nor spi0.0: ***** op.dummy.nbytes = 0x00
> [ 4322.168524] spi-nor spi0.0: ***** op.dummy.buswidth = 0x00
> [ 4322.174118] spi-nor spi0.0: *****
> [ 4322.177439] spi-nor spi0.0: ***** op.data.buswidth = 0x00
> [ 4322.182948] spi-nor spi0.0: ***** op.data.nbytes = 0
> [ 4439.966060] spi-nor spi0.0: ***** nor->reg_proto = 0x00010101
> [ 4439.971920] spi-nor spi0.0: *****
> [ 4439.975252] spi-nor spi0.0: ***** op.cmd.nbytes = 0x01
> [ 4439.980511] spi-nor spi0.0: ***** op.cmd.buswidth = 0x01
> [ 4439.985928] spi-nor spi0.0: ***** op.cmd.opcode = 0xc4
> [ 4439.991174] spi-nor spi0.0: *****
> [ 4439.994504] spi-nor spi0.0: ***** op.addr.nbytes = 0x04
> [ 4439.999834] spi-nor spi0.0: ***** op.addr.buswidth = 0x01
> [ 4440.005335] spi-nor spi0.0: ***** op.addr.buswidth = 0x4000000
> [ 4440.011272] spi-nor spi0.0: *****
> [ 4440.014604] spi-nor spi0.0: ***** op.dummy.nbytes = 0x00
> [ 4440.020018] spi-nor spi0.0: ***** op.dummy.buswidth = 0x00
> [ 4440.025606] spi-nor spi0.0: *****
> [ 4440.028937] spi-nor spi0.0: ***** op.data.buswidth = 0x00
> [ 4440.034438] spi-nor spi0.0: ***** op.data.nbytes = 0
> Erased 134217728 bytes from address 0x00000000 in flash
> 
> real    3m57.384s
> user    0m0.005s
> sys    3m35.211s
> 

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.

# time mtd_debug erase /dev/mtd1 0 134217728
spi-nor spi1.0: ***** nor->reg_proto = 0x00010101
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.cmd.nbytes = 0x01
spi-nor spi1.0: ***** op.cmd.buswidth = 0x01
spi-nor spi1.0: ***** op.cmd.opcode = 0xc4
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.addr.nbytes = 0x04
spi-nor spi1.0: ***** op.addr.buswidth = 0x01
spi-nor spi1.0: ***** op.addr.buswidth = 0x0
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.dummy.nbytes = 0x00
spi-nor spi1.0: ***** op.dummy.buswidth = 0x00
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.data.buswidth = 0x00
spi-nor spi1.0: ***** op.data.nbytes = 0
spi-nor spi1.0: ***** nor->reg_proto = 0x00010101
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.cmd.nbytes = 0x01
spi-nor spi1.0: ***** op.cmd.buswidth = 0x01
spi-nor spi1.0: ***** op.cmd.opcode = 0xc4
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.addr.nbytes = 0x04
spi-nor spi1.0: ***** op.addr.buswidth = 0x01
spi-nor spi1.0: ***** op.addr.buswidth = 0x2000000
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.dummy.nbytes = 0x00
spi-nor spi1.0: ***** op.dummy.buswidth = 0x00
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.data.buswidth = 0x00
spi-nor spi1.0: ***** op.data.nbytes = 0
spi-nor spi1.0: ***** nor->reg_proto = 0x00010101
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.cmd.nbytes = 0x01
spi-nor spi1.0: ***** op.cmd.buswidth = 0x01
spi-nor spi1.0: ***** op.cmd.opcode = 0xc4
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.addr.nbytes = 0x04
spi-nor spi1.0: ***** op.addr.buswidth = 0x01
spi-nor spi1.0: ***** op.addr.buswidth = 0x4000000
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.dummy.nbytes = 0x00
spi-nor spi1.0: ***** op.dummy.buswidth = 0x00
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.data.buswidth = 0x00
spi-nor spi1.0: ***** op.data.nbytes = 0
spi-nor spi1.0: ***** nor->reg_proto = 0x00010101
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.cmd.nbytes = 0x01
spi-nor spi1.0: ***** op.cmd.buswidth = 0x01
spi-nor spi1.0: ***** op.cmd.opcode = 0xc4
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.addr.nbytes = 0x04
spi-nor spi1.0: ***** op.addr.buswidth = 0x01
spi-nor spi1.0: ***** op.addr.buswidth = 0x6000000
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.dummy.nbytes = 0x00
spi-nor spi1.0: ***** op.dummy.buswidth = 0x00
spi-nor spi1.0: *****
spi-nor spi1.0: ***** op.data.buswidth = 0x00
spi-nor spi1.0: ***** op.data.nbytes = 0
Erased 134217728 bytes from address 0x00000000 in flash

real	0m5.485s
user	0m0.000s
sys	0m5.461s
# hexdump /dev/mtd1
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
8000000



More information about the linux-mtd mailing list