Commit fee39236 authored by Sandrine Bailleux's avatar Sandrine Bailleux
Browse files

juno: Fix the disable_mmu code

Remove the hard coding of all the MMU related registers with 0 and
disable MMU by clearing the M and C bit in SCTLR_ELx.

Also remove use of partially qualified asm helper functions.

Change-Id: I383083f93a0a53143e58f146faf7755198f6a6ca
parent 4c54d5c5
...@@ -89,11 +89,18 @@ void enable_mmu() ...@@ -89,11 +89,18 @@ void enable_mmu()
void disable_mmu(void) void disable_mmu(void)
{ {
/* Zero out the MMU related registers */ unsigned long sctlr;
write_mair(0); unsigned long current_el = read_current_el();
write_tcr(0);
write_ttbr0(0); if (GET_EL(current_el) == MODE_EL3) {
write_sctlr(0); sctlr = read_sctlr_el3();
sctlr = sctlr & ~(SCTLR_M_BIT | SCTLR_C_BIT);
write_sctlr_el3(sctlr);
} else {
sctlr = read_sctlr_el1();
sctlr = sctlr & ~(SCTLR_M_BIT | SCTLR_C_BIT);
write_sctlr_el1(sctlr);
}
/* Flush the caches */ /* Flush the caches */
dcsw_op_all(DCCISW); dcsw_op_all(DCCISW);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment