1 /*
2 * ===========================================================================================
3 *
4 * Filename: cache.S
5 *
6 * Description: cache operation for device
7 *
8 * Version: Melis3.0
9 * Create: 2019-11-25 20:31:28
10 * Revision: none
11 * Compiler: GCC:version 7.2.1 20170904 (release),ARM/embedded-7-branch revision 255204
12 *
13 * Author: caozilong@allwinnertech.com
14 * Organization: BU1-PSW
15 * Last Modified: 2020-03-27 10:55:45
16 *
17 * ===========================================================================================
18 */
19 #include <hal_cache.h>
20 #include <kconfig.h>
21
22
cpu_dcache_clean(unsigned long vaddr_start,unsigned long size)23 void cpu_dcache_clean(unsigned long vaddr_start, unsigned long size)
24 {
25 #ifndef CONFIG_CPU_DCACHE_DISABLE
26 awos_arch_mems_clean_dcache_region(vaddr_start, size);
27 #endif
28 }
29
cpu_dcache_clean_invalidate(unsigned long vaddr_start,unsigned long size)30 void cpu_dcache_clean_invalidate(unsigned long vaddr_start, unsigned long size)
31 {
32 #ifndef CONFIG_CPU_DCACHE_DISABLE
33 awos_arch_mems_clean_flush_dcache_region(vaddr_start, size);
34 #endif
35 }
36
cpu_dcache_invalidate(unsigned long vaddr_start,unsigned long size)37 void cpu_dcache_invalidate(unsigned long vaddr_start, unsigned long size)
38 {
39 #ifndef CONFIG_CPU_DCACHE_DISABLE
40 awos_arch_mems_flush_dcache_region(vaddr_start, size);
41 #endif
42 }
43
cpu_dcache_clean_all(void)44 void cpu_dcache_clean_all(void)
45 {
46 #ifndef CONFIG_CPU_DCACHE_DISABLE
47 awos_arch_clean_dcache();
48 #endif
49 }
50
cpu_dcache_invalidate_all(void)51 void cpu_dcache_invalidate_all(void)
52 {
53 #ifndef CONFIG_CPU_DCACHE_DISABLE
54 awos_arch_flush_dcache();
55 #endif
56 }
57
cpu_icache_invalidate_all(void)58 void cpu_icache_invalidate_all(void)
59 {
60 awos_arch_flush_icache_all();
61 }
62
cpu_icache_invalidate(unsigned long vaddr_start,unsigned long size)63 void cpu_icache_invalidate(unsigned long vaddr_start, unsigned long size)
64 {
65 awos_arch_mems_flush_icache_region(vaddr_start, size);
66 }
67