0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include <linux/export.h>
0018 #include <linux/init.h>
0019
0020 #include <asm/bootinfo.h>
0021 #include <asm/wbflush.h>
0022 #include <asm/barrier.h>
0023
0024 static void wbflush_kn01(void);
0025 static void wbflush_kn210(void);
0026 static void wbflush_mips(void);
0027
0028 void (*__wbflush) (void);
0029
0030 void __init wbflush_setup(void)
0031 {
0032 switch (mips_machtype) {
0033 case MACH_DS23100:
0034 case MACH_DS5000_200:
0035 __wbflush = wbflush_kn01;
0036 break;
0037 case MACH_DS5100:
0038 __wbflush = wbflush_kn210;
0039 break;
0040 case MACH_DS5000_1XX:
0041 case MACH_DS5000_XX:
0042 case MACH_DS5000_2X0:
0043 case MACH_DS5900:
0044 default:
0045 __wbflush = wbflush_mips;
0046 break;
0047 }
0048 }
0049
0050
0051
0052
0053
0054 static void wbflush_kn01(void)
0055 {
0056 asm(".set\tpush\n\t"
0057 ".set\tnoreorder\n\t"
0058 "1:\tbc0f\t1b\n\t"
0059 "nop\n\t"
0060 ".set\tpop");
0061 }
0062
0063
0064
0065
0066
0067 static void wbflush_kn210(void)
0068 {
0069 asm(".set\tpush\n\t"
0070 ".set\tnoreorder\n\t"
0071 "mfc0\t$2,$12\n\t"
0072 "lui\t$3,0x8000\n\t"
0073 "or\t$3,$2,$3\n\t"
0074 "mtc0\t$3,$12\n\t"
0075 "nop\n"
0076 "1:\tbc3f\t1b\n\t"
0077 "nop\n\t"
0078 "mtc0\t$2,$12\n\t"
0079 "nop\n\t"
0080 ".set\tpop"
0081 : : : "$2", "$3");
0082 }
0083
0084
0085
0086
0087
0088 static void wbflush_mips(void)
0089 {
0090 __fast_iob();
0091 }
0092 EXPORT_SYMBOL(__wbflush);