From: James Hilliard <james.hilliard1@gmail.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>,
Boris Brezillon <bbrezillon@kernel.org>,
Brian Norris <computersforpeace@gmail.com>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
James Hilliard <james.hilliard1@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH 3/4] mtd: rawnand: r852: use the standard OOB write operation
Date: Sun, 08 Nov 2026 18:29:22 -0700 [thread overview]
Message-ID: <20261108-submit-r852-smartmedia-attach-v1-v1-3-56d08c0571a2@gmail.com> (raw)
In-Reply-To: <20261108-submit-r852-smartmedia-attach-v1-v1-0-56d08c0571a2@gmail.com>
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@vger.kernel.org
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
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
next prev parent reply other threads:[~2026-11-09 1:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 1:29 [PATCH 0/4] mtd: rawnand: restore SmartMedia setup in r852 James Hilliard
2026-11-09 1:29 ` [PATCH 1/4] mtd: rawnand: sm_common: restore the first ECC region offset James Hilliard
2026-11-09 1:29 ` [PATCH 2/4] mtd: rawnand: sm_common: avoid recursive locking when marking bad blocks James Hilliard
2026-11-09 1:29 ` James Hilliard [this message]
2026-11-09 1:29 ` [PATCH 4/4] mtd: rawnand: r852: restore SmartMedia and ECC initialization James Hilliard
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=20261108-submit-r852-smartmedia-attach-v1-v1-3-56d08c0571a2@gmail.com \
--to=james.hilliard1@gmail.com \
--cc=bbrezillon@kernel.org \
--cc=computersforpeace@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=maximlevitsky@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®