mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 6/8] ARM: nxp-imx8mq-evk: Replace trampoline
Date: Thu, 22 Aug 2019 14:51:56 +0200	[thread overview]
Message-ID: <20190822125158.10296-7-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20190822125158.10296-1-s.hauer@pengutronix.de>

When the TF-A finishes it jumps to a hardcoded address in DRAM. We used
to put a trampoline there which brings us back to our image in SRAM.
Instead of putting a trampoline into DRAM just copy the image there
which simplifies things a bit.

Note that currently imx8_esdhc_load_piggy() uses that very same address
as a temporary buffer. This is changed in the next patch. Currently the
board is broken anyway, so we don't break bisectability.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/nxp-imx8mq-evk/Makefile     |  2 +-
 arch/arm/boards/nxp-imx8mq-evk/lowlevel.c   | 27 ++++-----------------
 arch/arm/boards/nxp-imx8mq-evk/trampoline.S | 10 --------
 3 files changed, 6 insertions(+), 33 deletions(-)
 delete mode 100644 arch/arm/boards/nxp-imx8mq-evk/trampoline.S

diff --git a/arch/arm/boards/nxp-imx8mq-evk/Makefile b/arch/arm/boards/nxp-imx8mq-evk/Makefile
index 7907de411f..2995f06f0f 100644
--- a/arch/arm/boards/nxp-imx8mq-evk/Makefile
+++ b/arch/arm/boards/nxp-imx8mq-evk/Makefile
@@ -1,2 +1,2 @@
 obj-y += board.o
-lwl-y += lowlevel.o ddr_init.o ddrphy_train.o trampoline.o
+lwl-y += lowlevel.o ddr_init.o ddrphy_train.o
diff --git a/arch/arm/boards/nxp-imx8mq-evk/lowlevel.c b/arch/arm/boards/nxp-imx8mq-evk/lowlevel.c
index cb1c499cb0..46dba16ec3 100644
--- a/arch/arm/boards/nxp-imx8mq-evk/lowlevel.c
+++ b/arch/arm/boards/nxp-imx8mq-evk/lowlevel.c
@@ -56,27 +56,6 @@ static void nxp_imx8mq_evk_sram_setup(void)
 	ddr_init();
 }
 
-extern unsigned char trampoline_start[];
-extern unsigned char trampoline_end[];
-
-static void nxp_imx8mq_evk_install_tfa_trampoline(void)
-{
-	unsigned int tramp_len;
-	unsigned int offset;
-	/*
-	 * Create a trampoline which is places in DRAM and calls back into the
-	 * PBL entry function found in the TCRAM. Register x0 is set to 1 to
-	 * indicate that DRAM setup was already run.
-	 */
-	tramp_len = (void *)trampoline_end - (void *)trampoline_start;
-	memcpy((void *)MX8MQ_ATF_BL33_BASE_ADDR, (void *)trampoline_start,
-	       tramp_len);
-
-	offset = get_runtime_offset();
-	memcpy((void *)MX8MQ_ATF_BL33_BASE_ADDR + tramp_len, &offset,
-	       sizeof(offset));
-}
-
 /*
  * Power-on execution flow of start_nxp_imx8mq_evk() might not be
  * obvious for a very first read, so here's, hopefully helpful,
@@ -117,8 +96,12 @@ static __noreturn noinline void nxp_imx8mq_evk_start(void)
 	 */
 	if (current_el() == 3) {
 		nxp_imx8mq_evk_sram_setup();
-		nxp_imx8mq_evk_install_tfa_trampoline();
 		get_builtin_firmware(imx8mq_bl31_bin, &bl31, &bl31_size);
+		/*
+		 * On completion the TF-A will jump to MX8MQ_ATF_BL33_BASE_ADDR in
+		 * EL2. Copy ourselves there.
+		 */
+		memcpy((void *)MX8MQ_ATF_BL33_BASE_ADDR, _text, __bss_start - _text);
 		imx8mq_atf_load_bl31(bl31, bl31_size);
 	}
 
diff --git a/arch/arm/boards/nxp-imx8mq-evk/trampoline.S b/arch/arm/boards/nxp-imx8mq-evk/trampoline.S
deleted file mode 100644
index 54a1b76518..0000000000
--- a/arch/arm/boards/nxp-imx8mq-evk/trampoline.S
+++ /dev/null
@@ -1,10 +0,0 @@
-/* SPDX-License-Identifier: (GPL-2.0) */
-#include <linux/linkage.h>
-#include <asm/sections.h>
-	.section .trampoline,"a"
-	.globl  trampoline_start
-trampoline_start:
-	ldr	w19, trampoline_end
-	br      x19
-	.globl  trampoline_end
-trampoline_end:
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2019-08-22 12:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22 12:51 [PATCH 0/8] i.MX8 EVK patches Sascha Hauer
2019-08-22 12:51 ` [PATCH 1/8] ARM: aarch64: Fixup relocation table for the second relocation Sascha Hauer
2019-08-22 13:09   ` Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 2/8] ARM: aarch64: Fix get_runtime_offset after relocation Sascha Hauer
2019-08-22 13:08   ` Rouven Czerwinski
2019-08-22 20:14   ` Andrey Smirnov
2019-08-23  8:11     ` Sascha Hauer
2019-08-22 12:51 ` [PATCH 3/8] pbl: Move piggy verification into pbl_barebox_uncompress() Sascha Hauer
2019-08-22 13:07   ` Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 4/8] ARM: i.MX: imx8-ddrc: Remove debug code Sascha Hauer
2019-08-22 13:04   ` Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 5/8] ARM: nxp-imx8mq-evk: Remove duplicate call to imx8mq_cpu_lowlevel_init() Sascha Hauer
2019-08-22 13:03   ` Rouven Czerwinski
2019-08-22 12:51 ` Sascha Hauer [this message]
2019-08-22 13:03   ` [PATCH 6/8] ARM: nxp-imx8mq-evk: Replace trampoline Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 7/8] ARM: i.MX8: Fix piggydata loading Sascha Hauer
2019-08-22 13:02   ` Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 8/8] ARM: nxp-imx8mq-evk: Update comments Sascha Hauer
2019-08-22 12:59   ` Rouven Czerwinski
2019-08-22 13:19 ` [PATCH 0/8] i.MX8 EVK patches Rouven Czerwinski

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=20190822125158.10296-7-s.hauer@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