I added some printk to the OEM firmware in the target/linux/mediatek/files/drivers/mtd/nand/mtk_snand.c
file after the dev_warn(dev, "[mtk_snand] probe successfully!\n");
to understand how the oob area is divided:
[ 1.598120] N53: nand_chip->ecc.size = 2048
[ 1.602299] N53: nand_chip->ecc.bytes = 32
[ 1.606393] N53: mtd->writesize = 2048
[ 1.610138] N53: mtd->oobsize = 64
[ 1.613538] N53: mtd->oobavail = 30
[ 1.617022] N53: mtd->erasesize = 131072
[ 1.620944] N53: snfc->use_bmt = 1
[ 1.624341] ### ECC REGION ###
[ 1.627394] N53: mtd_ooblayout_ecc(mtd, 0, &ooeccbregion1) = 0
[ 1.633222] N53: REGION 0
[ 1.635837] N53: ooeccbregion1->offset = 32
[ 1.640015] N53: ooeccbregion1->length = 32
[ 1.644193] N53: mtd_ooblayout_ecc(mtd, 1, &ooeccbregion2) = -34
[ 1.650194] N53: NO REGION 1
[ 1.653069] ### FREE REGION ###
[ 1.656206] N53: mtd_ooblayout_free(mtd, 0, &oobfreeregion1) = 0
[ 1.662207] N53: REGION 0
[ 1.664822] N53: oobfreeregion1->offset = 2
[ 1.669000] N53: oobfreeregion1->length = 30
[ 1.673266] N53: mtd_ooblayout_free(mtd, 1, &oobfreeregion2) = -34
[ 1.679439] N53: NO REGION 1
So there is an offset of two bytes, then there are 30 bytes for the free area and then 32 bytes for ecc. I am testing this configuration right now and seems promising... Do you know how to do a proper and extensive test? I have installed some big packages and after few reboots I don't see any CRC error...
EDIT:
After some more reboots I got the first CRC problem
[ 23.047630] jffs2: notice: (762) check_node_data: wrong data CRC in data node at 0x003f83a4: read 0xb02be10d, calculated 0xa13b9885.
Just out of curiosity I added nandutils to the OEM FW I got another OOB "structure" :
nanddump -p -o -l 0x1 -s 0x28F000 /dev/mtd12 | grep "OOB"
OEM FW:
OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
OOB Data: ff ff ff ff ff ff ff ff ff 2c 01 d2 ff ff ff ff
OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
OPENWRT (OLD FOR COMPARISON):
OOB Data: ff ff ff ff ff 2c 01 d2 ff ff ff ff ff ff ff ff
OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
OOB Data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
OOB Data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
U-BOOT (OLD FOR COMPARISON):
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 2c 01 d2
ff ff ff ff ff ff ff ff ff ff ff ff ff 2c 01 d2 ff ff ff ff ff 2c 01 d2 ff ff ff ff ff ff ff ff