summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorVikas Manocha <vikas.manocha@st.com>2017-05-03 15:48:26 -0700
committerTom Rini <trini@konsulko.com>2017-05-12 08:36:52 -0400
commit4098d2061ff57b731e195abe03a0b73ac69c8689 (patch)
tree35b5626c00dbf88b43fe4b5cd5162143574522af /arch
parenta0ee014f1bb0b6c6e038e11a261cb869ebb5a0f1 (diff)
downloadu-boot-4098d2061ff57b731e195abe03a0b73ac69c8689.tar.gz
u-boot-4098d2061ff57b731e195abe03a0b73ac69c8689.tar.xz
u-boot-4098d2061ff57b731e195abe03a0b73ac69c8689.zip
arvm7m: add cleanup before linux booting
Data cache memory needs to be disabled before handing over control to linux kernel. This patch populates the cleanup_before_linux stub. Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/armv7m/cpu.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv7m/cpu.c b/arch/arm/cpu/armv7m/cpu.c
index 58cde9391f..a424babde5 100644
--- a/arch/arm/cpu/armv7m/cpu.c
+++ b/arch/arm/cpu/armv7m/cpu.c
@@ -18,6 +18,25 @@
*/
int cleanup_before_linux(void)
{
+ /*
+ * this function is called just before we call linux
+ * it prepares the processor for linux
+ *
+ * disable interrupt and turn off caches etc ...
+ */
+ disable_interrupts();
+ /*
+ * turn off D-cache
+ * dcache_disable() in turn flushes the d-cache
+ * MPU is still enabled & can't be disabled as the u-boot
+ * code might be running in sdram which by default is not
+ * executable area.
+ */
+ dcache_disable();
+ /* invalidate to make sure no cache line gets dirty between
+ * dcache flushing and disabling dcache */
+ invalidate_dcache_all();
+
return 0;
}