1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2007 Michal Simek
5 * Michal SIMEK <monstr@monstr.eu>
11 #include <asm/cache.h>
13 int dcache_status(void)
17 __asm__ __volatile__ ("mfs %0,rmsr"::"r" (i):"memory");
19 __asm__ __volatile__ ("and %0,%0,%1"::"r" (i), "r" (mask):"memory");
23 int icache_status(void)
27 __asm__ __volatile__ ("mfs %0,rmsr"::"r" (i):"memory");
29 __asm__ __volatile__ ("and %0,%0,%1"::"r" (i), "r" (mask):"memory");
33 void icache_enable(void)
38 void icache_disable(void)
40 /* we are not generate ICACHE size -> flush whole cache */
41 flush_cache(0, 32768);
45 void dcache_enable(void)
50 void dcache_disable(void)
52 #ifdef XILINX_USE_DCACHE
53 flush_cache(0, XILINX_DCACHE_BYTE_SIZE);
58 void flush_cache(ulong addr, ulong size)
61 for (i = 0; i < size; i += 4)