/*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/init.h>1718#include <asm/bootinfo.h>19#include <asm/system.h>20#include <asm/wbflush.h>2122static void wbflush_kn01(void);23static void wbflush_kn210(void);24static void wbflush_mips(void);2526void (*__wbflush) (void);2728void __init wbflush_setup(void)29{30switch (mips_machtype) {31case MACH_DS23100:32case MACH_DS5000_200: /* DS5000 3max */33__wbflush = wbflush_kn01;34break;35case MACH_DS5100: /* DS5100 MIPSMATE */36__wbflush = wbflush_kn210;37break;38case MACH_DS5000_1XX: /* DS5000/100 3min */39case MACH_DS5000_XX: /* Personal DS5000/2x */40case MACH_DS5000_2X0: /* DS5000/240 3max+ */41case MACH_DS5900: /* DS5900 bigmax */42default:43__wbflush = wbflush_mips;44break;45}46}4748/*49* For the DS3100 and DS5000/200 the R2020/R3220 writeback buffer functions50* as part of Coprocessor 0.51*/52static void wbflush_kn01(void)53{54asm(".set\tpush\n\t"55".set\tnoreorder\n\t"56"1:\tbc0f\t1b\n\t"57"nop\n\t"58".set\tpop");59}6061/*62* For the DS5100 the writeback buffer seems to be a part of Coprocessor 3.63* But CP3 has to enabled first.64*/65static void wbflush_kn210(void)66{67asm(".set\tpush\n\t"68".set\tnoreorder\n\t"69"mfc0\t$2,$12\n\t"70"lui\t$3,0x8000\n\t"71"or\t$3,$2,$3\n\t"72"mtc0\t$3,$12\n\t"73"nop\n"74"1:\tbc3f\t1b\n\t"75"nop\n\t"76"mtc0\t$2,$12\n\t"77"nop\n\t"78".set\tpop"79: : : "$2", "$3");80}8182/*83* I/O ASIC systems use a standard writeback buffer that gets flushed84* upon an uncached read.85*/86static void wbflush_mips(void)87{88__fast_iob();89}9091#include <linux/module.h>9293EXPORT_SYMBOL(__wbflush);949596