public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Roman Tereshonkov <roman.tereshonkov@nokia.com>
To: linux-mtd@lists.infradead.org
Cc: kyungmin.park@samsung.com,
	Roman Tereshonkov <roman.tereshonkov@nokia.com>
Subject: [PATCH] mtd: onenand: add ecclayout and subpage_sft for none-flex 4kb page onenand
Date: Mon,  4 Apr 2011 14:07:04 +0300	[thread overview]
Message-ID: <1301915224-7571-1-git-send-email-roman.tereshonkov@nokia.com> (raw)

So as the ecclayout and suppage size for 4kb page
Flex- and none-Flex OneNAND are different
the new values for none-Flex 4kb page OneNAND memory are added.

The introduced ecclayout and suppage size are based on specification
4Gb M-die OneNAND Flash (KFM4G16Q4M, KFN8G16Q4M). Rev. 1.3, Apr. 2010

Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>
---
 drivers/mtd/onenand/onenand_base.c |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 56a8b20..9b53feb 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -87,6 +87,30 @@ static struct nand_ecclayout onenand_oob_128 = {
 };
 
 /**
+ *  onenand_oob_128 - oob info for OneNAND with 4KB page
+ *  and using reserved bytes as free bytes instead of
+ *  free bytes that are managed by ECC.
+ *  For now, we expose only 64 out of 72 ecc bytes
+ */
+static struct nand_ecclayout onenand_oob_128_none_flex = {
+	.eccbytes	= 64,
+	.eccpos		= {
+		7, 8, 9, 10, 11, 12, 13, 14, 15,
+		23, 24, 25, 26, 27, 28, 29, 30, 31,
+		39, 40, 41, 42, 43, 44, 45, 46, 47,
+		55, 56, 57, 58, 59, 60, 61, 62, 63,
+		71, 72, 73, 74, 75, 76, 77, 78, 79,
+		87, 88, 89, 90, 91, 92, 93, 94, 95,
+		103, 104, 105, 106, 107, 108, 109, 110, 111,
+		119
+	},
+	.oobfree	= {
+		{5, 2}, {21, 2}, {37, 2}, {53, 2},
+		{69, 2}, {85, 2}, {101, 2}, {117, 2}
+	}
+};
+
+/**
  * onenand_oob_64 - oob info for large (2KB) page
  */
 static struct nand_ecclayout onenand_oob_64 = {
@@ -4018,8 +4042,13 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
 	 */
 	switch (mtd->oobsize) {
 	case 128:
-		this->ecclayout = &onenand_oob_128;
-		mtd->subpage_sft = 0;
+		if (FLEXONENAND(this)) {
+			this->ecclayout = &onenand_oob_128;
+			mtd->subpage_sft = 0;
+		} else {
+			this->ecclayout = &onenand_oob_128_none_flex;
+			mtd->subpage_sft = 2;
+		}
 		break;
 	case 64:
 		this->ecclayout = &onenand_oob_64;
-- 
1.7.0.4

             reply	other threads:[~2011-04-04 11:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-04 11:07 Roman Tereshonkov [this message]
2011-04-04 11:56 ` [PATCH] mtd: onenand: add ecclayout and subpage_sft for none-flex 4kb page onenand Artem Bityutskiy

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=1301915224-7571-1-git-send-email-roman.tereshonkov@nokia.com \
    --to=roman.tereshonkov@nokia.com \
    --cc=kyungmin.park@samsung.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