arm: spl: prepare for jumping to OPTEE
Make sure to (if applicable) flush the D-cache, invalidate I-cache,
and disable MMU and caches before jumping to OPTEE.
This fixes the SDP->SPL->OPTEE boot flow on iMX6Q and most likely on
some other ARM SoCs.
Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Co-developed-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c
index 8e2bdf3..4f9b84b 100644
--- a/arch/arm/lib/spl.c
+++ b/arch/arm/lib/spl.c
@@ -77,3 +77,14 @@
}
#endif /* CONFIG_ARM64 */
#endif
+
+#if CONFIG_IS_ENABLED(OPTEE_IMAGE)
+void __noreturn jump_to_image_optee(struct spl_image_info *spl_image)
+{
+ /* flush and turn off caches before jumping to OPTEE */
+ cleanup_before_linux();
+
+ spl_optee_entry(NULL, NULL, spl_image->fdt_addr,
+ (void *)spl_image->entry_point);
+}
+#endif