blob: 0b879b545dde27d2371a746c7407d2fc8b03b77d [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Robert Baldyga1aee11c2014-09-19 12:17:55 +02002/*
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
Robert Baldyga1aee11c2014-09-19 12:17:55 +02008 */
9
10#include <common.h>
11
Trevor Woerner43ec7e02019-05-03 09:41:00 -040012#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
Robert Baldyga1aee11c2014-09-19 12:17:55 +020013void enable_caches(void)
14{
15 dcache_enable();
16}
17
18void disable_caches(void)
19{
20 dcache_disable();
21}
22#endif
23
24#ifndef CONFIG_SYS_L2CACHE_OFF
25void 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
36void 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