]> git.baikalelectronics.ru Git - uboot.git/commitdiff
spl: spl_nand: Fix bad block handling in fitImage
authorMichael Trimarchi <michael@amarulasolutions.com>
Sun, 15 May 2022 09:35:33 +0000 (11:35 +0200)
committerStefano Babic <sbabic@denx.de>
Fri, 20 May 2022 10:36:48 +0000 (12:36 +0200)
If the fitImage has some bad block in fit image area, the
offset must be recalulcated. This should be done always.
After implementing it in mxs now is possible to call the function
even for that platform.

Cc: Fabio Estevam <festevam@gmail.com>
Tested-By: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
common/spl/spl_nand.c

index fc61b447a52e06a9d03f770d7361db8005f1adc0..82a10ffa63aa7cb5ca64c249c27926f466851ccf 100644 (file)
@@ -43,15 +43,12 @@ static ulong spl_nand_fit_read(struct spl_load_info *load, ulong offs,
                               ulong size, void *dst)
 {
        int err;
-#ifdef CONFIG_SYS_NAND_BLOCK_SIZE
        ulong sector;
 
        sector = *(int *)load->priv;
-       offs = sector + nand_spl_adjust_offset(sector, offs - sector);
-#else
        offs *= load->bl_len;
        size *= load->bl_len;
-#endif
+       offs = sector + nand_spl_adjust_offset(sector, offs - sector);
        err = nand_spl_load_image(offs, size, dst);
        if (err)
                return 0;