Hi Sascha, Thanks for reviewing. On Tue, Mar 9, 2021 at 8:18 PM Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote: > > On Tue, Mar 09, 2021 at 02:15:19PM +0800, dillon.minfei@xxxxxxxxx wrote: > > From: dillon min <dillon.minfei@xxxxxxxxx> > > > > This patch intend to fix ubi filesystem mount failed on MYS-6ULX-IOT board, > > from Micron MT29F2G08ABAEAWP's datasheets, we need to choose 4-bit ECC. > > > > Table 18: Error Management Details > > > > Description Requirement > > > > Minimum number of valid blocks (NVB) per LUN 2008 > > Total available blocks per LUN 2048 > > First spare area location x8: byte 2048 x16: word 1024 > > Bad-block mark x8: 00h x16: 0000h > > Minimum required ECC 4-bit ECC per 528 bytes > > Minimum ECC with internal ECC enabled 4-bit ECC per 516 bytes (user data) + 8 > > bytes (parity data) > > Minimum required ECC for block 0 if PROGRAM/ > > ERASE cycles are less than 1000 1-bit ECC per 528 bytes > > 4-bit ECC is the minimum this chip requires. There's nothing wrong with > choosing a better ECC like the GPMI driver does by default. > Yes, indeed, the mt29f2g08's minimum ecc is 4-bit, you can use 8-bits ecc. but there is a dependency between new kernel gpmi-nand with the old mfg-kernel's , which means if the old nand ecc layout is 4-bits, you should use ecc 4-bit in the new kernel (by fsl,use-minimum-ecc), else use 8-bits. For my case, the ubifs filesystem was created by ecc 4-bits, without reflash filesystem or change gpmi-nand.c , so the better way is to use dts configure. use legacy_set_geometry() : [ 6.713115] GF length : 13 [ 6.713115] ECC Strength : 8 [ 6.713115] Page Size in Bytes : 2110 [ 6.713115] Metadata Size in Bytes : 10 [ 6.713115] ECC Chunk Size in Bytes: 512 [ 6.713115] ECC Chunk Count : 4 [ 6.713115] Payload Size in Bytes : 2048 [ 6.713115] Auxiliary Size in Bytes: 16 [ 6.713115] Auxiliary Status Offset: 12 [ 6.713115] Block Mark Byte Offset : 1999 [ 6.713115] Block Mark Bit Offset : 0 use set_geometry_by_ecc_info() [ 6.701262] GF length : 13 [ 6.701262] ECC Strength : 4 [ 6.701262] Page Size in Bytes : 2084 [ 6.701262] Metadata Size in Bytes : 10 [ 6.701262] ECC Chunk Size in Bytes: 512 [ 6.701262] ECC Chunk Count : 4 [ 6.701262] Payload Size in Bytes : 2048 [ 6.701262] Auxiliary Size in Bytes: 16 [ 6.701262] Auxiliary Status Offset: 12 [ 6.701262] Block Mark Byte Offset : 2018 [ 6.701262] Block Mark Bit Offset : 4 here are some background tips (fsl,use-minimum-ecc) for your refer: The bug was submitted in regression test, [1] https://linux-mtd.infradead.narkive.com/hfRFPn3P/gpmi-mtd-ecc-regression First patch to fix it [2] https://stable.vger.kernel.narkive.com/mupPGUPj/patch-v2-mtd-gpmi-fix-the-ecc-regression Introduce devicetree to configure by user(more flexibility) [3] https://linux-mtd.infradead.narkive.com/tqQZ75Iz/patch-v2-mtd-gpmi-add-a-new-dt-property-to-use-the-datasheet-s-minimum-required-ecc > It looks like you are papering over some other problem. > > Sascha > > -- > Pengutronix e.K. | | > Steuerwalder Str. 21 | http://www.pengutronix.de/ | > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |