From 01a1f7c2bc12b7fcb5cbb70c4091b0ac9ce79d4a Mon Sep 17 00:00:00 2001
From: Yann Gautier <yann.gautier@st.com>
Date: Thu, 26 Apr 2018 19:07:17 +0200
Subject: [PATCH] BL2_AT_EL3: do not try to disable MMU twice on AARCH32

If BL2_AT_EL3 is enabled, bl2_run_next_image is called at the end of BL2.
This function calls disable_mmu_icache_secure.
It is then useless to call it in bl2_main in that case.

fixes arm-software/tf-issues#582

Signed-off-by: Yann Gautier <yann.gautier@st.com>
---
 bl2/bl2_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/bl2/bl2_main.c b/bl2/bl2_main.c
index 41d174557..101eb33d0 100644
--- a/bl2/bl2_main.c
+++ b/bl2/bl2_main.c
@@ -46,6 +46,7 @@ void bl2_main(void)
 	/* Load the subsequent bootloader images. */
 	next_bl_ep_info = bl2_load_images();
 
+#if !BL2_AT_EL3
 #ifdef AARCH32
 	/*
 	 * For AArch32 state BL1 and BL2 share the MMU setup.
@@ -55,8 +56,6 @@ void bl2_main(void)
 	disable_mmu_icache_secure();
 #endif /* AARCH32 */
 
-
-#if !BL2_AT_EL3
 	console_flush();
 
 	/*
-- 
GitLab