1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
2225f5eecSMinkyu Kang /*
3225f5eecSMinkyu Kang * Copyright (C) 2014 Samsung Electronics
4225f5eecSMinkyu Kang * Minkyu Kang <mk7.kang@samsung.com>
5225f5eecSMinkyu Kang * Robert Baldyga <r.baldyga@samsung.com>
6225f5eecSMinkyu Kang *
7225f5eecSMinkyu Kang * based on arch/arm/cpu/armv7/omap3/cache.S
8225f5eecSMinkyu Kang */
9225f5eecSMinkyu Kang
10225f5eecSMinkyu Kang #include <common.h>
11225f5eecSMinkyu Kang
12225f5eecSMinkyu Kang #ifndef CONFIG_SYS_DCACHE_OFF
enable_caches(void)13225f5eecSMinkyu Kang void enable_caches(void)
14225f5eecSMinkyu Kang {
15225f5eecSMinkyu Kang dcache_enable();
16225f5eecSMinkyu Kang }
17225f5eecSMinkyu Kang
disable_caches(void)18225f5eecSMinkyu Kang void disable_caches(void)
19225f5eecSMinkyu Kang {
20225f5eecSMinkyu Kang dcache_disable();
21225f5eecSMinkyu Kang }
22225f5eecSMinkyu Kang #endif
23225f5eecSMinkyu Kang
24225f5eecSMinkyu Kang #ifndef CONFIG_SYS_L2CACHE_OFF
v7_outer_cache_enable(void)25225f5eecSMinkyu Kang void v7_outer_cache_enable(void)
26225f5eecSMinkyu Kang {
27225f5eecSMinkyu Kang __asm(
28225f5eecSMinkyu Kang "push {r0, r1, r2, lr}\n\t"
29225f5eecSMinkyu Kang "mrc 15, 0, r3, cr1, cr0, 1\n\t"
30225f5eecSMinkyu Kang "orr r3, r3, #2\n\t"
31225f5eecSMinkyu Kang "mcr 15, 0, r3, cr1, cr0, 1\n\t"
32225f5eecSMinkyu Kang "pop {r1, r2, r3, pc}"
33225f5eecSMinkyu Kang );
34225f5eecSMinkyu Kang }
35225f5eecSMinkyu Kang
v7_outer_cache_disable(void)36225f5eecSMinkyu Kang void v7_outer_cache_disable(void)
37225f5eecSMinkyu Kang {
38225f5eecSMinkyu Kang __asm(
39225f5eecSMinkyu Kang "push {r0, r1, r2, lr}\n\t"
40225f5eecSMinkyu Kang "mrc 15, 0, r3, cr1, cr0, 1\n\t"
41225f5eecSMinkyu Kang "bic r3, r3, #2\n\t"
42225f5eecSMinkyu Kang "mcr 15, 0, r3, cr1, cr0, 1\n\t"
43225f5eecSMinkyu Kang "pop {r1, r2, r3, pc}"
44225f5eecSMinkyu Kang );
45225f5eecSMinkyu Kang }
46225f5eecSMinkyu Kang #endif
47