MIPS: BMIPS: Move post DMA flush implementation to common header
[cascardo/linux.git] / arch / mips / include / asm / bmips.h
index 30939b0..6d25ad3 100644 (file)
@@ -122,6 +122,22 @@ static inline void bmips_write_zscm_reg(unsigned int offset, unsigned long data)
        barrier();
 }
 
+static inline void bmips_post_dma_flush(struct device *dev)
+{
+       void __iomem *cbr = BMIPS_GET_CBR();
+       u32 cfg;
+
+       if (boot_cpu_type() != CPU_BMIPS3300 &&
+           boot_cpu_type() != CPU_BMIPS4350 &&
+           boot_cpu_type() != CPU_BMIPS4380)
+               return;
+
+       /* Flush stale data out of the readahead cache */
+       cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG);
+       __raw_writel(cfg | 0x100, cbr + BMIPS_RAC_CONFIG);
+       __raw_readl(cbr + BMIPS_RAC_CONFIG);
+}
+
 #endif /* !defined(__ASSEMBLY__) */
 
 #endif /* _ASM_BMIPS_H */