Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Robert Baldyga | dab067c | 2014-09-19 12:17:55 +0200 | [diff] [blame] | 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 |
Robert Baldyga | dab067c | 2014-09-19 12:17:55 +0200 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include <common.h> |
| 11 | |
Trevor Woerner | 1001502 | 2019-05-03 09:41:00 -0400 | [diff] [blame] | 12 | #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) |
Robert Baldyga | dab067c | 2014-09-19 12:17:55 +0200 | [diff] [blame] | 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 |