/*1* Setup the right wbflush routine for the different DECstations.2*3* Created with information from:4* DECstation 3100 Desktop Workstation Functional Specification5* DECstation 5000/200 KN02 System Module Functional Specification6* mipsel-linux-objdump --disassemble vmunix | grep "wbflush" :-)7*8* This file is subject to the terms and conditions of the GNU General Public9* License. See the file "COPYING" in the main directory of this archive10* for more details.11*12* Copyright (C) 1998 Harald Koerfgen13* Copyright (C) 2002 Maciej W. Rozycki14*/1516#include <linux/export.h>17#include <linux/init.h>1819#include <asm/bootinfo.h>20#include <asm/wbflush.h>21#include <asm/barrier.h>2223static void wbflush_kn01(void);24static void wbflush_kn210(void);25static void wbflush_mips(void);2627void (*__wbflush) (void);2829void __init wbflush_setup(void)30{31switch (mips_machtype) {32case MACH_DS23100:33case MACH_DS5000_200: /* DS5000 3max */34__wbflush = wbflush_kn01;35break;36case MACH_DS5100: /* DS5100 MIPSMATE */37__wbflush = wbflush_kn210;38break;39case MACH_DS5000_1XX: /* DS5000/100 3min */40case MACH_DS5000_XX: /* Personal DS5000/2x */41case MACH_DS5000_2X0: /* DS5000/240 3max+ */42case MACH_DS5900: /* DS5900 bigmax */43default:44__wbflush = wbflush_mips;45break;46}47}4849/*50* For the DS3100 and DS5000/200 the R2020/R3220 writeback buffer functions51* as part of Coprocessor 0.52*/53static void wbflush_kn01(void)54{55asm(".set\tpush\n\t"56".set\tnoreorder\n\t"57"1:\tbc0f\t1b\n\t"58"nop\n\t"59".set\tpop");60}6162/*63* For the DS5100 the writeback buffer seems to be a part of Coprocessor 3.64* But CP3 has to enabled first.65*/66static void wbflush_kn210(void)67{68asm(".set\tpush\n\t"69".set\tnoreorder\n\t"70"mfc0\t$2,$12\n\t"71"lui\t$3,0x8000\n\t"72"or\t$3,$2,$3\n\t"73"mtc0\t$3,$12\n\t"74"nop\n"75"1:\tbc3f\t1b\n\t"76"nop\n\t"77"mtc0\t$2,$12\n\t"78"nop\n\t"79".set\tpop"80: : : "$2", "$3");81}8283/*84* I/O ASIC systems use a standard writeback buffer that gets flushed85* upon an uncached read.86*/87static void wbflush_mips(void)88{89__fast_iob();90}91EXPORT_SYMBOL(__wbflush);929394