Hi Bill,
I'm quite new to Linux (kernel) programming, I'm too old to start reading all the mailing lists on the Earth. Looks like I'm reinventing the wheel and you have already done fsl_nfc.c, which supports HW ECC on Vybrid, isn't it? If so, could you please share your code?
It looks like my fsl_nfc.c version needs to regard big endian MCF's, which seem using the same driver, right? There must be #if #else's for big and low endian machines, or special #if #elses for Vybrid, MCF, etc..
No, u-boot versions use similar, but not the same driver, at least in Timesys U-boot. Dmitry excerpt is from Linux driver.
I'm puzzled by u-boot driver, I see in it these lines:
if (!prv->pg_boot) {
if (hardware_ecc)
nfc_set_field(mtd, NFC_FLASH_CONFIG,
CONFIG_ECC_MODE_MASK,
CONFIG_ECC_MODE_SHIFT, ECC_45_BYTE);
else
/* set ECC BY_PASS */
nfc_set_field(mtd, NFC_FLASH_CONFIG,
CONFIG_ECC_MODE_MASK,
CONFIG_ECC_MODE_SHIFT, ECC_BYPASS);
if (!(page%0x40))
nfc_set_field(mtd, NFC_FLASH_CONFIG,
CONFIG_ECC_MODE_MASK,
CONFIG_ECC_MODE_SHIFT, ECC_BYPASS);
}
switch (command) {
case NAND_CMD_PAGEPROG:
fsl_nfc_send_cmd(mtd,
PROGRAM_PAGE_CMD_BYTE1,
PROGRAM_PAGE_CMD_BYTE2,
PROGRAM_PAGE_CMD_CODE);
break;
Looks like there must be some pages written with HW ECC bypassed, but flash checks using MQX code show, that there's no page with bad ECC failure except un programmed pages.
Thanks for the links to erased page ECC discussion. Interesting. Erased page with a couple of broken 0bits could be programmed and read well with the help of ECC. But what's better:
- erased page has some broken 0 bit(s), we signal unrecoverable error for such page
- page is programmed to all 1's except few 0's. ECC fails with unrecoverable error, 0 bit counting gives an answer that everything's well, and driver flips all 0's to 1's and gives two false reports, ECC OK, and data = all 1's.
I think the first is better. Robust solution would be to not allow un-programmed pages, but this would slow down NAND support very much and lower NAND life time...
Regards,
Edward