From: "Juha Yrjölä" <juha.yrjola@nokia.com>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] Add NAND_ECC_HW12_2048
Date: Mon, 01 Nov 2004 09:46:48 +0200 [thread overview]
Message-ID: <1099295208.10601.8.camel@two.research.nokia.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 139 bytes --]
Hi,
The attached patch adds support for ECC hardware that generates 12 bytes
of ECC per 2048 bytes of data.
Please apply.
Cheers,
Juha
[-- Attachment #2: mtd-nand-hw-ecc-2048.diff --]
[-- Type: text/x-patch, Size: 2905 bytes --]
===== include/linux/mtd/nand.h 1.6 vs edited =====
--- 1.6/include/linux/mtd/nand.h 2004-10-26 13:39:12 +03:00
+++ edited/include/linux/mtd/nand.h 2004-10-30 07:57:23 +03:00
@@ -138,6 +138,8 @@
#define NAND_ECC_HW6_512 4
/* Hardware ECC 8 byte ECC per 512 Byte data */
#define NAND_ECC_HW8_512 6
+/* Hardware ECC 12 byte ECC per 2048 Byte data */
+#define NAND_ECC_HW12_2048 7
/*
* Constants for Hardware ECC
===== drivers/mtd/nand/nand_base.c 1.11 vs edited =====
--- 1.11/drivers/mtd/nand/nand_base.c 2004-10-26 13:39:12 +03:00
+++ edited/drivers/mtd/nand/nand_base.c 2004-10-31 21:06:36 +02:00
@@ -840,7 +840,10 @@
}
this->write_buf(mtd, this->data_poi, mtd->oobblock);
break;
-
+
+ /* Hardware ECC 12 byte / 2048 byte data */
+ case NAND_ECC_HW12_2048:
+ eccbytes += 4;
/* Hardware ecc 8 byte / 512 byte data */
case NAND_ECC_HW8_512:
eccbytes += 2;
@@ -1099,6 +1102,9 @@
case NAND_ECC_HW8_512: /* Hardware ECC 8 byte / 512 byte data */
eccbytes = 8;
break;
+ case NAND_ECC_HW12_2048: /* Hardware ECC 8 byte / 512 byte data */
+ eccbytes = 12;
+ break;
case NAND_ECC_NONE:
compareecc = 0;
break;
@@ -1164,13 +1170,14 @@
for (i = 0, datidx = 0; eccsteps; eccsteps--, i+=3, datidx += ecc)
this->calculate_ecc(mtd, &data_poi[datidx], &ecc_calc[i]);
break;
-
- case NAND_ECC_HW3_256: /* Hardware ECC 3 byte /256 byte data */
- case NAND_ECC_HW3_512: /* Hardware ECC 3 byte /512 byte data */
+
+ case NAND_ECC_HW12_2048: /* Hardware ECC 12 byte / 2048 byte data */
+ case NAND_ECC_HW3_256: /* Hardware ECC 3 byte / 256 byte data */
+ case NAND_ECC_HW3_512: /* Hardware ECC 3 byte / 512 byte data */
case NAND_ECC_HW6_512: /* Hardware ECC 6 byte / 512 byte data */
case NAND_ECC_HW8_512: /* Hardware ECC 8 byte / 512 byte data */
for (i = 0, datidx = 0; eccsteps; eccsteps--, i+=eccbytes, datidx += ecc) {
- this->enable_hwecc(mtd, NAND_ECC_READ);
+ this->enable_hwecc(mtd, NAND_ECC_READ);
this->read_buf(mtd, &data_poi[datidx], ecc);
/* HW ecc with syndrome calculation must read the
@@ -2435,6 +2442,17 @@
this->eccsize = 256; /* set default eccsize */
switch (this->eccmode) {
+ case NAND_ECC_HW12_2048:
+ if (mtd->oobblock < 2048) {
+ printk(KERN_WARNING "2048 byte HW ECC not possible on %d byte page size, fallback to SW ECC\n",
+ mtd->oobblock);
+ this->eccmode = NAND_ECC_SOFT;
+ this->calculate_ecc = nand_calculate_ecc;
+ this->correct_data = nand_correct_data;
+ break;
+ } else
+ this->eccsize = 2048;
+ break;
case NAND_ECC_HW3_512:
case NAND_ECC_HW6_512:
@@ -2473,6 +2491,9 @@
/* Set the number of read / write steps for one page to ensure ECC generation */
switch (this->eccmode) {
+ case NAND_ECC_HW12_2048:
+ this->eccsteps = mtd->oobblock / 2048;
+ break;
case NAND_ECC_HW3_512:
case NAND_ECC_HW6_512:
case NAND_ECC_HW8_512:
reply other threads:[~2004-11-01 7:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1099295208.10601.8.camel@two.research.nokia.com \
--to=juha.yrjola@nokia.com \
--cc=linux-mtd@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