1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2017 Andes Technology Corporation
4  * Rick Chen, Andes Technology Corporation <rick@andestech.com>
5  */
6 
7 /* CPU specific code */
8 #include <common.h>
9 #include <cpu_func.h>
10 #include <irq_func.h>
11 #include <asm/cache.h>
12 
13 /*
14  * cleanup_before_linux() is called just before we call linux
15  * it prepares the processor for linux
16  *
17  * we disable interrupt and caches.
18  */
cleanup_before_linux(void)19 int cleanup_before_linux(void)
20 {
21 	disable_interrupts();
22 
23 	/* turn off I/D-cache */
24 	cache_flush();
25 	icache_disable();
26 	dcache_disable();
27 
28 	return 0;
29 }
30