public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Steve Tsai" <startec@ms11.hinet.net>
To: <tglx@linutronix.de>
Cc: "Linux MTD mailing list" <linux-mtd@lists.infradead.org>
Subject: RE: ECC in Nand_write_page
Date: Fri, 12 Jul 2002 14:58:26 +0800	[thread overview]
Message-ID: <000601c22971$86a72760$5501a8c0@synso.com.tw> (raw)
In-Reply-To: <0GZ400FB0H66SJ@smtp-out.bhp.t-online.de>

Hi,
I am using 20020619 and JFFS2 file system. I did not set the following
option. Will it cause the error? Thanks.

CONFIG_MTD_NAND_ECC_JFFS2=y
CONFIG_JFFS2_FS_NAND=y

Steve Tsai

-----Original Message-----
From: linux-mtd-admin@lists.infradead.org
[mailto:linux-mtd-admin@lists.infradead.org] On Behalf Of Thomas
Gleixner
Sent: Friday, July 12, 2002 2:12 PM
To: Steve Tsai; Linux MTD mailing list
Subject: Re: ECC in Nand_write_page


On Thursday, 11. July 2002 12:19, Steve Tsai wrote:
> The board I used will display the message, "nand_write_ecc: Failed ECC

> write", so I try to trace the function nand_write_ecc, I found it can 
> not write the ECC code into OOB sometime because the ECC in OOB are 
> not set as 0xff. There are two conditions to cause the problem, one 
> condition is the erase does not success, another condition is that the

> page  was written before. Nand_write_page could write partial page to 
> the flash. Does it cause the ECC in OOB was written and ECC can not be

> written next time. For example, nand_write_page write 100 byte the 
> first time and if it want to write 412 bytes to the same page next 
> time, it will fail. Does anyone have this problem?

Do you use latest CVS code ?
Which filesystem do you use ?
There's only JFFS2, which can handle the nand problem correct.

Read http://www.linux-mtd.infradead.org/tech/nand.html !

1. If an erase fails, the JFFS2 does not use this block.

2. JFFS2 writes only full pages

3. ECC is definitely not written, if you write 100 bytes

	/* Calculate and write the ECC if we have enough data */
	if ((col < mtd->eccsize) && (last >= mtd->eccsize)) {
		nand_calculate_ecc (&this->data_buf[0], &(ecc_code[0]));
		for (i = 0; i < 3; i++)
			this->data_buf[(mtd->oobblock +
oob_config.ecc_pos[i])] = ecc_code[i];
		if (oob_config.eccvalid_pos != -1)
			this->data_buf[mtd->oobblock +
oob_config.eccvalid_pos] = 0xf0;
	}

	/* Calculate and write the second ECC if we have enough data */
	if ((mtd->oobblock == 512) && (last == mtd->oobblock)) {
		nand_calculate_ecc (&this->data_buf[256],
&(ecc_code[3]));
		for (i = 3; i < 6; i++)
			this->data_buf[(mtd->oobblock +
oob_config.ecc_pos[i])] = ecc_code[i];
		if (oob_config.eccvalid_pos != -1)
			this->data_buf[mtd->oobblock +
oob_config.eccvalid_pos] &= 0x0f;
	}


-- 
Thomas
___________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx@linutronix.de

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

      reply	other threads:[~2002-07-12  6:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-11 10:19 ECC in Nand_write_page Steve Tsai
2002-07-11 13:25 ` Ken Offer
2002-07-12  2:39   ` Steve Tsai
2002-07-12 12:30     ` Jörn Engel
2002-07-12  6:11 ` Thomas Gleixner
2002-07-12  6:58   ` Steve Tsai [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='000601c22971$86a72760$5501a8c0@synso.com.tw' \
    --to=startec@ms11.hinet.net \
    --cc=linux-mtd@lists.infradead.org \
    --cc=tglx@linutronix.de \
    /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