[PATCH v3 0/3] mtd: rawnand: vf610_nfc: fix the OOB of written pages and command timeouts

From: Mehmet Fide

Date: Thu Nov 19 2026 - 08:12:57 EST


From: Mehmet Fide <mehmet.fide@xxxxxxxxxxxxxxxxxx>

Three fixes for the vf610_nfc driver. All three were pointed out by
Sashiko, on the large-OOB series [1] and on v1 of this one [2].

1/3: the ECC page write transfers the spare area out of the controller
SRAM but nothing ever puts chip->oob_poi there, so every written page
gets whatever the previous transfer left behind as its OOB.

2/3: a command that timed out can still finish later, and then the next
command returns before the controller is done.

3/3: a timeout is only logged, the callers report success.

Tested on a Colibri VF50 (MX30LF1G18AC) with v7.4-rc2, PROVE_LOCKING and
DEBUG_ATOMIC_SLEEP. A debug patch skipped the wait of one command, so
that the command finished after the status flags had been cleared, and
counted the commands that returned while the controller was still busy:

unpatched: 250 after 100 forced timeouts
completion reinitialized (v1): 41 after 100 forced timeouts
this series: 0 after 200 forced timeouts

With the series each forced timeout came back as a read error and the
reads after it returned the right data. An 8 MiB UBIFS write read back
identical after dropping the caches, with no ECC corrections or
failures and no lockdep or atomic sleep report.

For the v3 change the debug patch forced the timeout in the raw re-read
of an erased page, 50 times. With v2 each read of that page from
/dev/mtd succeeded and ecc_failures went up by one, with v3 each read
failed with ETIMEDOUT and ecc_failures stayed 0.

Changes in v3:
- 3/3: a timeout in the raw re-read of vf610_nfc_correct_data() was
counted as an ECC failure by vf610_nfc_read_page(). It is returned
now (Sashiko)
- 1/3, 2/3: no change

Changes in v2:
- rebased on v7.4-rc2. The large-OOB fix that patch 1 builds on
(vf610_nfc_spare_size()) is merged, which was the build failure
Sashiko reported on v1 1/2
- 1/3: comment dropped, commit message shortened, no code change
- 2/3: rewritten. Sashiko was right that reinitializing the completion
is not enough, see the numbers above. The idle interrupt is now
disabled on a timeout and the status flags are cleared before a
command starts
- 3/3: new

[1] https://lore.kernel.org/linux-mtd/20260818114208.2780311-1-mehmet.fide@xxxxxxxxx/
[2] https://lore.kernel.org/linux-mtd/20260828085340.3916239-1-mehmet.fide@xxxxxxxxx/

v2: https://lore.kernel.org/linux-mtd/20261114192031.959376-1-mehmet.fide@xxxxxxxxx/

Mehmet Fide (3):
mtd: rawnand: vf610_nfc: write the OOB bytes on page writes
mtd: rawnand: vf610_nfc: keep a timed-out command from completing the
next one
mtd: rawnand: vf610_nfc: return an error when a command times out

drivers/mtd/nand/raw/vf610_nfc.c | 43 ++++++++++++++++++++++++++++++----------
1 file changed, 32 insertions(+), 11 deletions(-)


base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
--
2.56.0