xref: /rk3399_rockchip-uboot/arch/arc/lib/init_helpers.c (revision 3fb8016360d5433f3c4da51f8dd57550e7ef9018)
1*3fb80163SAlexey Brodkin /*
2*3fb80163SAlexey Brodkin  * Copyright (C) 2013-2015 Synopsys, Inc. All rights reserved.
3*3fb80163SAlexey Brodkin  *
4*3fb80163SAlexey Brodkin  * SPDX-License-Identifier:	GPL-2.0+
5*3fb80163SAlexey Brodkin  */
6*3fb80163SAlexey Brodkin 
7*3fb80163SAlexey Brodkin #include <common.h>
8*3fb80163SAlexey Brodkin 
9*3fb80163SAlexey Brodkin DECLARE_GLOBAL_DATA_PTR;
10*3fb80163SAlexey Brodkin 
11*3fb80163SAlexey Brodkin int init_cache_f_r(void)
12*3fb80163SAlexey Brodkin {
13*3fb80163SAlexey Brodkin #ifndef CONFIG_SYS_ICACHE_OFF
14*3fb80163SAlexey Brodkin 	icache_enable();
15*3fb80163SAlexey Brodkin 	/* Make sure no stale entries persist from before we disabled cache */
16*3fb80163SAlexey Brodkin 	invalidate_icache_all();
17*3fb80163SAlexey Brodkin #endif
18*3fb80163SAlexey Brodkin 
19*3fb80163SAlexey Brodkin #ifndef CONFIG_SYS_DCACHE_OFF
20*3fb80163SAlexey Brodkin 	dcache_enable();
21*3fb80163SAlexey Brodkin 	/* Make sure no stale entries persist from before we disabled cache */
22*3fb80163SAlexey Brodkin 	invalidate_dcache_all();
23*3fb80163SAlexey Brodkin #endif
24*3fb80163SAlexey Brodkin 	return 0;
25*3fb80163SAlexey Brodkin }
26