* ECC in Nand_write_page @ 2002-07-11 10:19 Steve Tsai 2002-07-11 13:25 ` Ken Offer 2002-07-12 6:11 ` Thomas Gleixner 0 siblings, 2 replies; 6+ messages in thread From: Steve Tsai @ 2002-07-11 10:19 UTC (permalink / raw) To: Linux MTD mailing list 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? Steve Tsai ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ECC in Nand_write_page 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 6:11 ` Thomas Gleixner 1 sibling, 1 reply; 6+ messages in thread From: Ken Offer @ 2002-07-11 13:25 UTC (permalink / raw) To: Steve Tsai; +Cc: LinuxMTD On Thursday, July 11, 2002, at 05:19 AM, 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? I have read that some NAND memory devices can read partial pages but must write full pages. Could this be your problem? In such cases you might have to read the page, make a write to part of the page and then write out the modified full page. +-----------------------------------------------------------+ | Ken Offer koffer@arlut.utexas.edu ARL:UT | | Office: 512-835-3859 Fax: 512-835-3259 | +-----------------------------------------------------------+ ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: ECC in Nand_write_page 2002-07-11 13:25 ` Ken Offer @ 2002-07-12 2:39 ` Steve Tsai 2002-07-12 12:30 ` Jörn Engel 0 siblings, 1 reply; 6+ messages in thread From: Steve Tsai @ 2002-07-12 2:39 UTC (permalink / raw) To: 'Ken Offer'; +Cc: Linux MTD mailing list I don't think nand_write_page can write partial page, if someone enable ECC. For example, when I write the partial page to the page 100, it will write ECC code into the page also, but when I write the other data to the empty area of the same page, I can write data into the empty area of the page, but I can not write the ECC code, because the area storing ECC code was written at the previous time. Steve Tsai -----Original Message----- From: linux-mtd-admin@lists.infradead.org [mailto:linux-mtd-admin@lists.infradead.org] On Behalf Of Ken Offer Sent: Thursday, July 11, 2002 9:25 PM To: Steve Tsai Cc: LinuxMTD Subject: Re: ECC in Nand_write_page On Thursday, July 11, 2002, at 05:19 AM, 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? I have read that some NAND memory devices can read partial pages but must write full pages. Could this be your problem? In such cases you might have to read the page, make a write to part of the page and then write out the modified full page. +-----------------------------------------------------------+ | Ken Offer koffer@arlut.utexas.edu ARL:UT | | Office: 512-835-3859 Fax: 512-835-3259 | +-----------------------------------------------------------+ ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ECC in Nand_write_page 2002-07-12 2:39 ` Steve Tsai @ 2002-07-12 12:30 ` Jörn Engel 0 siblings, 0 replies; 6+ messages in thread From: Jörn Engel @ 2002-07-12 12:30 UTC (permalink / raw) To: Steve Tsai; +Cc: linux-mtd On Fri, 12 July 2002 10:39:36 +0800, Steve Tsai wrote: > I don't think nand_write_page can write partial page, if someone enable > ECC. For example, when I write the partial page to the page 100, it will > write ECC code into the page also, but when I write the other data to > the empty area of the same page, I can write data into the empty area > of the page, but I can not write the ECC code, because the area storing > ECC code was written at the previous time. You are right. I've had a similar problem with ECC flash lately - NOR flash, but the principle is the same. The ECC checksum is written to the flash. By writing the same page twice, the checksum would have to toggle some bits from 0 to 1, which is impossible for flash. Thus you have a constraint to write any given page but once between two erase cycles. Joern ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ECC in Nand_write_page 2002-07-11 10:19 ECC in Nand_write_page Steve Tsai 2002-07-11 13:25 ` Ken Offer @ 2002-07-12 6:11 ` Thomas Gleixner 2002-07-12 6:58 ` Steve Tsai 1 sibling, 1 reply; 6+ messages in thread From: Thomas Gleixner @ 2002-07-12 6:11 UTC (permalink / raw) To: Steve Tsai, Linux MTD mailing list 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: ECC in Nand_write_page 2002-07-12 6:11 ` Thomas Gleixner @ 2002-07-12 6:58 ` Steve Tsai 0 siblings, 0 replies; 6+ messages in thread From: Steve Tsai @ 2002-07-12 6:58 UTC (permalink / raw) To: tglx; +Cc: Linux MTD mailing list 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/ ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-07-12 12:31 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox