ath79: ar934x-nand: fix broken nand on kernel 5.10
authorKoen Vandeputte <koen.vandeputte@citymesh.com>
Tue, 6 Apr 2021 10:16:10 +0000 (12:16 +0200)
committerKoen Vandeputte <koen.vandeputte@ncentric.com>
Tue, 6 Apr 2021 15:00:07 +0000 (17:00 +0200)
commitf4f4259ca17e61a2bb14b9453e050451478f546a
treeb975be4b0908aa2219f828a94e965e842cb24876
parent880c8b44223c9cbce3dd14da78c33676c6f1a8a6
ath79: ar934x-nand: fix broken nand on kernel 5.10

Booting current 5.10.x testing kernel shows this:

[    0.335781] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xf1
[    0.342280] nand: Samsung NAND 128MiB 3,3V 8-bit
[    0.346982] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048,
OOB size: 64
[    0.354703] ar934x-nand 1b800200.nand: unknown ECC mode 2
[    0.360193] ar934x-nand 1b800200.nand: nand_scan failed, err:-22
[    0.366341] ar934x-nand: probe of 1b800200.nand failed with error -22

...

[    1.089264] /dev/root: Can't open blockdev
[    1.093482] VFS: Cannot open root device "(null)" or
unknown-block(0,0): error -6
[    1.101077] Please append a correct "root=" boot option; here are the
available partitions:
[    1.109555] 1f00              64 mtdblock0
[    1.109559]  (driver?)
[    1.116199] 1f01              48 mtdblock1
[    1.116202]  (driver?)
[    1.122841] 1f02               4 mtdblock2
[    1.122844]  (driver?)
[    1.129493] 1f03               4 mtdblock3
[    1.129497]  (driver?)
[    1.136138] 1f04               4 mtdblock4
[    1.136142]  (driver?)
[    1.142787] Kernel panic - not syncing: VFS: Unable to mount root fs
on unknown-block(0,0)
[    1.151168] Rebooting in 1 seconds..

The issue is caused by a wrong check for ECC engine type
on newer kernels.

Fix this.

Bootlog after:

[    0.335689] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xf1
[    0.342192] nand: Samsung NAND 128MiB 3,3V 8-bit
[    0.346884] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048,
OOB size: 64
[    0.354611] Scanning device for bad blocks
[    0.364924] random: fast init done
[    0.496641] 3 fixed-partitions partitions found on MTD device
ar934x-nand
[    0.503545] Creating 3 MTD partitions on "ar934x-nand":
[    0.508865] 0x000000000000-0x000000040000 : "booter"
[    0.515133] 0x000000040000-0x000000400000 : "kernel"
[    0.523265] 0x000000400000-0x000008000000 : "ubi"

Fixes: fb64e2c30f ("ath79: ar934x-nand: add kernel 5.10 compatibility")
Signed-off-by: Koen Vandeputte <koen.vandeputte@citymesh.com>
target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c