1 // SPDX-License-Identifier: GPL-2.0+
4 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
5 * Marius Groeger <mgroeger@sysgo.de>
8 * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
19 #include <asm/cache.h>
20 #include <asm/system.h>
22 static void cache_flush(void);
24 /************************************************************
25 * sdelay() - simple spin loop. Will be constant time as
26 * its generally used in bypass conditions only. This
27 * is necessary until timers are accessible.
29 * not inline to increase chances its in cache when called
30 *************************************************************/
31 void sdelay(unsigned long loops)
33 __asm__ volatile ("1:\n" "subs %0, %1, #1\n"
34 "bne 1b":"=r" (loops):"0"(loops));
37 int cleanup_before_linux (void)
40 * this function is called just before we call linux
41 * it prepares the processor for linux
43 * we turn off caches etc ...
49 /* turn off I/D-cache */
61 static void cache_flush (void)
63 #if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
66 asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i));