[U-Boot] [PATCH 2/2] MTD:NAND: ADD new ECC mode NAND_ECC_HW_OOB_FIRST

John Rigby jcrigby at gmail.com
Tue Sep 1 17:22:51 CEST 2009


Sorry for the late comments.  We have been trying to use this code with the
associated davinci 4-bit ecc patches and have some questions (inline).

.....
> +       uint8_t *ecc_code = chip->buffers->ecccode;
> +       uint32_t *eccpos = chip->ecc.layout->eccpos;
> +       uint8_t *ecc_calc = chip->buffers->ecccalc;
> +
> +       /* Read the OOB area first */
> +       chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
>

What about chips that do not support the  NAND_CMD_READOOB?  Do I need to
provide my own read routine for that case?

+       chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
> +       chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
> +
> +       for (i = 0; i < chip->ecc.total; i++)
> +               ecc_code[i] = chip->oob_poi[eccpos[i]];
> +
> +       for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
> +               int stat;
> +
> +               chip->ecc.hwctl(mtd, NAND_ECC_READ);
> +               chip->read_buf(mtd, p, eccsize);
> +               chip->ecc.calculate(mtd, p, &ecc_calc[i]);
>

Here you calculate ecc then never use the result?

+
> +               stat = chip->ecc.correct(mtd, p, &ecc_code[i], NULL);
> +               if (stat < 0)
> +                       mtd->ecc_stats.failed++;
> +               else
> +                       mtd->ecc_stats.corrected += stat;
> +       }
> +       return 0;
> +}
> +
>


More information about the U-Boot mailing list