Commit fb49454b1b6c7c6e238ac3c0b1e302e73eb1a1ea

Authored by Scott Wood
1 parent 1f7b1743d3
Exists in master and in 55 other branches 8qm-imx_v2020.04_5.4.70_2.3.0, emb_lf_v2022.04, emb_lf_v2023.04, imx_v2015.04_4.1.15_1.0.0_ga, pitx_8mp_lf_v2020.04, smarc-8m-android-10.0.0_2.6.0, smarc-8m-android-11.0.0_2.0.0, smarc-8mp-android-11.0.0_2.0.0, smarc-emmc-imx_v2014.04_3.10.53_1.1.0_ga, smarc-emmc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx-l5.0.0_1.0.0-ga, smarc-imx6_v2018.03_4.14.98_2.0.0_ga, smarc-imx7_v2017.03_4.9.11_1.0.0_ga, smarc-imx7_v2018.03_4.14.98_2.0.0_ga, smarc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx_v2015.04_4.1.15_1.0.0_ga, smarc-imx_v2017.03_4.9.11_1.0.0_ga, smarc-imx_v2017.03_4.9.88_2.0.0_ga, smarc-imx_v2017.03_o8.1.0_1.3.0_8m, smarc-imx_v2018.03_4.14.78_1.0.0_ga, smarc-m6.0.1_2.1.0-ga, smarc-n7.1.2_2.0.0-ga, smarc-rel_imx_4.1.15_2.0.0_ga, smarc_8m-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8m-imx_v2019.04_4.19.35_1.1.0, smarc_8m_00d0-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2019.04_4.19.35_1.1.0, smarc_8mm-imx_v2020.04_5.4.24_2.1.0, smarc_8mp_lf_v2020.04, smarc_8mq-imx_v2020.04_5.4.24_2.1.0, smarc_8mq_lf_v2020.04, ti-u-boot-2015.07, u-boot-2013.01.y, v2013.10, v2013.10-smarct33, v2013.10-smartmen, v2014.01, v2014.04, v2014.04-smarct33, v2014.04-smarct33-emmc, v2014.04-smartmen, v2014.07, v2014.07-smarct33, v2014.07-smartmen, v2015.07-smarct33, v2015.07-smarct33-emmc, v2015.07-smarct4x, v2016.05-dlt, v2016.05-smarct3x, v2016.05-smarct3x-emmc, v2016.05-smarct4x, v2017.01-smarct3x, v2017.01-smarct3x-emmc, v2017.01-smarct4x

nand: reinstate lazy bad block scanning

commit 2a8e0fc8b3dc31a3c571e439fbf04b882c8986be ("nand: Merge changes
from Linux nand driver") accidentally reverted commit
13f0fd94e3cae6f8a0d9fba5d367e311edc8ebde ("NAND: Scan bad blocks
lazily.").

Reinstate the change, as amended by commit
ff49ea8977b56916edd5b1766d9939010e30b181 ("NAND: Mark the BBT as scanned
prior to calling scan_bbt.").

Signed-off-by: Scott Wood <scottwood@freescale.com>

Showing 2 changed files with 9 additions and 3 deletions Side-by-side Diff

drivers/mtd/nand/nand_base.c
... ... @@ -479,6 +479,11 @@
479 479 {
480 480 struct nand_chip *chip = mtd->priv;
481 481  
  482 + if (!(chip->options & NAND_BBT_SCANNED)) {
  483 + chip->options |= NAND_BBT_SCANNED;
  484 + chip->scan_bbt(mtd);
  485 + }
  486 +
482 487 if (!chip->bbt)
483 488 return chip->block_bad(mtd, ofs, getchip);
484 489  
485 490  
... ... @@ -3166,10 +3171,9 @@
3166 3171  
3167 3172 /* Check, if we should skip the bad block table scan */
3168 3173 if (chip->options & NAND_SKIP_BBTSCAN)
3169   - return 0;
  3174 + chip->options |= NAND_BBT_SCANNED;
3170 3175  
3171   - /* Build bad block table */
3172   - return chip->scan_bbt(mtd);
  3176 + return 0;
3173 3177 }
3174 3178  
3175 3179 /**
include/linux/mtd/nand.h
... ... @@ -232,6 +232,8 @@
232 232 #define NAND_CREATE_EMPTY_BBT 0x01000000
233 233  
234 234 /* Options set by nand scan */
  235 +/* bbt has already been read */
  236 +#define NAND_BBT_SCANNED 0x40000000
235 237 /* Nand scan has allocated controller struct */
236 238 #define NAND_CONTROLLER_ALLOC 0x80000000
237 239