xref: /rk3399_rockchip-uboot/arch/arm/cpu/arm926ejs/cache.c (revision 679530278d5a79d34e356ad2d452f4400953bfc2)
12f3427ccSIlya Yanok /*
22f3427ccSIlya Yanok  * (C) Copyright 2011
32f3427ccSIlya Yanok  * Ilya Yanok, EmCraft Systems
42f3427ccSIlya Yanok  *
52f3427ccSIlya Yanok  * See file CREDITS for list of people who contributed to this
62f3427ccSIlya Yanok  * project.
72f3427ccSIlya Yanok  *
82f3427ccSIlya Yanok  * This program is free software; you can redistribute it and/or
92f3427ccSIlya Yanok  * modify it under the terms of the GNU General Public License as
102f3427ccSIlya Yanok  * published by the Free Software Foundation; either version 2 of
112f3427ccSIlya Yanok  * the License, or (at your option) any later version.
122f3427ccSIlya Yanok  *
132f3427ccSIlya Yanok  * This program is distributed in the hope that it will be useful,
142f3427ccSIlya Yanok  * but WITHOUT ANY WARRANTY; without even the implied warranty of
152f3427ccSIlya Yanok  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
162f3427ccSIlya Yanok  * GNU General Public License for more details.
172f3427ccSIlya Yanok  *
182f3427ccSIlya Yanok  * You should have received a copy of the GNU General Public License
192f3427ccSIlya Yanok  * along with this program; if not, write to the Free Software
202f3427ccSIlya Yanok  * Foundation, Inc.
212f3427ccSIlya Yanok  */
222f3427ccSIlya Yanok #include <linux/types.h>
232f3427ccSIlya Yanok #include <common.h>
242f3427ccSIlya Yanok 
252f3427ccSIlya Yanok #ifndef CONFIG_SYS_DCACHE_OFF
262f3427ccSIlya Yanok static inline void dcache_noop(void)
272f3427ccSIlya Yanok {
282f3427ccSIlya Yanok 	if (dcache_status()) {
292f3427ccSIlya Yanok 		puts("WARNING: cache operations are not implemented!\n"
302f3427ccSIlya Yanok 		     "WARNING: disabling D-Cache now, you can re-enable it"
312f3427ccSIlya Yanok 		     "later with 'dcache on' command\n");
322f3427ccSIlya Yanok 		dcache_disable();
332f3427ccSIlya Yanok 	}
342f3427ccSIlya Yanok }
352f3427ccSIlya Yanok 
362f3427ccSIlya Yanok void invalidate_dcache_all(void)
372f3427ccSIlya Yanok {
382f3427ccSIlya Yanok 	dcache_noop();
392f3427ccSIlya Yanok }
402f3427ccSIlya Yanok 
412f3427ccSIlya Yanok void invalidate_dcache_range(unsigned long start, unsigned long stop)
422f3427ccSIlya Yanok {
432f3427ccSIlya Yanok 	dcache_noop();
442f3427ccSIlya Yanok }
452f3427ccSIlya Yanok 
462f3427ccSIlya Yanok void flush_dcache_range(unsigned long start, unsigned long stop)
472f3427ccSIlya Yanok {
482f3427ccSIlya Yanok 	dcache_noop();
492f3427ccSIlya Yanok }
502f3427ccSIlya Yanok #else /* #ifndef CONFIG_SYS_DCACHE_OFF */
512f3427ccSIlya Yanok void invalidate_dcache_all(void)
522f3427ccSIlya Yanok {
532f3427ccSIlya Yanok }
542f3427ccSIlya Yanok 
552f3427ccSIlya Yanok void flush_dcache_all(void)
562f3427ccSIlya Yanok {
572f3427ccSIlya Yanok }
582f3427ccSIlya Yanok 
592f3427ccSIlya Yanok void invalidate_dcache_range(unsigned long start, unsigned long stop)
602f3427ccSIlya Yanok {
612f3427ccSIlya Yanok }
622f3427ccSIlya Yanok 
632f3427ccSIlya Yanok void flush_dcache_range(unsigned long start, unsigned long stop)
642f3427ccSIlya Yanok {
652f3427ccSIlya Yanok }
662f3427ccSIlya Yanok 
672f3427ccSIlya Yanok void  flush_cache(unsigned long start, unsigned long size)
682f3427ccSIlya Yanok {
692f3427ccSIlya Yanok }
702f3427ccSIlya Yanok #endif /* #ifndef CONFIG_SYS_DCACHE_OFF */
71*67953027SMichael Walle 
72*67953027SMichael Walle /*
73*67953027SMichael Walle  * Stub implementations for l2 cache operations
74*67953027SMichael Walle  */
75*67953027SMichael Walle void __l2_cache_disable(void)
76*67953027SMichael Walle {
77*67953027SMichael Walle }
78*67953027SMichael Walle void l2_cache_disable(void)
79*67953027SMichael Walle         __attribute__((weak, alias("__l2_cache_disable")));
80