From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Thu, 6 Dec 2012 12:22:37 -0600 Subject: [U-Boot] JFFS2 seems to drop nand data with ECC corrections In-Reply-To: <028AE8A7C04EE14889BE99E5450BE32D0F1CF3B3@kndmex01.barco.com> (from stephane.deltour@barco.com on Sat Dec 1 11:02:05 2012) References: <028AE8A7C04EE14889BE99E5450BE32D0F1CF3B3@kndmex01.barco.com> Message-ID: <1354818157.8062.9@snotra> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 12/01/2012 11:02:05 AM, Deltour, Stephane wrote: > I had a few boards with NAND related problems. In Linux a file was > written to a JFFS2 partition in NAND, but u-boot was unable to read > the > same file correctly from the JFFS2. This happened to be often the case > if the NAND had a few bad blocks in the JFFS2 partition. > Upon further examination it turned out Linux still was able to read > the > file 100% correctly from the partition, but u-boot wasn't. > I did get a lot of "read_nand_cache: error reading nand off ..." > messages in u-boot. > > When debugging further it appears that > read_nand_cached(...) in /fs/jffs2/jffs2_1pass.c > throws away the data if nand_read (/drivers/ mtd/nand/nand_base.c) > doesn't return 0. > This happens in case of an uncorrectable ECC error (-EBADMSG) or a > correctable ECC error(-EUCLEAN). > (see nand_do_read_ops in /drivers/ mtd/nand/nand_base.c) > > So this would mean that data gets thrown away in case of a correctable > ECC error, which doesn't seem the right thing to do and probably does > not match with how linux is behaving. > > I patched the code to not throw away data with correctable ECC errors > and this seems to fix it for the two boards that had this issue. > If it matters: the correctable ECC errors appeared in good blocks (but > often close to a bad block). > > So would my understanding be 'correct'? Yes. -Scott