From: Mario Kicherer <dev@kicherer.org>
To: u-boot@lists.denx.de
Cc: sbabic@denx.de, festevam@gmail.com, uboot-imx@nxp.com,
daniel.schwierzeck@gmail.com, weijie.gao@mediatek.com,
GSS_MTK_Uboot_upstream@mediatek.com, rick@andestech.com,
ycliang@andestech.com, Mario Kicherer <dev@kicherer.org>
Subject: [PATCH v2 2/2] spl: spl_nor: add spl_boot_device parameter to spl_nor_get_uboot_base()
Date: Thu, 19 Jan 2023 16:28:22 +0100 [thread overview]
Message-ID: <20230119152822.1214202-3-dev@kicherer.org> (raw)
In-Reply-To: <20230119152822.1214202-1-dev@kicherer.org>
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@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
prev parent reply other threads:[~2023-01-19 17:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-19 15:28 [PATCH v2 0/2] spl: spl_nor: add alternative SPL_LOAD_IMAGE_METHOD Mario Kicherer
2023-01-19 15:28 ` [PATCH v2 1/2] spl: spl_nor: add BOOT_DEVICE_NOR2 as " Mario Kicherer
2023-01-26 19:17 ` Tom Rini
2023-01-27 16:56 ` Mario Kicherer
2023-01-27 17:10 ` Tom Rini
2023-01-27 17:55 ` Mario Kicherer
2023-01-27 17:58 ` Tom Rini
2023-01-30 10:17 ` Mario Kicherer
2023-01-19 15:28 ` Mario Kicherer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230119152822.1214202-3-dev@kicherer.org \
--to=dev@kicherer.org \
--cc=GSS_MTK_Uboot_upstream@mediatek.com \
--cc=daniel.schwierzeck@gmail.com \
--cc=festevam@gmail.com \
--cc=rick@andestech.com \
--cc=sbabic@denx.de \
--cc=u-boot@lists.denx.de \
--cc=uboot-imx@nxp.com \
--cc=weijie.gao@mediatek.com \
--cc=ycliang@andestech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox