[PATCH] mtd: nand: raw: gpmi: fix bch geometry settings issue

Miquel Raynal miquel.raynal at bootlin.com
Thu Mar 24 07:24:09 PDT 2022


Hi Han,

sean at geanix.com wrote on Thu, 24 Mar 2022 12:48:01 +0100:

> Hi Han,
> 
> On Mon, Mar 21, 2022 at 03:20:28PM -0500, Han Xu wrote:
> > The code change fixed the kernel gpmi driver bch geometry settings not
> > aligned with u-boot settings issue. For the backward compatibility, it
> > still keeps the legacy bch setting as default. Users may choose to use
> > chips required minimum ecc strength by DT flag "fsl,use-minimum-ecc".
> > It also proposes a new way to set bch geometry for large oob NAND.
> > 
> > - For the legacy bch geometry settings
> > The driver uses legacy bch geometry settings by default, if the NAND
> > chips oob size is less than 1KB. The legacy_set_geometry() sets the data
> > chunk size(step_size) larger than oob size to make sure BBM locates in
> > data chunk, then set the maximum ecc stength oob can hold. It always use
> > unbalanced ECC layout, which ecc0 will cover both meta and data0 chunk.
> > 
> > - For the large oob bch geometry settings
> > This type of setting will be used for NAND chips that oob size is
> > larger than 1KB, the general idea is,
> > 
> >     1.Try all ECC strength from the minimum value required by NAND chip
> >       to the maximum one that works, any ECC makes the BBM locate in
> >       data chunk can be eligible.
> > 
> >     2.If none of them works, using separate ECC for meta, which will add
> >       one extra ecc with the same ECC strength as other data chunks.
> >       This extra ECC can guarantee BBM located in data chunk, also we
> >       need to check if oob can afford it.
> > 
> > - For all other cases
> > set the bch geometry by chip required strength and step size, which uses
> > the minimum ecc strength chip required. It can be explicitly enabled by
> > DT flag "fsl,use-minimum-ecc", but need to be en/disabled in both u-boot
> > and kernel at the same time.
> > 
> > Signed-off-by: Han Xu <han.xu at nxp.com>  
> Tested-by: Sean Nyekjaer <sean at geanix.com>
> 
> > ---  
> 
> [ ... ]
> 
> From my side it's looking good. I have tested this in legacy mode and it
> keeps functioning.
> 
> Since this introduces 2 changes maybe it would be better to seperate the
> changes into 2 patches?

Yeah I was about to ask for it as well.

And please use "mtd: rawnand: gpmi:" as prefix.

> 
> Thanks for finally fixing the Linux vs. U-boot unalignment.
> 
> /Sean


Thanks,
Miquèl



More information about the linux-mtd mailing list