]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spl: fit: nand: skip bad block handling if NAND chip not fully defined
authorTim Harvey <tharvey@gateworks.com>
Mon, 1 Mar 2021 22:33:27 +0000 (14:33 -0800)
committerStefano Babic <sbabic@denx.de>
Thu, 8 Apr 2021 18:29:53 +0000 (20:29 +0200)
commit 9f6a14c47ff9 ("spl: fit: nand: fix fit loading in case of bad blocks")
added support for adjusting the image offset to account for bad blocks.
However this requires nand_spl_adjust_offset() which requires fully defined
specifics of the NAND chip being used may not be avialable.

Allow skipping this support for drivers or configs which don't specify
the NAND chip details statically with defines.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
common/spl/spl_nand.c

index d13a5245974fedb0f3dd0b639f9645d8284be8e2..8213836df4076fcd8f9020d5e5275a62f871d370 100644 (file)
@@ -42,11 +42,13 @@ static int spl_nand_load_image(struct spl_image_info *spl_image,
 static ulong spl_nand_fit_read(struct spl_load_info *load, ulong offs,
                               ulong size, void *dst)
 {
-       ulong sector;
        int err;
+#ifdef CONFIG_SYS_NAND_BLOCK_SIZE
+       ulong sector;
 
        sector = *(int *)load->priv;
        offs = sector + nand_spl_adjust_offset(sector, offs - sector);
+#endif
        err = nand_spl_load_image(offs, size, dst);
        if (err)
                return 0;