MIPS: Move declaration of bcache ops to cache.c
authorJiaxun Yang <jiaxun.yang@flygoat.com>
Tue, 4 Apr 2023 09:33:40 +0000 (10:33 +0100)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Wed, 5 Apr 2023 07:45:08 +0000 (09:45 +0200)
bcache is not tied to CPU's cache interface. Just move those
declaration to cache.c so it can be avaialble to CPU with all
cache types.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/include/asm/cache.h
arch/mips/mm/c-r4k.c
arch/mips/mm/cache.c

index 29187e12b861af91d5a0dc1013daabb28aface38..3424a7908c0fa317dfe9b1d1a00e1524cf864593 100644 (file)
@@ -16,4 +16,6 @@
 
 #define __read_mostly __section(".data..read_mostly")
 
+extern void cache_noop(void);
+
 #endif /* _ASM_CACHE_H */
index 7d447050a20bb41bf581c26b66f294372eb79552..5599b9c9a737d83882cf82f8fdd09657f25fda9c 100644 (file)
@@ -110,20 +110,6 @@ static unsigned long dcache_size __read_mostly;
 static unsigned long vcache_size __read_mostly;
 static unsigned long scache_size __read_mostly;
 
-/*
- * Dummy cache handling routines for machines without boardcaches
- */
-static void cache_noop(void) {}
-
-static struct bcache_ops no_sc_ops = {
-       .bc_enable = (void *)cache_noop,
-       .bc_disable = (void *)cache_noop,
-       .bc_wback_inv = (void *)cache_noop,
-       .bc_inv = (void *)cache_noop
-};
-
-struct bcache_ops *bcops = &no_sc_ops;
-
 #define cpu_is_r4600_v1_x()    ((read_c0_prid() & 0xfffffff0) == 0x00002010)
 #define cpu_is_r4600_v2_x()    ((read_c0_prid() & 0xfffffff0) == 0x00002020)
 
index 11b3e7ddafd5c4c048a3c7885f1ac29bc39840fd..7dba4b5c02c35c309342f78fb92f38381cde67d7 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
 
+#include <asm/bcache.h>
 #include <asm/cacheflush.h>
 #include <asm/processor.h>
 #include <asm/cpu.h>
@@ -56,6 +57,24 @@ EXPORT_SYMBOL_GPL(local_flush_data_cache_page);
 EXPORT_SYMBOL(flush_data_cache_page);
 EXPORT_SYMBOL(flush_icache_all);
 
+/*
+ * Dummy cache handling routine
+ */
+
+void cache_noop(void) {}
+
+#ifdef CONFIG_BOARD_SCACHE
+
+static struct bcache_ops no_sc_ops = {
+       .bc_enable = (void *)cache_noop,
+       .bc_disable = (void *)cache_noop,
+       .bc_wback_inv = (void *)cache_noop,
+       .bc_inv = (void *)cache_noop
+};
+
+struct bcache_ops *bcops = &no_sc_ops;
+#endif
+
 #ifdef CONFIG_DMA_NONCOHERENT
 
 /* DMA cache operations. */