nand "BCH decoding failed" when using bch8_hw_romcode ecc mode

Sascha Hauer sha at pengutronix.de
Thu Mar 17 00:46:28 PDT 2022


Hi,

On Wed, Mar 16, 2022 at 01:45:31PM +0000, Tibault Damman wrote:
> Hi all
> 
> Due to component shortages, I'm trying to move an old board from a Phytec Phycore omap4430 with 8bit nand (Micron MT29F4G08ABBDAH4) to an omap4460 variant with 16bit nand (Micron MT29F8G16ADBDAH4).
> 
> To be compatible with Linux 5.4, the rootfs nand (ubi) partition needs to be in BCH8_HW_ROMCODE ecc mode instead of the default BCH8_HW.
> When I use ubiformat or ubiattach from barebox in this mode though, I get a bazillion "BCH decoding failed" prints (which I did not get on the omap4430)
> 
> > barebox at Phytec phyCORE-OMAP4460:/ ubiattach -O 2048 /dev/nand0.sys
> > ...
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > nand0.root: error -74 (ECC error) while reading 512 bytes from PEB 887:0
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > nand0.root: error -74 (ECC error) while reading 512 bytes from PEB 888:0
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > BCH decoding failed
> > ...
> 
> I tried these combinations:
> * omap4430 (8bit nand) + BCH8_HW ecc: works (but not compatible with Linux)
> * omap4430 (8bit nand) + BCH8_HW_ROMCODE ecc: works
> * omap4460 (16bit nand) + BCH8_HW ecc: works (but not compatible with Linux)
> * omap4460 (16bit nand) + BCH8_HW_ROMCODE ecc: does not work
> 
> I've reproduced this on the following barebox versions:
> * phytec's 2013.06 fork
> * 2019.07.0 (which I've been (successfully) using for omap4430)
> * the latest 2020.03.0
> 
> Any clues what could be going wrong here?

No clue, just some things you could test:

- in BCH8_HW_ROMCODE barebox can't read what it has written itself,
  right?
- Can barebox read what Linux has written in this mode?
- Use Linux to write known data to a page:
  seq 10000 > foo
  flash_erase /dev/mtdx 0 0
  nandwrite /dev/mtdx foo
- Read the same page in raw mode in barebox:
  md -s /dev/nand0.raw 0+2112
- Write the same data with barebox
- Read again:
  md -s /dev/nand0.raw 0+2112
- Compare the results

You could also just return successfully in chien() when the result would
fail and see what you read.

Use plain NAND accesses for now, i.e. no UBI.

Playing with these things should give us a starting point where to look
at.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list