mtd_nandbitserr and seed using pl35x NAND controller
Andrea Scian
andrea.scian at dave.eu
Tue Nov 25 02:12:47 PST 2025
Dear all,
I'm facing a weird behavior on mtd_nandbitserr mtd_test while working on a Zynk7k based platform, running kernel 6.6.0
As many of you suggest me, this test is part of our validation for the whole lowlevel support (NAND chip, hardware design, NAND controller).
I've found that this test, in my testbed, fails when using seed=1 but it seems to end successfully when using default parameters (so seed=0)
Here it is the test output in the two cases:
root at sw0005-devel:~# modprobe mtd_nandbiterrs seed=1
==================================================
mtd_nandbiterrs: MTD device: 0
mtd_nandbiterrs: MTD device size 1073741824, eraseblock=131072, page=2048, oob=64
mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
mtd_nandbiterrs: incremental biterrors test
mtd_nandbiterrs: write_page
mtd_nandbiterrs: rewrite page
mtd_nandbiterrs: read_page
mtd_nandbiterrs: verify_page
mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
mtd_nandbiterrs: Inserted biterror @ 0/7
mtd_nandbiterrs: rewrite page
mtd_nandbiterrs: read_page
mtd_nandbiterrs: Read reported 1 corrected bit errors
mtd_nandbiterrs: verify_page
mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
mtd_nandbiterrs: Inserted biterror @ 0/5
mtd_nandbiterrs: rewrite page
mtd_nandbiterrs: read_page
mtd_nandbiterrs: Read reported 1 corrected bit errors
mtd_nandbiterrs: verify_page
mtd_nandbiterrs: Error: page offset 0, expected a5, got 05
mtd_nandbiterrs: ECC failure, read data is incorrect despite read success
modprobe: ERROR: could not insert 'mtd_nandbiterrs': Input/output error
root at sw0005-devel:~# modprobe mtd_nandbiterrs
==================================================
mtd_nandbiterrs: MTD device: 0
mtd_nandbiterrs: MTD device size 1073741824, eraseblock=131072, page=2048, oob=64
mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
mtd_nandbiterrs: incremental biterrors test
mtd_nandbiterrs: write_page
mtd_nandbiterrs: rewrite page
mtd_nandbiterrs: read_page
mtd_nandbiterrs: verify_page
mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
mtd_nandbiterrs: Inserted biterror @ 0/5
mtd_nandbiterrs: rewrite page
mtd_nandbiterrs: read_page
mtd_nandbiterrs: Read reported 1 corrected bit errors
mtd_nandbiterrs: verify_page
mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
mtd_nandbiterrs: Inserted biterror @ 0/2
mtd_nandbiterrs: rewrite page
mtd_nandbiterrs: read_page
mtd_nandbiterrs: error: read failed at 0x0
mtd_nandbiterrs: After 2 biterrors per subpage, read reported error -74
mtd_nandbiterrs: finished successfully.
==================================================
modprobe: ERROR: could not insert 'mtd_nandbiterrs': Input/output error
After a bit of hacking (and looking at older kernel releases) I've seen that by re-enabling subpage writes all testcases end successfully
This is the patch that I've apply
From 1cb448ec34b39f0958db262c4a44e29ff9581b1e Mon Sep 17 00:00:00 2001
From: Andrea Scian <andrea.scian at dave.eu>
Date: Wed, 23 Jul 2025 11:25:55 +0200
Subject: [PATCH] mtd: nand: pl35x: enable subpage write
---
drivers/mtd/nand/raw/pl35x-nand-controller.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/raw/pl35x-nand-controller.c b/drivers/mtd/nand/raw/pl35x-nand-controller.c
index c506e92a3e457..542ec853e9a69 100644
--- a/drivers/mtd/nand/raw/pl35x-nand-controller.c
+++ b/drivers/mtd/nand/raw/pl35x-nand-controller.c
@@ -1064,7 +1064,7 @@ static int pl35x_nand_chip_init(struct pl35x_nandc *nfc,
plnand->cs = cs;
chip = &plnand->chip;
- chip->options = NAND_BUSWIDTH_AUTO | NAND_USES_DMA | NAND_NO_SUBPAGE_WRITE;
+ chip->options = NAND_BUSWIDTH_AUTO | NAND_USES_DMA;
chip->bbt_options = NAND_BBT_USE_FLASH;
chip->controller = &nfc->controller;
mtd = nand_to_mtd(chip);
So here it comes the questions:
* is it correct that changing seed in mtd_nandbiterrs make such a difference? IIUC this is just a "random" seed so I'll expect to fail in both cases or none
* is it correct that subpage write has been disabled in pl35x NAND controller? AFAIK on older kernel subpages were enable but maybe I'm missing something. Unfortunately git history doesn't help in this
I didn't have the chance to try a newer kernel but, at least on these two files, I don't see any significant changes
Kind Regards and thanks in advance,
Andrea SCIAN
SW Development Manager
More information about the linux-mtd
mailing list