cache.patch

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
diff -Naur linux-2.6.18.2/drivers/net/mcf_fec/fec.h linux-2.6.18.2/drivers/net/mcf_fec/fec.h
--- linux-2.6.18.2/drivers/net/mcf_fec/fec.h	2006-11-03 18:33:58.000000000 -0700
+++ linux-2.6.18.2/drivers/net/mcf_fec/fec.h	2006-11-22 12:22:25.000000000 -0700
@@ -285,8 +285,8 @@
 #define FEC_TX_BD_SC_ABC	((unsigned short)0x0200)
 
 
-#define fec_flush_dcache()		flush_cache_all()
-#define fec_flush_dcache_line(l)	flush_cache_all()
+#define fec_flush_dcache()		__flush_dcache_all()
+#define fec_flush_dcache_line(l)	__flush_cache_line(l)
 
 
 #define FEC_RES(n,s,e,f) 	\
diff -Naur linux-2.6.18.2/include/asm-m68knommu/cacheflush.h linux-2.6.18.2/include/asm-m68knommu/cacheflush.h
--- linux-2.6.18.2/include/asm-m68knommu/cacheflush.h	2006-11-03 18:33:58.000000000 -0700
+++ linux-2.6.18.2/include/asm-m68knommu/cacheflush.h	2006-11-22 12:12:45.000000000 -0700
@@ -50,13 +50,13 @@
 		"movec	%%d0,%%CACR\n\t"
 		: : : "d0", "a0" );
 #endif /* CONFIG_M5407 */
-#if defined(CONFIG_M527x) || defined(CONFIG_M528x)
+#if defined(CONFIG_M527x)
 	__asm__ __volatile__ (
         	"movel	#0x81400100, %%d0\n\t"
         	"movec	%%d0, %%CACR\n\t"
 		"nop\n\t"
 		: : : "d0" );
-#endif /* CONFIG_M527x || CONFIG_M528x */
+#endif /* CONFIG_M527x */
 #if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || defined(CONFIG_M5272)
 	__asm__ __volatile__ (
         	"movel	#0x81000100, %%d0\n\t"
@@ -78,6 +78,55 @@
 		"nop\n\t"
 		: : : "d0" );
 #endif /* CONFIG_M532x */
+#if defined(CONFIG_M520x) || defined(CONFIG_M528x)
+	__asm__ __volatile__ (
+        	"movel	#0x81000200, %%d0\n\t"
+        	"movec	%%d0, %%CACR\n\t"
+		"nop\n\t"
+		: : : "d0" );
+#endif /* CONFIG_M520x || CONFIG_M528x */
+}
+
+
+static inline void __flush_icache_all(void)
+{
+#if defined(CONFIG_M520x) || defined(CONFIG_M528x)
+	__asm__ __volatile__ (
+        	"movel	#0x81200200, %%d0\n\t"
+        	"movec	%%d0, %%CACR\n\t"
+		"nop\n\t"
+		: : : "d0" );
+#else
+	__flush_cache_all();
+#endif
 }
 
+
+static inline void __flush_dcache_all(void)
+{
+#if defined(CONFIG_M520x) || defined(CONFIG_M528x)
+	__asm__ __volatile__ (
+        	"movel	#0x81100200, %%d0\n\t"
+        	"movec	%%d0, %%CACR\n\t"
+		"nop\n\t"
+		: : : "d0" );
+#else
+	__flush_cache_all();
+#endif
+}
+
+
+static inline void __flush_cache_line(void *line)
+{
+#if defined(CONFIG_M520x) || defined(CONFIG_M528x)
+	__asm__ __volatile__ (
+		"moveal	%0, %%a0\n\t"
+		".word	0xf4e8\n\t" /* "cpushl bc, (%%a0)\n\t" */
+		: : "a" (line) : "a0" );
+#else
+	__flush_cache_all();
+#endif
+}
+
+
 #endif /* _M68KNOMMU_CACHEFLUSH_H */
diff -Naur linux-2.6.18.2/include/asm-m68knommu/mcfcache.h linux-2.6.18.2/include/asm-m68knommu/mcfcache.h
--- linux-2.6.18.2/include/asm-m68knommu/mcfcache.h	2006-11-03 18:33:58.000000000 -0700
+++ linux-2.6.18.2/include/asm-m68knommu/mcfcache.h	2006-11-22 12:15:52.000000000 -0700
@@ -58,9 +58,9 @@
 	movel	#0x01000000, %d0
 	movec	%d0, %CACR		/* Invalidate cache */
 	nop
-	movel	#0x0000c020, %d0	/* Set SDRAM cached only */
+	movel	#0x000fc020, %d0	/* Set SDRAM cached only */
 	movec	%d0, %ACR0
-	movel	#0xff00c000, %d0	/* Cache Flash also */
+	movel	#0x00000000, %d0	/* Cache Flash also */
 	movec	%d0, %ACR1
 	movel	#0x80000200, %d0	/* Setup cache mask */
 	movec	%d0, %CACR		/* Enable cache */
@@ -136,11 +136,11 @@
 	move.l	#0x01000000,%d0		/* invalidate whole cache */
 	movec	%d0,%CACR
 	nop
-	move.l	#0x0000c000,%d0		/* set SDRAM cached (write-thru) */
+	move.l	#0x400fc020,%d0		/* set SDRAM cached (write-thru) */
 	movec	%d0,%ACR0
 	move.l	#0x00000000,%d0		/* no other regions cached */
 	movec	%d0,%ACR1
-	move.l	#0x80400000,%d0		/* enable 8K instruction cache */
+	move.l	#0x80000200,%d0		/* enable 8K instruction cache */
 	movec	%d0,%CACR
 	nop
 .endm