AnsweredAssumed Answered

ECC errors with Samsung NAND K9K8G08U0F on i.MX6UL

Question asked by Hector Palacios on May 11, 2017
Latest reply on May 15, 2017 by igorpadykov

Hello,

 

I'm evaluating 1 GiB Samsung NAND K9K8G08U0F on i.MX6UL under Linux kernel v4.1. This NAND does not support ONFI detection and has embedded ECC controller. The Linux driver assigns the following ECC layout (added debug info):

nand: Could not find valid JEDEC parameter page; aborting
nand: device found, Manufacturer ID: 0xec, Chip ID: 0xd3
nand: Samsung NAND 1GiB 3,3V 8-bit
nand: 1024 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
nand_scan_tail()
ecc->strength: 8
ecc->size: 512

I don't know the algorithm by which the driver determines this ECC layout (8-bit/512).

 

When mounting the UBIFS rootfs however, I get some -74 ECC read errors, followed by kernel traces:

ubi1: attaching mtd5
ubi1 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 1572:0, read only 64 bytes, retry
ubi1 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 1572:0, read only 64 bytes, retry
ubi1 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 1572:0, read only 64 bytes, retry
ubi1 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 1572:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.1.15-dey+gde5df57ac351 #1
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<80015a74>] (unwind_backtrace) from [<800125bc>] (show_stack+0x10/0x14)
[<800125bc>] (show_stack) from [<8064a248>] (dump_stack+0x74/0xb4)
[<8064a248>] (dump_stack) from [<803664a8>] (ubi_io_read+0x13c/0x314)
[<803664a8>] (ubi_io_read) from [<803668ac>] (ubi_io_read_ec_hdr+0x48/0x20c)
[<803668ac>] (ubi_io_read_ec_hdr) from [<8036b214>] (ubi_attach+0x150/0x13a8)
[<8036b214>] (ubi_attach) from [<80360c84>] (ubi_attach_mtd_dev+0x674/0xcd0)
[<80360c84>] (ubi_attach_mtd_dev) from [<808c7aa0>] (ubi_init+0x228/0x2b8)
[<808c7aa0>] (ubi_init) from [<80009698>] (do_one_initcall+0x8c/0x1d0)
[<80009698>] (do_one_initcall) from [<808a8dac>] (kernel_init_freeable+0x140/0x1d0)
[<808a8dac>] (kernel_init_freeable) from [<80647b50>] (kernel_init+0x8/0xe8)
[<80647b50>] (kernel_init) from [<8000f3a8>] (ret_from_fork+0x14/0x2c)
ubi1 warning: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from PEB 1572:2048, read only 2048 bytes, rety
ubi1 warning: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from PEB 1572:2048, read only 2048 bytes, rety
ubi1 warning: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from PEB 1572:2048, read only 2048 bytes, rety
ubi1 error: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from PEB 1572:2048, read 2048 bytes
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.1.15-dey+gde5df57ac351 #1
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<80015a74>] (unwind_backtrace) from [<800125bc>] (show_stack+0x10/0x14)
[<800125bc>] (show_stack) from [<8064a248>] (dump_stack+0x74/0xb4)
[<8064a248>] (dump_stack) from [<803664a8>] (ubi_io_read+0x13c/0x314)
[<803664a8>] (ubi_io_read) from [<80366abc>] (ubi_io_read_vid_hdr+0x4c/0x20c)
[<80366abc>] (ubi_io_read_vid_hdr) from [<8036b2d4>] (ubi_attach+0x210/0x13a8)
[<8036b2d4>] (ubi_attach) from [<80360c84>] (ubi_attach_mtd_dev+0x674/0xcd0)
[<80360c84>] (ubi_attach_mtd_dev) from [<808c7aa0>] (ubi_init+0x228/0x2b8)
[<808c7aa0>] (ubi_init) from [<80009698>] (do_one_initcall+0x8c/0x1d0)
[<80009698>] (do_one_initcall) from [<808a8dac>] (kernel_init_freeable+0x140/0x1d0)
[<808a8dac>] (kernel_init_freeable) from [<80647b50>] (kernel_init+0x8/0xe8)
[<80647b50>] (kernel_init) from [<8000f3a8>] (ret_from_fork+0x14/0x2c)
ubi1 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 1573:0, read only 64 bytes, retry
ubi1 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 1573:0, read only 64 bytes, retry
ubi1 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 1573:0, read only 64 bytes, retry
ubi1 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 1573:0, read 64 bytes
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.1.15-dey+gde5df57ac351 #1
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<80015a74>] (unwind_backtrace) from [<800125bc>] (show_stack+0x10/0x14)
[<800125bc>] (show_stack) from [<8064a248>] (dump_stack+0x74/0xb4)
[<8064a248>] (dump_stack) from [<803664a8>] (ubi_io_read+0x13c/0x314)
[<803664a8>] (ubi_io_read) from [<803668ac>] (ubi_io_read_ec_hdr+0x48/0x20c)
[<803668ac>] (ubi_io_read_ec_hdr) from [<8036b214>] (ubi_attach+0x150/0x13a8)
[<8036b214>] (ubi_attach) from [<80360c84>] (ubi_attach_mtd_dev+0x674/0xcd0)
[<80360c84>] (ubi_attach_mtd_dev) from [<808c7aa0>] (ubi_init+0x228/0x2b8)
[<808c7aa0>] (ubi_init) from [<80009698>] (do_one_initcall+0x8c/0x1d0)
[<80009698>] (do_one_initcall) from [<808a8dac>] (kernel_init_freeable+0x140/0x1d0)
[<808a8dac>] (kernel_init_freeable) from [<80647b50>] (kernel_init+0x8/0xe8)
[<80647b50>] (kernel_init) from [<8000f3a8>] (ret_from_fork+0x14/0x2c)
ubi1 warning: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from PEB 1573:2048, read only 2048 bytes, rety
ubi1 warning: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from PEB 1573:2048, read only 2048 bytes, rety
ubi1 warning: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from PEB 1573:2048, read only 2048 bytes, rety
ubi1 error: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from PEB 1573:2048, read 2048 bytes
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.1.15-dey+gde5df57ac351 #1
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<80015a74>] (unwind_backtrace) from [<800125bc>] (show_stack+0x10/0x14)
[<800125bc>] (show_stack) from [<8064a248>] (dump_stack+0x74/0xb4)
[<8064a248>] (dump_stack) from [<803664a8>] (ubi_io_read+0x13c/0x314)
[<803664a8>] (ubi_io_read) from [<80366abc>] (ubi_io_read_vid_hdr+0x4c/0x20c)
[<80366abc>] (ubi_io_read_vid_hdr) from [<8036b2d4>] (ubi_attach+0x210/0x13a8)
[<8036b2d4>] (ubi_attach) from [<80360c84>] (ubi_attach_mtd_dev+0x674/0xcd0)
[<80360c84>] (ubi_attach_mtd_dev) from [<808c7aa0>] (ubi_init+0x228/0x2b8)
[<808c7aa0>] (ubi_init) from [<80009698>] (do_one_initcall+0x8c/0x1d0)
[<80009698>] (do_one_initcall) from [<808a8dac>] (kernel_init_freeable+0x140/0x1d0)
[<808a8dac>] (kernel_init_freeable) from [<80647b50>] (kernel_init+0x8/0xe8)
[<80647b50>] (kernel_init) from [<8000f3a8>] (ret_from_fork+0x14/0x2c)
ubi1: scanning is finished
ubi1: attached mtd5 (name "rootfs", size 512 MiB)
ubi1: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi1: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi1: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi1: good PEBs: 4093, bad PEBs: 3, corrupted PEBs: 0
ubi1: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi1: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 1479565992
ubi1: available PEBs: 0, total reserved PEBs: 4093, PEBs reserved for bad PEB handling: 157
ubi1: background thread "ubi_bgt1d" started, PID 142
mca-cc6ul-rtc mca-cc6ul-rtc: setting system clock to 2017-05-10 10:36:17 UTC (1494412577)
ubi1 warning: do_sync_erase: error -5 while erasing PEB 3607, retry
ubi1 warning: do_sync_erase: error -5 while erasing PEB 3607, retry
VLDO4: disabling
ubi1 warning: do_sync_erase: error -5 while erasing PEB 3607, retry
VLDO3: disabling
usb_otg1_vbus: disabling
ALSA device list:
  #0: imx-max98088
