diff mbox

mtd: nand: atmel: probe of Spansion S34ML02G1 fails

Message ID 20170725205406.5a946c08@bbrezillon
State Not Applicable
Headers show

Commit Message

Boris Brezillon July 25, 2017, 6:54 p.m. UTC
Hi Alexander,

Le Tue, 25 Jul 2017 11:26:33 +0200,
Alexander Dahl <ada@thorsis.com> a écrit :

> Hello,
> 
> when testing the recent v4.13-rc2 on our at91sam9g20 based platform I 
> discovered one of the NAND flash chips we use can not be setup correctly 
> anymore. I guess this may be due to the reworked atmel nand driver after 
> v4.9, but it may be another problem.
> 
> The board layout is similar to the at91sam9g20ek for the NAND flash part 
> and we're using different flash chips. With an hynix HY27UF082G2B 
> everything works, the console output on boot is like this:
> 
>   nand: Could not find valid ONFI parameter page; aborting
>   nand: device found, Manufacturer ID: 0xad, Chip ID: 0xda
>   nand: Hynix NAND 256MiB 3,3V 8-bit
>   nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
> 
> The same board with another pin compatible flash chip, the Spansion 
> S34ML02G100TF100 however fails. I added some debug print statements to a 
> otherwise clean 4.13-rc2 kernel and get this:
> 
>   nand: device found, Manufacturer ID: 0x01, Chip ID: 0xda
>   nand: AMD/Spansion S34ML02G1
>   nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
>   nand: onfi_version: 10, onfi_params.opt_cmd: 0x001B
>   nand: chip->onfi_set_features() failed: -22
>   nand: nand_setup_data_interface() failed: -22
>   atmel-nand-controller 10000000.ebi:nand-controller: nand_scan_ident() 
> failed: -22
>   atmel-nand-controller: probe of 10000000.ebi:nand-controller failed 
> with error -22
> 
> So in the ONFI parameter page of the flash chip the value for "optional 
> commands supported" in the features block is 0x001B which is exactly 
> what the datasheet says. This means this flash chip does not support 
> "Get Features" and "Set Features".
> 
> Now nand_onfi_set_features() correctly fails, because the nand chip can 
> not set features. It's called in nand_setup_data_interface() in 
> nand_base.c which fails itself because of the return value of the failed 
> set features call and so the whole chain of fails starts.

Oh crap! We didn't consider ONFI NANDs which are supporting the SET/GET
FEATURES operations when working on the timing selection logic.

> 
> The nand chip actually works fine in U-Boot, and with kernels up to 
> v4.9.35, I didn't test v4.10, v4.11, but IIRC the board booted from nand 
> flash with v4.12.
> 
> Can anyone help me to fix this?

Can you try with the following fix? 

Thanks,

Boris

> 
> Greets
> Alex
> 
--->8---

Comments

Alexander Dahl July 26, 2017, 8:15 a.m. UTC | #1
Hello,

Am Dienstag, 25. Juli 2017, 20:54:06 schrieb Boris Brezillon:
> Can you try with the following fix?

I tried. The initialization seems to be successful now, at least there 
are no error messages from the nand driver anymore. But later on UBI 
fails, which is strange because it does not fail with earlier kernels. 
Kernel command line is this:

console=ttyS0,115200 panic=1 
mtdparts=atmel_nand:128k(bootstrap)ro,512k(uboot)ro,256k(env1),256k(env2),3M(kernel_rec)ro,768k(fpga_rec)ro,47M(rootfs_rec)ro,3M(kernel),768k(fpga),200M(filesystem),128k(rootfs_update_script),-(free) 
ubi.mtd=rootfs_rec ubi.mtd=filesystem root=ubi1:rootfs1 rootfstype=ubifs

UBI/UBIFS kernel config is like this:

CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTD_UBI_BEB_LIMIT=50
# CONFIG_MTD_UBI_FASTMAP is not set
# CONFIG_MTD_UBI_GLUEBI is not set
# CONFIG_MTD_UBI_BLOCK is not set

