From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 8/8] mtd: nand: mxc_nand: support software ECC
Date: Tue, 16 Apr 2024 11:53:13 +0200 [thread overview]
Message-ID: <20240416095313.1977242-9-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20240416095313.1977242-1-s.hauer@pengutronix.de>
To support software ECC we still need the driver provided read_oob,
read_page_raw and write_page_raw ops, so set them unconditionally
no matter which engine_type we use. The OOB layout on the other hand
represents the layout the i.MX ECC hardware uses, so set this only
when NAND_ECC_ENGINE_TYPE_ON_HOST is in use.
With these changes the driver can be used with software BCH ECC which
is useful for NAND chips that require a stronger ECC than the i.MX
hardware supports.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/mtd/nand/raw/mxc_nand.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c
index bd320bf3b8..d057d1b1bc 100644
--- a/drivers/mtd/nand/raw/mxc_nand.c
+++ b/drivers/mtd/nand/raw/mxc_nand.c
@@ -1347,15 +1347,16 @@ static int mxcnd_attach_chip(struct nand_chip *chip)
chip->ecc.bytes = host->devtype_data->eccbytes;
host->eccsize = host->devtype_data->eccsize;
chip->ecc.size = 512;
- mtd_set_ooblayout(mtd, host->devtype_data->ooblayout);
+
+ chip->ecc.read_oob = mxc_nand_read_oob;
+ chip->ecc.read_page_raw = mxc_nand_read_page_raw;
+ chip->ecc.write_page_raw = mxc_nand_write_page_raw;
switch (chip->ecc.engine_type) {
case NAND_ECC_ENGINE_TYPE_ON_HOST:
+ mtd_set_ooblayout(mtd, host->devtype_data->ooblayout);
chip->ecc.read_page = mxc_nand_read_page;
- chip->ecc.read_page_raw = mxc_nand_read_page_raw;
- chip->ecc.read_oob = mxc_nand_read_oob;
chip->ecc.write_page = mxc_nand_write_page_ecc;
- chip->ecc.write_page_raw = mxc_nand_write_page_raw;
chip->ecc.write_oob = mxc_nand_write_oob;
break;
--
2.39.2
prev parent reply other threads:[~2024-04-16 9:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 9:53 [PATCH 0/8] Update NAND layer Sascha Hauer
2024-04-16 9:53 ` [PATCH 1/8] bch: update from Kernel Sascha Hauer
2024-04-16 9:53 ` [PATCH 2/8] mtd: nand: move to drivers/mtd/nand/raw/ Sascha Hauer
2024-04-16 9:53 ` [PATCH 3/8] mtd: update _lock/_unlock prototype Sascha Hauer
2024-04-16 9:53 ` [PATCH 4/8] mtd: nand: update to Linux-6.9-rc2 Sascha Hauer
2024-04-16 9:53 ` [PATCH 5/8] mtd: nand: replace nand_imx driver with kernel driver Sascha Hauer
2024-04-16 9:53 ` [PATCH 6/8] mtd: nand: mxc_nand: separate page read from ecc calc Sascha Hauer
2024-04-16 9:53 ` [PATCH 7/8] mtd: nand: mxc_nand: implement exec_op Sascha Hauer
2024-04-16 9:53 ` Sascha Hauer [this message]
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=20240416095313.1977242-9-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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