From mboxrd@z Thu Jan 1 00:00:00 1970 From: sbabic at denx.de Date: Mon, 11 May 2020 12:16:16 +0200 (CEST) Subject: [PATCH 01/14] mtd: gpmi: change the BCH layout setting for large oob NAND In-Reply-To: <20200504140903.23602-2-peng.fan@nxp.com> Message-ID: <20200511101616.C4F8281584@phobos.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de > From: Ye Li > The code change updated the NAND driver BCH ECC layout algorithm to > support large oob size NAND chips(oob > 1024 bytes) and proposed a new > way to set ECC layout. > Current implementation requires each chunk size larger than oob size so > the bad block marker (BBM) can be guaranteed located in data chunk. The > ECC layout always using the unbalanced layout(Ecc for both meta and > Data0 chunk), but for the NAND chips with oob larger than 1k, the driver > cannot support because BCH doesn?t support GF 15 for 2K chunk. > The change keeps the data chunk no larger than 1k and adjust the ECC > strength or ECC layout to locate the BBM in data chunk. General idea for > large oob NAND chips is > 1.Try all ECC strength from the minimum value required by NAND spec to > the maximum one that works, any ECC makes the BBM locate in data chunk > can be chosen. > 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, of course, we need to check > if oob can afford it. > Previous code has two methods for ECC layout setting, the > legacy_calc_ecc_layout and calc_ecc_layout_by_info, the difference > between these two methods is, legacy_calc_ecc_layout set the chunk size > larger chan oob size and then set the maximum ECC strength that oob can > afford. While the calc_ecc_layout_by_info set chunk size and ECC > strength according to NAND spec. It has been proved that the first > method cannot provide safe ECC strength for some modern NAND chips, so > in current code, > 1. Driver read NAND parameters first and then chose the proper ECC > layout setting method. > 2. If the oob is large or NAND required data chunk larger than oob size, > chose calc_ecc_for_large_oob, otherwise use calc_ecc_layout_by_info > 3. legacy_calc_ecc_layout only used for some NAND chips does not contains > necessary information. So this is only a backup plan, it is NOT > recommended to use these NAND chips. > Signed-off-by: Han Xu > Signed-off-by: Ye Li > Signed-off-by: Peng Fan Applied to u-boot-imx, master, thanks ! Best regards, Stefano Babic -- ===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================