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