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 <asm/system.h> 18 19 static void cache_flush(void); 20 21 int cleanup_before_linux (void) 22 { 23 /* 24 * this function is called just before we call linux 25 * it prepares the processor for linux 26 * 27 * we turn off caches etc ... 28 */ 29 30 disable_interrupts (); 31 32 /* turn off I/D-cache */ 33 icache_disable(); 34 dcache_disable(); 35 /* flush I/D-cache */ 36 cache_flush(); 37 38 return 0; 39 } 40 41 /* flush I/D-cache */ 42 static void cache_flush (void) 43 { 44 unsigned long i = 0; 45 46 asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i)); 47 } 48