[PATCH v2 2/2] spl: spl_nor: add spl_boot_device parameter to spl_nor_get_uboot_base()
Mario Kicherer
dev at kicherer.org
Thu Jan 19 16:28:22 CET 2023
With this additional parameter, a board-specific implementation of this
function can return an alternative address in case booting from the first
address in the NOR flash fails.
Signed-off-by: Mario Kicherer <dev at kicherer.org>
---
arch/arm/mach-imx/image-container.c | 2 +-
arch/mips/mach-mtmips/mt7621/spl/spl.c | 2 +-
arch/mips/mach-mtmips/spl.c | 2 +-
common/spl/spl_nor.c | 10 +++++-----
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-imx/image-container.c b/arch/arm/mach-imx/image-container.c
index 0e76786482..41fb9470a4 100644
--- a/arch/arm/mach-imx/image-container.c
+++ b/arch/arm/mach-imx/image-container.c
@@ -243,7 +243,7 @@ uint32_t spl_nand_get_uboot_raw_page(void)
#endif
#ifdef CONFIG_SPL_NOR_SUPPORT
-unsigned long spl_nor_get_uboot_base(void)
+unsigned long spl_nor_get_uboot_base(struct spl_boot_device *bootdev)
{
int end;
diff --git a/arch/mips/mach-mtmips/mt7621/spl/spl.c b/arch/mips/mach-mtmips/mt7621/spl/spl.c
index aa5b267bb9..76719ad2f6 100644
--- a/arch/mips/mach-mtmips/mt7621/spl/spl.c
+++ b/arch/mips/mach-mtmips/mt7621/spl/spl.c
@@ -61,7 +61,7 @@ void board_boot_order(u32 *spl_boot_list)
#endif
}
-unsigned long spl_nor_get_uboot_base(void)
+unsigned long spl_nor_get_uboot_base(struct spl_boot_device *bootdev)
{
const struct tpl_info *tpli;
const struct legacy_img_hdr *hdr;
diff --git a/arch/mips/mach-mtmips/spl.c b/arch/mips/mach-mtmips/spl.c
index fe5b49e702..ac7ca20027 100644
--- a/arch/mips/mach-mtmips/spl.c
+++ b/arch/mips/mach-mtmips/spl.c
@@ -34,7 +34,7 @@ void board_boot_order(u32 *spl_boot_list)
spl_boot_list[0] = BOOT_DEVICE_NOR;
}
-unsigned long spl_nor_get_uboot_base(void)
+unsigned long spl_nor_get_uboot_base(struct spl_boot_device *bootdev)
{
void *uboot_base = __image_copy_end;
diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
index 5e8b3bf621..e2ec2b9edf 100644
--- a/common/spl/spl_nor.c
+++ b/common/spl/spl_nor.c
@@ -17,7 +17,7 @@ static ulong spl_nor_load_read(struct spl_load_info *load, ulong sector,
return count;
}
-unsigned long __weak spl_nor_get_uboot_base(void)
+unsigned long __weak spl_nor_get_uboot_base(struct spl_boot_device *bootdev)
{
return CONFIG_SYS_UBOOT_BASE;
}
@@ -91,13 +91,13 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
* defined location in SDRAM
*/
#ifdef CONFIG_SPL_LOAD_FIT
- header = (const struct legacy_img_hdr *)spl_nor_get_uboot_base();
+ header = (const struct legacy_img_hdr *)spl_nor_get_uboot_base(bootdev);
if (image_get_magic(header) == FDT_MAGIC) {
debug("Found FIT format U-Boot\n");
load.bl_len = 1;
load.read = spl_nor_load_read;
return spl_load_simple_fit(spl_image, &load,
- spl_nor_get_uboot_base(),
+ spl_nor_get_uboot_base(bootdev),
(void *)header);
}
#endif
@@ -105,7 +105,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
load.bl_len = 1;
load.read = spl_nor_load_read;
return spl_load_imx_container(spl_image, &load,
- spl_nor_get_uboot_base());
+ spl_nor_get_uboot_base(bootdev));
}
/* Legacy image handling */
@@ -116,7 +116,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
load.read = spl_nor_load_read;
spl_nor_load_read(&load, spl_nor_get_uboot_base(bootdev), sizeof(hdr), &hdr);
return spl_load_legacy_img(spl_image, bootdev, &load,
- spl_nor_get_uboot_base(),
+ spl_nor_get_uboot_base(bootdev),
&hdr);
}
--
2.34.1
More information about the U-Boot
mailing list