xref: /rk3399_rockchip-uboot/arch/xtensa/lib/cache.c (revision c978b52410016b0ab5a213f235596340af8d45f7)
1*c978b524SChris Zankel /*
2*c978b524SChris Zankel  * (C) Copyright 2008 - 2013 Tensilica Inc.
3*c978b524SChris Zankel  * (C) Copyright 2014 - 2016 Cadence Design Systems Inc.
4*c978b524SChris Zankel  *
5*c978b524SChris Zankel  * SPDX-License-Identifier:	GPL-2.0+
6*c978b524SChris Zankel  */
7*c978b524SChris Zankel 
8*c978b524SChris Zankel #include <common.h>
9*c978b524SChris Zankel #include <asm/cache.h>
10*c978b524SChris Zankel 
11*c978b524SChris Zankel /*
12*c978b524SChris Zankel  * We currently run always with caches enabled when running from memory.
13*c978b524SChris Zankel  * Xtensa version D or later will support changing cache behavior, so
14*c978b524SChris Zankel  * we could implement it if necessary.
15*c978b524SChris Zankel  */
16*c978b524SChris Zankel 
dcache_status(void)17*c978b524SChris Zankel int dcache_status(void)
18*c978b524SChris Zankel {
19*c978b524SChris Zankel 	return 1;
20*c978b524SChris Zankel }
21*c978b524SChris Zankel 
dcache_enable(void)22*c978b524SChris Zankel void dcache_enable(void)
23*c978b524SChris Zankel {
24*c978b524SChris Zankel }
25*c978b524SChris Zankel 
dcache_disable(void)26*c978b524SChris Zankel void dcache_disable(void)
27*c978b524SChris Zankel {
28*c978b524SChris Zankel }
29*c978b524SChris Zankel 
flush_cache(ulong start_addr,ulong size)30*c978b524SChris Zankel void flush_cache(ulong start_addr, ulong size)
31*c978b524SChris Zankel {
32*c978b524SChris Zankel 	__flush_invalidate_dcache_range(start_addr, size);
33*c978b524SChris Zankel 	__invalidate_icache_range(start_addr, size);
34*c978b524SChris Zankel }
35*c978b524SChris Zankel 
flush_dcache_all(void)36*c978b524SChris Zankel void flush_dcache_all(void)
37*c978b524SChris Zankel {
38*c978b524SChris Zankel 	__flush_dcache_all();
39*c978b524SChris Zankel 	__invalidate_icache_all();
40*c978b524SChris Zankel }
41*c978b524SChris Zankel 
flush_dcache_range(ulong start_addr,ulong end_addr)42*c978b524SChris Zankel void flush_dcache_range(ulong start_addr, ulong end_addr)
43*c978b524SChris Zankel {
44*c978b524SChris Zankel 	__flush_invalidate_dcache_range(start_addr, end_addr - start_addr);
45*c978b524SChris Zankel }
46*c978b524SChris Zankel 
invalidate_dcache_range(ulong start,ulong stop)47*c978b524SChris Zankel void invalidate_dcache_range(ulong start, ulong stop)
48*c978b524SChris Zankel {
49*c978b524SChris Zankel 	__invalidate_dcache_range(start, stop - start);
50*c978b524SChris Zankel }
51*c978b524SChris Zankel 
invalidate_dcache_all(void)52*c978b524SChris Zankel void invalidate_dcache_all(void)
53*c978b524SChris Zankel {
54*c978b524SChris Zankel 	__invalidate_dcache_all();
55*c978b524SChris Zankel }
56*c978b524SChris Zankel 
invalidate_icache_all(void)57*c978b524SChris Zankel void invalidate_icache_all(void)
58*c978b524SChris Zankel {
59*c978b524SChris Zankel 	__invalidate_icache_all();
60*c978b524SChris Zankel }
61