mtd_nandbitserr and seed using pl35x NAND controller

Miquel Raynal miquel.raynal at bootlin.com
Thu Dec 11 08:02:26 PST 2025


Hello Andrea,

On 25/11/2025 at 10:12:47 GMT, Andrea Scian <andrea.scian at dave.eu> wrote:

> 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

...

> --- 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;

I no longer remember why this flag was set, tbh. If you enable subpage
writes, you should make sure that page and subpage tests really pass,
because it means I have not tested this possibility.

Nevertheless, I find this causal effect very unsatisfying. I do not
understand how this might be related to your issue.

Are you sure of the ECC configuration (can you show the DT snippet)?

Is the issue consistent?

> * 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

Yes, exactly. I can't make sense out of this observation :-)

> * 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

This flag has always been there, so what does that mean? Aren't you
talking about a Xilinx downstream kernel here?

> 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

Did you observe what seed=0/1 meant in practice? I clearly do not
understand the link it might have with subpages.

Can you try with the mtd-utils userspace tool instead? Kernel modules
are no longer actively maintained, so maybe there is a bug (?) inside.

Also, can you try manually flipping bits with nandflipbits and target
various area in the page (outside of the first subpage, unlike the
nandbiterrs test).

Thanks,
Miquèl



More information about the linux-mtd mailing list