Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1382410
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v5 39/50] mtd: nand: omap2: switch to mtd_ooblayout_ops |
| Date | 2016-04-19 13:30 +0200 |
| Message-ID | <rpC0X-64Y-21@gated-at.bofh.it> (permalink) |
| References | <rir0C-7XM-5@gated-at.bofh.it> <riraj-82U-27@gated-at.bofh.it> <rpivh-79W-45@gated-at.bofh.it> <rpiYh-7Ft-1@gated-at.bofh.it> <rpBez-5pW-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Roger,
On Tue, 19 Apr 2016 13:28:50 +0300
Roger Quadros <rogerq@ti.com> wrote:
> > @@ -1921,6 +1927,9 @@ static int omap_nand_probe(struct platform_device *pdev)
> > nand_chip->ecc.correct = omap_correct_data;
> > mtd_set_ooblayout(mtd, &omap_ooblayout_ops);
> > oobbytes_per_step = nand_chip->ecc.bytes;
> > +
> > + if (nand_chip->options & NAND_BUSWIDTH_16)
> > + min_oobbytes = 1;
>
> Shouldn't this have been
> if (!(nand_chip->options & NAND_BUSWIDTH_16)
> min_oobbytes = 1;
> ?
Yep.
>
> > break;
> >
> > case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW:
> > @@ -2038,10 +2047,8 @@ static int omap_nand_probe(struct platform_device *pdev)
> > }
> >
> > /* check if NAND device's OOB is enough to store ECC signatures */
> > - min_oobbytes = (oobbytes_per_step *
> > - (mtd->writesize / nand_chip->ecc.size)) +
> > - (nand_chip->options & NAND_BUSWIDTH_16 ?
> > - BADBLOCK_MARKER_LENGTH : 1);
> > + min_oobbytes += (oobbytes_per_step *
> > + (mtd->writesize / nand_chip->ecc.size));
> > if (mtd->oobsize < min_oobbytes) {
> > dev_err(&info->pdev->dev,
> > "not enough OOB bytes required = %d, available=%d\n",
> >
>
> After the above changes BCH with HW ECC worked fine but BCH with SW ECC still failed.
> I had to fix it up with the below patch. This is mainly because chip->ecc.steps wasn't
> yet initialized before calling nand_bch_init().
>
> After the below patch it worked fine with bch4 (hw & sw), bch8 (hw & sw) and ham1.
> I couldn't yet verify bch16 though.
Thanks for the fix, but I'd prefer fixing the bug for all soft BCH
users.
Could you try this patch?
--->8---
diff --git a/drivers/mtd/nand/nand_bch.c b/drivers/mtd/nand/nand_bch.c
index ca9b2a4..3ca3d39 100644
--- a/drivers/mtd/nand/nand_bch.c
+++ b/drivers/mtd/nand/nand_bch.c
@@ -177,6 +177,16 @@ struct nand_bch_control *nand_bch_init(struct mtd_info *mtd)
goto fail;
}
+ /*
+ * ecc->steps and ecc->total might be used by mtd->ooblayout->ecc(),
+ * which is called by mtd_ooblayout_count_eccbytes().
+ * Make sure they are properly initialized before calling
+ * mtd_ooblayout_count_eccbytes().
+ * FIXME: we should probaly rework the sequencing in nand_scan_tail()
+ * to avoid setting those fields twice.
+ */
+ nand->ecc.steps = eccsteps;
+ nand->ecc.total = eccsteps * eccbytes;
if (mtd_ooblayout_count_eccbytes(mtd) != (eccsteps*eccbytes)) {
printk(KERN_WARNING "invalid ecc layout\n");
goto fail;
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH v5 39/50] mtd: nand: omap2: switch to mtd_ooblayout_ops Roger Quadros <rogerq@ti.com> - 2016-04-18 16:40 +0200
Re: [PATCH v5 39/50] mtd: nand: omap2: switch to mtd_ooblayout_ops Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-04-18 17:10 +0200
Re: [PATCH v5 39/50] mtd: nand: omap2: switch to mtd_ooblayout_ops Roger Quadros <rogerq@ti.com> - 2016-04-19 12:40 +0200
Re: [PATCH v5 39/50] mtd: nand: omap2: switch to mtd_ooblayout_ops Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-04-19 13:30 +0200
Re: [PATCH v5 39/50] mtd: nand: omap2: switch to mtd_ooblayout_ops Roger Quadros <rogerq@ti.com> - 2016-04-19 14:40 +0200
Re: [PATCH v5 39/50] mtd: nand: omap2: switch to mtd_ooblayout_ops Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-04-19 14:50 +0200
Re: [PATCH v5 39/50] mtd: nand: omap2: switch to mtd_ooblayout_ops Roger Quadros <rogerq@ti.com> - 2016-04-19 15:00 +0200
csiph-web