cache.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. * ColdFire cache
  3. *
  4. * Copyright (C) 2004-2010 Freescale Semiconductor, Inc.
  5. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #ifndef __CACHE_H
  26. #define __CACHE_H
  27. #if defined(CONFIG_MCF520x) || defined(CONFIG_MCF523x) || \
  28. defined(CONFIG_MCF52x2) || defined(CONFIG_MCF5227x)
  29. #define CONFIG_CF_V2
  30. #endif
  31. #if defined(CONFIG_MCF532x) || defined(CONFIG_MCF5301x)
  32. #define CONFIG_CF_V3
  33. #endif
  34. #if defined(CONFIG_MCF547x_8x) || defined(CONFIG_MCF5445x)
  35. #define CONFIG_CF_V4
  36. #if defined(CONFIG_MCF5441x)
  37. #define CONFIG_CF_V4E /* Four Extra ACRn */
  38. #endif
  39. #endif
  40. /* ***** CACR ***** */
  41. /* V2 Core */
  42. #ifdef CONFIG_CF_V2
  43. #define CF_CACR_CENB (1 << 31)
  44. #define CF_CACR_CPD (1 << 28)
  45. #define CF_CACR_CFRZ (1 << 27)
  46. #define CF_CACR_CEIB (1 << 10)
  47. #define CF_CACR_DCM (1 << 9)
  48. #define CF_CACR_DBWE (1 << 8)
  49. #if defined(CONFIG_MCF5249) || defined(CONFIG_MCF5253)
  50. #define CF_CACR_DWP (1 << 6)
  51. #else
  52. #define CF_CACR_CINV (1 << 24)
  53. #define CF_CACR_DISI (1 << 23)
  54. #define CF_CACR_DISD (1 << 22)
  55. #define CF_CACR_INVI (1 << 21)
  56. #define CF_CACR_INVD (1 << 20)
  57. #define CF_CACR_DWP (1 << 5)
  58. #define CF_CACR_EUSP (1 << 4)
  59. #endif /* CONFIG_MCF5249 || CONFIG_MCF5253 */
  60. #endif /* CONFIG_CF_V2 */
  61. /* V3 Core */
  62. #ifdef CONFIG_CF_V3
  63. #define CF_CACR_EC (1 << 31)
  64. #define CF_CACR_ESB (1 << 29)
  65. #define CF_CACR_DPI (1 << 28)
  66. #define CF_CACR_HLCK (1 << 27)
  67. #define CF_CACR_CINVA (1 << 24)
  68. #define CF_CACR_DNFB (1 << 10)
  69. #define CF_CACR_DCM_UNMASK 0xFFFFFCFF
  70. #define CF_CACR_DCM_WT (0 << 8)
  71. #define CF_CACR_DCM_CB (1 << 8)
  72. #define CF_CACR_DCM_P (2 << 8)
  73. #define CF_CACR_DCM_IP (3 << 8)
  74. #define CF_CACR_DW (1 << 5)
  75. #define CF_CACR_EUSP (1 << 4)
  76. #endif /* CONFIG_CF_V3 */
  77. /* V4 Core */
  78. #ifdef CONFIG_CF_V4
  79. #define CF_CACR_DEC (1 << 31)
  80. #define CF_CACR_DW (1 << 30)
  81. #define CF_CACR_DESB (1 << 29)
  82. #define CF_CACR_DDPI (1 << 28)
  83. #define CF_CACR_DHLCK (1 << 27)
  84. #define CF_CACR_DDCM_UNMASK (0xF9FFFFFF)
  85. #define CF_CACR_DDCM_WT (0 << 25)
  86. #define CF_CACR_DDCM_CB (1 << 25)
  87. #define CF_CACR_DDCM_P (2 << 25)
  88. #define CF_CACR_DDCM_IP (3 << 25)
  89. #define CF_CACR_DCINVA (1 << 24)
  90. #define CF_CACR_DDSP (1 << 23)
  91. #define CF_CACR_BEC (1 << 19)
  92. #define CF_CACR_BCINVA (1 << 18)
  93. #define CF_CACR_IEC (1 << 15)
  94. #define CF_CACR_DNFB (1 << 13)
  95. #define CF_CACR_IDPI (1 << 12)
  96. #define CF_CACR_IHLCK (1 << 11)
  97. #define CF_CACR_IDCM (1 << 10)
  98. #define CF_CACR_ICINVA (1 << 8)
  99. #define CF_CACR_IDSP (1 << 7)
  100. #define CF_CACR_EUSP (1 << 5)
  101. #ifdef CONFIG_MCF5445x
  102. #define CF_CACR_IVO (1 << 20)
  103. #define CF_CACR_SPA (1 << 14)
  104. #else
  105. #define CF_CACR_DF (1 << 4)
  106. #endif
  107. #endif /* CONFIG_CF_V4 */
  108. /* ***** ACR ***** */
  109. #define CF_ACR_ADR_UNMASK (0x00FFFFFF)
  110. #define CF_ACR_ADR(x) ((x & 0xFF) << 24)
  111. #define CF_ACR_ADRMSK_UNMASK (0xFF00FFFF)
  112. #define CF_ACR_ADRMSK(x) ((x & 0xFF) << 16)
  113. #define CF_ACR_EN (1 << 15)
  114. #define CF_ACR_SM_UNMASK (0xFFFF9FFF)
  115. #define CF_ACR_SM_UM (0 << 13)
  116. #define CF_ACR_SM_SM (1 << 13)
  117. #define CF_ACR_SM_ALL (3 << 13)
  118. #define CF_ACR_WP (1 << 2)
  119. /* V2 Core */
  120. #ifdef CONFIG_CF_V2
  121. #define CF_ACR_CM (1 << 6)
  122. #define CF_ACR_BWE (1 << 5)
  123. #else
  124. /* V3 & V4 */
  125. #define CF_ACR_CM_UNMASK (0xFFFFFF9F)
  126. #define CF_ACR_CM_WT (0 << 5)
  127. #define CF_ACR_CM_CB (1 << 5)
  128. #define CF_ACR_CM_P (2 << 5)
  129. #define CF_ACR_CM_IP (3 << 5)
  130. #endif /* CONFIG_CF_V2 */
  131. /* V4 Core */
  132. #ifdef CONFIG_CF_V4
  133. #define CF_ACR_AMM (1 << 10)
  134. #define CF_ACR_SP (1 << 3)
  135. #endif /* CONFIG_CF_V4 */
  136. #ifndef CONFIG_SYS_CACHE_ICACR
  137. #define CONFIG_SYS_CACHE_ICACR 0
  138. #endif
  139. #ifndef CONFIG_SYS_CACHE_DCACR
  140. #ifdef CONFIG_SYS_CACHE_ICACR
  141. #define CONFIG_SYS_CACHE_DCACR CONFIG_SYS_CACHE_ICACR
  142. #else
  143. #define CONFIG_SYS_CACHE_DCACR 0
  144. #endif
  145. #endif
  146. #ifndef CONFIG_SYS_CACHE_ACR0
  147. #define CONFIG_SYS_CACHE_ACR0 0
  148. #endif
  149. #ifndef CONFIG_SYS_CACHE_ACR1
  150. #define CONFIG_SYS_CACHE_ACR1 0
  151. #endif
  152. #ifndef CONFIG_SYS_CACHE_ACR2
  153. #define CONFIG_SYS_CACHE_ACR2 0
  154. #endif
  155. #ifndef CONFIG_SYS_CACHE_ACR3
  156. #define CONFIG_SYS_CACHE_ACR3 0
  157. #endif
  158. #ifndef CONFIG_SYS_CACHE_ACR4
  159. #define CONFIG_SYS_CACHE_ACR4 0
  160. #endif
  161. #ifndef CONFIG_SYS_CACHE_ACR5
  162. #define CONFIG_SYS_CACHE_ACR5 0
  163. #endif
  164. #ifndef CONFIG_SYS_CACHE_ACR6
  165. #define CONFIG_SYS_CACHE_ACR6 0
  166. #endif
  167. #ifndef CONFIG_SYS_CACHE_ACR7
  168. #define CONFIG_SYS_CACHE_ACR7 0
  169. #endif
  170. #define CF_ADDRMASK(x) (((x > 0x10) ? ((x >> 4) - 1) : (x)) << 16)
  171. #ifndef __ASSEMBLY__ /* put C only stuff in this section */
  172. void icache_invalid(void);
  173. void dcache_invalid(void);
  174. #endif
  175. #endif /* __CACHE_H */