IMX7D NAND ECC error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX7D NAND ECC error

1,743 Views
hyoungkikim
Contributor III

hi   

on  MCIMX7D SABRE board.  to use NAND , i reworked the board with Macronix MX30LF4G28AC

kernel is 5.4.2 and U-boot is 2020.04

kernel config  is imx_v6_v7_defconfig ,  wiht imx7d-sdb-gpmi-weim.dtb , i just added nand-ecc-mode="hw" n and  fsl,use-mininum-ecc

a board booted well and i can see messages which show nand  (see below)

but in linux  when i mount nand with jffs or ubi   i got ecc error

i don't know the Error cause is sw or hw issue ,

any idea and advice will be of great help

thank you in advance ,

 

1) on mounting  jffs2

mount -t jffs2 /dev/mtdblock2 /mnt  and copy some data ,i got ecc error

[  244.169534] jffs2: notice: (291) jffs2_get_inode_nodes: Node header CRC failed at 0x11cc20. {655a,ca3a,b4db27fc,afbcb3ed}

[  244.249511] jffs2: mtd->read(0x320 bytes from 0x11fce0) returned ECC error

[  244.249541] jffs2: notice: (291) jffs2_get_inode_nodes: Node header CRC failed at 0x11fce0. {3a84,023e,249e0aee,81482350}

[  244.329488] jffs2: mtd->read(0x184 bytes from 0xf2e7c) returned ECC error

[  244.329518] jffs2: notice: (291) jffs2_get_inode_nodes: Node header CRC failed at 0x0f2e7c. {ec8d,815f,4fe6e50f,b00bf645}

[  244.399514] jffs2: mtd->read(0x6a0 bytes from 0xfa160) returned ECC error

[  244.399542] jffs2: notice: (291) jffs2_get_inode_nodes: Node header CRC failed at 0x0fa160. {0f08,25fa,115ee681,e1446179}

root@192:~#

 

2)  on mount ubi, i got below kernel message

i just use ubiformat /ubiattach/mount .

[  291.254076] ubi0: background thread "ubi_bgt0d" started, PID 298

[  314.548421] ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 2:4096, read only 4096 bytes, retry

[  314.549722] UBIFS (ubi0:0): Mounting in unauthenticated mode

[  314.551010] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 302

[  314.594967] UBIFS error (ubi0:0 pid 300): ubifs_read_node: bad node type (255 but expected 9)

[  314.594999] UBIFS error (ubi0:0 pid 300): ubifs_read_node: bad node at LEB 12:264, LEB mapping status 0

[  314.595017] Not a node, first 24 bytes:

[  314.595032] 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff                          ........................

[  314.595056] CPU: 0 PID: 300 Comm: mount Not tainted 5.4.161-39915-g0021a0c8a58f-dirty #18

[  314.595071] Hardware name: Freescale i.MX7 Dual (Device Tree)

[  314.595107] [<c01122a0>] (unwind_backtrace) from [<c010cbc8>] (show_stack+0x10/0x14)

[  314.595133] [<c010cbc8>] (show_stack) from [<c0def3c4>] (dump_stack+0xd0/0x104)

[  314.595159] [<c0def3c4>] (dump_stack) from [<c04664c8>] (ubifs_read_node+0x228/0x260)

[  314.595187] [<c04664c8>] (ubifs_read_node) from [<c046f6ac>] (dbg_old_index_check_init+0x64/0x94)

[  314.595213] [<c046f6ac>] (dbg_old_index_check_init) from [<c0462b24>] (ubifs_mount+0xf98/0x15ec)

[  314.595241] [<c0462b24>] (ubifs_mount) from [<c02e7670>] (legacy_get_tree+0x24/0x4c)

[  314.595268] [<c02e7670>] (legacy_get_tree) from [<c02a778c>] (vfs_get_tree+0x24/0xe8)

[  314.595293] [<c02a778c>] (vfs_get_tree) from [<c02d1b28>] (do_mount+0x8a8/0xbcc)

[  314.595316] [<c02d1b28>] (do_mount) from [<c02d2260>] (ksys_mount+0x88/0xb4)

[  314.595339] [<c02d2260>] (ksys_mount) from [<c0101000>] (ret_fast_syscall+0x0/0x28)

[  314.595355] Exception stack(0xd842ffa8 to 0xd842fff0)

