Repository navigation
SPI NAND: a USB transfer that fails fails the operation - #54
Conversation
The results of a read from the cache and of a status read were not looked at: a read ended with "Status: OK" and wrong data, a write programmed a page over data it had not read, and an erase went on from a status that never came. A failed read from the cache leaves no page in the buffers, so the next read goes to the chip. With -k a USB failure stops the operation, it is not a BAD page. Version 1.20.2.
PR Summary by QodoStop SPI NAND operations when USB reads fail
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
1.
|
The four branches of the ECC setup were one read, set and read back, none of them looked at: they are one function now, and its result is the detection's.
|
Qodo finding 1 (ECC setup masks a failed read) is fixed in 46fda5d: the ECC setup checks its reads, the detection fails on a failure. Checked with the build and all tests in the container (new checks through registers 0xB0 and 0x90) and on CH347T + W25N01G and CH341A + F35SQA001G, with and without |
|
/review |
|
Code review by qodo was updated up to the latest commit 46fda5d |
… the ECC write is checked A write that stops at the status poll left the page it was to write in the buffers, and a read of that page would have returned it. The write of the ECC register reports a failed CS high, and the ECC setup looks at it.
|
Qodo findings 1 and 2 of the last review are fixed in 1e96da2: a write stopped at the status poll clears the page buffers, and |
|
/review |
|
/review |
|
Code review by qodo was updated up to the latest commit 1e96da2 |
A page is too long to be held, so a failed transfer of it shows only in the result of the write, and nobody looked: the chip was told to program what its cache held and the write ended with Status: OK. The write stops before the program command.
|
Qodo finding "A failed page upload can still report a good write" is fixed in 48f576d: |
|
/review |
|
Code review by qodo was updated up to the latest commit 48f576d |
|
Two Qodo findings on 48f576d are left as they are, with these reasons:
|
A failed USB transfer in the SPI NAND layer went unnoticed: the result of a read from the cache and of a status read was not looked at.
Status: OKand wrong data in the dump.Status: OK.Now
spi_nand_protocol_read_from_cacheandspi_nand_protocol_get_featurereport the failure,spi_nand_wait_readypasses it on, and read, write and erase stop with a message (SPI_NAND_FLASH_RTN_IO_ERROR). A command that failed earlier is caught too: the failure of a held transfer comes with the next read. The failed page is not kept in the buffers, and with-ka USB failure stops the operation instead of counting as a BAD page. The detection fails too when the ECC setup does not get through: its four identical branches are one function now.Version 1.20.2.
Tests:
nandsimgets USB failures of a cache read and of a status read: read,-kread, write (nothing is programmed) and erase fail, and the next read brings the right data; the detection fails on a failed ECC setup through both registers. Five of the new checks failed on the code before this change.Hardware, normal paths only (a real USB failure was not provoked): CH347T + W25N01G and CH341A + F35SQA001G, 1 MB read twice with the same md5 and
-tOK on both, 1 MB in 2.4 s and 9.7 s.