diff mbox

[U-Boot,PATCHv7,1/6] armv8: fsl-layerscape: add i/d-cache enable function to enable_caches

Message ID 1467116297-33720-1-git-send-email-Zhiqiang.Hou@nxp.com
State Accepted
Delegated to: York Sun
Headers show

Commit Message

Z.Q. Hou June 28, 2016, 12:18 p.m. UTC
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

This function assume that the d-cache and MMU has been enabled earlier,
so it just created MMU table in main memory. But the assumption is not
always correct, for example, the early setup is done in EL3, while
enable_caches() is called when the PE has turned into another EL.

Define the function mmu_setup() for fsl-layerscape to cover the weak
one.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
---
V7:
 - no change

 arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

York Sun July 19, 2016, 8:27 p.m. UTC | #1
On 06/28/2016 05:29 AM, Zhiqiang Hou wrote:
> From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
>
> This function assume that the d-cache and MMU has been enabled earlier,
> so it just created MMU table in main memory. But the assumption is not
> always correct, for example, the early setup is done in EL3, while
> enable_caches() is called when the PE has turned into another EL.
>
> Define the function mmu_setup() for fsl-layerscape to cover the weak
> one.
>
> Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> ---
> V7:
>  - no change
>

This set is applied to fsl-qoriq master. Awaiting upstream.
Thanks.

York
diff mbox

Patch

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index 8062106..d5bcf67 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -422,15 +422,21 @@  int arch_cpu_init(void)
 	return 0;
 }
 
+void mmu_setup(void)
+{
+	final_mmu_setup();
+}
+
 /*
- * This function is called from lib/board.c.
- * It recreates MMU table in main memory. MMU and d-cache are enabled earlier.
- * There is no need to disable d-cache for this operation.
+ * This function is called from common/board_r.c.
+ * It recreates MMU table in main memory.
  */
 void enable_caches(void)
 {
-	final_mmu_setup();
+	mmu_setup();
 	__asm_invalidate_tlb_all();
+	icache_enable();
+	dcache_enable();
 }
 #endif