ubi1 error: do_sync_erase: cannot erase PEB 3607, error -5
CPU: 0 PID: 142 Comm: ubi_bgt1d Not tainted 4.1.15-dey+gde5df57ac351 #1
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<80015a74>] (unwind_backtrace) from [<800125bc>] (show_stack+0x10/0x14)
[<800125bc>] (show_stack) from [<8064a248>] (dump_stack+0x74/0xb4)
[<8064a248>] (dump_stack) from [<803679a8>] (do_sync_erase+0x1b4/0x2a4)
[<803679a8>] (do_sync_erase) from [<80367c30>] (ubi_io_sync_erase+0x198/0x2d4)
[<80367c30>] (ubi_io_sync_erase) from [<8036879c>] (erase_worker+0xf0/0x68c)
[<8036879c>] (erase_worker) from [<80367ff0>] (do_work+0x90/0x110)
[<80367ff0>] (do_work) from [<80369bc0>] (ubi_thread+0x11c/0x1b4)
[<80369bc0>] (ubi_thread) from [<800441a8>] (kthread+0xdc/0xf4)
[<800441a8>] (kthread) from [<8000f3a8>] (ret_from_fork+0x14/0x2c)
ubi1 error: erase_worker: failed to erase PEB 3607, error -5
ubi1: mark PEB 3607 as bad
UBIFS (ubi1:0): background thread "ubifs_bgt1_0" started, PID 143
ubi1: 156 PEBs left in the reserve
ubi1 warning: do_sync_erase: error -5 while erasing PEB 3606, retry
ubi1 warning: do_sync_erase: error -5 while erasing PEB 3606, retry
ubi1 warning: do_sync_erase: error -5 while erasing PEB 3606, retry
UBIFS (ubi1:0): UBIFS: mounted UBI device 1, volume 0, name "rootfs"
ubi1 error: do_sync_erase: cannot erase PEB 3606, error -5
UBIFS (ubi1:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
CPU: 0 PID: 142 Comm: ubi_bgt1d Not tainted 4.1.15-dey+gde5df57ac351 #1
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<80015a74>] (unwind_backtrace) from [<800125bc>] (show_stack+0x10/0x14)
[<800125bc>] (show_stack) from [<8064a248>] (dump_stack+0x74/0xb4)
[<8064a248>] (dump_stack) from [<803679a8>] (do_sync_erase+0x1b4/0x2a4)
[<803679a8>] (do_sync_erase) from [<80367c30>] (ubi_io_sync_erase+0x198/0x2d4)
[<80367c30>] (ubi_io_sync_erase) from [<8036879c>] (erase_worker+0xf0/0x68c)
[<8036879c>] (erase_worker) from [<80367ff0>] (do_work+0x90/0x110)
[<80367ff0>] (do_work) from [<80369bc0>] (ubi_thread+0x11c/0x1b4)
[<80369bc0>] (ubi_thread) from [<800441a8>] (kthread+0xdc/0xf4)
[<800441a8>] (kthread) from [<8000f3a8>] (ret_from_fork+0x14/0x2c)
UBIFS (ubi1:0): FS size: 258523136 bytes (246 MiB, 2036 LEBs), journal size 9023488 bytes (8 MiB, 72 LEBs)
UBIFS (ubi1:0): reserved for root: 0 bytes (0 KiB)
UBIFS (ubi1:0): media format: w4/r0 (latest is w4/r0), UUID A2D8AC74-7598-42DC-BEBF-6FAB49324F43, small LPT model
ubi1 error: erase_worker: failed to erase PEB 3606, error -5
ubi1: mark PEB 3606 as bad
VFS: Mounted root (ubifs filesystem) on device 0:13.
devtmpfs: mounted
Freeing unused kernel memory: 320K (808a8000 - 808f8000)
ubi1: 155 PEBs left in the reserve
ubi1 warning: do_sync_erase: error -5 while erasing PEB 1573, retry
ubi1 warning: do_sync_erase: error -5 while erasing PEB 1573, retry
ubi1 warning: do_sync_erase: error -5 while erasing PEB 1573, retry
ubi1 error: do_sync_erase: cannot erase PEB 1573, error -5
CPU: 0 PID: 142 Comm: ubi_bgt1d Not tainted 4.1.15-dey+gde5df57ac351 #1
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<80015a74>] (unwind_backtrace) from [<800125bc>] (show_stack+0x10/0x14)
[<800125bc>] (show_stack) from [<8064a248>] (dump_stack+0x74/0xb4)
[<8064a248>] (dump_stack) from [<803679a8>] (do_sync_erase+0x1b4/0x2a4)
[<803679a8>] (do_sync_erase) from [<80367c30>] (ubi_io_sync_erase+0x198/0x2d4)
[<80367c30>] (ubi_io_sync_erase) from [<8036879c>] (erase_worker+0xf0/0x68c)
[<8036879c>] (erase_worker) from [<80367ff0>] (do_work+0x90/0x110)
[<80367ff0>] (do_work) from [<80369bc0>] (ubi_thread+0x11c/0x1b4)
[<80369bc0>] (ubi_thread) from [<800441a8>] (kthread+0xdc/0xf4)
[<800441a8>] (kthread) from [<8000f3a8>] (ret_from_fork+0x14/0x2c)
ubi1 error: erase_worker: failed to erase PEB 1573, error -5
ubi1: mark PEB 1573 as bad
ubi1: 154 PEBs left in the reserve
ubi1 warning: do_sync_erase: error -5 while erasing PEB 1572, retry
ubi1 warning: do_sync_erase: error -5 while erasing PEB 1572, retry
ubi1 warning: do_sync_erase: error -5 while erasing PEB 1572, retry
ubi1 error: do_sync_erase: cannot erase PEB 1572, error -5
CPU: 0 PID: 142 Comm: ubi_bgt1d Not tainted 4.1.15-dey+gde5df57ac351 #1
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<80015a74>] (unwind_backtrace) from [<800125bc>] (show_stack+0x10/0x14)
[<800125bc>] (show_stack) from [<8064a248>] (dump_stack+0x74/0xb4)
[<8064a248>] (dump_stack) from [<803679a8>] (do_sync_erase+0x1b4/0x2a4)
[<803679a8>] (do_sync_erase) from [<80367c30>] (ubi_io_sync_erase+0x198/0x2d4)
[<80367c30>] (ubi_io_sync_erase) from [<8036879c>] (erase_worker+0xf0/0x68c)
[<8036879c>] (erase_worker) from [<80367ff0>] (do_work+0x90/0x110)
[<80367ff0>] (do_work) from [<80369bc0>] (ubi_thread+0x11c/0x1b4)
[<80369bc0>] (ubi_thread) from [<800441a8>] (kthread+0xdc/0xf4)
[<800441a8>] (kthread) from [<8000f3a8>] (ret_from_fork+0x14/0x2c)
ubi1 error: erase_worker: failed to erase PEB 1572, error -5
ubi1: mark PEB 1572 as bad
ubi1: 153 PEBs left in the reserve

 

I get the exact same errors on different platforms programmed with the same image, so I assume it's not a physical error but a problem with the writing of the image. I tried programming the image both from U-Boot (using the 8-bit/512 ECC layout) as well as from Linux, but the errors persist.

 

I also ran the kernel mtd tests but they are not passing correctly:

~# insmod /mtd_nandbiterrs.ko dev=6
mtd_nandbiterrs: error: read failed at 0x0
mtd_nandbiterrs: After 0 biterrors per subpage, read reported error -74
insmod: can't insert '/mtd_nandbiterrs.ko': Input/output error

U-Boot seems to be working fine with this ECC layout (8-bit/512) but for some reason the iMX NAND driver seems to fail with it.

 

Is anybody using this NAND successfully? Any hint is appreciated.

Thanks,

--

Héctor Palacios

 

+CC Fabio Estevam Luis Casado

Outcomes