From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 6/7] ARM: i.MX93: add scratch space support
Date: Fri, 19 Jan 2024 15:24:12 +0100 [thread overview]
Message-ID: <20240119142413.3206832-7-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20240119142413.3206832-1-s.hauer@pengutronix.de>
With upcoming i.MX93 OP-TEE support we'll need to transport the OP-TEE
base address from PBL to barebox proper. Add scratch space support for
i.MX93 to accommodate this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-imx/atf.c | 2 ++
arch/arm/mach-imx/esdctl.c | 2 ++
arch/arm/mach-imx/scratch.c | 11 +++++++++++
include/mach/imx/scratch.h | 1 +
4 files changed, 16 insertions(+)
diff --git a/arch/arm/mach-imx/atf.c b/arch/arm/mach-imx/atf.c
index d334c902b2..148de8f448 100644
--- a/arch/arm/mach-imx/atf.c
+++ b/arch/arm/mach-imx/atf.c
@@ -384,6 +384,8 @@ void __noreturn imx93_load_and_start_image_via_tfa(void)
const void *tfa;
size_t tfa_size;
+ imx93_init_scratch_space(true);
+
/*
* 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/esdctl.c b/arch/arm/mach-imx/esdctl.c
index 9c2c4b105d..0dbf0f7242 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -1047,6 +1047,8 @@ void __noreturn imx7d_barebox_entry(void *boarddata)
void __noreturn imx93_barebox_entry(void *boarddata)
{
+ imx93_init_scratch_space(false);
+
barebox_arm_entry(MX9_DDR_CSD1_BASE_ADDR,
imx9_ddrc_sdram_size(), boarddata);
}
diff --git a/arch/arm/mach-imx/scratch.c b/arch/arm/mach-imx/scratch.c
index 117b2eadbf..60d15a4f1a 100644
--- a/arch/arm/mach-imx/scratch.c
+++ b/arch/arm/mach-imx/scratch.c
@@ -5,6 +5,7 @@
#include <linux/err.h>
#include <linux/printk.h>
#include <mach/imx/imx8m-regs.h>
+#include <mach/imx/imx9-regs.h>
#include <mach/imx/esdctl.h>
#include <mach/imx/scratch.h>
#include <memory.h>
@@ -30,6 +31,16 @@ void imx8m_init_scratch_space(int ddr_buswidth, bool zero_init)
memset(scratch, 0, sizeof(*scratch));
}
+void imx93_init_scratch_space(bool zero_init)
+{
+ ulong endmem = MX9_DDR_CSD1_BASE_ADDR + imx9_ddrc_sdram_size();
+
+ scratch = (void *)arm_mem_scratch(endmem);
+
+ if (zero_init)
+ memset(scratch, 0, sizeof(*scratch));
+}
+
void imx8m_scratch_save_bootrom_log(const u32 *rom_log)
{
size_t sz = sizeof(scratch->bootrom_log);
diff --git a/include/mach/imx/scratch.h b/include/mach/imx/scratch.h
index b1bb2e446e..6c2cecabcd 100644
--- a/include/mach/imx/scratch.h
+++ b/include/mach/imx/scratch.h
@@ -4,6 +4,7 @@
#define __MACH_IMX_SCRATCH_H
void imx8m_init_scratch_space(int ddr_buswidth, bool zero_init);
+void imx93_init_scratch_space(bool zero_init);
const u32 *imx8m_scratch_get_bootrom_log(void);
void imx8m_scratch_save_bootrom_log(const u32 *rom_log);
--
2.39.2
next prev parent reply other threads:[~2024-01-19 14:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 14:24 [PATCH 0/7] ARM: Add i.MX93 OP-TEE support Sascha Hauer
2024-01-19 14:24 ` [PATCH 1/7] firmware: add missing FIRMWARE_IMX8MQ_OPTEE symbol Sascha Hauer
2024-01-19 15:10 ` Marco Felsch
2024-01-19 14:24 ` [PATCH 2/7] firmware: add missing include Sascha Hauer
2024-01-19 15:11 ` Marco Felsch
2024-01-19 14:24 ` [PATCH 3/7] firmware: i.MX OP-TEE: Add some Kconfig help Sascha Hauer
2024-01-19 15:12 ` Marco Felsch
2024-01-19 14:24 ` [PATCH 4/7] ARM: i.MX93: add imx93_barebox_entry() Sascha Hauer
2024-01-19 15:21 ` Marco Felsch
2024-01-22 10:20 ` Sascha Hauer
2024-01-19 14:24 ` [PATCH 5/7] ARM: i.MX: export imx9_ddrc_sdram_size() Sascha Hauer
2024-01-19 15:21 ` Marco Felsch
2024-01-19 14:24 ` Sascha Hauer [this message]
2024-01-19 15:23 ` [PATCH 6/7] ARM: i.MX93: add scratch space support Marco Felsch
2024-01-19 14:24 ` [PATCH 7/7] ARM: i.MX93: Add OP-TEE support Sascha Hauer
2024-01-22 10:15 ` [PATCH 0/7] ARM: Add i.MX93 " 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=20240119142413.3206832-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