summaryrefslogtreecommitdiff
path: root/common/spl
diff options
context:
space:
mode:
authorSean Anderson <seanga2@gmail.com>2023-11-08 11:48:44 -0500
committerTom Rini <trini@konsulko.com>2023-11-16 13:49:14 -0500
commit0ddfa868ba45903babf19039c80dfeb1503f9001 (patch)
tree403462d26e20e539b24a66cab28bc0d1c9b053e7 /common/spl
parent5271e359a46cc6a60d0048576326e2fa1527f231 (diff)
downloadu-boot-0ddfa868ba45903babf19039c80dfeb1503f9001.tar.gz
u-boot-0ddfa868ba45903babf19039c80dfeb1503f9001.tar.bz2
u-boot-0ddfa868ba45903babf19039c80dfeb1503f9001.zip
spl: nand: Remove spl_nand_legacy_read
Now that spl_nand_fit_read works in units of bytes, it can be combined with spl_nand_legacy_read. Rename the resulting function spl_nand_read, since it is no longer FIT-specific. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/spl')
-rw-r--r--common/spl/spl_nand.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index 281211b7f2..91fa7674f1 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -42,29 +42,22 @@ static int spl_nand_load_image(struct spl_image_info *spl_image,
}
#else
-static ulong spl_nand_fit_read(struct spl_load_info *load, ulong offs,
- ulong size, void *dst)
+__weak u32 nand_spl_adjust_offset(u32 sector, u32 offs)
{
- int err;
- ulong sector;
-
- sector = *(int *)load->priv;
- offs = sector + nand_spl_adjust_offset(sector, offs - sector);
- err = nand_spl_load_image(offs, size, dst);
- if (err)
- return 0;
-
- return size;
+ return offs;
}
-static ulong spl_nand_legacy_read(struct spl_load_info *load, ulong offs,
- ulong size, void *dst)
+static ulong spl_nand_read(struct spl_load_info *load, ulong offs, ulong size,
+ void *dst)
{
int err;
+ ulong sector;
debug("%s: offs %lx, size %lx, dst %p\n",
__func__, offs, size, dst);
+ sector = *(int *)load->priv;
+ offs = sector + nand_spl_adjust_offset(sector, offs - sector);
err = nand_spl_load_image(offs, size, dst);
if (err)
return 0;
@@ -91,7 +84,7 @@ static int spl_nand_load_element(struct spl_image_info *spl_image,
debug("Found FIT\n");
load.priv = &offset;
spl_set_bl_len(&load, bl_len);
- load.read = spl_nand_fit_read;
+ load.read = spl_nand_read;
return spl_load_simple_fit(spl_image, &load, offset, header);
} else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER) &&
valid_container_hdr((void *)header)) {
@@ -99,16 +92,16 @@ static int spl_nand_load_element(struct spl_image_info *spl_image,
load.priv = &offset;
spl_set_bl_len(&load, bl_len);
- load.read = spl_nand_fit_read;
+ load.read = spl_nand_read;
return spl_load_imx_container(spl_image, &load, offset);
} else if (IS_ENABLED(CONFIG_SPL_LEGACY_IMAGE_FORMAT) &&
image_get_magic(header) == IH_MAGIC) {
struct spl_load_info load;
debug("Found legacy image\n");
+ load.priv = &offset;
spl_set_bl_len(&load, IS_ENABLED(CONFIG_SPL_LZMA) ? bl_len : 1);
- load.read = spl_nand_legacy_read;
-
+ load.read = spl_nand_read;
return spl_load_legacy_img(spl_image, bootdev, &load, offset, header);
} else {
err = spl_parse_image_header(spl_image, bootdev, header);