summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-02-12 13:04:03 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-02-19 08:30:32 +0100
commit783777153fb69c15a91a9e7d4e77c44d70ea0480 (patch)
treebe6c578296ce3d6f8db05b673805250b39fc8086 /arch
parent0266042714b2e0a17e397fe5d8a29a4487785df4 (diff)
downloadbarebox-783777153fb69c15a91a9e7d4e77c44d70ea0480.tar.gz
ARM: i.MX8M: Add TF-A loading support for i.MX8MM
Basically the same as for i.MX8MQ, just some function split up needed to account for different base addresses for the TF-A on both SoCs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-imx/Makefile2
-rw-r--r--arch/arm/mach-imx/atf.c26
-rw-r--r--arch/arm/mach-imx/include/mach/atf.h9
3 files changed, 27 insertions, 10 deletions
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 105785b..30ced0e 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -16,7 +16,7 @@ lwl-$(CONFIG_ARCH_IMX6) += imx6-mmdc.o
obj-$(CONFIG_ARCH_IMX7) += imx7.o
obj-$(CONFIG_ARCH_VF610) += vf610.o
obj-$(CONFIG_ARCH_IMX8M) += imx8m.o
-lwl-$(CONFIG_ARCH_IMX8MQ) += atf.o
+lwl-$(CONFIG_ARCH_IMX8M) += atf.o
obj-$(CONFIG_IMX_IIM) += iim.o
obj-$(CONFIG_NAND_IMX) += nand.o
lwl-$(CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND) += external-nand-boot.o
diff --git a/arch/arm/mach-imx/atf.c b/arch/arm/mach-imx/atf.c
index c1b358d..4ced8cd 100644
--- a/arch/arm/mach-imx/atf.c
+++ b/arch/arm/mach-imx/atf.c
@@ -2,13 +2,14 @@
#include <mach/atf.h>
/**
- * imx8mq_atf_load_bl31 - Load ATF BL31 blob and transfer control to it
+ * imx8m_atf_load_bl31 - Load ATF BL31 blob and transfer control to it
*
* @fw: Pointer to the BL31 blob
* @fw_size: Size of the BL31 blob
+ * @atf_dest: Place where the BL31 is copied to and executed
*
* This function:
-
+ *
* 1. Copies built-in BL31 blob to an address i.MX8M's BL31
* expects to be placed
*
@@ -25,17 +26,28 @@
* any other implementation may or may not work
*
*/
-void imx8mq_atf_load_bl31(const void *fw, size_t fw_size)
+
+static void imx8m_atf_load_bl31(const void *fw, size_t fw_size, void *atf_dest)
{
- void __noreturn (*bl31)(void) = (void *)MX8MQ_ATF_BL31_BASE_ADDR;
+ void __noreturn (*bl31)(void) = atf_dest;
- if (WARN_ON(fw_size > MX8MQ_ATF_BL31_SIZE_LIMIT))
+ if (WARN_ON(fw_size > MX8M_ATF_BL31_SIZE_LIMIT))
return;
memcpy(bl31, fw, fw_size);
asm volatile("msr sp_el2, %0" : :
- "r" (MX8MQ_ATF_BL33_BASE_ADDR - 16) :
+ "r" (atf_dest - 16) :
"cc");
bl31();
-} \ No newline at end of file
+}
+
+void imx8mm_atf_load_bl31(const void *fw, size_t fw_size)
+{
+ imx8m_atf_load_bl31(fw, fw_size, (void *)MX8MM_ATF_BL31_BASE_ADDR);
+}
+
+void imx8mq_atf_load_bl31(const void *fw, size_t fw_size)
+{
+ imx8m_atf_load_bl31(fw, fw_size, (void *)MX8MQ_ATF_BL31_BASE_ADDR);
+}
diff --git a/arch/arm/mach-imx/include/mach/atf.h b/arch/arm/mach-imx/include/mach/atf.h
index aeb24ba..f64a9dd 100644
--- a/arch/arm/mach-imx/include/mach/atf.h
+++ b/arch/arm/mach-imx/include/mach/atf.h
@@ -4,10 +4,15 @@
#include <linux/sizes.h>
#include <asm/system.h>
-#define MX8MQ_ATF_BL31_SIZE_LIMIT SZ_64K
+#define MX8M_ATF_BL31_SIZE_LIMIT SZ_64K
+
+#define MX8MM_ATF_BL31_BASE_ADDR 0x00920000
#define MX8MQ_ATF_BL31_BASE_ADDR 0x00910000
-#define MX8MQ_ATF_BL33_BASE_ADDR 0x40200000
+#define MX8M_ATF_BL33_BASE_ADDR 0x40200000
+#define MX8MM_ATF_BL33_BASE_ADDR MX8M_ATF_BL33_BASE_ADDR
+#define MX8MQ_ATF_BL33_BASE_ADDR MX8M_ATF_BL33_BASE_ADDR
+void imx8mm_atf_load_bl31(const void *fw, size_t fw_size);
void imx8mq_atf_load_bl31(const void *fw, size_t fw_size);
#endif \ No newline at end of file