mcfcache.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. #include <linux/config.h>
  12. /*
  13. * The different ColdFire families have different cache arrangments.
  14. * Everything from a small instruction only cache, to configurable
  15. * data and/or instruction cache, to unified instruction/data, to
  16. * harvard style separate instruction and data caches.
  17. */
  18. #if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || defined(CONFIG_M5272)
  19. /*
  20. * Simple version 2 core cache. These have instruction cache only,
  21. * we just need to invalidate it and enable it.
  22. */
  23. .macro CACHE_ENABLE
  24. movel #0x01000000,%d0 /* invalidate cache cmd */
  25. movec %d0,%CACR /* do invalidate cache */
  26. movel #0x80000100,%d0 /* setup cache mask */
  27. movec %d0,%CACR /* enable cache */
  28. .endm
  29. #endif /* CONFIG_M5206 || CONFIG_M5206e || CONFIG_M5272 */
  30. #if defined(CONFIG_M527x)
  31. /*
  32. * New version 2 cores have a configurable split cache arrangement.
  33. * For now I am just enabling instruction cache - but ultimately I
  34. * think a split instruction/data cache would be better.
  35. */
  36. .macro CACHE_ENABLE
  37. movel #0x01400000,%d0
  38. movec %d0,%CACR /* invalidate cache */
  39. nop
  40. movel #0x0000c000,%d0 /* set SDRAM cached only */
  41. movec %d0,%ACR0
  42. movel #0x00000000,%d0 /* no other regions cached */
  43. movec %d0,%ACR1
  44. movel #0x80400100,%d0 /* configure cache */
  45. movec %d0,%CACR /* enable cache */
  46. nop
  47. .endm
  48. #endif /* CONFIG_M527x */
  49. #if defined(CONFIG_M528x)
  50. /*
  51. * Cache is totally broken on early 5282 silicon. So far now we
  52. * disable its cache all together.
  53. */
  54. .macro CACHE_ENABLE
  55. movel #0x01000000,%d0
  56. movec %d0,%CACR /* invalidate cache */
  57. nop
  58. movel #0x0000c000,%d0 /* set SDRAM cached only */
  59. movec %d0,%ACR0
  60. movel #0x00000000,%d0 /* no other regions cached */
  61. movec %d0,%ACR1
  62. movel #0x00000000,%d0 /* configure cache */
  63. movec %d0,%CACR /* enable cache */
  64. nop
  65. .endm
  66. #endif /* CONFIG_M528x */
  67. #if defined(CONFIG_M5249) || defined(CONFIG_M5307)
  68. /*
  69. * The version 3 core cache. Oddly enough the version 2 core 5249
  70. * has the same SDRAM and cache setup as the version 3 cores.
  71. * This is a single unified instruction/data cache.
  72. */
  73. .macro CACHE_ENABLE
  74. movel #0x01000000,%d0 /* invalidate whole cache */
  75. movec %d0,%CACR
  76. nop
  77. #if defined(DEBUGGER_COMPATIBLE_CACHE) || defined(CONFIG_SECUREEDGEMP3)
  78. movel #0x0000c000,%d0 /* set SDRAM cached (write-thru) */
  79. #else
  80. movel #0x0000c020,%d0 /* set SDRAM cached (copyback) */
  81. #endif
  82. movec %d0,%ACR0
  83. movel #0x00000000,%d0 /* no other regions cached */
  84. movec %d0,%ACR1
  85. movel #0xa0000200,%d0 /* enable cache */
  86. movec %d0,%CACR
  87. nop
  88. .endm
  89. #endif /* CONFIG_M5249 || CONFIG_M5307 */
  90. #if defined(CONFIG_M5407)
  91. /*
  92. * Version 4 cores have a true harvard style separate instruction
  93. * and data cache. Invalidate and enable cache, also enable write
  94. * buffers and branch accelerator.
  95. */
  96. .macro CACHE_ENABLE
  97. movel #0x01040100,%d0 /* invalidate whole cache */
  98. movec %d0,%CACR
  99. nop
  100. movel #0x000fc000,%d0 /* set SDRAM cached only */
  101. movec %d0, %ACR0
  102. movel #0x00000000,%d0 /* no other regions cached */
  103. movec %d0, %ACR1
  104. movel #0x000fc000,%d0 /* set SDRAM cached only */
  105. movec %d0, %ACR2
  106. movel #0x00000000,%d0 /* no other regions cached */
  107. movec %d0, %ACR3
  108. movel #0xb6088400,%d0 /* enable caches */
  109. movec %d0,%CACR
  110. nop
  111. .endm
  112. #endif /* CONFIG_M5407 */
  113. /****************************************************************************/
  114. #endif /* __M68KNOMMU_MCFCACHE_H */