CONFIG_UBIFS_FS=y
CONFIG_UBIFS_FS_ADVANCED_COMPR=y
CONFIG_UBIFS_FS_LZO=y
CONFIG_UBIFS_FS_ZLIB=y
# CONFIG_UBIFS_ATIME_SUPPORT is not set
# CONFIG_UBIFS_FS_ENCRYPTION is not set
CONFIG_UBIFS_FS_SECURITY=y

According to the datasheet the NAND flash (Spansion® S34ML02G1) supports 
1-bit ECC. According to the SAM9G20 datasheet the SMC supports ECC-
enabled NAND flash, but as far as I could see the ECC controller of the 
SAM9G20 has no driver and is not used, but ECC is computed in software?

The nand node in my dts file is like the one in 
arch/arm/boot/dts/at91sam9g20ek_common.dtsi (with different partitions).

See the console output:

nand: device found, Manufacturer ID: 0x01, Chip ID: 0xda
nand: AMD/Spansion S34ML02G1
nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
Bad block table found at page 131008, version 0x01
Bad block table found at page 130944, version 0x01
12 cmdlinepart partitions found on MTD device atmel_nand
Creating 12 MTD partitions on "atmel_nand":
0x000000000000-0x000000020000 : "bootstrap"
0x000000020000-0x0000000a0000 : "uboot"
0x0000000a0000-0x0000000e0000 : "env1"
0x0000000e0000-0x000000120000 : "env2"
0x000000120000-0x000000420000 : "kernel_rec"
0x000000420000-0x0000004e0000 : "fpga_rec"
0x0000004e0000-0x0000033e0000 : "rootfs_rec"
0x0000033e0000-0x0000036e0000 : "kernel"
0x0000036e0000-0x0000037a0000 : "fpga"
0x0000037a0000-0x00000ffa0000 : "filesystem"
0x00000ffa0000-0x00000ffc0000 : "rootfs_update_script"
0x00000ffc0000-0x000010000000 : "free"
NET: Registered protocol family 17
ubi0: attaching mtd6
ubi0: MTD device 6 is write-protected, attach in read-only mode
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 1:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 1:0, read only 64 bytes, retry
ubi0: fixable bit-flip detected at PEB 1
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 2:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 2:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 2:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 2:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
(ubi_io_read_ec_hdr+0xa4/0x32c)
[<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
(scan_all.constprop.0+0x150/0xb80)
[<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
ubi0: fixable bit-flip detected at PEB 2
ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
header at PEB 2
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 3:0, read only 64 bytes, retry
ubi0: fixable bit-flip detected at PEB 3
ubi0: fixable bit-flip detected at PEB 3
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 4:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 4:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 4:0, read only 64 bytes, retry
ubi0: fixable bit-flip detected at PEB 4
ubi0: fixable bit-flip detected at PEB 4
ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
header at PEB 4
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 5:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 5:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 5:0, read only 64 bytes, retry
ubi0: fixable bit-flip detected at PEB 5
ubi0: fixable bit-flip detected at PEB 5
ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
header at PEB 5
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 6:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 6:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 6:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 6:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
(ubi_io_read_ec_hdr+0xa4/0x32c)
[<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
(scan_all.constprop.0+0x150/0xb80)
[<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
ubi0: fixable bit-flip detected at PEB 6
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 7:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 7:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 7:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 7:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
(ubi_io_read_ec_hdr+0xa4/0x32c)
[<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
(scan_all.constprop.0+0x150/0xb80)
[<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
ubi0: fixable bit-flip detected at PEB 7
ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
header at PEB 7
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 8:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 8:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 8:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 8:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
(ubi_io_read_ec_hdr+0xa4/0x32c)
[<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
(scan_all.constprop.0+0x150/0xb80)
[<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 8:512, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 8:512, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 8:512, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 8:512, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0259200>] 
(ubi_io_read_vid_hdr+0xac/0x32c)
[<c0259200>] (ubi_io_read_vid_hdr) from [<c025f3d8>] 
(scan_all.constprop.0+0x208/0xb80)
[<c025f3d8>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
ubi0: fixable bit-flip detected at PEB 9
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 9:512, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 9:512, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 9:512, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 9:512, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0259200>] 
(ubi_io_read_vid_hdr+0xac/0x32c)
[<c0259200>] (ubi_io_read_vid_hdr) from [<c025f3d8>] 
(scan_all.constprop.0+0x208/0xb80)
[<c025f3d8>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 129024 
bytes from PEB 9:2048, read only 129024 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 129024 
bytes from PEB 9:2048, read only 129024 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 129024 
bytes from PEB 9:2048, read only 129024 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 129024 
bytes from PEB 9:2048, read 129024 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c025f468>] 
(scan_all.constprop.0+0x298/0xb80)
[<c025f468>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 10:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 10:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 10:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 10:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
(ubi_io_read_ec_hdr+0xa4/0x32c)
[<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
(scan_all.constprop.0+0x150/0xb80)
[<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 10:512, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 10:512, read only 64 bytes, retry
ubi0: fixable bit-flip detected at PEB 10
ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
header at PEB 10
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 11:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 11:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 11:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 11:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
(ubi_io_read_ec_hdr+0xa4/0x32c)
[<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
(scan_all.constprop.0+0x150/0xb80)
[<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 11:512, read only 64 bytes, retry
ubi0: fixable bit-flip detected at PEB 11
ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
header at PEB 11
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 12:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 12:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 12:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 12:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
(ubi_io_read_ec_hdr+0xa4/0x32c)
[<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
(scan_all.constprop.0+0x150/0xb80)
[<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
ubi0: fixable bit-flip detected at PEB 12
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 13:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 13:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 13:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 13:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
(ubi_io_read_ec_hdr+0xa4/0x32c)
[<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
(scan_all.constprop.0+0x150/0xb80)
[<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
ubi0: fixable bit-flip detected at PEB 13
ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
header at PEB 13
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 14:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 14:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 14:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 14:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
(ubi_io_read_ec_hdr+0xa4/0x32c)
[<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
(scan_all.constprop.0+0x150/0xb80)
[<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
ubi0: fixable bit-flip detected at PEB 14
ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
header at PEB 14
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 15:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 15:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 15:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 15:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
(ubi_io_read_ec_hdr+0xa4/0x32c)
[<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
(scan_all.constprop.0+0x150/0xb80)
[<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
ubi0: fixable bit-flip detected at PEB 15
ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
header at PEB 15
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 16:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 16:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 16:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 16:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
(ubi_io_read_ec_hdr+0xa4/0x32c)
[<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
(scan_all.constprop.0+0x150/0xb80)
[<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
ubi0: fixable bit-flip detected at PEB 16
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 17:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 17:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 17:0, read only 64 bytes, retry
ubi0: fixable bit-flip detected at PEB 17
ubi0: fixable bit-flip detected at PEB 17
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 18:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 18:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 18:0, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 18:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
(ubi_io_read_ec_hdr+0xa4/0x32c)
[<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
(scan_all.constprop.0+0x150/0xb80)
[<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 18:512, read only 64 bytes, retry
ubi0: fixable bit-flip detected at PEB 18
ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
header at PEB 18
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 19:0, read only 64 bytes, retry
ubi0: fixable bit-flip detected at PEB 19
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 19:512, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 19:512, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 19:512, read only 64 bytes, retry
__nand_correct_data: uncorrectable ECC error
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
from PEB 19:512, read 64 bytes
CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
Hardware name: Atmel AT91SAM9
[<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
[<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
[<c0258b4c>] (ubi_io_read) from [<c0259200>] 
(ubi_io_read_vid_hdr+0xac/0x32c)
[<c0259200>] (ubi_io_read_vid_hdr) from [<c025f3d8>] 
(scan_all.constprop.0+0x208/0xb80)
[<c025f3d8>] (scan_all.constprop.0) from [<c0260084>] 
(ubi_attach+0xa0/0x194)
[<c0260084>] (ubi_attach) from [<c02524f8>] 
(ubi_attach_mtd_dev+0x1f4/0x698)
[<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
(ubi_init+0x138/0x1d8)
[<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
[<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
(kernel_init_freeable+0x104/0x1c0)
[<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
(kernel_init+0x8/0xf0)
[<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
__nand_correct_data: uncorrectable ECC error
__nand_correct_data: uncorrectable ECC error
__nand_correct_data: uncorrectable ECC error
__nand_correct_data: uncorrectable ECC error
__nand_correct_data: uncorrectable ECC error

[…]

This goes on forever until I cut power, just interrupted by messages 
like this every now and then:

ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 129024 
bytes from PEB 19:2048, read only 129024 bytes, retry

Greets
Alex
Boris Brezillon July 26, 2017, 6:33 p.m. UTC | #2
Hi Alexander,

Le Wed, 26 Jul 2017 10:15:13 +0200,
Alexander Dahl <ada@thorsis.com> a écrit :

> Hello,
> 
> Am Dienstag, 25. Juli 2017, 20:54:06 schrieb Boris Brezillon:
> > Can you try with the following fix?  
> 
> I tried. The initialization seems to be successful now, at least there 
> are no error messages from the nand driver anymore. But later on UBI 
> fails, which is strange because it does not fail with earlier kernels. 
> Kernel command line is this:
> 
> console=ttyS0,115200 panic=1 
> mtdparts=atmel_nand:128k(bootstrap)ro,512k(uboot)ro,256k(env1),256k(env2),3M(kernel_rec)ro,768k(fpga_rec)ro,47M(rootfs_rec)ro,3M(kernel),768k(fpga),200M(filesystem),128k(rootfs_update_script),-(free) 
> ubi.mtd=rootfs_rec ubi.mtd=filesystem root=ubi1:rootfs1 rootfstype=ubifs
> 
> UBI/UBIFS kernel config is like this:
> 
> CONFIG_MTD_UBI=y
> CONFIG_MTD_UBI_WL_THRESHOLD=4096
> CONFIG_MTD_UBI_BEB_LIMIT=50
> # CONFIG_MTD_UBI_FASTMAP is not set
> # CONFIG_MTD_UBI_GLUEBI is not set
> # CONFIG_MTD_UBI_BLOCK is not set
> 
> CONFIG_UBIFS_FS=y
> CONFIG_UBIFS_FS_ADVANCED_COMPR=y
> CONFIG_UBIFS_FS_LZO=y
> CONFIG_UBIFS_FS_ZLIB=y
> # CONFIG_UBIFS_ATIME_SUPPORT is not set
> # CONFIG_UBIFS_FS_ENCRYPTION is not set
> CONFIG_UBIFS_FS_SECURITY=y
> 
> According to the datasheet the NAND flash (Spansion® S34ML02G1) supports 
> 1-bit ECC. According to the SAM9G20 datasheet the SMC supports ECC-
> enabled NAND flash, but as far as I could see the ECC controller of the 
> SAM9G20 has no driver and is not used, but ECC is computed in software?
> 
> The nand node in my dts file is like the one in 
> arch/arm/boot/dts/at91sam9g20ek_common.dtsi (with different partitions).
> 
> See the console output:
> 
> nand: device found, Manufacturer ID: 0x01, Chip ID: 0xda
> nand: AMD/Spansion S34ML02G1
> nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
> Bad block table found at page 131008, version 0x01
> Bad block table found at page 130944, version 0x01
> 12 cmdlinepart partitions found on MTD device atmel_nand
> Creating 12 MTD partitions on "atmel_nand":
> 0x000000000000-0x000000020000 : "bootstrap"
> 0x000000020000-0x0000000a0000 : "uboot"
> 0x0000000a0000-0x0000000e0000 : "env1"
> 0x0000000e0000-0x000000120000 : "env2"
> 0x000000120000-0x000000420000 : "kernel_rec"
> 0x000000420000-0x0000004e0000 : "fpga_rec"
> 0x0000004e0000-0x0000033e0000 : "rootfs_rec"
> 0x0000033e0000-0x0000036e0000 : "kernel"
> 0x0000036e0000-0x0000037a0000 : "fpga"
> 0x0000037a0000-0x00000ffa0000 : "filesystem"
> 0x00000ffa0000-0x00000ffc0000 : "rootfs_update_script"
> 0x00000ffc0000-0x000010000000 : "free"
> NET: Registered protocol family 17
> ubi0: attaching mtd6
> ubi0: MTD device 6 is write-protected, attach in read-only mode
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 1:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 1:0, read only 64 bytes, retry
> ubi0: fixable bit-flip detected at PEB 1
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 2:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 2:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 2:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 2:0, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
> (ubi_io_read_ec_hdr+0xa4/0x32c)
> [<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
> (scan_all.constprop.0+0x150/0xb80)
> [<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> ubi0: fixable bit-flip detected at PEB 2
> ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
> header at PEB 2
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 3:0, read only 64 bytes, retry
> ubi0: fixable bit-flip detected at PEB 3
> ubi0: fixable bit-flip detected at PEB 3
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 4:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 4:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 4:0, read only 64 bytes, retry
> ubi0: fixable bit-flip detected at PEB 4
> ubi0: fixable bit-flip detected at PEB 4
> ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
> header at PEB 4
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 5:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 5:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 5:0, read only 64 bytes, retry
> ubi0: fixable bit-flip detected at PEB 5
> ubi0: fixable bit-flip detected at PEB 5
> ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
> header at PEB 5
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 6:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 6:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 6:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 6:0, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
> (ubi_io_read_ec_hdr+0xa4/0x32c)
> [<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
> (scan_all.constprop.0+0x150/0xb80)
> [<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> ubi0: fixable bit-flip detected at PEB 6
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 7:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 7:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 7:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 7:0, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
> (ubi_io_read_ec_hdr+0xa4/0x32c)
> [<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
> (scan_all.constprop.0+0x150/0xb80)
> [<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> ubi0: fixable bit-flip detected at PEB 7
> ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
> header at PEB 7
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 8:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 8:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 8:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 8:0, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
> (ubi_io_read_ec_hdr+0xa4/0x32c)
> [<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
> (scan_all.constprop.0+0x150/0xb80)
> [<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 8:512, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 8:512, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 8:512, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 8:512, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0259200>] 
> (ubi_io_read_vid_hdr+0xac/0x32c)
> [<c0259200>] (ubi_io_read_vid_hdr) from [<c025f3d8>] 
> (scan_all.constprop.0+0x208/0xb80)
> [<c025f3d8>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> ubi0: fixable bit-flip detected at PEB 9
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 9:512, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 9:512, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 9:512, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 9:512, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0259200>] 
> (ubi_io_read_vid_hdr+0xac/0x32c)
> [<c0259200>] (ubi_io_read_vid_hdr) from [<c025f3d8>] 
> (scan_all.constprop.0+0x208/0xb80)
> [<c025f3d8>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 129024 
> bytes from PEB 9:2048, read only 129024 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 129024 
> bytes from PEB 9:2048, read only 129024 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 129024 
> bytes from PEB 9:2048, read only 129024 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 129024 
> bytes from PEB 9:2048, read 129024 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c025f468>] 
> (scan_all.constprop.0+0x298/0xb80)
> [<c025f468>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 10:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 10:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 10:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 10:0, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
> (ubi_io_read_ec_hdr+0xa4/0x32c)
> [<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
> (scan_all.constprop.0+0x150/0xb80)
> [<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 10:512, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 10:512, read only 64 bytes, retry
> ubi0: fixable bit-flip detected at PEB 10
> ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
> header at PEB 10
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 11:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 11:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 11:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 11:0, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
> (ubi_io_read_ec_hdr+0xa4/0x32c)
> [<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
> (scan_all.constprop.0+0x150/0xb80)
> [<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 11:512, read only 64 bytes, retry
> ubi0: fixable bit-flip detected at PEB 11
> ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
> header at PEB 11
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 12:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 12:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 12:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 12:0, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
> (ubi_io_read_ec_hdr+0xa4/0x32c)
> [<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
> (scan_all.constprop.0+0x150/0xb80)
> [<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> ubi0: fixable bit-flip detected at PEB 12
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 13:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 13:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 13:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 13:0, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
> (ubi_io_read_ec_hdr+0xa4/0x32c)
> [<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
> (scan_all.constprop.0+0x150/0xb80)
> [<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> ubi0: fixable bit-flip detected at PEB 13
> ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
> header at PEB 13
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 14:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 14:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 14:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 14:0, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
> (ubi_io_read_ec_hdr+0xa4/0x32c)
> [<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
> (scan_all.constprop.0+0x150/0xb80)
> [<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> ubi0: fixable bit-flip detected at PEB 14
> ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
> header at PEB 14
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 15:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 15:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 15:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 15:0, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
> (ubi_io_read_ec_hdr+0xa4/0x32c)
> [<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
> (scan_all.constprop.0+0x150/0xb80)
> [<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> ubi0: fixable bit-flip detected at PEB 15
> ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
> header at PEB 15
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 16:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 16:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 16:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 16:0, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
> (ubi_io_read_ec_hdr+0xa4/0x32c)
> [<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
> (scan_all.constprop.0+0x150/0xb80)
> [<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> ubi0: fixable bit-flip detected at PEB 16
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 17:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 17:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 17:0, read only 64 bytes, retry
> ubi0: fixable bit-flip detected at PEB 17
> ubi0: fixable bit-flip detected at PEB 17
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 18:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 18:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 18:0, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 18:0, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0258ecc>] 
> (ubi_io_read_ec_hdr+0xa4/0x32c)
> [<c0258ecc>] (ubi_io_read_ec_hdr) from [<c025f320>] 
> (scan_all.constprop.0+0x150/0xb80)
> [<c025f320>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 18:512, read only 64 bytes, retry
> ubi0: fixable bit-flip detected at PEB 18
> ubi0 warning: scan_all.constprop.0: valid VID header but corrupted EC 
> header at PEB 18
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 19:0, read only 64 bytes, retry
> ubi0: fixable bit-flip detected at PEB 19
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 19:512, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 19:512, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 19:512, read only 64 bytes, retry
> __nand_correct_data: uncorrectable ECC error
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes 
> from PEB 19:512, read 64 bytes
> CPU: 0 PID: 1 Comm: swapper Not tainted 4.13.0-rc2+ #13
> Hardware name: Atmel AT91SAM9
> [<c000f4b8>] (unwind_backtrace) from [<c000d5b4>] (show_stack+0x10/0x14)
> [<c000d5b4>] (show_stack) from [<c0258b4c>] (ubi_io_read+0x214/0x328)
> [<c0258b4c>] (ubi_io_read) from [<c0259200>] 
> (ubi_io_read_vid_hdr+0xac/0x32c)
> [<c0259200>] (ubi_io_read_vid_hdr) from [<c025f3d8>] 
> (scan_all.constprop.0+0x208/0xb80)
> [<c025f3d8>] (scan_all.constprop.0) from [<c0260084>] 
> (ubi_attach+0xa0/0x194)
> [<c0260084>] (ubi_attach) from [<c02524f8>] 
> (ubi_attach_mtd_dev+0x1f4/0x698)
> [<c02524f8>] (ubi_attach_mtd_dev) from [<c04d1384>] 
> (ubi_init+0x138/0x1d8)
> [<c04d1384>] (ubi_init) from [<c00096d8>] (do_one_initcall+0xa8/0x158)
> [<c00096d8>] (do_one_initcall) from [<c04b2cf4>] 
> (kernel_init_freeable+0x104/0x1c0)
> [<c04b2cf4>] (kernel_init_freeable) from [<c0356a94>] 
> (kernel_init+0x8/0xf0)
> [<c0356a94>] (kernel_init) from [<c000a290>] (ret_from_fork+0x14/0x24)
> __nand_correct_data: uncorrectable ECC error
> __nand_correct_data: uncorrectable ECC error
> __nand_correct_data: uncorrectable ECC error
> __nand_correct_data: uncorrectable ECC error
> __nand_correct_data: uncorrectable ECC error
> 
> […]
> 
> This goes on forever until I cut power, just interrupted by messages 
> like this every now and then:
> 
> ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 129024 
> bytes from PEB 19:2048, read only 129024 bytes, retry

Okay, first thing to test: revert f9ce2eddf176 ("mtd: nand: atmel: Add
->setup_data_interface() hooks"). You may have to revert other commits
to compile the driver.

If it works, I'd like you to drop SMC timings in both situations (with
and without this commit).

I'd also like to to dump NAND timings (those passed to
->setup_data_interface()).

Thanks,

Boris
Alexander Dahl July 26, 2017, 8:40 p.m. UTC | #3
Hei Boris,

On Wed, Jul 26, 2017 at 08:33:26PM +0200, Boris Brezillon wrote:
> If it works, I'd like you to drop SMC timings in both situations (with
> and without this commit).

What do you mean with drop? For other CS? How?

> I'd also like to to dump NAND timings (those passed to
> ->setup_data_interface()).

I'll see hat I can do tomorrow.

Greets
Alex
Boris Brezillon July 27, 2017, 7:27 p.m. UTC | #4
Le Wed, 26 Jul 2017 22:40:56 +0200,
Alexander Dahl <post@lespocky.de> a écrit :

> Hei Boris,
> 
> On Wed, Jul 26, 2017 at 08:33:26PM +0200, Boris Brezillon wrote:
> > If it works, I'd like you to drop SMC timings in both situations (with
> > and without this commit).  
> 
> What do you mean with drop? For other CS? How?

Sorry, I meant dump not drop.

> 
> > I'd also like to to dump NAND timings (those passed to  
> > ->setup_data_interface()).  
> 
> I'll see hat I can do tomorrow.

Did you have time to test with f9ce2eddf176 ("mtd: nand: atmel: Add
->setup_data_interface() hooks") reverted? BTW, it's probably simpler
to just comment out this line [1]

> 
> Greets
> Alex
> 

[1]http://elixir.free-electrons.com/linux/v4.13-rc2/source/drivers/mtd/nand/atmel/nand-controller.c#L1493
Alexander Dahl July 31, 2017, 6:13 a.m. UTC | #5
Hei hei,

Am Donnerstag, 27. Juli 2017, 21:27:03 schrieb Boris Brezillon:
> Did you have time to test with f9ce2eddf176 ("mtd: nand: atmel: Add
> ->setup_data_interface() hooks") reverted? BTW, it's probably simpler
> to just comment out this line [1]

This does not revert cleanly.

> [1]http://elixir.free-electrons.com/linux/v4.13-rc2/source/drivers/mtd
> /nand/atmel/nand-controller.c#L1493

I tried this in atmel_nand_init():

+       /*
        if (nc->mck && nc->caps->ops->setup_data_interface)
                chip->setup_data_interface = atmel_nand_setup_data_interface;
+       */

So this basically skips all those timing init, right? If I do this I get 
the timings which were applied in U-Boot and the NAND-Flash just works.

Greets
Alex
diff mbox

Patch

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 5fa5ddc94834..fc897f799def 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1125,7 +1125,9 @@  static int nand_setup_data_interface(struct nand_chip *chip, int chipnr)
         * Ensure the timing mode has been changed on the chip side
         * before changing timings on the controller side.
         */
-       if (chip->onfi_version) {
+       if (chip->onfi_version &&
+           (le16_to_cpu(chip->onfi_params.opt_cmd) &
+            ONFI_OPT_CMD_SET_GET_FEATURES)) {
                u8 tmode_param[ONFI_SUBFEATURE_PARAM_LEN] = {
                        chip->onfi_timing_mode_default,
                };