]> git.sur5r.net Git - u-boot/blobdiff - arch/mips/include/asm/cache.h
MIPS: Probe cache line sizes once during boot
[u-boot] / arch / mips / include / asm / cache.h
index 0dfb54ef4dda75e49be553569ce10f0af61e4894..669c362a52a563ab6f7dfcf43188b8559644b69d 100644 (file)
@@ -7,15 +7,25 @@
 #ifndef __MIPS_CACHE_H__
 #define __MIPS_CACHE_H__
 
+#define L1_CACHE_SHIFT         CONFIG_MIPS_L1_CACHE_SHIFT
+#define L1_CACHE_BYTES         (1 << L1_CACHE_SHIFT)
+
+#define ARCH_DMA_MINALIGN      (L1_CACHE_BYTES)
+
 /*
- * The maximum L1 data cache line size on MIPS seems to be 128 bytes.  We use
- * that as a default for aligning DMA buffers unless the board config has
- * specified another cache line size.
+ * CONFIG_SYS_CACHELINE_SIZE is still used in various drivers primarily for
+ * DMA buffer alignment. Satisfy those drivers by providing it as a synonym
+ * of ARCH_DMA_MINALIGN for now.
+ */
+#define CONFIG_SYS_CACHELINE_SIZE ARCH_DMA_MINALIGN
+
+/**
+ * mips_cache_probe() - Probe the properties of the caches
+ *
+ * Call this to probe the properties such as line sizes of the caches
+ * present in the system, if any. This must be done before cache maintenance
+ * functions such as flush_cache may be called.
  */
-#ifdef CONFIG_SYS_CACHELINE_SIZE
-#define ARCH_DMA_MINALIGN      CONFIG_SYS_CACHELINE_SIZE
-#else
-#define ARCH_DMA_MINALIGN      128
-#endif
+void mips_cache_probe(void);
 
 #endif /* __MIPS_CACHE_H__ */