m52xxacr.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /****************************************************************************/
  2. /*
  3. * m52xxacr.h -- ColdFire version 2 core cache support
  4. *
  5. * (C) Copyright 2010, Greg Ungerer <gerg@snapgear.com>
  6. */
  7. /****************************************************************************/
  8. #ifndef m52xxacr_h
  9. #define m52xxacr_h
  10. /****************************************************************************/
  11. /*
  12. * All varients of the ColdFire using version 2 cores have a similar
  13. * cache setup. Although not absolutely identical the cache register
  14. * definitions are compatible for all of them. Mostly they support a
  15. * configurable cache memory that can be instruction only, data only,
  16. * or split instruction and data. The exception is the very old version 2
  17. * core based parts, like the 5206(e), 5249 and 5272, which are instruction
  18. * cache only. Cache size varies from 2k up to 16k.
  19. */
  20. /*
  21. * Define the Cache Control register flags.
  22. */
  23. #define CACR_CENB 0x80000000 /* Enable cache */
  24. #define CACR_CDPI 0x10000000 /* Disable invalidation by CPUSHL */
  25. #define CACR_CFRZ 0x08000000 /* Cache freeze mode */
  26. #define CACR_CINV 0x01000000 /* Invalidate cache */
  27. #define CACR_DISI 0x00800000 /* Disable instruction cache */
  28. #define CACR_DISD 0x00400000 /* Disable data cache */
  29. #define CACR_INVI 0x00200000 /* Invalidate instruction cache */
  30. #define CACR_INVD 0x00100000 /* Invalidate data cache */
  31. #define CACR_CEIB 0x00000400 /* Non-cachable instruction burst */
  32. #define CACR_DCM 0x00000200 /* Default cache mode */
  33. #define CACR_DBWE 0x00000100 /* Buffered write enable */
  34. #define CACR_DWP 0x00000020 /* Write protection */
  35. #define CACR_EUSP 0x00000010 /* Enable separate user a7 */
  36. /*
  37. * Define the Access Control register flags.
  38. */
  39. #define ACR_BASE_POS 24 /* Address Base (upper 8 bits) */
  40. #define ACR_MASK_POS 16 /* Address Mask (next 8 bits) */
  41. #define ACR_ENABLE 0x00008000 /* Enable this ACR */
  42. #define ACR_USER 0x00000000 /* Allow only user accesses */
  43. #define ACR_SUPER 0x00002000 /* Allow supervisor access only */
  44. #define ACR_ANY 0x00004000 /* Allow any access type */
  45. #define ACR_CENB 0x00000000 /* Caching of region enabled */
  46. #define ACR_CDIS 0x00000040 /* Caching of region disabled */
  47. #define ACR_BWE 0x00000020 /* Write buffer enabled */
  48. #define ACR_WPROTECT 0x00000004 /* Write protect region */
  49. /*
  50. * Set the cache controller settings we will use. This code is set to
  51. * only use the instruction cache, even on the controllers that support
  52. * split cache. (This setup is trying to preserve the existing behavior
  53. * for now, in the furture I hope to actually use the split cache mode).
  54. */
  55. #if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || \
  56. defined(CONFIG_M5249) || defined(CONFIG_M5272)
  57. #define CACHE_INIT (CACR_CINV)
  58. #define CACHE_MODE (CACR_CENB + CACR_DCM)
  59. #else
  60. #ifdef CONFIG_COLDFIRE_SW_A7
  61. #define CACHE_INIT (CACR_CINV + CACR_DISD)
  62. #define CACHE_MODE (CACR_CENB + CACR_DISD + CACR_DCM)
  63. #else
  64. #define CACHE_INIT (CACR_CINV + CACR_DISD + CACR_EUSP)
  65. #define CACHE_MODE (CACR_CENB + CACR_DISD + CACR_DCM + CACR_EUSP)
  66. #endif
  67. #endif
  68. #define CACHE_INVALIDATE (CACHE_MODE + CACR_CINV)
  69. #define ACR0_MODE ((CONFIG_RAMBASE & 0xff000000) + \
  70. (0x000f0000) + \
  71. (ACR_ENABLE + ACR_ANY + ACR_CENB + ACR_BWE))
  72. #define ACR1_MODE 0
  73. /****************************************************************************/
  74. #endif /* m52xxsim_h */