xref: /openbmc/u-boot/arch/arm/mach-s5pc1xx/cache.c (revision ef64e782)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2014 Samsung Electronics
4  * Minkyu Kang <mk7.kang@samsung.com>
5  * Robert Baldyga <r.baldyga@samsung.com>
6  *
7  * based on arch/arm/cpu/armv7/omap3/cache.S
8  */
9 
10 #include <common.h>
11 
12 #ifndef CONFIG_SYS_DCACHE_OFF
13 void enable_caches(void)
14 {
15 	dcache_enable();
16 }
17 
18 void disable_caches(void)
19 {
20 	dcache_disable();
21 }
22 #endif
23 
24 #ifndef CONFIG_SYS_L2CACHE_OFF
25 void v7_outer_cache_enable(void)
26 {
27 	__asm(
28 		"push    {r0, r1, r2, lr}\n\t"
29 		"mrc     15, 0, r3, cr1, cr0, 1\n\t"
30 		"orr     r3, r3, #2\n\t"
31 		"mcr     15, 0, r3, cr1, cr0, 1\n\t"
32 		"pop     {r1, r2, r3, pc}"
33 	);
34 }
35 
36 void v7_outer_cache_disable(void)
37 {
38 	__asm(
39 		"push    {r0, r1, r2, lr}\n\t"
40 		"mrc     15, 0, r3, cr1, cr0, 1\n\t"
41 		"bic     r3, r3, #2\n\t"
42 		"mcr     15, 0, r3, cr1, cr0, 1\n\t"
43 		"pop     {r1, r2, r3, pc}"
44 	);
45 }
46 #endif
47