cache.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * (C) Copyright 2002
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. /* for now: just dummy functions to satisfy the linker */
  8. #include <common.h>
  9. __weak void flush_cache(unsigned long start, unsigned long size)
  10. {
  11. #if defined(CONFIG_CPU_ARM1136)
  12. #if !defined(CONFIG_SYS_ICACHE_OFF)
  13. asm("mcr p15, 0, r1, c7, c5, 0"); /* invalidate I cache */
  14. #endif
  15. #if !defined(CONFIG_SYS_DCACHE_OFF)
  16. asm("mcr p15, 0, r1, c7, c14, 0"); /* Clean+invalidate D cache */
  17. #endif
  18. #endif /* CONFIG_CPU_ARM1136 */
  19. #ifdef CONFIG_CPU_ARM926EJS
  20. /* test and clean, page 2-23 of arm926ejs manual */
  21. asm("0: mrc p15, 0, r15, c7, c10, 3\n\t" "bne 0b\n" : : : "memory");
  22. /* disable write buffer as well (page 2-22) */
  23. asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (0));
  24. #endif /* CONFIG_CPU_ARM926EJS */
  25. return;
  26. }
  27. /*
  28. * Default implementation:
  29. * do a range flush for the entire range
  30. */
  31. __weak void flush_dcache_all(void)
  32. {
  33. flush_cache(0, ~0);
  34. }
  35. /*
  36. * Default implementation of enable_caches()
  37. * Real implementation should be in platform code
  38. */
  39. __weak void enable_caches(void)
  40. {
  41. puts("WARNING: Caches not enabled\n");
  42. }