Skip to contentSkip to conversation

UBI ECC errors on kernel 3.16.2

DISCUSSION Angelo Dureghello 3 participants 11 messages Oct 1, 2014 – Oct 6, 2014 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Dear all,

i am working on an embedded system: arm TI AM1808 cpu with a nand flash mt29f1g08abb.

The flash is 128MB, no-subages, pages as 2048bytes, OOB 64 bytes

Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          480 (62914560 bytes, 60.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  512 bytes
OOB size:                       64 bytes
Character device major/minor:   90:12
Bad blocks are allowed:         true
Device is writable:             true

I had UBI/UBIFS working fine with kernel 3.5.1 (flashing it through u.boot). As ecclayout, from my board.c, i was setting up a custom one:

/* NAND ECC modified to reflect the DaVinci RBL layout (i.e. 512B rather than 2kB)
* patch from http://processors.wiki.ti.com/index.php/DM365_Nand_ECC_layout
*/

static struct nand_ecclayout ipam390_nand_ecclayout = {
    .eccbytes    = 40,
    .eccpos        = {6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
              22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
              38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
              54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
    },
    .oobfree    = {{2, 4}, {16, 6}, {32, 6}, {48, 6} },
};

Now i am moving to kernel 3.16.2.

With quite same config, the same UBI image now produces several errors

platform barix-ipam390.0: Driver barix-ipam390 requests probe deferral
UBI: scanning is finished
UBI: volume 0 ("rootfs") re-sized from 205 to 456 LEBs
UBI: attached mtd6 (name "rootfs", size 60 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
UBI: good PEBs: 480, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1641262122
UBI: available PEBs: 0, total reserved PEBs: 480, PEBs reserved for bad PEB handling: 20
UBI: background thread "ubi_bgt0d" started, PID 1025
davinci_emac 1e20000.ethernet: failed to get EMAC clock
davinci_emac: probe of 1e20000.ethernet failed with error -16
davinci_emac davinci_emac.1: Runtime PM disabled, clock forced on.
davinci_emac davinci_emac.1: Runtime PM disabled, clock forced on.
davinci_emac davinci_emac.1: Runtime PM disabled, clock forced on.
barix-ipam390 barix-ipam390.0: ASoC: platform davinci-pcm-audio not registered
gpio-keys gpio-keys.0: Unable to get irq number for GPIO 126, error -6
platform barix-ipam390.0: Driver barix-ipam390 requests probe deferral
omap_rtc da830-rtc: setting system clock to 2014-10-01 18:55:35 UTC (1412189735)
ALSA device list:
No soundcards found.
UBI warning: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 2:4096, read only 4096 bytes, retry UBI warning: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 2:4096, read only 4096 bytes, retry UBI warning: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 2:4096, read only 4096 bytes, retry UBI error: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 2:4096, read 4096 bytes
UBIFS: background thread "ubifs_bgt0_0" started, PID 1032

I tred also to boot a jffs2 file system and had similar ECC errors.

I suspect something in the mtd/ecc part is changed in a way that my custom ecc is no more valid.

Every help is very appreciated.

Thanks
Regards,
Angelo

#1 lore raw
Quoted 77 lines · Angelo Dureghello

Dear all,

i am working on an embedded system: arm TI AM1808 cpu with a nand flash mt29f1g08abb.

The flash is 128MB, no-subages, pages as 2048bytes, OOB 64 bytes

Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          480 (62914560 bytes, 60.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  512 bytes
OOB size:                       64 bytes
Character device major/minor:   90:12
Bad blocks are allowed:         true
Device is writable:             true

I had UBI/UBIFS working fine with kernel 3.5.1 (flashing it through u.boot). As ecclayout, from my board.c, i was setting up a custom one:

/* NAND ECC modified to reflect the DaVinci RBL layout (i.e. 512B rather than 2kB)
* patch from http://processors.wiki.ti.com/index.php/DM365_Nand_ECC_layout
*/

static struct nand_ecclayout ipam390_nand_ecclayout = {
    .eccbytes    = 40,
    .eccpos        = {6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
              22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
              38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
              54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
    },
    .oobfree    = {{2, 4}, {16, 6}, {32, 6}, {48, 6} },
};

Now i am moving to kernel 3.16.2.

With quite same config, the same UBI image now produces several errors

platform barix-ipam390.0: Driver barix-ipam390 requests probe deferral
UBI: scanning is finished
UBI: volume 0 ("rootfs") re-sized from 205 to 456 LEBs
UBI: attached mtd6 (name "rootfs", size 60 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
UBI: good PEBs: 480, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number:
1641262122
UBI: available PEBs: 0, total reserved PEBs: 480, PEBs reserved for bad PEB
handling: 20
UBI: background thread "ubi_bgt0d" started, PID 1025 davinci_emac 1e20000.ethernet: failed to get EMAC clock
davinci_emac: probe of 1e20000.ethernet failed with error -16 davinci_emac davinci_emac.1: Runtime PM disabled, clock forced on. davinci_emac davinci_emac.1: Runtime PM disabled, clock forced on. davinci_emac davinci_emac.1: Runtime PM disabled, clock forced on. barix-ipam390 barix-ipam390.0: ASoC: platform davinci-pcm-audio not registered
gpio-keys gpio-keys.0: Unable to get irq number for GPIO 126, error -6 platform barix-ipam390.0: Driver barix-ipam390 requests probe deferral omap_rtc da830-rtc: setting system clock to 2014-10-01 18:55:35 UTC (1412189735)
ALSA device list:
No soundcards found.
UBI warning: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 2:4096, read only 4096 bytes, retry
UBI warning: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 2:4096, read only 4096 bytes, retry
UBI warning: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 2:4096, read only 4096 bytes, retry
UBI error: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 2:4096, read 4096 bytes
UBIFS: background thread "ubifs_bgt0_0" started, PID 1032

Quoted 6 lines

I tred also to boot a jffs2 file system and had similar ECC errors.

I suspect something in the mtd/ecc part is changed in a way that my custom ecc is no more valid.

Every help is very appreciated.

Do mtd and ubi tests pass?

Signature · 2 lines
Thanks,
//richard
#2 lore raw
Quoted 3 lines · Richard Weinberger

Do mtd and ubi tests pass?

I have successfully executed all mtd tests under old kernel 3.5.1.
Now, with this new kernel 3.16.2 i can't boot, and i don't know how i could test it.

Only thing that i can do is to minimally verify the flashed image from u-boot

U-Boot > ubi part rootfs 2048
UBI: attaching mtd1 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: volume 0 ("rootfs") re-sized from 205 to 472 LEBs
UBI: attached mtd1 to ubi0
UBI: MTD device name: "mtd=6"
UBI: MTD device size: 60 MiB
UBI: number of good PEBs: 480
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 1
UBI: available PEBs: 0
UBI: total number of reserved PEBs: 480
UBI: number of PEBs reserved for bad PEB handling: 4
UBI: max/mean erase counter: 1/0
U-Boot >

It seems sane.

Also, once loaded the system and get the errors, the ubi get damaged (check from U.boot shows ecc errors

Regards

#3 lore raw

I have some additional info:
i added some traces in the mtd nand driver, and see that until a certain point of the boot, mtddriver reads without any ecc error.

Then, after some other driver inits, the same offset read gives ecc error.

nand_davinci_read_buf: buf c791588c, len 64
nand_davinci_read_buf: buf c883d000, len 512
nand_davinci_read_buf: buf c883d200, len 512
nand_davinci_read_buf: buf c883d400, len 512
nand_davinci_read_buf: buf c883d600, len 512
nand_davinci_read_buf: buf c791588c, len 64
nand_davinci_read_buf: buf c883d800, len 512
nand_davinci_read_buf: buf c883da00, len 512
nand_davinci_read_buf: buf c883dc00, len 512
nand_davinci_read_buf: buf c883de00, len 512
nand_davinci_read_buf: buf c791588c, len 64
nand_davinci_read_buf: buf c883e000, len 512
nand_davinci_read_buf: buf c883e200, len 512
nand_davinci_read_buf: buf c883e400, len 512
nand_davinci_read_buf: buf c883e600, len 512
nand_read(): ret=0
UBI: volume 0 ("rootfs") re-sized from 205 to 456 LEBs
UBI: attached mtd6 (name "rootfs", size 60 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
UBI: good PEBs: 480, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1641262122
UBI: available PEBs: 0, total reserved PEBs: 480, PEBs reserved for bad PEB handling: 20
UBI: background thread "ubi_bgt0d" started, PID 1025
davinci_emac 1e20000.ethernet: failed to get EMAC clock
davinci_emac: probe of 1e20000.ethernet failed with error -16
davinci_emac davinci_emac.1: Runtime PM disabled, clock forced on. davinci_emac davinci_emac.1: Runtime PM disabled, clock forced on. davinci_emac davinci_emac.1: Runtime PM disabled, clock forced on. gpio-keys gpio-keys.0: Unable to get irq number for GPIO 126, error -6 omap_rtc da830-rtc: setting system clock to 2014-10-02 09:06:57 UTC (1412240817) barix-ipam390 barix-ipam390.0: ASoC: platform davinci-pcm-audio not registered ALSA device list:
No soundcards found.
platform barix-ipam390.0: Driver barix-ipam390 requests probe deferral
nand_davinci_read_buf: buf c791588c, len 64
nand_davinci_read_buf: buf c791b000, len 512
nand_davinci_read_buf: buf c791b200, len 512
nand_davinci_read_buf: buf c791b400, len 512
nand_davinci_read_buf: buf c791b600, len 512
ecc_failed !!
nand_davinci_read_buf: buf c791588c, len 64
nand_davinci_read_buf: buf c791b800, len 512
nand_davinci_read_buf: buf c791ba00, len 512
nand_davinci_read_buf: buf c791bc00, len 512
nand_davinci_read_buf: buf c791be00, len 512
nand_read(): ret=-74

So seems some of the latest driver probe or the ubi attach someway mess up the next mtd read.

Regards
angelo

#4 lore raw

Hi all,

still some updated on these -74 EBADMSG i am receiving.

well, seems the first ecc error is detected as soon as the kernel driver starts to read the ubifs (so file system) data part of the rootfs.ubi image.

Before reading the file system data, so attaching, there is no ecc error detected at all. I added traces on some kernel file as nand_base.c.

Ubi scanning / attaching ...

nand_read_page_hwecc_oob_first page :3659
nand_read_page_hwecc_oob_first correct p:c883d800 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:0b; nand_read_page_hwecc_oob_first correct p:c883da00 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:58; nand_read_page_hwecc_oob_first correct p:c883dc00 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:cf; nand_read_page_hwecc_oob_first correct p:c883de00 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:8b;
nand_read_page_hwecc_oob_first page :3660
nand_read_page_hwecc_oob_first correct p:c883e000 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:9b; nand_read_page_hwecc_oob_first correct p:c883e200 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:f1; nand_read_page_hwecc_oob_first correct p:c883e400 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:26; nand_read_page_hwecc_oob_first correct p:c883e600 p[0]:p[1] ff:ff i:30 eccpos[i]:36 ecc_code[i]:3f;
UBI: volume 0 ("rootfs") re-sized from 205 to 456 LEBs
UBI: attached mtd6 (name "rootfs", size 60 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
UBI: good PEBs: 480, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 272604537
UBI: available PEBs: 0, total reserved PEBs: 480, PEBs reserved for bad PEB handling: 20
UBI: background thread "ubi_bgt0d" started, PID 995
gpio-keys gpio-keys.0: Failed to request GPIO 126, error -517
platform gpio-keys.0: Driver gpio-keys requests probe deferral
omap_rtc da830-rtc: setting system clock to 2014-10-02 15:59:28 UTC (1412265568) ALSA device list:
No soundcards found.

*** reading the file system here ***

At page 3712 there is the first of the file system blocks
3712 3713 3714 3715
EC HEADER | VID HEADER | fs data | fs data etc

                           ^
                           ^

nand_read_page_hwecc_oob_first page :3714
nand_read_page_hwecc_oob_first error p:c7906000 p[0]:p[1] 31:18 i:0 eccpos[i]:06 ecc_code[i]:1f; <<< ERROR
nand_read_page_hwecc_oob_first correct p:c7906200 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906400 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906600 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:00; ecc_failed !!
nand_read_page_hwecc_oob_first page :3715
nand_read_page_hwecc_oob_first correct p:c7906800 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906a00 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906c00 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906e00 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:00; UBI warning: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 2:4096, read only 4096 bytes, retry

I am tracing the first 2 bytes only of each 512B eccblock.
I verified, first 2 bytes with errors (0x31, 0x18) are sane, as in the rootfs.ubi file.

So, i am supposing these errors are caused from a misalignment from u-boot and kernel davinci / nand drivers that calculate the ecc values.

U-Boot 2014.07-03397-gab92542 (Oct 02 2014 - 16:14:43) Kernel is 3.16.2

What do you think ?

Regards angelo

#5 lore raw
Quoted 87 lines · Angelo Dureghello

Hi all,

still some updated on these -74 EBADMSG i am receiving.

well, seems the first ecc error is detected as soon as the kernel driver starts to
read the ubifs (so file system) data part of the rootfs.ubi image.

Before reading the file system data, so attaching, there is no ecc error detected at all.
I added traces on some kernel file as nand_base.c.

Ubi scanning / attaching ...

nand_read_page_hwecc_oob_first page :3659
nand_read_page_hwecc_oob_first correct p:c883d800 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:0b;
nand_read_page_hwecc_oob_first correct p:c883da00 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:58;
nand_read_page_hwecc_oob_first correct p:c883dc00 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:cf;
nand_read_page_hwecc_oob_first correct p:c883de00 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:8b;
nand_read_page_hwecc_oob_first page :3660
nand_read_page_hwecc_oob_first correct p:c883e000 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:9b;
nand_read_page_hwecc_oob_first correct p:c883e200 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:f1;
nand_read_page_hwecc_oob_first correct p:c883e400 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:26;
nand_read_page_hwecc_oob_first correct p:c883e600 p[0]:p[1] ff:ff i:30 eccpos[i]:36 ecc_code[i]:3f;
UBI: volume 0 ("rootfs") re-sized from 205 to 456 LEBs
UBI: attached mtd6 (name "rootfs", size 60 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
UBI: good PEBs: 480, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number:
272604537
UBI: available PEBs: 0, total reserved PEBs: 480, PEBs reserved for bad PEB
handling: 20
UBI: background thread "ubi_bgt0d" started, PID 995
gpio-keys gpio-keys.0: Failed to request GPIO 126, error -517 platform gpio-keys.0: Driver gpio-keys requests probe deferral omap_rtc da830-rtc: setting system clock to 2014-10-02 15:59:28 UTC (1412265568)
ALSA device list:
No soundcards found.

*** reading the file system here ***

At page 3712 there is the first of the file system blocks
3712 3713 3714 3715
EC HEADER | VID HEADER | fs data | fs data etc

                           ^
                           ^

nand_read_page_hwecc_oob_first page :3714
nand_read_page_hwecc_oob_first error p:c7906000 p[0]:p[1] 31:18 i:0
eccpos[i]:06 ecc_code[i]:1f; <<< ERROR
nand_read_page_hwecc_oob_first correct p:c7906200 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:00;
nand_read_page_hwecc_oob_first correct p:c7906400 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:00;
nand_read_page_hwecc_oob_first correct p:c7906600 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:00;
ecc_failed !!
nand_read_page_hwecc_oob_first page :3715
nand_read_page_hwecc_oob_first correct p:c7906800 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:00;
nand_read_page_hwecc_oob_first correct p:c7906a00 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:00;
nand_read_page_hwecc_oob_first correct p:c7906c00 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:00;
nand_read_page_hwecc_oob_first correct p:c7906e00 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:00;
UBI warning: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 2:4096, read only 4096 bytes, retry

I am tracing the first 2 bytes only of each 512B eccblock. I verified, first 2 bytes with errors (0x31, 0x18) are sane, as in the rootfs.ubi file.

Quoted 8 lines

So, i am supposing these errors are caused from a misalignment from u-boot and kernel davinci / nand drivers
that calculate the ecc values.

U-Boot 2014.07-03397-gab92542 (Oct 02 2014 - 16:14:43) Kernel is 3.16.2

What do you think ?

Please boot the board via NFS/whatever to run mtd tests.
Before we search issues in UBI we need to make sure that you mtd did not break.

Signature · 2 lines
Thanks,
//richard
#6 lore raw
In reply to Angelo Dureghello

Hi Angelo,

Quoted 91 lines · Angelo Dureghello

Hi all,

still some updated on these -74 EBADMSG i am receiving.

well, seems the first ecc error is detected as soon as the kernel driver starts to
read the ubifs (so file system) data part of the rootfs.ubi image.

Before reading the file system data, so attaching, there is no ecc error detected at all.
I added traces on some kernel file as nand_base.c.

Ubi scanning / attaching ...

nand_read_page_hwecc_oob_first page :3659
nand_read_page_hwecc_oob_first correct p:c883d800 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:0b; nand_read_page_hwecc_oob_first correct p:c883da00 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:58; nand_read_page_hwecc_oob_first correct p:c883dc00 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:cf; nand_read_page_hwecc_oob_first correct p:c883de00 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:8b;
nand_read_page_hwecc_oob_first page :3660
nand_read_page_hwecc_oob_first correct p:c883e000 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:9b; nand_read_page_hwecc_oob_first correct p:c883e200 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:f1; nand_read_page_hwecc_oob_first correct p:c883e400 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:26; nand_read_page_hwecc_oob_first correct p:c883e600 p[0]:p[1] ff:ff i:30 eccpos[i]:36 ecc_code[i]:3f;
UBI: volume 0 ("rootfs") re-sized from 205 to 456 LEBs
UBI: attached mtd6 (name "rootfs", size 60 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
UBI: good PEBs: 480, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 1/0, WL threshold: 4096, image sequence
number: 272604537
UBI: available PEBs: 0, total reserved PEBs: 480, PEBs reserved for bad PEB handling: 20
UBI: background thread "ubi_bgt0d" started, PID 995 gpio-keys gpio-keys.0: Failed to request GPIO 126, error -517 platform gpio-keys.0: Driver gpio-keys requests probe deferral omap_rtc da830-rtc: setting system clock to 2014-10-02 15:59:28 UTC (1412265568)
ALSA device list:
No soundcards found.

*** reading the file system here ***

At page 3712 there is the first of the file system blocks
3712 3713 3714 3715
EC HEADER | VID HEADER | fs data | fs data etc

                           ^
                           ^

nand_read_page_hwecc_oob_first page :3714
nand_read_page_hwecc_oob_first error p:c7906000 p[0]:p[1] 31:18 i:0
eccpos[i]:06 ecc_code[i]:1f; <<< ERROR
nand_read_page_hwecc_oob_first correct p:c7906200 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906400 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906600 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:00;
ecc_failed !!
nand_read_page_hwecc_oob_first page :3715
nand_read_page_hwecc_oob_first correct p:c7906800 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906a00 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906c00 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906e00 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:00;
UBI warning: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 2:4096, read only 4096 bytes, retry

I am tracing the first 2 bytes only of each 512B eccblock. I verified, first 2 bytes with errors (0x31, 0x18) are sane, as in the rootfs.ubi file.

So, i am supposing these errors are caused from a misalignment from u-boot and kernel davinci / nand drivers
that calculate the ecc values.

Quoted 7 lines

U-Boot 2014.07-03397-gab92542 (Oct 02 2014 - 16:14:43) Kernel is 3.16.2

What do you think ?

Regards angelo

Yes, this seems to be mis-alignment in ecc-scheme (or layout)

+ [email protected]

Also following User-Guides for *OMAP* processors (not davinci) may help you narrow down the cause.

with regards, pekon

[1] http://processors.wiki.ti.com/index.php/Linux_Core_NAND_User%27s_Guide#ECC_schemes_support
[2] http://processors.wiki.ti.com/index.php/UBIFS_Support

------------------------
Powered by BigRock.com

#7 lore raw

Dear,

many thakns for your support. Hope i can contribute to help you also in the future, i will try to post some useful patch someday.

I tried to run mtd tests, but for some other issues encoutered on running this kernel version (PHY link not detected) i couldn't mount the NFS for testing, and couldn't execute them.So i had to fight inside the mtd and mtd/nand folders to find out the reason of this.

The following temporary fix into nand_base.c seems to solve my issue.

         if (!ecc->write_oob)
             ecc->write_oob = nand_write_oob_std;
         /* Angelo
          * temporary patch, no subpage wrote allowed for ipam390,
          * must comment them out, or ECC layout get broken.
          */
!        //if (!ecc->read_subpage)
!        //    ecc->read_subpage = nand_read_subpage;
!        //if (!ecc->write_subpage)
!        //    ecc->write_subpage = nand_write_subpage_hwecc;

It is connected to the fact that the driver want to use "subpage" write from some kernel versions, since this binding was not there into 3.5.1.

Maybe you can now clarify some mistery i still cannot understand:
1) My flash does not support subpages write (page 2048, no subpages support from the datasheet), so i set subpage and max/io size to 2048. But sill UBI attach shows the 512 supbage as available. Upon this nand flash limit, is also the davinci-nand (aemif HW) controller able to support subpages write ? If yes, is it also the driver for it able to support subpages write ? From my understanding, it was not, and now it should.

2) So how does it works this subpages-write support if the nand flash does not supports subpages write ?

Thanks

Regards,
Angelo

Quoted 119 lines · Pekon Gupta

Hi Angelo,

Quoted 91 lines · Angelo Dureghello

Hi all,

still some updated on these -74 EBADMSG i am receiving.

well, seems the first ecc error is detected as soon as the kernel driver starts to
read the ubifs (so file system) data part of the rootfs.ubi image.

Before reading the file system data, so attaching, there is no ecc error detected at all.
I added traces on some kernel file as nand_base.c.

Ubi scanning / attaching ...

nand_read_page_hwecc_oob_first page :3659
nand_read_page_hwecc_oob_first correct p:c883d800 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:0b; nand_read_page_hwecc_oob_first correct p:c883da00 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:58; nand_read_page_hwecc_oob_first correct p:c883dc00 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:cf; nand_read_page_hwecc_oob_first correct p:c883de00 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:8b;
nand_read_page_hwecc_oob_first page :3660
nand_read_page_hwecc_oob_first correct p:c883e000 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:9b; nand_read_page_hwecc_oob_first correct p:c883e200 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:f1; nand_read_page_hwecc_oob_first correct p:c883e400 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:26; nand_read_page_hwecc_oob_first correct p:c883e600 p[0]:p[1] ff:ff i:30 eccpos[i]:36 ecc_code[i]:3f;
UBI: volume 0 ("rootfs") re-sized from 205 to 456 LEBs
UBI: attached mtd6 (name "rootfs", size 60 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
UBI: good PEBs: 480, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 1/0, WL threshold: 4096, image sequence
number: 272604537
UBI: available PEBs: 0, total reserved PEBs: 480, PEBs reserved for bad PEB handling: 20
UBI: background thread "ubi_bgt0d" started, PID 995 gpio-keys gpio-keys.0: Failed to request GPIO 126, error -517 platform gpio-keys.0: Driver gpio-keys requests probe deferral omap_rtc da830-rtc: setting system clock to 2014-10-02 15:59:28 UTC (1412265568)
ALSA device list:
No soundcards found.

*** reading the file system here ***

At page 3712 there is the first of the file system blocks
3712 3713 3714 3715
EC HEADER | VID HEADER | fs data | fs data etc

                           ^
                           ^

nand_read_page_hwecc_oob_first page :3714
nand_read_page_hwecc_oob_first error p:c7906000 p[0]:p[1] 31:18 i:0
eccpos[i]:06 ecc_code[i]:1f; <<< ERROR
nand_read_page_hwecc_oob_first correct p:c7906200 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906400 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906600 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:00;
ecc_failed !!
nand_read_page_hwecc_oob_first page :3715
nand_read_page_hwecc_oob_first correct p:c7906800 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906a00 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906c00 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906e00 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:00;
UBI warning: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 2:4096, read only 4096 bytes, retry

I am tracing the first 2 bytes only of each 512B eccblock. I verified, first 2 bytes with errors (0x31, 0x18) are sane, as in the rootfs.ubi file.

So, i am supposing these errors are caused from a misalignment from u-boot and kernel davinci / nand drivers
that calculate the ecc values.

Quoted 7 lines

U-Boot 2014.07-03397-gab92542 (Oct 02 2014 - 16:14:43) Kernel is 3.16.2

What do you think ?

Regards angelo

Yes, this seems to be mis-alignment in ecc-scheme (or layout)

+ [email protected]

Also following User-Guides for *OMAP* processors (not davinci) may help you narrow down the cause.

with regards, pekon

[1] http://processors.wiki.ti.com/index.php/Linux_Core_NAND_User%27s_Guide#ECC_schemes_support
[2] http://processors.wiki.ti.com/index.php/UBIFS_Support

------------------------
Powered by BigRock.com

#8 lore raw

Hello Angelo,

Quoted 30 lines · Angelo Dureghello

Dear,

many thakns for your support. Hope i can contribute to help you also in the future, i will try to post some useful patch someday.

I tried to run mtd tests, but for some other issues encoutered on running this
kernel version (PHY link not detected) i couldn't mount the NFS for testing,
and couldn't execute them.So i had to fight inside the mtd and mtd/nand folders to find out the reason of this.

The following temporary fix into nand_base.c seems to solve my issue.

          if (!ecc->write_oob)
              ecc->write_oob = nand_write_oob_std;
          /* Angelo
           * temporary patch, no subpage wrote allowed for ipam390,
           * must comment them out, or ECC layout get broken.
           */
!        //if (!ecc->read_subpage)
!        //    ecc->read_subpage = nand_read_subpage;
!        //if (!ecc->write_subpage)
!        //    ecc->write_subpage = nand_write_subpage_hwecc;

It is connected to the fact that the driver want to use "subpage" write from
some kernel versions, since this binding was not there into 3.5.1.

Quoted 12 lines

Maybe you can now clarify some mistery i still cannot understand:
1) My flash does not support subpages write (page 2048, no subpages support from
the datasheet), so i set subpage and max/io size to 2048. But sill UBI attach
shows the 512 supbage as available. Upon this nand flash limit, is also the davinci-nand (aemif HW) controller able to support subpages write ? If yes, is it
also the driver for it able to support subpages write ? From my understanding, it
was not, and now it should.

I'm not sure how mtd-utils use the arguments but following combination worked for me to mount a UBI image without sub-pages.

(1) mkfs.ubifs  -m (min-io-size=2048)   [-s (subpage-size=2048)]
(2) ubinize     -m (min-io-size=2048)
(3) ubiformat   -O 2048  (indicates that offset of volume-ID header from start of block)
Quoted 4 lines

2) So how does it works this subpages-write support if the nand flash does not
supports subpages write ?

You can disable sub-page write by adding following in your driver probe.
+ chip->options |= NAND_NO_SUBPAGE_WRITE

You should also be able to specify this via DT bindings if driver supports one.

with regards, pekon

Quoted 129 lines

Thanks

Regards,
Angelo

Quoted 121 lines · Pekon Gupta

Hi Angelo,

Quoted 91 lines · Angelo Dureghello

Hi all,

still some updated on these -74 EBADMSG i am receiving.

well, seems the first ecc error is detected as soon as the kernel driver starts to
read the ubifs (so file system) data part of the rootfs.ubi image.

Before reading the file system data, so attaching, there is no ecc error detected at all.
I added traces on some kernel file as nand_base.c.

Ubi scanning / attaching ...

nand_read_page_hwecc_oob_first page :3659
nand_read_page_hwecc_oob_first correct p:c883d800 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:0b; nand_read_page_hwecc_oob_first correct p:c883da00 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:58; nand_read_page_hwecc_oob_first correct p:c883dc00 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:cf; nand_read_page_hwecc_oob_first correct p:c883de00 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:8b;
nand_read_page_hwecc_oob_first page :3660
nand_read_page_hwecc_oob_first correct p:c883e000 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:9b; nand_read_page_hwecc_oob_first correct p:c883e200 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:f1; nand_read_page_hwecc_oob_first correct p:c883e400 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:26; nand_read_page_hwecc_oob_first correct p:c883e600 p[0]:p[1] ff:ff i:30 eccpos[i]:36 ecc_code[i]:3f;
UBI: volume 0 ("rootfs") re-sized from 205 to 456 LEBs
UBI: attached mtd6 (name "rootfs", size 60 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
UBI: good PEBs: 480, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 1/0, WL threshold: 4096, image sequence
number: 272604537
UBI: available PEBs: 0, total reserved PEBs: 480, PEBs reserved for bad PEB handling: 20
UBI: background thread "ubi_bgt0d" started, PID 995 gpio-keys gpio-keys.0: Failed to request GPIO 126, error -517 platform gpio-keys.0: Driver gpio-keys requests probe deferral omap_rtc da830-rtc: setting system clock to 2014-10-02 15:59:28 UTC (1412265568)
ALSA device list:
No soundcards found.

*** reading the file system here ***

At page 3712 there is the first of the file system blocks
3712 3713 3714 3715
EC HEADER | VID HEADER | fs data | fs data etc

                           ^
                           ^

nand_read_page_hwecc_oob_first page :3714
nand_read_page_hwecc_oob_first error p:c7906000 p[0]:p[1] 31:18 i:0
eccpos[i]:06 ecc_code[i]:1f; <<< ERROR
nand_read_page_hwecc_oob_first correct p:c7906200 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906400 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906600 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:00;
ecc_failed !!
nand_read_page_hwecc_oob_first page :3715
nand_read_page_hwecc_oob_first correct p:c7906800 p[0]:p[1] 00:00 i:0 eccpos[i]:06 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906a00 p[0]:p[1] 00:00 i:10 eccpos[i]:16 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906c00 p[0]:p[1] 00:00 i:20 eccpos[i]:26 ecc_code[i]:00; nand_read_page_hwecc_oob_first correct p:c7906e00 p[0]:p[1] 00:00 i:30 eccpos[i]:36 ecc_code[i]:00;
UBI warning: ubi_io_read: error -74 (ECC error) while reading 4096 bytes from PEB 2:4096, read only 4096 bytes, retry

I am tracing the first 2 bytes only of each 512B eccblock. I verified, first 2 bytes with errors (0x31, 0x18) are sane, as in the rootfs.ubi file.

So, i am supposing these errors are caused from a misalignment from u-boot and kernel davinci / nand drivers
that calculate the ecc values.

Quoted 7 lines

U-Boot 2014.07-03397-gab92542 (Oct 02 2014 - 16:14:43) Kernel is 3.16.2

What do you think ?

Regards angelo

Yes, this seems to be mis-alignment in ecc-scheme (or layout)

+ [email protected]

Also following User-Guides for *OMAP* processors (not davinci) may help you narrow down the cause.

with regards, pekon

[1]
http://processors.wiki.ti.com/index.php/Linux_Core_NAND_User%27s_Guide#ECC_schemes_support

[2] http://processors.wiki.ti.com/index.php/UBIFS_Support

------------------------
Powered by BigRock.com

------------------------
Powered by BigRock.com

#9 lore raw

Dear pekon,

Quoted 5 lines · pekon

I'm not sure how mtd-utils use the arguments but following combination worked for me to mount a UBI image without sub-pages.

(1) mkfs.ubifs  -m (min-io-size=2048)   [-s (subpage-size=2048)]
(2) ubinize     -m (min-io-size=2048)
(3) ubiformat   -O 2048  (indicates that offset of volume-ID header from start of block)

Sure, this is the combination i use too, that doesn't work with sub-pages write. Sems kernel anyway consider sub-page (512) as available.

Quoted 8 lines
Quoted 5 lines

2) So how does it works this subpages-write support if the nand flash does not
supports subpages write ?

You can disable sub-page write by adding following in your driver probe.
+ chip->options |= NAND_NO_SUBPAGE_WRITE

Thanks, would be more elegant your patch.
Anyway, i was expecting that mtd probe, on nand detection, to akcnowledge that the nand donesn't have subpages, so to set automatically no subpages.

https://bugzilla.kernel.org/show_bug.cgi?id=85481

Thanks again for the help,

Regards
Angelo

#10 lore raw
In reply to pekon

Dear Pekon,

Quoted 4 lines
(1) mkfs.ubifs  -m (min-io-size=2048)   [-s (subpage-size=2048)]
(2) ubinize     -m (min-io-size=2048)
(3) ubiformat   -O 2048  (indicates that offset of volume-ID header from start of block)

Yes, this is the configuration i alwaus used. But with this last kernel was not working.

Quoted 7 lines
Quoted 4 lines

2) So how does it works this subpages-write support if the nand flash does not
supports subpages write ?

You can disable sub-page write by adding following in your driver probe.
+ chip->options |= NAND_NO_SUBPAGE_WRITE

Thansk, this is much more elegant.
Anyway, mtd probe should be able to detect that my flash (mt28f1g08abb) does not support sub-pages.

I opened a bug.

https://bugzilla.kernel.org/show_bug.cgi?id=85481

Many thanks
Angelo