From 7f0eacc7540df352bb254f9afb75b3a3fac45d9c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 29 Jul 2013 19:57:15 -0600 Subject: [PATCH] SAMA5: More cache and mmu inline utility functions --- configs/sama5d3x-ek/src/nor_main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/configs/sama5d3x-ek/src/nor_main.c b/configs/sama5d3x-ek/src/nor_main.c index 96d881dfb50..96b576ac2e0 100644 --- a/configs/sama5d3x-ek/src/nor_main.c +++ b/configs/sama5d3x-ek/src/nor_main.c @@ -43,7 +43,8 @@ #include #include "up_arch.h" -#include "sctlr.h" +#include "mmu.h" +#include "cache.h" #include "sam_periphclks.h" #include "chip/sam_hsmc.h" @@ -120,11 +121,15 @@ int nor_main(int argc, char *argv) * virtual addressing. */ -#if 0 /* Causes a crash */ - printf("Disabling the caches and the MMU\n"); - regval = cp15_rdsctlr(); - regval &= ~(SCTLR_M | SCTLR_C | SCTLR_I); - cp15_wrsctlr(regval); +#if 0 /* Causes crashes */ + cp15_disable_mmu(); + cp15_disable_caches(); + + /* Invalidate caches and TLBs */ + + cp15_invalidate_icache(); + cp15_invalidate_dcache_all(); + cp15_invalidate_tlbs(); #endif #ifdef SAMA5_NOR_START