Re: [PATCH v2] mtd: spinand: add support for Foresee FS35ND01G-S1Y2
From: Daniel Palmer
Date: Fri Mar 26 2021 - 10:10:38 EST
Hi Miquel,
Sorry for the constant pestering on this..
On Tue, 23 Mar 2021 at 23:06, Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote:
> > # nandbiterrs -i /dev/mtd1
> > incremental biterrors test
> > Successfully corrected 0 bit errors per subpage
> > Inserted biterror @ 0/5
> > Read reported 4 corrected bit errors
> > ECC failure, invalid data despite read success
>
> This is not a valid behavior. There is something wrong with the way ECC
> status is read/retrieved. The read should indeed report 4 corrected bit
> errors, but then the data should be valid. Here it means that the
> introduced error appears corrected but in fact is not.
> We need to understand what status are available and write the
> appropriate vendor code.
I looked at the datasheet again and the encoding for ecc status seems
a bit funky.
The chip seems to have only two bits for ECC status with this encoding:
0 - Read success with 0-3 flipped bits.
1 - Read success with 4 flipped bits.
2 - Uncorrectable.
3 - Reserved.
This looks almost the same as the Winbond chips with 0 and 1 being successes
but with no totally error free status.
Anyhow, if 4 bits were corrected is returned for 1 then nandbiterrs
reports "ECC failure, invalid data despite read success".
If I return 3 bit errors for 0 and -EBADMSG for anything else
nandbiterrs doesn't complain anymore but is this right?:
# nandbiterrs -i /dev/mtd1
incremental biterrors test
Read reported 3 corrected bit errors
Successfully corrected 0 bit errors per subpage
biterror @ 0/5
Failed to recover 1 bitflips
Read error after 1 bit errors per page
When running nandbiterrs the status is always 0 before injecting the
error and then sometimes 1 and sometimes 2 after the error is
injected.
Thanks,
Daniel