[  314.595376] ffa0:                   00000000 b6eed90c 01049318 01049328 01049308 00000000

[  314.595398] ffc0: 00000000 b6eed90c b6eee114 00000015 01049318 01049308 01049258 00000000

[  314.595415] ffe0: b6eedfc4 beb68a18 b6ebe833 b6e49c7a

 

kernel boot message

[ 2.835671] imx ahci driver is registered.
[ 2.851340] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xdc
[ 2.857722] nand: Macronix MX30LF4G28AC
[ 2.861691] nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 112
[ 2.873112] Bad block table not found for chip 0
[ 2.878023] Bad block table found at page 262016, version 0x01
[ 2.884215] nand_read_bbt: bad block at 0x0000011e0000
[ 2.889468] nand_read_bbt: bad block at 0x00000b0a0000
[ 2.894638] nand_read_bbt: bad block at 0x000015a60000
[ 2.901535] Bad block table written to 0x00001ffe0000, version 0x01

 

Labels (3)
0 Kudos
9 Replies

1,708 Views
hyoungkikim
Contributor III

Hi  Sanket_Parehk

i tried images from L5.15.52-2.1.0_image_IMX6uL7D 

but  the result is the same ,

with kobj-ng i wrote u-boot to nand and    i store kernel and dtb by nand write cmd, and read back, and boot a borad with no problem

a strange things is  from u-boot  OOBSIZE is 112 byte ,but linux booting message showed OOBSIZE is 64 

and kernel couldn't find onfi nand 

i have no clue  it is about HW or SW  ...

 

1  . from U-boot.

Normal Boot
Hit any key to stop autoboot: 0
=> nand info

Device 0: nand0, sector size 128 KiB
Page size 2048 b
OOB size 112 b
Erase size 131072 b
subpagesize 2048 b
options 0x40004200
bbt options 0x00068000
=>

2. booting message

[ 1.251221] imx ahci driver is registered.
[ 1.260274] Could not find a valid ONFI parameter page, trying bit-wise majority to recover it
[ 1.269039] ONFI parameter recovery failed, aborting
[ 1.274050] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xdc
[ 1.280433] nand: Macronix NAND 512MiB 3,3V 8-bit
[ 1.285158] nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[ 1.293187] Block protection check failed
[ 1.297879] Bad block table found at page 262080, version 0x01
[ 1.304180] Bad block table found at page 262016, version 0x01
[ 1.310208] nand_read_bbt: bad block at 0x0000011e0000
[ 1.315385] nand_read_bbt: bad block at 0x00000b0a0000
[ 1.320540] nand_read_bbt: bad block at 0x000015a60000
[ 1.325842] 5 cmdlinepart partitions found on MTD device gpmi-nand

0 Kudos

1,706 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @hyoungkikim 

Can you please try to perform the same experiment with Linux versions imx-4.14.98/imx-4.1.15?

Thanks & Regards

Sanket Parekh

0 Kudos

1,698 Views
hyoungkikim
Contributor III

Hi  SanKet_Parekh

i tested with L4.14.78_1_0_0_ga_image_MX7DSABRESD image

i worked , there is a message  of "  gpmi-nand 33002000.gpmi-nand: mode:5 ,failed in set feature."

but i mounted  a nand partition with ubifs 

and i found that in L5.15 Kernel , when  in   nand_onfi_detect  function nand_read_param_page_op  return  data  which  the first 190 bytes are "FF"s and got valid data. ,  but  in  u-boot, it read valid page data ,

thank you  for your interest 

[ 1.246169] input: fxas2100x as /devices/soc0/soc/30800000.aips-bus/30a30000.i2c/i2c-1/1-0020/input/input1
[ 1.261442] fxas2100x 1-0020: fxas2100x device driver probe successfully
[ 1.275288] random: fast init done
[ 1.281192] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xdc
[ 1.287577] nand: Macronix MX30LF4G28AC
[ 1.291422] nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 112
[ 1.299445] gpmi-nand 33002000.gpmi-nand: mode:5 ,failed in set feature.
[ 1.306478] Bad block table found at page 262080, version 0x01
[ 1.312745] Bad block table found at page 262016, version 0x01
[ 1.318948] nand_read_bbt: bad block at 0x0000011e0000
[ 1.324118] nand_read_bbt: bad block at 0x00000b0a0000
[ 1.329314] nand_read_bbt: bad block at 0x000015a60000
[ 1.334786] 5 cmdlinepart partitions found on MTD device gpmi-nand
[ 1.340998] Creating 5 MTD partitions on "gpmi-nand":
[ 1.346081] 0x000000000000-0x000000080000 : "mx7-bcb"
[ 1.352048] 0x000000080000-0x000000200000 : "u-boot1"
[ 1.357942] 0x000000200000-0x000000380000 : "u-boot2"
[ 1.363794] 0x000000380000-0x000000400000 : "u-boot-env"
[ 1.369926] 0x000000400000-0x000020000000 : "ubi"

