cache.S 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #define ASSEMBLY
  2. #include <asm/linkage.h>
  3. #include <config.h>
  4. #include <asm/blackfin.h>
  5. #include <asm/mach-common/bits/mpu.h>
  6. .text
  7. .align 2
  8. ENTRY(_blackfin_icache_flush_range)
  9. R2 = -32;
  10. R2 = R0 & R2;
  11. P0 = R2;
  12. P1 = R1;
  13. CSYNC;
  14. 1:
  15. IFLUSH[P0++];
  16. CC = P0 < P1(iu);
  17. IF CC JUMP 1b(bp);
  18. IFLUSH[P0];
  19. SSYNC;
  20. RTS;
  21. ENTRY(_blackfin_dcache_flush_range)
  22. R2 = -32;
  23. R2 = R0 & R2;
  24. P0 = R2;
  25. P1 = R1;
  26. CSYNC;
  27. 1:
  28. FLUSH[P0++];
  29. CC = P0 < P1(iu);
  30. IF CC JUMP 1b(bp);
  31. FLUSH[P0];
  32. SSYNC;
  33. RTS;
  34. ENTRY(_icache_invalidate)
  35. ENTRY(_invalidate_entire_icache)
  36. [--SP] = (R7:5);
  37. P0.L = (IMEM_CONTROL & 0xFFFF);
  38. P0.H = (IMEM_CONTROL >> 16);
  39. R7 =[P0];
  40. /*
  41. * Clear the IMC bit , All valid bits in the instruction
  42. * cache are set to the invalid state
  43. */
  44. BITCLR(R7, IMC_P);
  45. CLI R6;
  46. /* SSYNC required before invalidating cache. */
  47. SSYNC;
  48. .align 8;
  49. [P0] = R7;
  50. SSYNC;
  51. STI R6;
  52. /* Configures the instruction cache agian */
  53. R6 = (IMC | ENICPLB);
  54. R7 = R7 | R6;
  55. CLI R6;
  56. SSYNC;
  57. .align 8;
  58. [P0] = R7;
  59. SSYNC;
  60. STI R6;
  61. (R7:5) =[SP++];
  62. RTS;
  63. /*
  64. * Invalidate the Entire Data cache by
  65. * clearing DMC[1:0] bits
  66. */
  67. ENTRY(_invalidate_entire_dcache)
  68. ENTRY(_dcache_invalidate)
  69. [--SP] = (R7:6);
  70. P0.L = (DMEM_CONTROL & 0xFFFF);
  71. P0.H = (DMEM_CONTROL >> 16);
  72. R7 =[P0];
  73. /*
  74. * Clear the DMC[1:0] bits, All valid bits in the data
  75. * cache are set to the invalid state
  76. */
  77. BITCLR(R7, DMC0_P);
  78. BITCLR(R7, DMC1_P);
  79. CLI R6;
  80. SSYNC;
  81. .align 8;
  82. [P0] = R7;
  83. SSYNC;
  84. STI R6;
  85. /* Configures the data cache again */
  86. R6 = (ACACHE_BCACHE | ENDCPLB | PORT_PREF0);
  87. R7 = R7 | R6;
  88. CLI R6;
  89. SSYNC;
  90. .align 8;
  91. [P0] = R7;
  92. SSYNC;
  93. STI R6;
  94. (R7:6) =[SP++];
  95. RTS;
  96. ENTRY(_blackfin_dcache_invalidate_range)
  97. R2 = -32;
  98. R2 = R0 & R2;
  99. P0 = R2;
  100. P1 = R1;
  101. CSYNC;
  102. 1:
  103. FLUSHINV[P0++];
  104. CC = P0 < P1(iu);
  105. IF CC JUMP 1b(bp);
  106. /*
  107. * If the data crosses a cache line, then we'll be pointing to
  108. * the last cache line, but won't have flushed/invalidated it yet, so do
  109. * one more.
  110. */
  111. FLUSHINV[P0];
  112. SSYNC;
  113. RTS;