This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ECC error during mounting UBIFS volume

Other Parts Discussed in Thread: OMAP-L138, OMAPL138

Hello all!

I work with development board LCDK OMAP-L138. I have some problems with UBIFS on NAND device.

I use Linux kernel 3.3.0 from MCSDK OMAPL138 (processors.wiki.ti.com/.../MCSDK_OMAPL138_User_Guide_Chapter_Tools).

Kernel and rootfs image was built with Buildroot-2014.05 and GCC 4.4.7.

I change following parameters in Linux build configuration file (turn on NAND, MTD, UBIFS and turn off MMC):

MTD [=y];

MTD_NAND [=y];

MTD_NAND_DAVINCI [=y];

MTD_NAND_ECC_BCH [=y];

MTD_NAND_ECC_SMC [=y];

UBIFS_FS [=y];

MTD_UBI [=y];

Linux starts fine and founds MTD partitions.

I try to make UBIFS volume and mount it:

# mtdinfo /dev/mtd3

mtd3

Name: filesystem

Type: nand

Eraseblock size: 131072 bytes, 128.0 KiB

Amount of eraseblocks: 4075 (534118400 bytes, 509.4 MiB)

Minimum input/output unit size: 2048 bytes

Sub-page size: 512 bytes

OOB size: 64 bytes

Character device major/minor: 90:6

Bad blocks are allowed: true

Device is writable: true

#

# ubiformat /dev/mtd3 -s 512 -O 2048

ubiformat: mtd3 (nand), size 534118400 bytes (509.4 MiB), 4075 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes

libscan: scanning eraseblock 4074 -- 100 % complete

ubiformat: 4071 eraseblocks have valid erase counter, mean value is 0

ubiformat: 4 bad eraseblocks found, numbers: 4071, 4072, 4073, 4074

ubiformat: formatting eraseblock 4074 -- 100 % complete

#

# ubiattach /dev/ubi_ctrl -m 3 -O 2048

UBI: attaching mtd3 to ubi0

UBI: physical eraseblock size: 131072 bytes (128 KiB)

UBI: logical eraseblock size: 126976 bytes

UBI: smallest flash I/O unit: 2048

UBI: sub-page size: 512

UBI: VID header offset: 2048 (aligned 2048)

UBI: data offset: 4096

UBI: max. sequence number: 0

UBI error: ubi_io_read: error -74 (ECC error) while reading 22528 bytes from PEB 0:4096, read 22528 bytes

[<c000d798>] (unwind_backtrace+0x0/0xf4) from [<c01d2e68>] (ubi_io_read+0x150/0x2a4)

[<c01d2e68>] (ubi_io_read+0x150/0x2a4) from [<c01c8cb4>] (ubi_read_volume_table+0x110/0xa80)

[<c01c8cb4>] (ubi_read_volume_table+0x110/0xa80) from [<c01ccd60>] (ubi_attach_mtd_dev+0x678/0xd60)

[<c01ccd60>] (ubi_attach_mtd_dev+0x678/0xd60) from [<c01cd5cc>] (ctrl_cdev_ioctl+0xec/0x168)

[<c01cd5cc>] (ctrl_cdev_ioctl+0xec/0x168) from [<c00932e8>] (do_vfs_ioctl+0x7c/0x5dc)

[<c00932e8>] (do_vfs_ioctl+0x7c/0x5dc) from [<c0093880>] (sys_ioctl+0x38/0x60)

[<c0093880>] (sys_ioctl+0x38/0x60) from [<c0009420>] (ret_fast_syscall+0x0/0x2c)

UBI error: ubi_io_read: error -74 (ECC error) while reading 22528 bytes from PEB 1:4096, read 22528 bytes

[<c000d798>] (unwind_backtrace+0x0/0xf4) from [<c01d2e68>] (ubi_io_read+0x150/0x2a4)

[<c01d2e68>] (ubi_io_read+0x150/0x2a4) from [<c01c8cb4>] (ubi_read_volume_table+0x110/0xa80)

[<c01c8cb4>] (ubi_read_volume_table+0x110/0xa80) from [<c01ccd60>] (ubi_attach_mtd_dev+0x678/0xd60)

[<c01ccd60>] (ubi_attach_mtd_dev+0x678/0xd60) from [<c01cd5cc>] (ctrl_cdev_ioctl+0xec/0x168)

[<c01cd5cc>] (ctrl_cdev_ioctl+0xec/0x168) from [<c00932e8>] (do_vfs_ioctl+0x7c/0x5dc)

[<c00932e8>] (do_vfs_ioctl+0x7c/0x5dc) from [<c0093880>] (sys_ioctl+0x38/0x60)

[<c0093880>] (sys_ioctl+0x38/0x60) from [<c0009420>] (ret_fast_syscall+0x0/0x2c)

UBI error: vtbl_check: bad CRC at record 11: 0x315afa8e, not 0xffffffff

UBI error: vtbl_check: bad CRC at record 11: 0x315afa8e, not 0xffffffff

UBI error: process_lvol: both volume tables are corrupted

UBI error: ubi_attach_mtd_dev: failed to attach by scanning, error -22

ubiattach: error!: cannot attach mtd3

error 22 (Invalid argument)

#



I try another method after Linux rebooting:

# flash_erase /dev/mtd3 0 0

Erasing 128 Kibyte @ 1fcc0000 -- 99 % complete flash_erase: Skipping bad block at 1fce0000

flash_erase: Skipping bad block at 1fd00000

flash_erase: Skipping bad block at 1fd20000

flash_erase: Skipping bad block at 1fd40000

Erasing 128 Kibyte @ 1fd40000 -- 100 % complete

#

# ubiattach /dev/ubi_ctrl -m 3 -O 2048

UBI: attaching mtd3 to ubi0

UBI: physical eraseblock size: 131072 bytes (128 KiB)

UBI: logical eraseblock size: 126976 bytes

UBI: smallest flash I/O unit: 2048

UBI: sub-page size: 512

UBI: VID header offset: 2048 (aligned 2048)

UBI: data offset: 4096

UBI: empty MTD device detected

UBI: max. sequence number: 0

