mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 08:42:12 +02:00
spl: fit: nand: fix fit loading in case of bad blocks
The offset at which the image to be loaded from NAND is located is retrieved from the itb header. The presence of bad blocks in the area of the NAND where the itb image is located could invalidate the offset which must therefore be adjusted taking into account the state of the sectors concerned. cc: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Dario Binacchi <dariobin@libero.it> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
This commit is contained in:
@@ -42,8 +42,11 @@ 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 ret;
|
||||
|
||||
sector = *(int *)load->priv;
|
||||
offs = sector + nand_spl_adjust_offset(sector, offs - sector);
|
||||
ret = nand_spl_load_image(offs, size, dst);
|
||||
if (!ret)
|
||||
return size;
|
||||
@@ -66,7 +69,7 @@ static int spl_nand_load_element(struct spl_image_info *spl_image,
|
||||
|
||||
debug("Found FIT\n");
|
||||
load.dev = NULL;
|
||||
load.priv = NULL;
|
||||
load.priv = &offset;
|
||||
load.filename = NULL;
|
||||
load.bl_len = 1;
|
||||
load.read = spl_nand_fit_read;
|
||||
|
Reference in New Issue
Block a user