mtd: rawnand: gpmi: Refactor bch geometry settings function
authorHan Xu <han.xu@nxp.com>
Tue, 12 Apr 2022 02:52:42 +0000 (21:52 -0500)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 21 Apr 2022 07:34:02 +0000 (09:34 +0200)
commit15616c7cfb968d72e614b1ba669467dc373b2582
tree03ec9848b2732f1c64108a00bce4aa58650b32a2
parent3a745b51cddafade99aaea1b93aad31e9614e230
mtd: rawnand: gpmi: Refactor bch geometry settings function

The code change refactor the bch geometry setting function, which
doesn't change the default behavior, while user may choose to use chips
required minimum ecc strength by DT flag "fsl,use-minimum-ecc".

The default way to set bch geometry need to set the data chunk
size(step_size) larger than oob size to make sure BBM locates in data
chunk, then set the maximum ecc strength oob can hold. It always use
unbalanced ECC layout, which ecc0 will cover both meta and data0 chunk.
But the default bch setting is deprecated for large oobsize NAND
(oobsize >1KB), so in the patch set, there is a split commit that
introduces a new way to set bch geometry for large oob size NAND.

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@nxp.com>
Tested-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220412025246.24269-2-han.xu@nxp.com
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c