1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * (C) Copyright 2002 4 * Sysgo Real-Time Solutions, GmbH <www.elinos.com> 5 * Marius Groeger <mgroeger@sysgo.de> 6 * 7 * (C) Copyright 2002 8 * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> 9 */ 10 11 /* 12 * CPU specific code 13 */ 14 15 #include <common.h> 16 #include <command.h> 17 #include <cpu_func.h> 18 #include <irq_func.h> 19 #include <asm/system.h> 20 21 static void cache_flush(void); 22 cleanup_before_linux(void)23int cleanup_before_linux (void) 24 { 25 /* 26 * this function is called just before we call linux 27 * it prepares the processor for linux 28 * 29 * we turn off caches etc ... 30 */ 31 32 disable_interrupts(); 33 34 /* turn off I/D-cache */ 35 icache_disable(); 36 dcache_disable(); 37 /* flush I/D-cache */ 38 cache_flush(); 39 40 return 0; 41 } 42 43 /* flush I/D-cache */ cache_flush(void)44static void cache_flush (void) 45 { 46 unsigned long i = 0; 47 48 asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i)); 49 } 50