dma.c 627 B

123456789101112131415161718192021222324252627
  1. // SPDX-License-Identifier: GPL-2.0+
  2. #include <linux/types.h>
  3. #include <linux/dma-map-ops.h>
  4. #include <asm/bmips.h>
  5. #include <asm/io.h>
  6. bool bmips_rac_flush_disable;
  7. void arch_sync_dma_for_cpu_all(void)
  8. {
  9. void __iomem *cbr = BMIPS_GET_CBR();
  10. u32 cfg;
  11. if (boot_cpu_type() != CPU_BMIPS3300 &&
  12. boot_cpu_type() != CPU_BMIPS4350 &&
  13. boot_cpu_type() != CPU_BMIPS4380)
  14. return;
  15. if (unlikely(bmips_rac_flush_disable))
  16. return;
  17. /* Flush stale data out of the readahead cache */
  18. cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG);
  19. __raw_writel(cfg | 0x100, cbr + BMIPS_RAC_CONFIG);
  20. __raw_readl(cbr + BMIPS_RAC_CONFIG);
  21. }