0 Kudos

1,719 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @hyoungkikim 

I hope you are doing well.

It seems Macronix MX30LF4G28AC NAND chip driver in new kernel is differ than in old one in point of ECC calculation.
So you need to re-format NAND structure with kobs-ng.

Alternatively you can try to compile the driver from old kernel in new one.

Thanks & Regards

Sanket Parekh

0 Kudos

1,711 Views
hyoungkikim
Contributor III

hi Sanket_Parekh

i downloaded LF_V5..15.42-2.1.0.image_IMX6UL7D

and  updated to u-boot-imx7dsabresd_nand.imx 

it booted well. and i download kernel and dtb , write to nand flash, and read back, 

successfully booted with that image 

but  the result is the same , i couldn't  use nand on linux

i have another questions

 on u-boot  OOBSIZE is 112 byte but kernel booting message shows oobsize is 64 byte

and there is a message about ONFI parameter fail

i am cofused it is a problem with hw or sw 

thank you 

1) 

Hit any key to stop autoboot: 0
=> nand info

Device 0: nand0, sector size 128 KiB
Page size 2048 b
OOB size 112 b
Erase size 131072 b
subpagesize 2048 b
options 0x40004200
bbt options 0x00068000
=>

2) kernel booting message

[ 1.251221] imx ahci driver is registered.
[ 1.260274] Could not find a valid ONFI parameter page, trying bit-wise majority to recover it
[ 1.269039] ONFI parameter recovery failed, aborting
[ 1.274050] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xdc
[ 1.280433] nand: Macronix NAND 512MiB 3,3V 8-bit
[ 1.285158] nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[ 1.293187] Block protection check failed
[ 1.297879] Bad block table found at page 262080, version 0x01
[ 1.304180] Bad block table found at page 262016, version 0x01
[ 1.310208] nand_read_bbt: bad block at 0x0000011e0000
[ 1.315385] nand_read_bbt: bad block at 0x00000b0a0000
[ 1.320540] nand_read_bbt: bad block at 0x000015a60000
[ 1.325842] 5 cmdlinepart partitions found on MTD device gpmi-nand
[ 1.332032] Creating 5 MTD partitions on "gpmi-nand":
[ 1.337116] 0x000000000000-0x000004000000 : "nandboot"

 

0 Kudos

1,686 Views
kef2
Senior Contributor IV

Comparing gpmi-nand.c from 5.15 and 5.4 I noticed removed gpmi_copy_bits() routine. Call to it got replaced with nand_extract_bits() calls with same arguments set. Looks like routines aren't doing the same work. Restoring gpmi_copy_bits and call to it seems fixing all problems.

Edward

0 Kudos

1,685 Views
kef2
Senior Contributor IV
Changes to bysy_timeout_cycles further make NAND unreadable:

busy_timeout_ps = max(sdr->tBERS_max, sdr->tPROG_max);
busy_timeout_cycles = TO_CYCLES(busy_timeout_ps, period_ps);

Older code works OK:
busy_timeout_cycles = TO_CYCLES(sdr->tWB_max + sdr->tR_max, period_ps);
0 Kudos

1,657 Views
hyoungkikim
Contributor III

Hi kef2

i recompiled a kernel and  it worked  

thank you  

0 Kudos

1,671 Views
hyoungkikim
Contributor III

hi kef2 

i tested as you adviced but it didn't work

the kernel ( L4.14) worked well on  a NADN Flash but  a kernel (5.x.x) doesn't work which reads ID sucessfully but when  reading parameter pages , it  got  190byte dummy 0xFF data before valid data

thank you

0 Kudos