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@xxxxxxxxxxxxxx> --- 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