mcfcache.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /****************************************************************************/
  2. /*
  3. * mcfcache.h -- ColdFire CPU cache support code
  4. *
  5. * (C) Copyright 2004, Greg Ungerer <gerg@snapgear.com>
  6. */
  7. /****************************************************************************/
  8. #ifndef __M68KNOMMU_MCFCACHE_H
  9. #define __M68KNOMMU_MCFCACHE_H
  10. /****************************************************************************/
  11. /*
  12. * The different ColdFire families have different cache arrangments.
  13. * Everything from a small instruction only cache, to configurable
  14. * data and/or instruction cache, to unified instruction/data, to
  15. * harvard style separate instruction and data caches.
  16. */
  17. #if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || defined(CONFIG_M5272)
  18. /*
  19. * Simple version 2 core cache. These have instruction cache only,
  20. * we just need to invalidate it and enable it.
  21. */
  22. .macro CACHE_ENABLE
  23. movel #0x01000000,%d0 /* invalidate cache cmd */
  24. movec %d0,%CACR /* do invalidate cache */
  25. movel #0x80000100,%d0 /* setup cache mask */
  26. movec %d0,%CACR /* enable cache */
  27. .endm
  28. #endif /* CONFIG_M5206 || CONFIG_M5206e || CONFIG_M5272 */
  29. #if defined(CONFIG_M523x) || defined(CONFIG_M527x)
  30. /*
  31. * New version 2 cores have a configurable split cache arrangement.
  32. * For now I am just enabling instruction cache - but ultimately I
  33. * think a split instruction/data cache would be better.
  34. */
  35. .macro CACHE_ENABLE
  36. movel #0x01400000,%d0
  37. movec %d0,%CACR /* invalidate cache */
  38. nop
  39. movel #0x0000c000,%d0 /* set SDRAM cached only */
  40. movec %d0,%ACR0
  41. movel #0x00000000,%d0 /* no other regions cached */
  42. movec %d0,%ACR1
  43. movel #0x80400100,%d0 /* configure cache */
  44. movec %d0,%CACR /* enable cache */
  45. nop
  46. .endm
  47. #endif /* CONFIG_M523x || CONFIG_M527x */
  48. #if defined(CONFIG_M528x)
  49. .macro CACHE_ENABLE
  50. nop
  51. movel #0x01000000, %d0
  52. movec %d0, %CACR /* Invalidate cache */
  53. nop
  54. movel #0x0000c020, %d0 /* Set SDRAM cached only */
  55. movec %d0, %ACR0
  56. movel #0x00000000, %d0 /* No other regions cached */
  57. movec %d0, %ACR1
  58. movel #0x80000200, %d0 /* Setup cache mask */
  59. movec %d0, %CACR /* Enable cache */
  60. nop
  61. .endm
  62. #endif /* CONFIG_M528x */
  63. #if defined(CONFIG_M5249) || defined(CONFIG_M5307)
  64. /*
  65. * The version 3 core cache. Oddly enough the version 2 core 5249
  66. * has the same SDRAM and cache setup as the version 3 cores.
  67. * This is a single unified instruction/data cache.
  68. */
  69. .macro CACHE_ENABLE
  70. movel #0x01000000,%d0 /* invalidate whole cache */
  71. movec %d0,%CACR
  72. nop
  73. #if defined(DEBUGGER_COMPATIBLE_CACHE) || defined(CONFIG_SECUREEDGEMP3)
  74. movel #0x0000c000,%d0 /* set SDRAM cached (write-thru) */
  75. #else
  76. movel #0x0000c020,%d0 /* set SDRAM cached (copyback) */
  77. #endif
  78. movec %d0,%ACR0
  79. movel #0x00000000,%d0 /* no other regions cached */
  80. movec %d0,%ACR1
  81. movel #0xa0000200,%d0 /* enable cache */
  82. movec %d0,%CACR
  83. nop
  84. .endm
  85. #endif /* CONFIG_M5249 || CONFIG_M5307 */
  86. #if defined(CONFIG_M532x)
  87. .macro CACHE_ENABLE
  88. movel #0x01000000,%d0 /* invalidate cache cmd */
  89. movec %d0,%CACR /* do invalidate cache */
  90. nop
  91. movel #0x4001C000,%d0 /* set SDRAM cached (write-thru) */
  92. movec %d0,%ACR0
  93. movel #0x00000000,%d0 /* no other regions cached */
  94. movec %d0,%ACR1
  95. movel #0x80000200,%d0 /* setup cache mask */
  96. movec %d0,%CACR /* enable cache */
  97. nop
  98. .endm
  99. #endif /* CONFIG_M532x */
  100. #if defined(CONFIG_M5407)
  101. /*
  102. * Version 4 cores have a true harvard style separate instruction
  103. * and data cache. Invalidate and enable cache, also enable write
  104. * buffers and branch accelerator.
  105. */
  106. .macro CACHE_ENABLE
  107. movel #0x01040100,%d0 /* invalidate whole cache */
  108. movec %d0,%CACR
  109. nop
  110. movel #0x000fc000,%d0 /* set SDRAM cached only */
  111. movec %d0, %ACR0
  112. movel #0x00000000,%d0 /* no other regions cached */
  113. movec %d0, %ACR1
  114. movel #0x000fc000,%d0 /* set SDRAM cached only */
  115. movec %d0, %ACR2
  116. movel #0x00000000,%d0 /* no other regions cached */
  117. movec %d0, %ACR3
  118. movel #0xb6088400,%d0 /* enable caches */
  119. movec %d0,%CACR
  120. nop
  121. .endm
  122. #endif /* CONFIG_M5407 */
  123. #if defined(CONFIG_M520x)
  124. .macro CACHE_ENABLE
  125. move.l #0x01000000,%d0 /* invalidate whole cache */
  126. movec %d0,%CACR
  127. nop
  128. move.l #0x0000c000,%d0 /* set SDRAM cached (write-thru) */
  129. movec %d0,%ACR0
  130. move.l #0x00000000,%d0 /* no other regions cached */
  131. movec %d0,%ACR1
  132. move.l #0x80400000,%d0 /* enable 8K instruction cache */
  133. movec %d0,%CACR
  134. nop
  135. .endm
  136. #endif /* CONFIG_M520x */
  137. /****************************************************************************/
  138. #endif /* __M68KNOMMU_MCFCACHE_H */