[U-Boot] OMAP3 broken NAND hardware ECC generation

Dear Scott and Nishanth,
we have broken OMAP3 NAND hardware ECC generation while our clean up of OMAP3 NAND code.
I did some debugging. Do you like to have a look to
http://git.denx.de/?p=u-boot/u-boot-arm.git;a=blob;f=drivers/mtd/nand/omap_g...
?
Using some well defined data in SDRAM, I used older U-Boot with working nand ecc hw/sw implementation and our recent version to write this data to NAND. I then compared ecc written and found that our latest version writes the correct location, but all zero:
Working version from older U-Boot:
OOB: ff ff ec 13 0f 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Recent version:
OOB: ff ff 00 00 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
In both versions the data the ecc is calculated for is the same. In recent version only zero is written.
Some additional debugging by adding some printf() in hw ecc functions:
OMAP3 beagleboard.org # nandecc hw omap_hwecc_init HW ECC selected OMAP3 beagleboard.org # nand write 80000000 680000 1000
NAND write: device 0 offset 0x680000, size 0x1000 omap_calculate_ecc 0x00 0x00 0x00 omap_calculate_ecc 0x00 0x00 0x00 omap_calculate_ecc 0x00 0x00 0x00 omap_calculate_ecc 0x00 0x00 0x00 omap_calculate_ecc 0x00 0x00 0x00 omap_calculate_ecc 0x00 0x00 0x00 omap_calculate_ecc 0x00 0x00 0x00 omap_calculate_ecc 0x00 0x00 0x00 4096 bytes written: OK OMAP3 beagleboard.org #
This is the result of
printf("omap_calculate_ecc 0x%02x 0x%02x 0x%02x\n", ecc_code[2], ecc_code[1], ecc_code[0]);
I'm not sure, but it seems to me, that omap_enable_hwecc() is never called. An printf() in this function is not shown.
Maybe call of nand_scan_tail(mtd); in omap_nand_switch_ecc() resets anything? Or any other idea?
Thanks for your help
Dirk

Dirk Behme wrote:
I'm not sure, but it seems to me, that omap_enable_hwecc() is never called. An printf() in this function is not shown.
Maybe call of nand_scan_tail(mtd); in omap_nand_switch_ecc() resets anything? Or any other idea?
You never cleared out nand->ecc.write_page (and others), so nand_scan_tail() saw that they were non-NULL and assumed you were overriding them, and you got the soft-ECC versions of those, but the hard-ECC calculate method.
-Scott
participants (2)
-
Dirk Behme
-
Scott Wood