Problems in TI omap2-nand driver OMAP_ECC_BCH8_CODE_HW_DETECTION_SW mode

Ted Juan ted.juan at gmail.com
Mon May 12 01:08:34 PDT 2014


Hi All,

TI am3517/3505 can use the  OMAP_ECC_BCH8_CODE_HW_DETECTION_SW mode in
the latest linux-mtd git tree.

I post the latest driver and older driver as below.

Wouldn't the latest driver get bad performance since it always do the
decode_bch() ?

Thanks,
regards,

Ted


==========the latest omap2.c driver==========

int nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf,
                          unsigned char *read_ecc, unsigned char *calc_ecc)
{
        const struct nand_chip *chip = mtd->priv;
        struct nand_bch_control *nbc = chip->ecc.priv;
        unsigned int *errloc = nbc->errloc;
        int i, count;

        count = decode_bch(nbc->bch, NULL, chip->ecc.size, read_ecc, calc_ecc,
                           NULL, errloc);
        if (count > 0) {

       ......................
}


==========older omap2.c driver==========

static int omap_correct_data_bch(int correct_bits, struct mtd_info *mtd,
                                 uint8_t *dat, uint8_t *read_ecc,
                                 uint8_t *calc_ecc)
{

  ..................

  for (i = 0; i < blockCnt; i++) {
    /* check if any ecc error */
    eccflag = 0;
    for (j = 0; (j < eccsize) && (eccflag == 0); j++)
      if (calc_ecc[j] != 0)
       eccflag = 1;

    if (eccflag == 1) {
      eccflag = 0;
      for (j = 0; (j < eccsize) && (eccflag == 0); j++)
       if (read_ecc[j] != 0xFF)
         eccflag = 1;
    }

    if (eccflag == 1) {
      /*printk(KERN_INFO "...bch correct(%d 512 byte)\n", i+1);*/
      count = decode_bch(mode, calc_ecc, err_loc);

  ...............


}



More information about the linux-mtd mailing list