Linux-mtd Archive on lore.kernel.org
 help / color / Atom feed
* Issue with 'ubi part' ubi_io_read: error -74 (ECC error)
@ 2020-05-17 11:27 Jupiter
  2020-05-19 11:17 ` Richard Weinberger
  0 siblings, 1 reply; 5+ messages in thread
From: Jupiter @ 2020-05-17 11:27 UTC (permalink / raw)
  To: linux-mtd; +Cc: u-boot

Sorry for a bit recalcitrant with the issue of calling 'ubi part"
error -74 -EBADMSG, is it MTD issue or u-boot issue?

I used Linux kernel 4.19 to flash UBIFS volume images ubi.img to
imx6ull NAND using following command in Linux:

flash_erase /dev/mtd2 0 0
ubiformat /dev/mtd2 -f ubi.img

The flashing image process went well, not errors, but in NAND booting
(u-boot version 2018), running "ubi part" stuck following errors:

ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 2
35:0, read 64 bytes
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from PEB
 235:2048, read 2048 bytes

The document says "The -74 error code is -EBADMSG and means an ECC
error. In other words, UBI tried to read some data from the flash, but
the flash driver found that there is an uncorrectable ECC error, and
returned -EBADMSG."

My question for ubiformat, how does it write ECC to UBIFS volume
partition when it flashed UBIFS image to NAND?

In NAND booting, how does the "ubi part" read ECC (DTB) from?

Thank you very much, appreciate your kind advice.

- j


-- 
"A man can fail many times, but he isn't a failure until he begins to
blame somebody else."
-- John Burroughs

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Issue with 'ubi part' ubi_io_read: error -74 (ECC error)
  2020-05-17 11:27 Issue with 'ubi part' ubi_io_read: error -74 (ECC error) Jupiter
@ 2020-05-19 11:17 ` Richard Weinberger
  2020-05-19 12:06   ` Jupiter
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2020-05-19 11:17 UTC (permalink / raw)
  To: Jupiter; +Cc: u-boot, linux-mtd

On Sun, May 17, 2020 at 1:28 PM Jupiter <jupiter.hce@gmail.com> wrote:
>
> Sorry for a bit recalcitrant with the issue of calling 'ubi part"
> error -74 -EBADMSG, is it MTD issue or u-boot issue?
>
> I used Linux kernel 4.19 to flash UBIFS volume images ubi.img to
> imx6ull NAND using following command in Linux:
>
> flash_erase /dev/mtd2 0 0
> ubiformat /dev/mtd2 -f ubi.img
>
> The flashing image process went well, not errors, but in NAND booting
> (u-boot version 2018), running "ubi part" stuck following errors:
>
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 2
> 35:0, read 64 bytes
> ubi0 error: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from PEB
>  235:2048, read 2048 bytes
>
> The document says "The -74 error code is -EBADMSG and means an ECC
> error. In other words, UBI tried to read some data from the flash, but
> the flash driver found that there is an uncorrectable ECC error, and
> returned -EBADMSG."
>
> My question for ubiformat, how does it write ECC to UBIFS volume
> partition when it flashed UBIFS image to NAND?

Neither UBI nor UBIFS care about ECC. The MTD stack does.
If you write something in Linux you cannot read back in u-boot a common
problem is that u-boot and Linux use different MTD settings (layout,
ECC, etc...).

-- 
Thanks,
//richard

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Issue with 'ubi part' ubi_io_read: error -74 (ECC error)
  2020-05-19 11:17 ` Richard Weinberger
@ 2020-05-19 12:06   ` Jupiter
  2020-05-22  4:03     ` Heiko Schocher
  0 siblings, 1 reply; 5+ messages in thread
From: Jupiter @ 2020-05-19 12:06 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: u-boot, linux-mtd

Thanks Richard for the response.

On 5/19/20, Richard Weinberger <richard.weinberger@gmail.com> wrote:
> Neither UBI nor UBIFS care about ECC. The MTD stack does.
> If you write something in Linux you cannot read back in u-boot a common
> problem is that u-boot and Linux use different MTD settings (layout,
> ECC, etc...).

That is exactly the problem I have, the MTD layout in both Linux and
u-boot is the same:

