From: Ilko Iliev <iliev@ronetix.at>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] - fix "nand erase clean" problem
Date: Mon, 27 Oct 2008 20:39:17 +0100 [thread overview]
Message-ID: <490618E5.9080609@ronetix.at> (raw)
In-Reply-To: <20081027185006.GA3693@ld0162-tx32.am.freescale.net>
Dear Scott,
Scott Wood wrote:
> On Sun, Oct 26, 2008 at 05:48:47PM +0100, Ilko Iliev wrote:
>
>> 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 ) {
>>
>
> Patch is linewrapped. Also, no space after ( or before ).
>
I will send again with git-send-email.
> Why must the cleanmarker fit in the first free segment?
>
The Linux NAND driver looks for the cleanmarkers at this place.
>
>> + memset(buf, 0xFF, sizeof(buf));
>> + chip->ops.oobbuf = buf;
>> + chip->ops.ooboffs = chip->badblockpos &
>> ~0x01;
>> + chip->ops.len = chip->ops.ooblen =
>> meminfo->oobsize;
>>
>
> What if oobsize > 64 (as with 4k pages)? Why write anything at all if
> you're not going to write the cleanmarker? Why badblockpos & ~1 (I know
> existing code does it, but why)?
>
The current Linux NAND Flash driver supports 8, 16 and 64 bytes OOB.
The "badblockpos & ~1" is in the current file - I have no idea why.
>
>> + }
>> + else {
>>
>
> } else {
>
>
>> + chip->ops.oobbuf = (uint8_t *)&cleanmarker;
>> + chip->ops.ooboffs =
>> chip->ecc.layout->oobfree->offset;
>> + chip->ops.len = chip->ops.ooblen =
>> cleanmarker.totlen;
>> + }
>>
>
> Set ooboffs to zero, and use MTD_OOB_AUTO.
>
> -Scott
>
I think the NAND driver should work not only with MTD_OOB_AUTO.
--
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 prev parent reply other threads:[~2008-10-27 19:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-26 16:48 [U-Boot] [PATCH] - fix "nand erase clean" problem Ilko Iliev
2008-10-27 18:50 ` Scott Wood
2008-10-27 19:39 ` Ilko Iliev [this message]
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=490618E5.9080609@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.