public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Kyungmin Park <kyungmin.park@samsung.com>
To: Timo Teras <timo.teras@solidboot.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	David Woodhouse <dwmw2@infradead.org>
Subject: OneNAND: Update OOB free table
Date: Fri, 08 Dec 2006 00:11:06 +0000 (GMT)	[thread overview]
Message-ID: <1216089.366391165536680515.JavaMail.weblogic@ep_ml03> (raw)

Hi Timo Teras,

Yes, The OneNAND Spec. says these bytes are manged by internal ecc logic.
Acutually it means that when we write some data in this area. The ecc logic generates the ecc bytes automatically.
So even though we write 3 bytes. the OneNAND is written by 5 bytes (3 data bytes, 2 space ecc bytes).

I think we consider the whole spare area. if we don't use this area. we only have 8 bytes of 64 bytes in spare area.
If it makes misbehavior of JFFS2, we have alternative method turn off ecc logic when write oob area.

% original

 OOB Data: ff ff 85 19 03 ff ff ff ff ff ff 30 ff ff ff ff

% after patch

 OOB Data: ff ff 85 19 03 ff ff ff ff ff ff ff ff ff ff ff

Pleaes test this patch

Thank you,
Kyungmin Park

--

Index: drivers/mtd/onenand/onenand_base.c
===================================================================
RCS file: /cvsroot/linux-2.6.18-omap/drivers/mtd/onenand/onenand_base.c,v
retrieving revision 1.2
diff -u -p -r1.2 onenand_base.c
--- drivers/mtd/onenand/onenand_base.c	12 Oct 2006 06:59:27 -0000	1.2
+++ drivers/mtd/onenand/onenand_base.c	7 Dec 2006 23:51:01 -0000
@@ -924,6 +924,7 @@ static int onenand_do_write_oob(struct m
 	struct onenand_chip *this = mtd->priv;
 	int column, ret = 0;
 	int written = 0;
+	int syscfg;
 
 	DEBUG(MTD_DEBUG_LEVEL3, "onenand_write_oob: to = 0x%08x, len = %i\n", (unsigned int) to, (int) len);
 
@@ -939,6 +940,10 @@ static int onenand_do_write_oob(struct m
 	/* Grab the lock and see if the device is available */
 	onenand_get_device(mtd, FL_WRITING);
 
+	/* Turn off the ECC logic for spare area */
+	syscfg = this->read_word(this->base + ONENAND_REG_SYS_CFG1);
+	this->write_word(syscfg | ONENAND_SYS_CFG1_NO_ECC, this->base + ONENAND_REG_SYS_CFG1);
+
 	/* Loop until all data write */
 	while (written < len) {
 		int thislen = min_t(int, mtd->oobsize, len - written);
@@ -979,6 +984,8 @@ static int onenand_do_write_oob(struct m
 	}
 
 out:
+	/* Restore previous settings */
+	this->write_word(syscfg, this->base + ONENAND_REG_SYS_CFG1);
 	/* Deselect and wake up anyone waiting on the device */
 	onenand_release_device(mtd);
 



------- Original Message -------
Sender : Timo Teras<timo.teras@solidboot.com> 
Date   : Dec 07, 2006 19:13
Title  : [PATCH] OneNAND: Update OOB free table

Do not use bytes managed by OneNAND ECC logic for Logical Sector Number
data.

Signed-off-by: Timo Teras <timo.teras@solidboot.com>
---
The OneNAND specification says that the three bytes at offsets 2, 18, 34
and 50 are managed by internal ecc logic. The effect is obvious as
modifying these bytes, it also modifies ECC code for spare area.



             reply	other threads:[~2006-12-08  0:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-08  0:11 Kyungmin Park [this message]
2006-12-08  8:43 ` OneNAND: Update OOB free table Timo Teras
2006-12-11 12:20 ` Timo Teras
  -- strict thread matches above, loose matches on Subject: below --
2006-12-15  2:38 Kyungmin Park
2006-12-15  8:33 ` Timo Teras
2006-12-15 10:41 ` Artem Bityutskiy
2006-12-15 11:19   ` Timo Teras
2006-12-18  4:24 Kyungmin Park
2006-12-18 14:23 ` Artem Bityutskiy
2006-12-21 11:15 ` Artem Bityutskiy
2006-12-21 12:35   ` Artem Bityutskiy
2006-12-22  1:52 Kyungmin Park
2006-12-22  9:17 ` Artem Bityutskiy
2006-12-26  7:15 Kyungmin Park

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=1216089.366391165536680515.JavaMail.weblogic@ep_ml03 \
    --to=kyungmin.park@samsung.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=timo.teras@solidboot.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