From: Artem Bityutskiy <dedekind1@gmail.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: tglx@linutronix.de, linux-mtd@lists.infradead.org
Subject: Re: [PATCH 3/5] mtd/nand: add support for BBT without OOB
Date: Wed, 29 Sep 2010 23:11:04 +0300 [thread overview]
Message-ID: <1285791064.1776.35.camel@brekeke> (raw)
In-Reply-To: <1285782234-32509-4-git-send-email-bigeasy@linutronix.de>
On Wed, 2010-09-29 at 19:43 +0200, Sebastian Andrzej Siewior wrote:
> The first (sixt) byte in the OOB area contains vendor's bad block
> information. During identification of the NAND chip this information is
> collected by scanning the complete chip.
> The option NAND_USE_FLASH_BBT is used to store this information in a sector so
> we don't have to scan the complete flash. Unfortunately the code stores
> a marker, in order to recognize the BBT, in the OOB area. This will fail
> if the OOB area is completely used for ECC.
> This patch introduces the option NAND_USE_FLASH_BBT_NO_OOB which has to be
> used with NAND_USE_FLASH_BBT. It will then store BBT on flash without
> touching the OOB area. The BBT format on flash remains same except the
> first page starts with the recognition pattern followed by the no longer
> optional version byte.
> This change was tested in nandsim and on real HW with this issue.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> drivers/mtd/nand/nand_bbt.c | 193 ++++++++++++++++++++++++++++++++++++++++---
> include/linux/mtd/bbm.h | 2 +
> include/linux/mtd/nand.h | 7 +-
> 3 files changed, 189 insertions(+), 13 deletions(-)
Few minor things.
First, is it please possible to add more descriptive comment into the
code. Something like you put to the patch description, may be even a bit
more descriptive. May be to the header of nand_bbt.c?
The idea is that the BBT code is quite difficult to follow, and you make
it even more complex, so a comment describing various flavors of BBT
would be very useful.
And then several stylistic nitpicks.
> while (totlen) {
> +
> len = min(totlen, (size_t) (1 << this->bbt_erase_shift));
These extra whits spaces are not really needed. Ideally, your patch
should make checkpatch.pl happy.
> +
> + if (marker_len) {
> + /*
> + * In case the BBT marker is not in the OOB area it
> + * will be just in the first page
> + */
Yes, this is the right multi-line comment. You may also put a dot at the
end. But in other places you used not the right multi-line comments.
> + } else if (td->options & NAND_BBT_NO_OOB) {
> +
> + ooboffs = 0;
Extra blank line.
> + offs = td->len;
> + /* the version byte */
> + if (td->options & NAND_BBT_VERSION)
> + offs++;
> + /* Calc length */
> + len = (size_t) (numblocks >> sft);
> + len += offs;
> + /* Make it page aligned ! */
> + len = ALIGN(len, mtd->writesize);
> + /* Preset the buffer with 0xff */
> + memset(buf, 0xff, len);
> + /* Pattern is located at the begin of first page */
> + memcpy(buf, td->pattern, td->len);
> +
> } else {
And here.
> -/* Use a flash based bad block table. This option is passed to the
> - * default bad block table function. */
> +/* Use a flash based bad block table. OOB identifier is saved in OOB area.
> + * This option is passed to the default bad block table function. */
Would be nice to convert this to the right multi-line comment.
> #define NAND_USE_FLASH_BBT 0x00010000
> /* This option skips the bbt scan during initialization. */
> #define NAND_SKIP_BBTSCAN 0x00020000
> @@ -215,6 +215,9 @@ typedef enum {
> #define NAND_OWN_BUFFERS 0x00040000
> /* Chip may not exist, so silence any errors in scan */
> #define NAND_SCAN_SILENT_NODEV 0x00080000
> +/* If passed additionally to NAND_USE_FLASH_BBT then BBT code will not touch
> + * the OOB area */
And this. Yeah, I know this file uses different styles, but you could
convert even all of them.
> +#define NAND_USE_FLASH_BBT_NO_OOB 0x00100000
--
Best Regards,
Artem Bityutskiy (Битюцкий Артём)
next prev parent reply other threads:[~2010-09-29 20:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-29 17:43 Add support for BBT without touching OOB area Sebastian Andrzej Siewior
2010-09-29 17:43 ` [PATCH 1/5] mtd/nand: use ALIGN where possible Sebastian Andrzej Siewior
2010-09-29 17:43 ` [PATCH 2/5] mtd/nand: pull in td into read_bbt() Sebastian Andrzej Siewior
2010-09-29 17:43 ` [PATCH 3/5] mtd/nand: add support for BBT without OOB Sebastian Andrzej Siewior
2010-09-29 20:11 ` Artem Bityutskiy [this message]
2010-09-30 8:51 ` Sebastian Andrzej Siewior
2010-09-30 9:14 ` Artem Bityutskiy
2010-09-30 19:28 ` [PATCH v2] " Sebastian Andrzej Siewior
2010-10-01 18:56 ` Artem Bityutskiy
2010-09-29 17:43 ` [PATCH 4/5] mtd/nand: introduce NAND_CREATE_EMPTY_BBT Sebastian Andrzej Siewior
2010-10-01 18:57 ` Artem Bityutskiy
2010-10-01 19:37 ` [PATCH v2] " Sebastian Andrzej Siewior
2010-10-01 20:00 ` Artem Bityutskiy
2010-09-29 17:43 ` [PATCH 5/5] mtd/nandsim: add module param for BBT handling Sebastian Andrzej Siewior
2010-09-29 20:11 ` Add support for BBT without touching OOB area Artem Bityutskiy
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=1285791064.1776.35.camel@brekeke \
--to=dedekind1@gmail.com \
--cc=bigeasy@linutronix.de \
--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 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.