From 00f5e098a16411ec5d5508815d17edf5bbd79909 Mon Sep 17 00:00:00 2001 From: "Philip, Avinash" Date: Thu, 1 Dec 2011 11:56:12 +0530 Subject: [PATCH] arm:omap:nand - BCH8 read path corrected. NAND read path for BCH8 is corrected to handle reading of erased pages. Previously on nand read, ecc was taken from wrong offset in oob_poi buffer and was giving non-0xff data and hence was giving ecc uncorrectable issue on erased pages. Signed-off-by: Philip, Avinash --- drivers/mtd/nand/omap2.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 4e7634c..806f1ec 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -816,7 +816,7 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, uint8_t *ecc_calc = chip->buffers->ecccalc; uint8_t *ecc_code = chip->buffers->ecccode; uint32_t *eccpos = chip->ecc.layout->eccpos; - uint8_t *oob = chip->oob_poi; + uint8_t *oob = &chip->oob_poi[eccpos[0]]; uint32_t data_pos; uint32_t oob_pos; @@ -836,10 +836,9 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, /* read respective ecc from oob area */ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, oob_pos, page); - if (info->ecc_opt == OMAP_ECC_BCH8_CODE_HW) { + if (info->ecc_opt == OMAP_ECC_BCH8_CODE_HW) chip->read_buf(mtd, oob, 13); - oob++; - } else + else chip->read_buf(mtd, oob, eccbytes); /* read syndrome */ chip->ecc.calculate(mtd, p, &ecc_calc[i]); -- 1.9.1