linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* NAND ECC errors
@ 2025-08-07 15:16 markus.stockhausen
  2025-08-07 20:36 ` Chris Packham
  0 siblings, 1 reply; 10+ messages in thread
From: markus.stockhausen @ 2025-08-07 15:16 UTC (permalink / raw)
  To: miquel.raynal, vigneshr, richard, tudor.ambarus, linux-mtd
  Cc: 'Chris Packham'

Hi,

Chris (CC) developed the drivers/spi/spi-realtek-rtl-snand.c for the 
Realtek switch platform. Thanks for that and the inclusion into mainline. 
While adding it to one of my devices I'm getting ECC errors. 

Situation is as follows.

- Linksys LGS328 (with RTL9301 SOC and that NAND controller)
- OpenWrt with Kernel 6.12 longterm
- The Realtek SPI NAND driver (backported from current master)
- Macronix MX35LF1GE4AB (1GBit)
- Boot via TFTP

I found a vendor UBI partition in NAND that I want to analyze. 
It is actively and the vendor firmware seems to work on in.
I assume it contains a filesystem with configuration and logs.
During ubiattach I get tons of errors "ubi0 warning: ubi_io_read: 
Error -77  (ECC error) while reading 64 bytes from PEB 0:0, read 
only 64 bytes, retry".

Call stack shows:

spinand_mtd_regular_page_read
  spinand_read_page
    spinand_load_page_op
    spinand_wait -> sets status = STATUS_ECC_UNCOR_ERROR 
    nand_ecc_finish_io_req start
      spinand_ondie_ecc_finish_io_req run
        spinand_check_ecc_status start
          macronix_ecc_get_status -> reads status & returns -EBADMSG

Reading data from NAND directly I see this data layout for 2K data

- 4x 512 bytes data
- 4x 6 bytes oob = 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- 4x 10 bytes ECC 

A quick ECC calc for empty blocks says it must be BCH6. So now I have
several options but have no idea if I'm right or which to follow.

1. The NAND chip seems to have ECC build in. Ignored by vendor?
2. There is a hardware ECC controller -> Driver must be coded
3. Maybe I must activate the software BCH driver
4. The old vendor firmware (Linux 4.x) uses other ECC logic.

Anyone good ideas what to do first from here?

Thanks in advance.

Markus


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

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

end of thread, other threads:[~2025-08-08 13:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07 15:16 NAND ECC errors markus.stockhausen
2025-08-07 20:36 ` Chris Packham
2025-08-07 21:23   ` AW: " markus.stockhausen
2025-08-07 21:32     ` Chris Packham
2025-08-08  8:41       ` Miquel Raynal
2025-08-08 12:25         ` AW: " markus.stockhausen
2025-08-08 12:41           ` Miquel Raynal
2025-08-08 13:21             ` AW: " markus.stockhausen
2025-08-08 13:31               ` Miquel Raynal
2025-08-08  8:37   ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).