From: Ilko Iliev <iliev@ronetix.at>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] - fix "nand erase clean" problem
Date: Sun, 26 Oct 2008 17:48:47 +0100 [thread overview]
Message-ID: <49049F6F.4070707@ronetix.at> (raw)
With this patch "nand erase clean" writes correctly the cleanmarkers.
Without this patch "nand erase clean" fills the OOB with zeros which
marks all blocks as bad.
Signed-off-by: Ilko Iliev <iliev@ronetix.at>
---
drivers/mtd/nand/nand_util.c | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
index 52b3d21..a601772 100644
--- a/drivers/mtd/nand/nand_util.c
+++ b/drivers/mtd/nand/nand_util.c
@@ -156,10 +156,19 @@ int nand_erase_opts(nand_info_t *meminfo, const
nand_erase_options_t *opts)
/* format for JFFS2 ? */
if (opts->jffs2) {
- chip->ops.len = chip->ops.ooblen = 64;
+ if ( chip->ecc.layout->oobfree->length <
cleanmarker.totlen ) {
+ memset(buf, 0xFF, sizeof(buf));
+ chip->ops.oobbuf = buf;
+ chip->ops.ooboffs = chip->badblockpos &
~0x01;
+ chip->ops.len = chip->ops.ooblen =
meminfo->oobsize;
+ }
+ else {
+ chip->ops.oobbuf = (uint8_t *)&cleanmarker;
+ chip->ops.ooboffs =
chip->ecc.layout->oobfree->offset;
+ chip->ops.len = chip->ops.ooblen =
cleanmarker.totlen;
+ }
+
chip->ops.datbuf = NULL;
- chip->ops.oobbuf = buf;
- chip->ops.ooboffs = chip->badblockpos & ~0x01;
result = meminfo->write_oob(meminfo,
erase.addr +
meminfo->oobsize,
@@ -170,7 +179,8 @@ int nand_erase_opts(nand_info_t *meminfo, const
nand_erase_options_t *opts)
continue;
}
else
- printf("%s: MTD writeoob at
0x%08x\n",mtd_device, erase.addr + meminfo->oobsize );
+ MTDDEBUG (MTD_DEBUG_LEVEL3, "%s: MTD
writeoob at 0x%08x\n",
+ mtd_device, erase.addr +
meminfo->oobsize );
}
if (!opts->quiet) {
@@ -189,12 +199,13 @@ int nand_erase_opts(nand_info_t *meminfo, const
nand_erase_options_t *opts)
if (percent != percent_complete) {
percent_complete = percent;
- printf("\rErasing at 0x%x -- %3d%%
complete.",
- erase.addr, percent);
+ printf("\rErasing %sat 0x%x -- %3d%%
complete.",
+ opts->jffs2 ? "and writing
cleanmarker ": "",
+ erase.addr, percent);
if (opts->jffs2 && result == 0)
- printf(" Cleanmarker written at 0x%x.",
- erase.addr);
+ MTDDEBUG (MTD_DEBUG_LEVEL3, "
Cleanmarker written at 0x%x.",
+ erase.addr);
}
}
}
--
1.5.2.2
--
Mit freundlichen Gr??en/With best regards,
Ilko Iliev
Ronetix Development Tools GmbH
CPU Modules, JTAG/BDM Emulators and Flash Programmers
Waidhausenstrasse 13/5, 1140 Vienna, Austria
E-Mail: iliev at ronetix.at; Web: www.ronetix.at
next reply other threads:[~2008-10-26 16:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-26 16:48 Ilko Iliev [this message]
2008-10-27 18:50 ` [U-Boot] [PATCH] - fix "nand erase clean" problem Scott Wood
2008-10-27 19:39 ` Ilko Iliev
2008-10-27 19:49 ` Scott Wood
2008-10-28 10:45 ` Ilko Iliev
2008-10-28 16:55 ` Scott Wood
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=49049F6F.4070707@ronetix.at \
--to=iliev@ronetix.at \
--cc=u-boot@lists.denx.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