# mtdinfo
Count of MTD devices:           3
Present MTD devices:            mtd0, mtd1, mtd2
Sysfs interface supported:      yes

Are there any ways or tools in Linux to change MTD settings (most
likely the ECC or DTB) to the same setting in u-boot? I do have mtd
and fw_setenv in Linux.

Thank you so much.

Kind regards,

- jh


-- 
"A man can fail many times, but he isn't a failure until he begins to
blame somebody else."
-- John Burroughs

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Issue with 'ubi part' ubi_io_read: error -74 (ECC error)
  2020-05-19 12:06   ` Jupiter
@ 2020-05-22  4:03     ` Heiko Schocher
  2020-05-22 12:19       ` Jupiter
  0 siblings, 1 reply; 5+ messages in thread
From: Heiko Schocher @ 2020-05-22  4:03 UTC (permalink / raw)
  To: Jupiter; +Cc: Richard Weinberger, u-boot, linux-mtd

Hello Jupiter,

Am 19.05.2020 um 14:06 schrieb Jupiter:
> Thanks Richard for the response.
> 
> On 5/19/20, Richard Weinberger <richard.weinberger@gmail.com> wrote:
>> Neither UBI nor UBIFS care about ECC. The MTD stack does.
>> If you write something in Linux you cannot read back in u-boot a common
>> problem is that u-boot and Linux use different MTD settings (layout,
>> ECC, etc...).
> 
> That is exactly the problem I have, the MTD layout in both Linux and
> u-boot is the same:
> 
> # mtdinfo
> Count of MTD devices:           3
> Present MTD devices:            mtd0, mtd1, mtd2
> Sysfs interface supported:      yes
> 
> Are there any ways or tools in Linux to change MTD settings (most
> likely the ECC or DTB) to the same setting in u-boot? I do have mtd
> and fw_setenv in Linux.

No for U-Boot (as I am aware of). You need to fix the DTS or may if
older U-Boot your code.

May you need to add in your U-Boot DTS gpmi node the property:

fsl,legacy-bch-geometry;

?

see commit:

51cdf83eea - mtd: gpmi: provide the option to use legacy bch geometry

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs@denx.de

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Issue with 'ubi part' ubi_io_read: error -74 (ECC error)
  2020-05-22  4:03     ` Heiko Schocher
@ 2020-05-22 12:19       ` Jupiter
  0 siblings, 0 replies; 5+ messages in thread
From: Jupiter @ 2020-05-22 12:19 UTC (permalink / raw)
  To: hs; +Cc: Richard Weinberger, u-boot, linux-mtd

Hi Heiko,

Thanks for your response.

On 5/22/20, Heiko Schocher <hs@denx.de> wrote:
>> Are there any ways or tools in Linux to change MTD settings (most
>> likely the ECC or DTB) to the same setting in u-boot? I do have mtd
>> and fw_setenv in Linux.
>
> No for U-Boot (as I am aware of). You need to fix the DTS or may if
> older U-Boot your code.
>
> May you need to add in your U-Boot DTS gpmi node the property:
>
> fsl,legacy-bch-geometry;

I tried but that did not work, it is equivalent to remove
fsl,use-minimum-ecc in gpmi node I used to run ubiformat to flash
UBIFS image to NAND:

# flash_erase /dev/mtd2 0 0
# ubiformat /dev/mtd2 -f /tmp/ubi.img

That caused the NAND boot error to run "ubi part" ubi_io_read: error
-74 (ECC error).

Richard shed light on the problem that u-boot and Linux use different
MTD settings, I figured out it is the ECC problem, while adding
fsl,use-minimum-ecc in gpmi node cannot even start NAND boot. Why
fsl,use-minimum-ecc in gpmi node causing such predicament?

Thank you.

Kind regards,

- jh

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-17 11:27 Issue with 'ubi part' ubi_io_read: error -74 (ECC error) Jupiter
2020-05-19 11:17 ` Richard Weinberger
2020-05-19 12:06   ` Jupiter
2020-05-22  4:03     ` Heiko Schocher
2020-05-22 12:19       ` Jupiter

Linux-mtd Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mtd/0 linux-mtd/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mtd linux-mtd/ https://lore.kernel.org/linux-mtd \
		linux-mtd@lists.infradead.org
	public-inbox-index linux-mtd

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-mtd


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git