2 * (C) Copyright 2008 Texas Insturments
5 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
6 * Marius Groeger <mgroeger@sysgo.de>
9 * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
11 * SPDX-License-Identifier: GPL-2.0+
21 #include <asm/system.h>
22 #include <asm/cache.h>
23 #include <asm/armv7.h>
24 #include <linux/compiler.h>
26 void __weak cpu_cache_initialization(void){}
28 int cleanup_before_linux(void)
31 * this function is called just before we call linux
32 * it prepares the processor for linux
34 * we turn off caches etc ...
36 #ifndef CONFIG_SPL_BUILD
40 /* switch off LCD panel */
42 /* disable LCD controller */
45 #endif /* CONFIG_LCD */
46 #endif /* CONFIG_SPL_BUILD */
49 * Turn off I-cache and invalidate it
52 invalidate_icache_all();
56 * dcache_disable() in turn flushes the d-cache and disables MMU
59 v7_outer_cache_disable();
62 * After D-cache is flushed and before it is disabled there may
63 * be some new valid entries brought into the cache. We are sure
64 * that these lines are not dirty and will not affect our execution.
65 * (because unwinding the call-stack and setting a bit in CP15 SCTRL
66 * is all we did during this. We have not pushed anything on to the
67 * stack. Neither have we affected any static data)
68 * So just invalidate the entire d-cache again to avoid coherency
71 invalidate_dcache_all();
74 * Some CPU need more cache attention before starting the kernel.
76 cpu_cache_initialization();