cache.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2008 - 2013 Tensilica Inc.
  4. * (C) Copyright 2014 - 2016 Cadence Design Systems Inc.
  5. */
  6. #include <common.h>
  7. #include <asm/cache.h>
  8. /*
  9. * We currently run always with caches enabled when running from memory.
  10. * Xtensa version D or later will support changing cache behavior, so
  11. * we could implement it if necessary.
  12. */
  13. int dcache_status(void)
  14. {
  15. return 1;
  16. }
  17. void dcache_enable(void)
  18. {
  19. }
  20. void dcache_disable(void)
  21. {
  22. }
  23. void flush_cache(ulong start_addr, ulong size)
  24. {
  25. __flush_invalidate_dcache_range(start_addr, size);
  26. __invalidate_icache_range(start_addr, size);
  27. }
  28. void flush_dcache_all(void)
  29. {
  30. __flush_dcache_all();
  31. __invalidate_icache_all();
  32. }
  33. void flush_dcache_range(ulong start_addr, ulong end_addr)
  34. {
  35. __flush_invalidate_dcache_range(start_addr, end_addr - start_addr);
  36. }
  37. void invalidate_dcache_range(ulong start, ulong stop)
  38. {
  39. __invalidate_dcache_range(start, stop - start);
  40. }
  41. void invalidate_dcache_all(void)
  42. {
  43. __invalidate_dcache_all();
  44. }
  45. void invalidate_icache_all(void)
  46. {
  47. __invalidate_icache_all();
  48. }