[U-Boot] [PATCH 1/5] NAND: Really ignore bad blocks when scrubbing

Scott Wood
2011-09-27T18:54:08Z

On Mon, Sep 12, 2011 at 06:04:06AM +0200, Marek Vasut wrote:
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> Cc: Scott Wood <scottwood@freescale.com>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Detlev Zundel <dzu@denx.de>
> ---
> drivers/mtd/nand/nand_base.c | 2 +-
> drivers/mtd/nand/nand_util.c | 22 +++++-----------------
> include/linux/mtd/mtd.h | 1 +
> 3 files changed, 7 insertions(+), 18 deletions(-)

Applied to u-boot-nand-flash next with this change to remove the
chip/priv_nand redundancy:

diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
index 0c3b7f7..60c778e 100644
--- a/drivers/mtd/nand/nand_util.c
+++ b/drivers/mtd/nand/nand_util.c
@@ -79,7 +79,6 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
const char *mtd_device = meminfo->name;
struct mtd_oob_ops oob_opts;
struct nand_chip *chip = meminfo->priv;
- struct nand_chip *priv_nand = meminfo->priv;

if ((opts->offset & (meminfo->writesize - 1)) != 0) {
printf("Attempt to erase non page aligned data\n");
@@ -109,10 +108,10 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
* We don't need the bad block table anymore...
* after scrub, there are no bad blocks left!
*/
- if (priv_nand->bbt) {
- kfree(priv_nand->bbt);
+ if (chip->bbt) {
+ kfree(chip->bbt);
}
- priv_nand->bbt = NULL;
+ chip->bbt = NULL;
}

for (erased_length = 0;
@@ -197,7 +196,7 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
printf("\n");

if (opts->scrub)
- priv_nand->scan_bbt(meminfo);
+ chip->scan_bbt(meminfo);

return 0;
}

-Scott