[PATCH 3/4] mtd: rawnand: r852: use the standard OOB write operation
From: James Hilliard
Date: Sun Nov 08 2026 - 20:53:30 EST
r852 uses interleaved ECC placement to transfer a complete 512-byte sector
and its 16-byte spare area through the hardware ECC engine. It supplies a
custom OOB reader but leaves the OOB writer unset, so the NAND core selects
nand_write_oob_syndrome().
With one ECC step and no prepad or postpad, that writer starts programming
at steps * (size + bytes), or byte 528. The subsequent 16-byte transfer
starts beyond the spare area instead of writing bytes 512-527. Raw OOB
writes inherit the same callback.
Set write_oob to nand_write_oob_std(), which writes the spare area starting
at the page's data size. Keep the interleaved page callbacks for full-page
ECC transfers.
Fixes: 67e054e91924 ("mtd: nand: Add driver for Ricoh xD/SmartMedia reader")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: James Hilliard <james.hilliard1@xxxxxxxxx>
---
drivers/mtd/nand/raw/r852.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/nand/raw/r852.c b/drivers/mtd/nand/raw/r852.c
index 92c47d351c27..e78606b97b42 100644
--- a/drivers/mtd/nand/raw/r852.c
+++ b/drivers/mtd/nand/raw/r852.c
@@ -833,6 +833,7 @@ static int r852_attach_chip(struct nand_chip *chip)
/* TODO: hack */
chip->ecc.read_oob = r852_read_oob;
+ chip->ecc.write_oob = nand_write_oob_std;
return 0;
}
--
2.53.0