UBI: create volume table (copy #1)

UBI: create volume table (copy #2)

UBI: attached mtd3 to ubi0

UBI: MTD device name: "filesystem"

UBI: MTD device size: 509 MiB

UBI: number of good PEBs: 4071

UBI: number of bad PEBs: 4

UBI: number of corrupted PEBs: 0

UBI: max. allowed volumes: 128

UBI: wear-leveling threshold: 4096

UBI: number of internal volumes: 1

UBI: number of user volumes: 0

UBI: available PEBs: 4027

UBI: total number of reserved PEBs: 44

UBI: number of PEBs reserved for bad PEB handling: 40

UBI: max/mean erase counter: 0/0

UBI: image sequence number: 358316078

UBI: background thread "ubi_bgt0d" started, PID 919

UBI device number 0, total 4071 LEBs (516919296 bytes, 493.0 MiB), available 4027 LEBs (511332352 bytes, 487.6 MiB), LEB size 126976 bytes (124.0 KiB)

#

# ubimkvol /dev/ubi0 -N rootfs -s 20MiB

Volume ID 0, size 166 LEBs (21078016 bytes, 20.1 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs", alignment 1

#

# mkdir /mnt/nand

# mount -t ubifs ubi0:rootfs /mnt/nand

UBIFS: default file-system created

UBI error: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 4070:4096, read 4096 bytes

[<c000d798>] (unwind_backtrace+0x0/0xf4) from [<c01d2e68>] (ubi_io_read+0x150/0x2a4)

[<c01d2e68>] (ubi_io_read+0x150/0x2a4) from [<c01d1ae4>] (ubi_eba_read_leb+0xa4/0x3fc)

[<c01d1ae4>] (ubi_eba_read_leb+0xa4/0x3fc) from [<c01cf4d4>] (ubi_leb_read+0xdc/0x130)

[<c01cf4d4>] (ubi_leb_read+0xdc/0x130) from [<c012cd6c>] (ubifs_leb_read+0x24/0x88)

[<c012cd6c>] (ubifs_leb_read+0x24/0x88) from [<c012ce68>] (ubifs_read_node+0x98/0x2a0)

[<c012ce68>] (ubifs_read_node+0x98/0x2a0) from [<c0129478>] (ubifs_read_sb_node+0x54/0x78)

[<c0129478>] (ubifs_read_sb_node+0x54/0x78) from [<c012a438>] (ubifs_read_superblock+0xc40/0x15c0)

[<c012a438>] (ubifs_read_superblock+0xc40/0x15c0) from [<c01279a0>] (ubifs_fill_super+0x49c/0x1824)

[<c01279a0>] (ubifs_fill_super+0x49c/0x1824) from [<c0128fbc>] (ubifs_mount+0x294/0x4f0)

[<c0128fbc>] (ubifs_mount+0x294/0x4f0) from [<c00850b8>] (mount_fs+0x14/0xd4)

[<c00850b8>] (mount_fs+0x14/0xd4) from [<c00a090c>] (vfs_kern_mount+0x50/0xc4)

[<c00a090c>] (vfs_kern_mount+0x50/0xc4) from [<c00a09c4>] (do_kern_mount+0x34/0xcc)

[<c00a09c4>] (do_kern_mount+0x34/0xcc) from [<c00a0ba8>] (do_mount+0x14c/0x754)

[<c00a0ba8>] (do_mount+0x14c/0x754) from [<c00a1234>] (sys_mount+0x84/0xc4)

[<c00a1234>] (sys_mount+0x84/0xc4) from [<c0009420>] (ret_fast_syscall+0x0/0x2c)

UBIFS error (pid 923): ubifs_read_node: bad node type (255 but expected 6)

UBIFS error (pid 923): ubifs_read_node: bad node at LEB 0:0, LEB mapping status 1

[<c000d798>] (unwind_backtrace+0x0/0xf4) from [<c012cff8>] (ubifs_read_node+0x228/0x2a0)

[<c012cff8>] (ubifs_read_node+0x228/0x2a0) from [<c0129478>] (ubifs_read_sb_node+0x54/0x78)

[<c0129478>] (ubifs_read_sb_node+0x54/0x78) from [<c012a438>] (ubifs_read_superblock+0xc40/0x15c0)

[<c012a438>] (ubifs_read_superblock+0xc40/0x15c0) from [<c01279a0>] (ubifs_fill_super+0x49c/0x1824)

[<c01279a0>] (ubifs_fill_super+0x49c/0x1824) from [<c0128fbc>] (ubifs_mount+0x294/0x4f0)

[<c0128fbc>] (ubifs_mount+0x294/0x4f0) from [<c00850b8>] (mount_fs+0x14/0xd4)

[<c00850b8>] (mount_fs+0x14/0xd4) from [<c00a090c>] (vfs_kern_mount+0x50/0xc4)

[<c00a090c>] (vfs_kern_mount+0x50/0xc4) from [<c00a09c4>] (do_kern_mount+0x34/0xcc)

[<c00a09c4>] (do_kern_mount+0x34/0xcc) from [<c00a0ba8>] (do_mount+0x14c/0x754)

[<c00a0ba8>] (do_mount+0x14c/0x754) from [<c00a1234>] (sys_mount+0x84/0xc4)

[<c00a1234>] (sys_mount+0x84/0xc4) from [<c0009420>] (ret_fast_syscall+0x0/0x2c)

mount: mounting ubi0:rootfs on /mnt/nand failed: Invalid argument

Does Linux NAND driver for DaVinci compatible device supports ECC properly?

Thanks in advance.

7875.Linux_boot_log.txt
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
NAND: 512 MiB
MMC: davinci: 0
Bad block table found at page 262080, version 0x01
Bad block table found at page 262016, version 0x01
In: serial
Out: serial
Err: serial
Net: DaVinci-EMAC
Hit any key to stop autoboot: 0
Using DaVinci-EMAC device
TFTP from server 192.168.0.115; our IP address is 192.168.0.21
Filename 'rootfs.ext2.gz'.
Load address: 0xc4000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
###########################
done
Bytes transferred = 6119761 (5d6151 hex)
Using DaVinci-EMAC device
TFTP from server 192.168.0.115; our IP address is 192.168.0.21
Filename 'uImage'.
Load address: 0xc0700000
Loading: #################################################################
###############################
done
Bytes transferred = 1395888 (154cb0 hex)
## Booting kernel from Legacy Image at c0700000 ...
Image Name: Linux-3.3.0
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1395824 Bytes = 1.3 MiB
Load Address: c0008000
Entry Point: c0008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0
Linux version 3.3.0 (ubu@ub) (gcc version 4.4.7 (Buildroot 2014.05) ) #16 PREEMPT Wed May 20 14:53:14 MSK 2015
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: AM18x/OMAP-L138 lcdk board
Memory policy: ECC disabled, Data cache writeback
BUG: mapping for 0x80000000 at 0xfffe0000 out of vmalloc space
DaVinci da850/omap-l138/am18x variant 0x1
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 24320
Kernel command line: console=ttyS2,115200n8 root=/dev/ram0 rw mem=32M@0xc0000000 mem=64M@0xc4000000 initrd=0xc4000000,32M
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 32MB 64MB = 96MB total
Memory: 60916k/60916k available, 37388k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xc8800000 - 0xff000000 ( 872 MB)
lowmem : 0xc0000000 - 0xc8000000 ( 128 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc0346200 (3321 kB)
.init : 0xc0347000 - 0xc0368000 ( 132 kB)
.data : 0xc0368000 - 0xc03887a0 ( 130 kB)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 

0876.Linux_config.txt
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 3.3.0 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_KTIME_SCALAR=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_ARCH_HAS_CPUFREQ=y
CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ZONE_DMA=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_VECTORS_BASE=0xffff0000
CONFIG_ARM_PATCH_PHYS_VIRT=y
CONFIG_GENERIC_BUG=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_HAVE_IRQ_WORK=y
#
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_LZO=y
# CONFIG_KERNEL_GZIP is not set
CONFIG_KERNEL_LZMA=y
# CONFIG_KERNEL_LZO is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
# CONFIG_BSD_PROCESS_ACCT is not set
# CONFIG_FHANDLE is not set
# CONFIG_TASKSTATS is not set
# CONFIG_AUDIT is not set
CONFIG_HAVE_GENERIC_HARDIRQS=y
#
# IRQ subsystem
#
CONFIG_GENERIC_HARDIRQS=y
CONFIG_HAVE_SPARSE_IRQ=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_CHIP=y
# CONFIG_SPARSE_IRQ is not set
#
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Could you please attach the ECC error log.
    Try to boot the board with NFS then try to mount UBIFS partition in linux.
  • Console output is under spoiler.

    ubiattach in first case and mount in second case failed with "UBI error: ubi_io_read: error -74 (ECC error)".

    Have I to send you an extended ECC error log? How can I get it?

    Why NFS? I boot the board via TFTP for debugging purpose.

  • Hi Artem,

    Please refer to the following TI wiki page.

    processors.wiki.ti.com/.../UBIFS_Support

    I suspect that it could be problme on UBI file creating, you have to create with correct PEB calculation.

    free-electrons.com/.../creating-flashing-ubi-ubifs-images

    Regards,
    Shankari.
  • Thanks for your answers. I have tried commands from TI wiki but the problem is not resolved.

    Commands from TI wiki page (or ):

    ubiformat /dev/mtd3 -s 512 -O 2048

    ubiattach /dev/ubi_ctrl -m 3 -O 2048

    fails with UBI error -74 (ECC error). Error log in first post.

    An another method from e2e forum:

    flash_erase /dev/mtd3 0 0

    ubiattach /dev/ubi_ctrl -m 3 -O 2048

    ubimkvol /dev/ubi0 -N rootfs -s 20MiB

    mkdir /mnt/nand

    mount -t ubifs ubi0:rootfs /mnt/nand

    These commands raise similar ECC error. Error log in first post.

    Thanks in advance.

  • mtdinfo says:

    # mtdinfo /dev/mtd3
    mtd3
    Name:                           filesystem
    Type:                           nand
    Eraseblock size:                131072 bytes, 128.0 KiB
    Amount of eraseblocks:          4075 (534118400 bytes, 509.4 MiB)
    Minimum input/output unit size: 2048 bytes
    Sub-page size:                  512 bytes
    OOB size:                       64 bytes
    Character device major/minor:   90:6
    Bad blocks are allowed:         true
    Device is writable:             true



    ubi and ubifs images creating

    mkfs.ubifs -q -r root-fs -m 2048 -e 131072 -c 4075 -o ubifs.img
    ubinize -o ubi.img -m 2048 -p 128KiB -s 512 ubinize.cfg

    ubinize.cfg:
    [ubifs]
    mode=ubi
    image=ubifs.img
    vol_id=0
    vol_size=450MiB
    vol_type=dynamic
    vol_name=rootfs
    vol_alignment=1
    vol_flags=autoresize


    Then

    ubiformat /dev/mtd3 ubi.img
    ubiattach /dev/ubi_ctrl -m 3 -O 2048

    Console output:

    # ubiformat /dev/mtd3 -f ubi.img
    ubiformat: mtd3 (nand), size 534118400 bytes (509.4 MiB), 4075 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
    libscan: scanning eraseblock 4074 -- 100 % complete
    ubiformat: 4071 eraseblocks have valid erase counter, mean value is 8
    ubiformat: 4 bad eraseblocks found, numbers: 4071, 4072, 4073, 4074
    ubiformat: warning!: VID header and data offsets on flash are 2048 and 4096, which is different to requested offsets 512 and 2048
    ubiformat: use new offsets 512 and 2048? ubiformat: continue? (y/N) y
    ubiformat: use offsets 512 and 2048
    ubiformat: flashing eraseblock 16 -- 100 % complete
    ubiformat: formatting eraseblock 4074 -- 100 % complete
    # ubiattach /dev/ubi_ctrl -m 3 -O 2048
    UBI: attaching mtd3 to ubi0
    UBI: physical eraseblock size:   131072 bytes (128 KiB)
    UBI: logical eraseblock size:    126976 bytes
    UBI: smallest flash I/O unit:    2048
    UBI: sub-page size:              512
    UBI: VID header offset:          2048 (aligned 2048)
    UBI: data offset:                4096
    UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 13:2048, read 512 bytes
    [<c000d798>] (unwind_backtrace+0x0/0xf4) from [<c01d2e68>] (ubi_io_read+0x150/0x2a4)
    [<c01d2e68>] (ubi_io_read+0x150/0x2a4) from [<c01d3128>] (ubi_io_read_vid_hdr+0x48/0x238)
    [<c01d3128>] (ubi_io_read_vid_hdr+0x48/0x238) from [<c01d7514>] (process_eb+0x1b4/0x738)
    [<c01d7514>] (process_eb+0x1b4/0x738) from [<c01d7ba8>] (ubi_scan+0x110/0xe08)
    [<c01d7ba8>] (ubi_scan+0x110/0xe08) from [<c01ccd10>] (ubi_attach_mtd_dev+0x628/0xd60)
    [<c01ccd10>] (ubi_attach_mtd_dev+0x628/0xd60) from [<c01cd5cc>] (ctrl_cdev_ioctl+0xec/0x168)
    [<c01cd5cc>] (ctrl_cdev_ioctl+0xec/0x168) from [<c00932e8>] (do_vfs_ioctl+0x7c/0x5dc)
    [<c00932e8>] (do_vfs_ioctl+0x7c/0x5dc) from [<c0093880>] (sys_ioctl+0x38/0x60)
    [<c0093880>] (sys_ioctl+0x38/0x60) from [<c0009420>] (ret_fast_syscall+0x0/0x2c)
    UBI error: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 13:4096, read 126976 bytes
    [<c000d798>] (unwind_backtrace+0x0/0xf4) from [<c01d2e68>] (ubi_io_read+0x150/0x2a4)
    [<c01d2e68>] (ubi_io_read+0x150/0x2a4) from [<c01d7764>] (process_eb+0x404/0x738)
    [<c01d7764>] (process_eb+0x404/0x738) from [<c01d7ba8>] (ubi_scan+0x110/0xe08)
    [<c01d7ba8>] (ubi_scan+0x110/0xe08) from [<c01ccd10>] (ubi_attach_mtd_dev+0x628/0xd60)
    [<c01ccd10>] (ubi_attach_mtd_dev+0x628/0xd60) from [<c01cd5cc>] (ctrl_cdev_ioctl+0xec/0x168)
    [<c01cd5cc>] (ctrl_cdev_ioctl+0xec/0x168) from [<c00932e8>] (do_vfs_ioctl+0x7c/0x5dc)
    [<c00932e8>] (do_vfs_ioctl+0x7c/0x5dc) from [<c0093880>] (sys_ioctl+0x38/0x60)
    [<c0093880>] (sys_ioctl+0x38/0x60) from [<c0009420>] (ret_fast_syscall+0x0/0x2c)
    UBI error: validate_ec_hdr: bad VID header offset 512, expected 2048
    UBI error: validate_ec_hdr: bad EC header
    [<c000d798>] (unwind_backtrace+0x0/0xf4) from [<c01d24d0>] (validate_ec_hdr+0x140/0x194)
    [<c01d24d0>] (validate_ec_hdr+0x140/0x194) from [<c01d3490>] (ubi_io_read_ec_hdr+0x178/0x228)
    [<c01d3490>] (ubi_io_read_ec_hdr+0x178/0x228) from [<c01d73bc>] (process_eb+0x5c/0x738)
    [<c01d73bc>] (process_eb+0x5c/0x738) from [<c01d7ba8>] (ubi_scan+0x110/0xe08)
    [<c01d7ba8>] (ubi_scan+0x110/0xe08) from [<c01ccd10>] (ubi_attach_mtd_dev+0x628/0xd60)
    [<c01ccd10>] (ubi_attach_mtd_dev+0x628/0xd60) from [<c01cd5cc>] (ctrl_cdev_ioctl+0xec/0x168)
    [<c01cd5cc>] (ctrl_cdev_ioctl+0xec/0x168) from [<c00932e8>] (do_vfs_ioctl+0x7c/0x5dc)
    [<c00932e8>] (do_vfs_ioctl+0x7c/0x5dc) from [<c0093880>] (sys_ioctl+0x38/0x60)
    [<c0093880>] (sys_ioctl+0x38/0x60) from [<c0009420>] (ret_fast_syscall+0x0/0x2c)
    UBI error: ubi_io_read_ec_hdr: validation failed for PEB 18
    UBI error: ubi_attach_mtd_dev: failed to attach by scanning, error -22
    ubiattach: error!: cannot attach mtd3
               error 22 (Invalid argument)
    #

  • I made experiment. I wrote one page in the size of 2048 byte two times by u-boot and by linux. I checked what was written and that ECC.

    U-boot sent this commands:

    nand erase 0x540000 0x800
    nand dump.obb 0x540000
    tftp 0xc0700000 192.168.0.115:nand_page
    nand write 0xc0700000 0x540000 0x800
    nand dump.obb 0x540000
    
    Page 00540000 dump:
            6a 68 73 64 6b 66 6a 77  65 75 68 66 61 73 68 64
            61 6a 73 64 68 66 6c 75  77 79 67 65 68 66 67 61
            73 64 66 6a 35 39 67 68  61 73 39 68 66 6a 35 61
            73 64 68 66 35 6c 39 6b  6a 73 35 61 32 68 64 66
            35 68 61 75 73 77 34 37  69 39 35 31 35 32 37 33
            39 35 34 31 6f 35 38 33  31 34 35 39 35 6f 38 32
            79 6f 77 65 38 72 79 6f  75 68 61 73 6c 68 66 6c
            75 69 61 73 64 35 39 73  6a 69 72 68 66 32 70 71
            72 39 38 79 68 32 61 77  39 75 69 72 79 68 61 38
            69 77 6f 79 68 75 32 69  73 39 6f 32 61 79 68 66
            35 38 32 77 70 79 68 66  61 79 68 66 70 38 32 73
            77 68 66 35 61 73 64 32  32 35 39 35 6f 69 61 73
            68 66 75 77 67 61 75 67  62 76 6b 6c 6a 78 7a 62
            63 76 6a 7a 6e 78 63 6a  76 68 61 73 75 69 68 66
            6c 6a 73 68 64 67 66 6b  6a 68 66 67 6c 3b 64 6b
            68 67 66 3b 6a 61 73 68  64 61 73 68 64 6f 66 68
            3b 77 65 75 69 68 75 68  73 64 66 68 3b 6a 68 73
            65 69 77 68 69 75 68 64  66 6b 6a 62 64 64 6a 73
            68 66 6b 6a 68 73 67 65  68 67 73 6b 6a 64 68 67
            66 68 61 73 64 67 66 79  6a 61 77 67 65 6a 68 66
            61 62 73 64 68 62 76 66  33 32 73 31 76 66 36 35
            68 32 73 64 62 76 66 6d  68 73 32 64 66 35 36 68
            32 67 77 68 66 67 73 31  34 64 68 66 35 30 33 68
            66 6a 62 67 6f 79 69 73  77 72 67 6f 77 69 75 67
            72 66 6f 69 61 77 67 66  65 61 77 67 68 66 6c 69
            61 75 77 79 68 33 38 35  68 35 61 75 69 66 35 68
            39 6c 61 75 69 73 64 68  66 35 69 32 37 61 75 77
            68 39 72 38 69 35 61 68  75 69 67 66 35 61 73 39
            6c 75 69 64 66 67 68 6c  61 39 67 68 77 72 69 35
            75 61 65 77 67 69 75 36  72 66 67 61 6c 36 68 67
            66 35 39 6c 61 73 66 6c  6a 61 73 68 64 66 6c 35
            68 6a 67 73 64 67 68 73  6c 75 61 77 75 65 68 77
            6a 68 73 64 6b 66 6a 77  65 75 68 66 61 73 68 64
            61 6a 73 64 68 66 6c 75  77 79 67 65 68 66 67 61
            73 64 66 6a 35 39 67 68  61 73 39 68 66 6a 35 61
            73 64 68 66 35 6c 39 6b  6a 73 35 61 32 68 64 66
            35 68 61 75 73 77 34 37  69 39 35 31 35 32 37 33
            39 35 34 31 6f 35 38 33  31 34 35 39 35 6f 38 32
            79 6f 77 65 38 72 79 6f  75 68 61 73 6c 68 66 6c
            75 69 61 73 64 35 39 73  6a 69 72 68 66 32 70 71
            72 39 38 79 68 32 61 77  39 75 69 72 79 68 61 38
            69 77 6f 79 68 75 32 69  73 39 6f 32 61 79 68 66
            35 38 32 77 70 79 68 66  61 79 68 66 70 38 32 73
            77 68 66 35 61 73 64 32  32 35 39 35 6f 69 61 73
            68 66 75 77 67 61 75 67  62 76 6b 6c 6a 78 7a 62
            63 76 6a 7a 6e 78 63 6a  76 68 61 73 75 69 68 66
            6c 6a 73 68 64 67 66 6b  6a 68 66 67 6c 3b 64 6b
            68 67 66 3b 6a 61 73 68  64 61 73 68 64 6f 66 68
            3b 77 65 75 69 68 75 68  73 64 66 68 3b 6a 68 73
            65 69 77 68 69 75 68 64  66 6b 6a 62 64 64 6a 73
            68 66 6b 6a 68 73 67 65  68 67 73 6b 6a 64 68 67
            66 68 61 73 64 67 66 79  6a 61 77 67 65 6a 68 66
            61 62 73 64 68 62 76 66  33 32 73 31 76 66 36 35
            68 32 73 64 62 76 66 6d  68 73 32 64 66 35 36 68
            32 67 77 68 66 67 73 31  34 64 68 66 35 30 33 68
            66 6a 62 67 6f 79 69 73  77 72 67 6f 77 69 75 67
            72 66 6f 69 61 77 67 66  65 61 77 67 68 66 6c 69
            61 75 77 79 68 33 38 35  68 35 61 75 69 66 35 68
            39 6c 61 75 69 73 64 68  66 35 69 32 37 61 75 77
            68 39 72 38 69 35 61 68  75 69 67 66 35 61 73 39
            6c 75 69 64 66 67 68 6c  61 39 67 68 77 72 69 35
            75 61 65 77 67 69 75 36  72 66 67 61 6c 36 68 67
            66 35 39 6c 61 73 66 6c  6a 61 73 68 64 66 6c 35
            68 6a 67 73 64 67 68 73  6c 75 61 77 75 65 68 77
            6a 68 73 64 6b 66 6a 77  65 75 68 66 61 73 68 64
            61 6a 73 64 68 66 6c 75  77 79 67 65 68 66 67 61
            73 64 66 6a 35 39 67 68  61 73 39 68 66 6a 35 61
            73 64 68 66 35 6c 39 6b  6a 73 35 61 32 68 64 66
            35 68 61 75 73 77 34 37  69 39 35 31 35 32 37 33
            39 35 34 31 6f 35 38 33  31 34 35 39 35 6f 38 32
            79 6f 77 65 38 72 79 6f  75 68 61 73 6c 68 66 6c
            75 69 61 73 64 35 39 73  6a 69 72 68 66 32 70 71
            72 39 38 79 68 32 61 77  39 75 69 72 79 68 61 38
            69 77 6f 79 68 75 32 69  73 39 6f 32 61 79 68 66
            35 38 32 77 70 79 68 66  61 79 68 66 70 38 32 73
            77 68 66 35 61 73 64 32  32 35 39 35 6f 69 61 73
            68 66 75 77 67 61 75 67  62 76 6b 6c 6a 78 7a 62
            63 76 6a 7a 6e 78 63 6a  76 68 61 73 75 69 68 66
            6c 6a 73 68 64 67 66 6b  6a 68 66 67 6c 3b 64 6b
            68 67 66 3b 6a 61 73 68  64 61 73 68 64 6f 66 68
            3b 77 65 75 69 68 75 68  73 64 66 68 3b 6a 68 73
            65 69 77 68 69 75 68 64  66 6b 6a 62 64 64 6a 73
            68 66 6b 6a 68 73 67 65  68 67 73 6b 6a 64 68 67
            66 68 61 73 64 67 66 79  6a 61 77 67 65 6a 68 66
            61 62 73 64 68 62 76 66  33 32 73 31 76 66 36 35
            68 32 73 64 62 76 66 6d  68 73 32 64 66 35 36 68
            32 67 77 68 66 67 73 31  34 64 68 66 35 30 33 68
            66 6a 62 67 6f 79 69 73  77 72 67 6f 77 69 75 67
            72 66 6f 69 61 77 67 66  65 61 77 67 68 66 6c 69
            61 75 77 79 68 33 38 35  68 35 61 75 69 66 35 68
            39 6c 61 75 69 73 64 68  66 35 69 32 37 61 75 77
            68 39 72 38 69 35 61 68  75 69 67 66 35 61 73 39
            6c 75 69 64 66 67 68 6c  61 39 67 68 77 72 69 35
            75 61 65 77 67 69 75 36  72 66 67 61 6c 36 68 67
            66 35 39 6c 61 73 66 6c  6a 61 73 68 64 66 6c 35
            68 6a 67 73 64 67 68 73  6c 75 61 77 75 65 68 77
            6a 68 73 64 6b 66 6a 77  65 75 68 66 61 73 68 64
            61 6a 73 64 68 66 6c 75  77 79 67 65 68 66 67 61
            73 64 66 6a 35 39 67 68  61 73 39 68 66 6a 35 61
            73 64 68 66 35 6c 39 6b  6a 73 35 61 32 68 64 66
            35 68 61 75 73 77 34 37  69 39 35 31 35 32 37 33
            39 35 34 31 6f 35 38 33  31 34 35 39 35 6f 38 32
            79 6f 77 65 38 72 79 6f  75 68 61 73 6c 68 66 6c
            75 69 61 73 64 35 39 73  6a 69 72 68 66 32 70 71
            72 39 38 79 68 32 61 77  39 75 69 72 79 68 61 38
            69 77 6f 79 68 75 32 69  73 39 6f 32 61 79 68 66
            35 38 32 77 70 79 68 66  61 79 68 66 70 38 32 73
            77 68 66 35 61 73 64 32  32 35 39 35 6f 69 61 73
            68 66 75 77 67 61 75 67  62 76 6b 6c 6a 78 7a 62
            63 76 6a 7a 6e 78 63 6a  76 68 61 73 75 69 68 66
            6c 6a 73 68 64 67 66 6b  6a 68 66 67 6c 3b 64 6b
            68 67 66 3b 6a 61 73 68  64 61 73 68 64 6f 66 68
            3b 77 65 75 69 68 75 68  73 64 66 68 3b 6a 68 73
            65 69 77 68 69 75 68 64  66 6b 6a 62 64 64 6a 73
            68 66 6b 6a 68 73 67 65  68 67 73 6b 6a 64 68 67
            66 68 61 73 64 67 66 79  6a 61 77 67 65 6a 68 66
            61 62 73 64 68 62 76 66  33 32 73 31 76 66 36 35
            68 32 73 64 62 76 66 6d  68 73 32 64 66 35 36 68
            32 67 77 68 66 67 73 31  34 64 68 66 35 30 33 68
            66 6a 62 67 6f 79 69 73  77 72 67 6f 77 69 75 67
            72 66 6f 69 61 77 67 66  65 61 77 67 68 66 6c 69
            61 75 77 79 68 33 38 35  68 35 61 75 69 66 35 68
            39 6c 61 75 69 73 64 68  66 35 69 32 37 61 75 77
            68 39 72 38 69 35 61 68  75 69 67 66 35 61 73 39
            6c 75 69 64 66 67 68 6c  61 39 67 68 77 72 69 35
            75 61 65 77 67 69 75 36  72 66 67 61 6c 36 68 67
            66 35 39 6c 61 73 66 6c  6a 61 73 68 64 66 6c 35
            68 6a 67 73 64 67 68 73  6c 75 61 77 75 65 68 77
    OOB:
            ff ff ff ff ff ff ff ff
            ff ff ff ff ff ff ff ff
            ff ff ff ff ff ff ff ff
            d1 80 ea ee 44 42 43 55
            6a a6 d1 80 ea ee 44 42
            43 55 6a a6 d1 80 ea ee
            44 42 43 55 6a a6 d1 80
            ea ee 44 42 43 55 6a a6


    Linux sent this commands:

    tftp -g -r nand_page 192.168.0.115
    flash_erase /dev/mtd3 0 0
    nandwrite -s 0x2a0000 --input-size=2048 /dev/mtd3 nand_page
    nanddump -p -o -s 0x2a0000 -l 2048 /dev/mtd3
    
    ECC failed: 0
    ECC corrected: 0
    Number of bad blocks: 4
    Number of bbt blocks: 0
    Block size 131072, page size 2048, OOB size 64
    Dumping data starting at 0x002a0000 and ending at 0x002a0800...
    0x002a0000: 6a 68 73 64 6b 66 6a 77 65 75 68 66 61 73 68 64
    0x002a0010: 61 6a 73 64 68 66 6c 75 77 79 67 65 68 66 67 61
    0x002a0020: 73 64 66 6a 35 39 67 68 61 73 39 68 66 6a 35 61
    0x002a0030: 73 64 68 66 35 6c 39 6b 6a 73 35 61 32 68 64 66
    0x002a0040: 35 68 61 75 73 77 34 37 69 39 35 31 35 32 37 33
    0x002a0050: 39 35 34 31 6f 35 38 33 31 34 35 39 35 6f 38 32
    0x002a0060: 79 6f 77 65 38 72 79 6f 75 68 61 73 6c 68 66 6c
    0x002a0070: 75 69 61 73 64 35 39 73 6a 69 72 68 66 32 70 71
    0x002a0080: 72 39 38 79 68 32 61 77 39 75 69 72 79 68 61 38
    0x002a0090: 69 77 6f 79 68 75 32 69 73 39 6f 32 61 79 68 66
    0x002a00a0: 35 38 32 77 70 79 68 66 61 79 68 66 70 38 32 73
    0x002a00b0: 77 68 66 35 61 73 64 32 32 35 39 35 6f 69 61 73
    0x002a00c0: 68 66 75 77 67 61 75 67 62 76 6b 6c 6a 78 7a 62
    0x002a00d0: 63 76 6a 7a 6e 78 63 6a 76 68 61 73 75 69 68 66
    0x002a00e0: 6c 6a 73 68 64 67 66 6b 6a 68 66 67 6c 3b 64 6b
    0x002a00f0: 68 67 66 3b 6a 61 73 68 64 61 73 68 64 6f 66 68
    0x002a0100: 3b 77 65 75 69 68 75 68 73 64 66 68 3b 6a 68 73
    0x002a0110: 65 69 77 68 69 75 68 64 66 6b 6a 62 64 64 6a 73
    0x002a0120: 68 66 6b 6a 68 73 67 65 68 67 73 6b 6a 64 68 67
    0x002a0130: 66 68 61 73 64 67 66 79 6a 61 77 67 65 6a 68 66
    0x002a0140: 61 62 73 64 68 62 76 66 33 32 73 31 76 66 36 35
    0x002a0150: 68 32 73 64 62 76 66 6d 68 73 32 64 66 35 36 68
    0x002a0160: 32 67 77 68 66 67 73 31 34 64 68 66 35 30 33 68
    0x002a0170: 66 6a 62 67 6f 79 69 73 77 72 67 6f 77 69 75 67
    0x002a0180: 72 66 6f 69 61 77 67 66 65 61 77 67 68 66 6c 69
    0x002a0190: 61 75 77 79 68 33 38 35 68 35 61 75 69 66 35 68
    0x002a01a0: 39 6c 61 75 69 73 64 68 66 35 69 32 37 61 75 77
    0x002a01b0: 68 39 72 38 69 35 61 68 75 69 67 66 35 61 73 39
    0x002a01c0: 6c 75 69 64 66 67 68 6c 61 39 67 68 77 72 69 35
    0x002a01d0: 75 61 65 77 67 69 75 36 72 66 67 61 6c 36 68 67
    0x002a01e0: 66 35 39 6c 61 73 66 6c 6a 61 73 68 64 66 6c 35
    0x002a01f0: 68 6a 67 73 64 67 68 73 6c 75 61 77 75 65 68 77
    0x002a0200: 6a 68 73 64 6b 66 6a 77 65 75 68 66 61 73 68 64
    0x002a0210: 61 6a 73 64 68 66 6c 75 77 79 67 65 68 66 67 61
    0x002a0220: 73 64 66 6a 35 39 67 68 61 73 39 68 66 6a 35 61
    0x002a0230: 73 64 68 66 35 6c 39 6b 6a 73 35 61 32 68 64 66
    0x002a0240: 35 68 61 75 73 77 34 37 69 39 35 31 35 32 37 33
    0x002a0250: 39 35 34 31 6f 35 38 33 31 34 35 39 35 6f 38 32
    0x002a0260: 79 6f 77 65 38 72 79 6f 75 68 61 73 6c 68 66 6c
    0x002a0270: 75 69 61 73 64 35 39 73 6a 69 72 68 66 32 70 71
    0x002a0280: 72 39 38 79 68 32 61 77 39 75 69 72 79 68 61 38
    0x002a0290: 69 77 6f 79 68 75 32 69 73 39 6f 32 61 79 68 66
    0x002a02a0: 35 38 32 77 70 79 68 66 61 79 68 66 70 38 32 73
    0x002a02b0: 77 68 66 35 61 73 64 32 32 35 39 35 6f 69 61 73
    0x002a02c0: 68 66 75 77 67 61 75 67 62 76 6b 6c 6a 78 7a 62
    0x002a02d0: 63 76 6a 7a 6e 78 63 6a 76 68 61 73 75 69 68 66
    0x002a02e0: 6c 6a 73 68 64 67 66 6b 6a 68 66 67 6c 3b 64 6b
    0x002a02f0: 68 67 66 3b 6a 61 73 68 64 61 73 68 64 6f 66 68
    0x002a0300: 3b 77 65 75 69 68 75 68 73 64 66 68 3b 6a 68 73
    0x002a0310: 65 69 77 68 69 75 68 64 66 6b 6a 62 64 64 6a 73
    0x002a0320: 68 66 6b 6a 68 73 67 65 68 67 73 6b 6a 64 68 67
    0x002a0330: 66 68 61 73 64 67 66 79 6a 61 77 67 65 6a 68 66
    0x002a0340: 61 62 73 64 68 62 76 66 33 32 73 31 76 66 36 35
    0x002a0350: 68 32 73 64 62 76 66 6d 68 73 32 64 66 35 36 68
    0x002a0360: 32 67 77 68 66 67 73 31 34 64 68 66 35 30 33 68
    0x002a0370: 66 6a 62 67 6f 79 69 73 77 72 67 6f 77 69 75 67
    0x002a0380: 72 66 6f 69 61 77 67 66 65 61 77 67 68 66 6c 69
    0x002a0390: 61 75 77 79 68 33 38 35 68 35 61 75 69 66 35 68
    0x002a03a0: 39 6c 61 75 69 73 64 68 66 35 69 32 37 61 75 77
    0x002a03b0: 68 39 72 38 69 35 61 68 75 69 67 66 35 61 73 39
    0x002a03c0: 6c 75 69 64 66 67 68 6c 61 39 67 68 77 72 69 35
    0x002a03d0: 75 61 65 77 67 69 75 36 72 66 67 61 6c 36 68 67
    0x002a03e0: 66 35 39 6c 61 73 66 6c 6a 61 73 68 64 66 6c 35
    0x002a03f0: 68 6a 67 73 64 67 68 73 6c 75 61 77 75 65 68 77
    0x002a0400: 6a 68 73 64 6b 66 6a 77 65 75 68 66 61 73 68 64
    0x002a0410: 61 6a 73 64 68 66 6c 75 77 79 67 65 68 66 67 61
    0x002a0420: 73 64 66 6a 35 39 67 68 61 73 39 68 66 6a 35 61
    0x002a0430: 73 64 68 66 35 6c 39 6b 6a 73 35 61 32 68 64 66
    0x002a0440: 35 68 61 75 73 77 34 37 69 39 35 31 35 32 37 33
    0x002a0450: 39 35 34 31 6f 35 38 33 31 34 35 39 35 6f 38 32
    0x002a0460: 79 6f 77 65 38 72 79 6f 75 68 61 73 6c 68 66 6c
    0x002a0470: 75 69 61 73 64 35 39 73 6a 69 72 68 66 32 70 71
    0x002a0480: 72 39 38 79 68 32 61 77 39 75 69 72 79 68 61 38
    0x002a0490: 69 77 6f 79 68 75 32 69 73 39 6f 32 61 79 68 66
    0x002a04a0: 35 38 32 77 70 79 68 66 61 79 68 66 70 38 32 73
    0x002a04b0: 77 68 66 35 61 73 64 32 32 35 39 35 6f 69 61 73
    0x002a04c0: 68 66 75 77 67 61 75 67 62 76 6b 6c 6a 78 7a 62
    0x002a04d0: 63 76 6a 7a 6e 78 63 6a 76 68 61 73 75 69 68 66
    0x002a04e0: 6c 6a 73 68 64 67 66 6b 6a 68 66 67 6c 3b 64 6b
    0x002a04f0: 68 67 66 3b 6a 61 73 68 64 61 73 68 64 6f 66 68
    0x002a0500: 3b 77 65 75 69 68 75 68 73 64 66 68 3b 6a 68 73
    0x002a0510: 65 69 77 68 69 75 68 64 66 6b 6a 62 64 64 6a 73
    0x002a0520: 68 66 6b 6a 68 73 67 65 68 67 73 6b 6a 64 68 67
    0x002a0530: 66 68 61 73 64 67 66 79 6a 61 77 67 65 6a 68 66
    0x002a0540: 61 62 73 64 68 62 76 66 33 32 73 31 76 66 36 35
    0x002a0550: 68 32 73 64 62 76 66 6d 68 73 32 64 66 35 36 68
    0x002a0560: 32 67 77 68 66 67 73 31 34 64 68 66 35 30 33 68
    0x002a0570: 66 6a 62 67 6f 79 69 73 77 72 67 6f 77 69 75 67
    0x002a0580: 72 66 6f 69 61 77 67 66 65 61 77 67 68 66 6c 69
    0x002a0590: 61 75 77 79 68 33 38 35 68 35 61 75 69 66 35 68
    0x002a05a0: 39 6c 61 75 69 73 64 68 66 35 69 32 37 61 75 77
    0x002a05b0: 68 39 72 38 69 35 61 68 75 69 67 66 35 61 73 39
    0x002a05c0: 6c 75 69 64 66 67 68 6c 61 39 67 68 77 72 69 35
    0x002a05d0: 75 61 65 77 67 69 75 36 72 66 67 61 6c 36 68 67
    0x002a05e0: 66 35 39 6c 61 73 66 6c 6a 61 73 68 64 66 6c 35
    0x002a05f0: 68 6a 67 73 64 67 68 73 6c 75 61 77 75 65 68 77
    0x002a0600: 6a 68 73 64 6b 66 6a 77 65 75 68 66 61 73 68 64
    0x002a0610: 61 6a 73 64 68 66 6c 75 77 79 67 65 68 66 67 61
    0x002a0620: 73 64 66 6a 35 39 67 68 61 73 39 68 66 6a 35 61
    0x002a0630: 73 64 68 66 35 6c 39 6b 6a 73 35 61 32 68 64 66
    0x002a0640: 35 68 61 75 73 77 34 37 69 39 35 31 35 32 37 33
    0x002a0650: 39 35 34 31 6f 35 38 33 31 34 35 39 35 6f 38 32
    0x002a0660: 79 6f 77 65 38 72 79 6f 75 68 61 73 6c 68 66 6c
    0x002a0670: 75 69 61 73 64 35 39 73 6a 69 72 68 66 32 70 71
    0x002a0680: 72 39 38 79 68 32 61 77 39 75 69 72 79 68 61 38
    0x002a0690: 69 77 6f 79 68 75 32 69 73 39 6f 32 61 79 68 66
    0x002a06a0: 35 38 32 77 70 79 68 66 61 79 68 66 70 38 32 73
    0x002a06b0: 77 68 66 35 61 73 64 32 32 35 39 35 6f 69 61 73
    0x002a06c0: 68 66 75 77 67 61 75 67 62 76 6b 6c 6a 78 7a 62
    0x002a06d0: 63 76 6a 7a 6e 78 63 6a 76 68 61 73 75 69 68 66
    0x002a06e0: 6c 6a 73 68 64 67 66 6b 6a 68 66 67 6c 3b 64 6b
    0x002a06f0: 68 67 66 3b 6a 61 73 68 64 61 73 68 64 6f 66 68
    0x002a0700: 3b 77 65 75 69 68 75 68 73 64 66 68 3b 6a 68 73
    0x002a0710: 65 69 77 68 69 75 68 64 66 6b 6a 62 64 64 6a 73
    0x002a0720: 68 66 6b 6a 68 73 67 65 68 67 73 6b 6a 64 68 67
    0x002a0730: 66 68 61 73 64 67 66 79 6a 61 77 67 65 6a 68 66
    0x002a0740: 61 62 73 64 68 62 76 66 33 32 73 31 76 66 36 35
    0x002a0750: 68 32 73 64 62 76 66 6d 68 73 32 64 66 35 36 68
    0x002a0760: 32 67 77 68 66 67 73 31 34 64 68 66 35 30 33 68
    0x002a0770: 66 6a 62 67 6f 79 69 73 77 72 67 6f 77 69 75 67
    0x002a0780: 72 66 6f 69 61 77 67 66 65 61 77 67 68 66 6c 69
    0x002a0790: 61 75 77 79 68 33 38 35 68 35 61 75 69 66 35 68
    0x002a07a0: 39 6c 61 75 69 73 64 68 66 35 69 32 37 61 75 77
    0x002a07b0: 68 39 72 38 69 35 61 68 75 69 67 66 35 61 73 39
    0x002a07c0: 6c 75 69 64 66 67 68 6c 61 39 67 68 77 72 69 35
    0x002a07d0: 75 61 65 77 67 69 75 36 72 66 67 61 6c 36 68 67
    0x002a07e0: 66 35 39 6c 61 73 66 6c 6a 61 73 68 64 66 6c 35
    0x002a07f0: 68 6a 67 73 64 67 68 73 6c 75 61 77 75 65 68 77
      OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
      OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
      OOB Data: ff ff ff ff ff ff ff ff 4a ae e4 4a ae e4 4a ae
      OOB Data: e4 4a ae e4 ff ff ff ff ff ff ff ff ff ff ff ff

    Conclusion

    Data is the same but ECC is different. This can be the cause of error mounting NAND to Linux. That should we do to make ECC the same?

     

  • I found out that U-boot and Linux NAND drivers use different Error Correction Code algorithms. U-boot uses 4-bit hardware ECC algorithm and Linux uses 1-bit hardware ECC algorithm. One of the comments to Linux NAND driver source file mentions that this driver doesn’t support 4-bit ECC for 16-bit flash.

    In spite of that, I made an attempt to adapt the driver’s NAND algorithm to 4-bit mode (in the file board-omapl138-lcdk.c)

    I wrote a sample NAND data page by Linux and then tried to read it with Linux and then with U-boot. The data I read with Linux was incorrect, and the data I read with U-boot was just the same as the initial data page. The issue is that Linux driver with 4-bit ECC on writes Data and OOB correctly, but reads Data incorrectly and OOB - correctly.

    So wouldn’t you please tell me if you got any Linux patch or driver for 4-bit hardware ECC to be used with DaVinchi? I’d be happy to have it in my disposal.

    Thanks in advance.

  • The NAND EMIFA latencies in Linux driver were configured for clock frequency 300 MHz but actually run on 456 MHz. I resolved the issue by switching Fclk to 300 MHz.
  • Hi,
    Sounds good.
    We are glad that you solved the problem.
    Thanks for your update.