[PATCH 3/5] ARM: i.MX8M: define imx8mX_scratch_space() helper

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Nov 1 11:06:41 PDT 2022


Now that we have a generic ARM scratch area and a way to find out where
it is, add new helper functions that return a pointer to this area.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/mach-imx/include/mach/xload.h | 11 +++++++++++
 arch/arm/mach-imx/xload-common.c       | 10 ++++++++++
 2 files changed, 21 insertions(+)

diff --git a/arch/arm/mach-imx/include/mach/xload.h b/arch/arm/mach-imx/include/mach/xload.h
index 82bf663c4266..d19bedb9e84a 100644
--- a/arch/arm/mach-imx/include/mach/xload.h
+++ b/arch/arm/mach-imx/include/mach/xload.h
@@ -30,4 +30,15 @@ int piggydata_size(void);
 extern unsigned char input_data[];
 extern unsigned char input_data_end[];
 
+struct imx_scratch_space {
+	u32 bootrom_log[128];
+};
+
+struct imx_scratch_space *__imx8m_scratch_space(int ddr_buswidth);
+
+#define imx8mq_scratch_space() __imx8m_scratch_space(32)
+#define imx8mm_scratch_space() __imx8m_scratch_space(32)
+#define imx8mn_scratch_space() __imx8m_scratch_space(16)
+#define imx8mp_scratch_space() __imx8m_scratch_space(32)
+
 #endif /* __MACH_XLOAD_H */
diff --git a/arch/arm/mach-imx/xload-common.c b/arch/arm/mach-imx/xload-common.c
index f4bcca1d1483..710dcc1ed909 100644
--- a/arch/arm/mach-imx/xload-common.c
+++ b/arch/arm/mach-imx/xload-common.c
@@ -4,6 +4,9 @@
 #include <asm/sections.h>
 #include <linux/sizes.h>
 #include <mach/xload.h>
+#include <mach/esdctl.h>
+#include <mach/imx8m-regs.h>
+#include <asm/barebox-arm.h>
 
 int imx_image_size(void)
 {
@@ -16,3 +19,10 @@ int piggydata_size(void)
 	return input_data_end - input_data;
 }
 
+struct imx_scratch_space *__imx8m_scratch_space(int ddr_buswidth)
+{
+	ulong endmem = MX8M_DDR_CSD1_BASE_ADDR +
+		imx8m_barebox_earlymem_size(ddr_buswidth);
+
+	return (void *)__arm_mem_scratch(endmem);
+}
-- 
2.30.2




More information about the barebox mailing list