All of lore.kernel.org
 help / color / mirror / Atom feed
From: <markus.stockhausen@gmx.de>
To: <miquel.raynal@bootlin.com>, <vigneshr@ti.com>, <richard@nod.at>,
	<tudor.ambarus@linaro.org>, <linux-mtd@lists.infradead.org>
Cc: "'Chris Packham'" <Chris.Packham@alliedtelesis.co.nz>
Subject: NAND ECC errors
Date: Thu, 7 Aug 2025 17:16:25 +0200	[thread overview]
Message-ID: <118501dc07ae$3f6379a0$be2a6ce0$@gmx.de> (raw)

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/

             reply	other threads:[~2025-08-07 15:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07 15:16 markus.stockhausen [this message]
2025-08-07 20:36 ` NAND ECC errors 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='118501dc07ae$3f6379a0$be2a6ce0$@gmx.de' \
    --to=markus.stockhausen@gmx.de \
    --cc=Chris.Packham@alliedtelesis.co.nz \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=tudor.ambarus@linaro.org \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.