mcfcache.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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_M523x) || 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_M523x || CONFIG_M527x */
  49. #if defined(CONFIG_M528x)
  50. .macro CACHE_ENABLE
  51. nop
  52. movel #0x01000000, %d0
  53. movec %d0, %CACR /* Invalidate cache */
  54. nop
  55. movel #0x0000c020, %d0 /* Set SDRAM cached only */
  56. movec %d0, %ACR0
  57. movel #0xff00c000, %d0 /* Cache Flash also */
  58. movec %d0, %ACR1
  59. movel #0x80000200, %d0 /* Setup cache mask */
  60. movec %d0, %CACR /* Enable cache */
  61. nop
  62. .endm
  63. #endif /* CONFIG_M528x */
  64. #if defined(CONFIG_M5249) || defined(CONFIG_M5307)
  65. /*
  66. * The version 3 core cache. Oddly enough the version 2 core 5249
  67. * has the same SDRAM and cache setup as the version 3 cores.
  68. * This is a single unified instruction/data cache.
  69. */
  70. .macro CACHE_ENABLE
  71. movel #0x01000000,%d0 /* invalidate whole cache */
  72. movec %d0,%CACR
  73. nop
  74. #if defined(DEBUGGER_COMPATIBLE_CACHE) || defined(CONFIG_SECUREEDGEMP3)
  75. movel #0x0000c000,%d0 /* set SDRAM cached (write-thru) */
  76. #else
  77. movel #0x0000c020,%d0 /* set SDRAM cached (copyback) */
  78. #endif
  79. movec %d0,%ACR0
  80. movel #0x00000000,%d0 /* no other regions cached */
  81. movec %d0,%ACR1
  82. movel #0xa0000200,%d0 /* enable cache */
  83. movec %d0,%CACR
  84. nop
  85. .endm
  86. #endif /* CONFIG_M5249 || CONFIG_M5307 */
  87. #if defined(CONFIG_M5407)
  88. /*
  89. * Version 4 cores have a true harvard style separate instruction
  90. * and data cache. Invalidate and enable cache, also enable write
  91. * buffers and branch accelerator.
  92. */
  93. .macro CACHE_ENABLE
  94. movel #0x01040100,%d0 /* invalidate whole cache */
  95. movec %d0,%CACR
  96. nop
  97. movel #0x000fc000,%d0 /* set SDRAM cached only */
  98. movec %d0, %ACR0
  99. movel #0x00000000,%d0 /* no other regions cached */
  100. movec %d0, %ACR1
  101. movel #0x000fc000,%d0 /* set SDRAM cached only */
  102. movec %d0, %ACR2
  103. movel #0x00000000,%d0 /* no other regions cached */
  104. movec %d0, %ACR3
  105. movel #0xb6088400,%d0 /* enable caches */
  106. movec %d0,%CACR
  107. nop
  108. .endm
  109. #endif /* CONFIG_M5407 */
  110. /****************************************************************************/
  111. #endif /* __M68KNOMMU_MCFCACHE_H */