diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2016-10-25 19:00:14 -0700 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2016-11-21 14:29:57 +0100 |
commit | a888b5b88f078c8aaf1772f4eaa48f9625e78983 (patch) | |
tree | 785077bb25f7db9e6e05fe6ffc7d5442fc3c230f | |
parent | 95b2e908c6aecaefccbad3f3fa808f8ffe1b3a92 (diff) |
nand: force BBT scan for controllers which need it
Commit 35c204d8a9d0 ("nand: reinstate lazy bad block scanning")
introduced lazy BBT scanning. However, some controller do parts
of the initialization (mxs_nand.c) during scan_bbt, hence for
those controllers the BBT must be scanned at initialization time.
Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r-- | drivers/mtd/nand/mxs_nand.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 5 | ||||
-rw-r--r-- | include/linux/mtd/nand.h | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c index 7f6351fa69..87c62c4bcb 100644 --- a/drivers/mtd/nand/mxs_nand.c +++ b/drivers/mtd/nand/mxs_nand.c @@ -1250,7 +1250,7 @@ int board_nand_init(struct nand_chip *nand) memset(&fake_ecc_layout, 0, sizeof(fake_ecc_layout)); nand->priv = nand_info; - nand->options |= NAND_NO_SUBPAGE_WRITE; + nand->options |= NAND_NO_SUBPAGE_WRITE | NAND_NEED_BBTSCAN; nand->cmd_ctrl = mxs_nand_cmd_ctrl; diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index c0e381ad2d..cbe083f988 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -4256,6 +4256,11 @@ int nand_scan_tail(struct mtd_info *mtd) if (!mtd->bitflip_threshold) mtd->bitflip_threshold = mtd->ecc_strength; + if (chip->options & NAND_NEED_BBTSCAN) { + chip->options |= NAND_BBT_SCANNED; + return chip->scan_bbt(mtd); + } + return 0; } EXPORT_SYMBOL(nand_scan_tail); diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 528266b498..130c3ae79b 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -222,6 +222,8 @@ typedef enum { * before calling nand_scan_tail. */ #define NAND_BUSWIDTH_AUTO 0x00080000 +/* Chip needs BBT scan */ +#define NAND_NEED_BBTSCAN 0x00200000 /* Options set by nand scan */ /* bbt has already been read */ |