m52xxacr.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /****************************************************************************/
  3. /*
  4. * m52xxacr.h -- ColdFire version 2 core cache support
  5. *
  6. * (C) Copyright 2010, Greg Ungerer <[email protected]>
  7. */
  8. /****************************************************************************/
  9. #ifndef m52xxacr_h
  10. #define m52xxacr_h
  11. /****************************************************************************/
  12. /*
  13. * All varients of the ColdFire using version 2 cores have a similar
  14. * cache setup. Although not absolutely identical the cache register
  15. * definitions are compatible for all of them. Mostly they support a
  16. * configurable cache memory that can be instruction only, data only,
  17. * or split instruction and data. The exception is the very old version 2
  18. * core based parts, like the 5206(e), 5249 and 5272, which are instruction
  19. * cache only. Cache size varies from 2k up to 16k.
  20. */
  21. /*
  22. * Define the Cache Control register flags.
  23. */
  24. #define CACR_CENB 0x80000000 /* Enable cache */
  25. #define CACR_CDPI 0x10000000 /* Disable invalidation by CPUSHL */
  26. #define CACR_CFRZ 0x08000000 /* Cache freeze mode */
  27. #define CACR_CINV 0x01000000 /* Invalidate cache */
  28. #define CACR_DISI 0x00800000 /* Disable instruction cache */
  29. #define CACR_DISD 0x00400000 /* Disable data cache */
  30. #define CACR_INVI 0x00200000 /* Invalidate instruction cache */
  31. #define CACR_INVD 0x00100000 /* Invalidate data cache */
  32. #define CACR_CEIB 0x00000400 /* Non-cachable instruction burst */
  33. #define CACR_DCM 0x00000200 /* Default cache mode */
  34. #define CACR_DBWE 0x00000100 /* Buffered write enable */
  35. #define CACR_DWP 0x00000020 /* Write protection */
  36. #define CACR_EUSP 0x00000010 /* Enable separate user a7 */
  37. /*
  38. * Define the Access Control register flags.
  39. */
  40. #define ACR_BASE_POS 24 /* Address Base (upper 8 bits) */
  41. #define ACR_MASK_POS 16 /* Address Mask (next 8 bits) */
  42. #define ACR_ENABLE 0x00008000 /* Enable this ACR */
  43. #define ACR_USER 0x00000000 /* Allow only user accesses */
  44. #define ACR_SUPER 0x00002000 /* Allow supervisor access only */
  45. #define ACR_ANY 0x00004000 /* Allow any access type */
  46. #define ACR_CENB 0x00000000 /* Caching of region enabled */
  47. #define ACR_CDIS 0x00000040 /* Caching of region disabled */
  48. #define ACR_BWE 0x00000020 /* Write buffer enabled */
  49. #define ACR_WPROTECT 0x00000004 /* Write protect region */
  50. /*
  51. * Set the cache controller settings we will use. On the cores that support
  52. * a split cache configuration we allow all the combinations at Kconfig
  53. * time. For those cores that only have an instruction cache we just set
  54. * that as on.
  55. */
  56. #if defined(CONFIG_CACHE_I)
  57. #define CACHE_TYPE (CACR_DISD + CACR_EUSP)
  58. #define CACHE_INVTYPEI 0
  59. #elif defined(CONFIG_CACHE_D)
  60. #define CACHE_TYPE (CACR_DISI + CACR_EUSP)
  61. #define CACHE_INVTYPED 0
  62. #elif defined(CONFIG_CACHE_BOTH)
  63. #define CACHE_TYPE CACR_EUSP
  64. #define CACHE_INVTYPEI CACR_INVI
  65. #define CACHE_INVTYPED CACR_INVD
  66. #else
  67. /* This is the instruction cache only devices (no split cache, no eusp) */
  68. #define CACHE_TYPE 0
  69. #define CACHE_INVTYPEI 0
  70. #endif
  71. #define CACHE_INIT (CACR_CINV + CACHE_TYPE)
  72. #define CACHE_MODE (CACR_CENB + CACHE_TYPE + CACR_DCM)
  73. #define CACHE_INVALIDATE (CACHE_MODE + CACR_CINV)
  74. #if defined(CACHE_INVTYPEI)
  75. #define CACHE_INVALIDATEI (CACHE_MODE + CACR_CINV + CACHE_INVTYPEI)
  76. #endif
  77. #if defined(CACHE_INVTYPED)
  78. #define CACHE_INVALIDATED (CACHE_MODE + CACR_CINV + CACHE_INVTYPED)
  79. #endif
  80. #define ACR0_MODE ((CONFIG_RAMBASE & 0xff000000) + \
  81. (0x000f0000) + \
  82. (ACR_ENABLE + ACR_ANY + ACR_CENB + ACR_BWE))
  83. #define ACR1_MODE 0
  84. /****************************************************************************/
  85. #endif /* m52xxsim_h */