cacheflush_no.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _M68KNOMMU_CACHEFLUSH_H
  3. #define _M68KNOMMU_CACHEFLUSH_H
  4. /*
  5. * (C) Copyright 2000-2010, Greg Ungerer <[email protected]>
  6. */
  7. #include <linux/mm.h>
  8. #include <asm/mcfsim.h>
  9. #define flush_cache_all() __flush_cache_all()
  10. #define flush_dcache_range(start, len) __flush_dcache_all()
  11. #define flush_icache_range(start, len) __flush_icache_all()
  12. void mcf_cache_push(void);
  13. static inline void __clear_cache_all(void)
  14. {
  15. #ifdef CACHE_INVALIDATE
  16. __asm__ __volatile__ (
  17. "movec %0, %%CACR\n\t"
  18. "nop\n\t"
  19. : : "r" (CACHE_INVALIDATE) );
  20. #endif
  21. }
  22. static inline void __flush_cache_all(void)
  23. {
  24. #ifdef CACHE_PUSH
  25. mcf_cache_push();
  26. #endif
  27. __clear_cache_all();
  28. }
  29. /*
  30. * Some ColdFire parts implement separate instruction and data caches,
  31. * on those we should just flush the appropriate cache. If we don't need
  32. * to do any specific flushing then this will be optimized away.
  33. */
  34. static inline void __flush_icache_all(void)
  35. {
  36. #ifdef CACHE_INVALIDATEI
  37. __asm__ __volatile__ (
  38. "movec %0, %%CACR\n\t"
  39. "nop\n\t"
  40. : : "r" (CACHE_INVALIDATEI) );
  41. #endif
  42. }
  43. static inline void __flush_dcache_all(void)
  44. {
  45. #ifdef CACHE_PUSH
  46. mcf_cache_push();
  47. #endif
  48. #ifdef CACHE_INVALIDATED
  49. __asm__ __volatile__ (
  50. "movec %0, %%CACR\n\t"
  51. "nop\n\t"
  52. : : "r" (CACHE_INVALIDATED) );
  53. #else
  54. /* Flush the write buffer */
  55. __asm__ __volatile__ ( "nop" );
  56. #endif
  57. }
  58. /*
  59. * Push cache entries at supplied address. We want to write back any dirty
  60. * data and then invalidate the cache lines associated with this address.
  61. */
  62. static inline void cache_push(unsigned long paddr, int len)
  63. {
  64. __flush_cache_all();
  65. }
  66. /*
  67. * Clear cache entries at supplied address (that is don't write back any
  68. * dirty data).
  69. */
  70. static inline void cache_clear(unsigned long paddr, int len)
  71. {
  72. __clear_cache_all();
  73. }
  74. #include <asm-generic/cacheflush.h>
  75. #endif /* _M68KNOMMU_CACHEFLUSH_H */