u-boot/drivers/mtd/nand
Michael Trimarchi a222c14792 mtd: nand: mxs_nand_spl: Fix bad block skipping
The specific implementation was having bug. Those bugs are since
the beginning of the implementation. Some manufactures can already
experience this bug in their SPL code. This bug can be more visible on
architecture that has complicated boot process like imx8mn. Older
version of uboot can be affected if the bad block
appear in correspoding of the beginning of u-boot image. In order to
adjust the function we scan from the first erase block.

The problematic part of old code was in this part:

while (is_badblock(mtd, offs, 1)) {
           page = page + nand_page_per_block;
          /* Check i we've reached the end of flash. */
          if (page >= mtd->size >> chip->page_shift) {
                      free(page_buf);
                      return -ENOMEM;
         }
}

Even we fix it adding increment of the offset of one erase block size
, we don't fix the problem, because the first erase block where the
image start is not checked. The code was tested on an imx8mn where
the boot rom api was not able to skip it. This code is used by other
architecures like imx6 and imx8mm

Cc: Han Xu <han.xu@nxp.com>
Cc: Fabio Estevam <festevam@gmail.com>
Acked-by: Han Xu <han.xu@nxp.com>
Tested-By: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2022-05-20 12:36:47 +02:00
..
raw mtd: nand: mxs_nand_spl: Fix bad block skipping 2022-05-20 12:36:47 +02:00
spi mtd: spinand: macronix: Fix ECC Status Read 2021-10-08 17:59:34 +05:30
bbt.c Fix corner case in bad block table handling. 2020-08-04 23:30:02 -04:00
core.c mtd: nand: Add WATCHDOG_RESET() in nanddev_mtd_erase() 2021-03-11 16:59:16 +01:00
Kconfig mtd: nand: Add core infrastructure to support SPI NANDs 2018-09-20 20:10:49 +05:30
Makefile mtd: Makefile: deep cleanup 2019-12-04 17:10:51 -05:00