mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: [PATCH 2/4] ARM: i.MX93: add destination argument to imx93_romapi_load_image()
Date: Wed, 30 Oct 2024 12:30:37 +0100	[thread overview]
Message-ID: <20241030-handoff-data-v1-2-4403e0c62c2a@pengutronix.de> (raw)
In-Reply-To: <20241030-handoff-data-v1-0-4403e0c62c2a@pengutronix.de>

Pass the destination address to imx93_romapi_load_image() rather
than hardcoding the destination to MX93_ATF_BL33_BASE_ADDR.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/tqma93xx/lowlevel.c |  1 -
 arch/arm/mach-imx/atf.c             |  2 ++
 arch/arm/mach-imx/romapi.c          | 11 +++++------
 include/mach/imx/romapi.h           |  2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boards/tqma93xx/lowlevel.c b/arch/arm/boards/tqma93xx/lowlevel.c
index 14733d52a3..cc5101a1a3 100644
--- a/arch/arm/boards/tqma93xx/lowlevel.c
+++ b/arch/arm/boards/tqma93xx/lowlevel.c
@@ -81,7 +81,6 @@ static noinline void tqma93xx_continue(void)
 			break;
 		}
 
-		imx93_romapi_load_image();
 		imx93_load_and_start_image_via_tfa();
 	}
 
diff --git a/arch/arm/mach-imx/atf.c b/arch/arm/mach-imx/atf.c
index 8b80460268..f4ba07bf06 100644
--- a/arch/arm/mach-imx/atf.c
+++ b/arch/arm/mach-imx/atf.c
@@ -395,6 +395,8 @@ void __noreturn imx93_load_and_start_image_via_tfa(void)
 	imx_set_cpu_type(IMX_CPU_IMX93);
 	imx93_init_scratch_space(true);
 
+	imx93_romapi_load_image(bl33);
+
 	/*
 	 * On completion the TF-A will jump to MX93_ATF_BL33_BASE_ADDR
 	 * in EL2. Copy the image there, but replace the PBL part of
diff --git a/arch/arm/mach-imx/romapi.c b/arch/arm/mach-imx/romapi.c
index 0f1555abad..155e706437 100644
--- a/arch/arm/mach-imx/romapi.c
+++ b/arch/arm/mach-imx/romapi.c
@@ -173,13 +173,12 @@ static int imx_romapi_boot_device_seekable(struct rom_api *rom_api)
 	return seekable;
 }
 
-int imx93_romapi_load_image(void)
+int imx93_romapi_load_image(void *adr)
 {
 	struct rom_api *rom_api = (void *)0x1980;
 	int ret;
 	int seekable;
 	uint32_t offset, image_offset;
-	void *bl33 = (void *)MX93_ATF_BL33_BASE_ADDR;
 	struct flash_header_v3 *fh;
 
 	OPTIMIZER_HIDE_VAR(rom_api);
@@ -190,7 +189,7 @@ int imx93_romapi_load_image(void)
 
 	if (!seekable) {
 		int align_size = ALIGN(barebox_pbl_size, 1024) - barebox_pbl_size;
-		void *pbl_size_aligned = bl33 + ALIGN(barebox_pbl_size, 1024);
+		void *pbl_size_aligned = adr + ALIGN(barebox_pbl_size, 1024);
 
 		/*
 		 * The USB protocol uploads in chunks of 1024 bytes. This means
@@ -209,11 +208,11 @@ int imx93_romapi_load_image(void)
 
 	pr_debug("%s: IVT offset on boot device: 0x%08x\n", __func__, offset);
 
-	ret = imx_romapi_load_seekable(rom_api, bl33, offset, 4096);
+	ret = imx_romapi_load_seekable(rom_api, adr, offset, 4096);
 	if (ret)
 		return ret;
 
-	fh = bl33;
+	fh = adr;
 
 	if (fh->tag != 0x87) {
 		pr_err("Invalid IVT header: 0x%02x, expected 0x87\n", fh->tag);
@@ -228,7 +227,7 @@ int imx93_romapi_load_image(void)
 	 * We assume the first image in the first container is the barebox image,
 	 * which is what the imx9image call in images/Makefile.imx generates.
 	 */
-	ret = imx_romapi_load_seekable(rom_api, bl33, offset + image_offset, barebox_image_size);
+	ret = imx_romapi_load_seekable(rom_api, adr, offset + image_offset, barebox_image_size);
 	if (ret)
 		return ret;
 
diff --git a/include/mach/imx/romapi.h b/include/mach/imx/romapi.h
index e26b98097d..9967a2a4c3 100644
--- a/include/mach/imx/romapi.h
+++ b/include/mach/imx/romapi.h
@@ -38,7 +38,7 @@ enum boot_dev_type_e {
 /* Below functions only load and don't start the image */
 int imx8mp_romapi_load_image(void *bl33);
 int imx8mn_romapi_load_image(void *bl33);
-int imx93_romapi_load_image(void);
+int imx93_romapi_load_image(void *adr);
 
 /* only call after DRAM has been configured */
 void imx8m_save_bootrom_log(void);

-- 
2.39.5




  parent reply	other threads:[~2024-10-30 11:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-30 11:30 [PATCH 0/4] handoff-data: some update Sascha Hauer
2024-10-30 11:30 ` [PATCH 1/4] handoff_data: add handoff_data_add_dt() Sascha Hauer
2024-10-30 11:30 ` Sascha Hauer [this message]
2024-10-30 11:30 ` [PATCH 3/4] handoff-data: set flags of moved handoff data entry Sascha Hauer
2024-10-30 11:30 ` [PATCH 4/4] handoff-data: add protection against multiple invocation Sascha Hauer

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=20241030-handoff-data-v1-2-4403e0c62c2a@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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