MT7621 NAND OOB misdetect

Peter Naulls peter at chocky.org
Fri Feb 10 10:42:00 PST 2023


This is the boot on the vendor legacy code - OpenWrt 18.06ish, with kernel 
4.14.131, with probably a bunch of their customizations, but:

[    9.398860] [NAND]select ecc bit:12, sparesize :112 spare_per_sector=28
[    9.412077] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xf1
[    9.424719] nand: Macronix NAND 128MiB 3,3V 8-bit
[    9.434084] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB 
size: 32

But under 5.10 on 22.03 (I also tried 5.15 with current development, but that
has unrelated issues):

[   16.071380] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xf1
[   16.084185] nand: Macronix MX30LF1G28AD
[   16.091826] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB 
size: 128
[   16.107083] mt7621-nand 1e003000.nand: ECC strength adjusted to 12 bits
[   16.163318] 8 fixed-partitions partitions found on MTD device mt7621-nand

Suffice to that accessing the device (nanddump) does not go well.

I did look around the code, and in particular at the nand_onfi.c code,
where the OOB is set based upon various metrics. I tried hard wiring
here to 32, but this caused other problems with ECC determination.

It turns out the legacy code actually uses a whole other driver:

/******************************************************************************
* mtk_nand2.c - MTK NAND Flash Device Driver
  *
* Copyright 2009-2012 MediaTek Co.,Ltd.


Suffice to say it does not build under current kernels, even with some
attempts in this direction.

What should I be looking at here - I can put some debug/queries under the legacy 
code if need be, but clearly the current code needs to be updated to support 
this.   I haven't looked at the datasheet yet for this part, but probably
I should do.

Many thanks.





More information about the openwrt-devel mailing list