armv7.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * (C) Copyright 2010
  3. * Texas Instruments, <www.ti.com>
  4. * Aneesh V <aneesh@ti.com>
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #ifndef ARMV7_H
  9. #define ARMV7_H
  10. /* Cortex-A9 revisions */
  11. #define MIDR_CORTEX_A9_R0P1 0x410FC091
  12. #define MIDR_CORTEX_A9_R1P2 0x411FC092
  13. #define MIDR_CORTEX_A9_R1P3 0x411FC093
  14. #define MIDR_CORTEX_A9_R2P10 0x412FC09A
  15. /* Cortex-A15 revisions */
  16. #define MIDR_CORTEX_A15_R0P0 0x410FC0F0
  17. #define MIDR_CORTEX_A15_R2P2 0x412FC0F2
  18. /* Cortex-A7 revisions */
  19. #define MIDR_CORTEX_A7_R0P0 0x410FC070
  20. #define MIDR_PRIMARY_PART_MASK 0xFF0FFFF0
  21. /* ID_PFR1 feature fields */
  22. #define CPUID_ARM_SEC_SHIFT 4
  23. #define CPUID_ARM_SEC_MASK (0xF << CPUID_ARM_SEC_SHIFT)
  24. #define CPUID_ARM_VIRT_SHIFT 12
  25. #define CPUID_ARM_VIRT_MASK (0xF << CPUID_ARM_VIRT_SHIFT)
  26. #define CPUID_ARM_GENTIMER_SHIFT 16
  27. #define CPUID_ARM_GENTIMER_MASK (0xF << CPUID_ARM_GENTIMER_SHIFT)
  28. /* valid bits in CBAR register / PERIPHBASE value */
  29. #define CBAR_MASK 0xFFFF8000
  30. /* CCSIDR */
  31. #define CCSIDR_LINE_SIZE_OFFSET 0
  32. #define CCSIDR_LINE_SIZE_MASK 0x7
  33. #define CCSIDR_ASSOCIATIVITY_OFFSET 3
  34. #define CCSIDR_ASSOCIATIVITY_MASK (0x3FF << 3)
  35. #define CCSIDR_NUM_SETS_OFFSET 13
  36. #define CCSIDR_NUM_SETS_MASK (0x7FFF << 13)
  37. /*
  38. * Values for InD field in CSSELR
  39. * Selects the type of cache
  40. */
  41. #define ARMV7_CSSELR_IND_DATA_UNIFIED 0
  42. #define ARMV7_CSSELR_IND_INSTRUCTION 1
  43. /* Values for Ctype fields in CLIDR */
  44. #define ARMV7_CLIDR_CTYPE_NO_CACHE 0
  45. #define ARMV7_CLIDR_CTYPE_INSTRUCTION_ONLY 1
  46. #define ARMV7_CLIDR_CTYPE_DATA_ONLY 2
  47. #define ARMV7_CLIDR_CTYPE_INSTRUCTION_DATA 3
  48. #define ARMV7_CLIDR_CTYPE_UNIFIED 4
  49. #ifndef __ASSEMBLY__
  50. #include <linux/types.h>
  51. /*
  52. * CP15 Barrier instructions
  53. * Please note that we have separate barrier instructions in ARMv7
  54. * However, we use the CP15 based instructtions because we use
  55. * -march=armv5 in U-Boot
  56. */
  57. #define CP15ISB asm volatile ("mcr p15, 0, %0, c7, c5, 4" : : "r" (0))
  58. #define CP15DSB asm volatile ("mcr p15, 0, %0, c7, c10, 4" : : "r" (0))
  59. #define CP15DMB asm volatile ("mcr p15, 0, %0, c7, c10, 5" : : "r" (0))
  60. void v7_outer_cache_enable(void);
  61. void v7_outer_cache_disable(void);
  62. void v7_outer_cache_flush_all(void);
  63. void v7_outer_cache_inval_all(void);
  64. void v7_outer_cache_flush_range(u32 start, u32 end);
  65. void v7_outer_cache_inval_range(u32 start, u32 end);
  66. #if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV7_VIRT)
  67. int armv7_switch_nonsec(void);
  68. int armv7_switch_hyp(void);
  69. /* defined in assembly file */
  70. unsigned int _nonsec_init(void);
  71. void _smp_pen(void);
  72. void _switch_to_hyp(void);
  73. #endif /* CONFIG_ARMV7_NONSEC || CONFIG_ARMV7_VIRT */
  74. #endif /* ! __ASSEMBLY__ */
  75. #endif