[PATCH V4 2/5] mtd: nand: mxs_nand_spl: Fix bad block skipping

sbabic at denx.de sbabic at denx.de
Fri May 20 15:43:51 CEST 2022


> 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 at nxp.com>
> Cc: Fabio Estevam <festevam at gmail.com>
> Acked-by: Han Xu <han.xu at nxp.com>
> Tested-By: Tim Harvey <tharvey at gateworks.com>
> Signed-off-by: Michael Trimarchi <michael at amarulasolutions.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================


More information about the U-Boot mailing list