marvell_def.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * Copyright (C) 2018 Marvell International Ltd.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. * https://spdx.org/licenses
  6. */
  7. #ifndef MARVELL_DEF_H
  8. #define MARVELL_DEF_H
  9. #include <platform_def.h>
  10. #include <arch.h>
  11. #include <common/tbbr/tbbr_img_def.h>
  12. #include <lib/xlat_tables/xlat_tables_v2.h>
  13. #include <plat/common/common_def.h>
  14. /****************************************************************************
  15. * Definitions common to all MARVELL standard platforms
  16. ****************************************************************************
  17. */
  18. /* Special value used to verify platform parameters from BL2 to BL31 */
  19. #define MARVELL_BL31_PLAT_PARAM_VAL 0x0f1e2d3c4b5a6978ULL
  20. #define PLAT_MARVELL_NORTHB_COUNT 1
  21. #define PLAT_MARVELL_CLUSTER_COUNT 1
  22. #define MARVELL_CACHE_WRITEBACK_SHIFT 6
  23. /*
  24. * Macros mapping the MPIDR Affinity levels to MARVELL Platform Power levels.
  25. * The power levels have a 1:1 mapping with the MPIDR affinity levels.
  26. */
  27. #define MARVELL_PWR_LVL0 MPIDR_AFFLVL0
  28. #define MARVELL_PWR_LVL1 MPIDR_AFFLVL1
  29. #define MARVELL_PWR_LVL2 MPIDR_AFFLVL2
  30. /*
  31. * Macros for local power states in Marvell platforms encoded by State-ID field
  32. * within the power-state parameter.
  33. */
  34. /* Local power state for power domains in Run state. */
  35. #define MARVELL_LOCAL_STATE_RUN 0
  36. /* Local power state for retention. Valid only for CPU power domains */
  37. #define MARVELL_LOCAL_STATE_RET 1
  38. /* Local power state for OFF/power-down.
  39. * Valid for CPU and cluster power domains
  40. */
  41. #define MARVELL_LOCAL_STATE_OFF 2
  42. /* This leaves a gap between end of DRAM and start of ROM block */
  43. #define MARVELL_TRUSTED_DRAM_SIZE 0x80000 /* 512 KB */
  44. /* The first 4KB of Trusted SRAM are used as shared memory */
  45. #define MARVELL_SHARED_RAM_BASE PLAT_MARVELL_ATF_BASE
  46. #define MARVELL_SHARED_RAM_SIZE 0x00001000 /* 4 KB */
  47. /* The remaining Trusted SRAM is used to load the BL images */
  48. #define MARVELL_BL_RAM_BASE (MARVELL_SHARED_RAM_BASE + \
  49. MARVELL_SHARED_RAM_SIZE)
  50. #define MARVELL_BL_RAM_SIZE (MARVELL_TRUSTED_DRAM_SIZE - \
  51. MARVELL_SHARED_RAM_SIZE)
  52. #define MARVELL_DRAM_BASE ULL(0x0)
  53. #define MARVELL_DRAM_SIZE ULL(0x20000000)
  54. #define MARVELL_DRAM_END (MARVELL_DRAM_BASE + \
  55. MARVELL_DRAM_SIZE - 1)
  56. #define MARVELL_IRQ_SEC_PHY_TIMER 29
  57. #define MARVELL_IRQ_SEC_SGI_0 8
  58. #define MARVELL_IRQ_SEC_SGI_1 9
  59. #define MARVELL_IRQ_SEC_SGI_2 10
  60. #define MARVELL_IRQ_SEC_SGI_3 11
  61. #define MARVELL_IRQ_SEC_SGI_4 12
  62. #define MARVELL_IRQ_SEC_SGI_5 13
  63. #define MARVELL_IRQ_SEC_SGI_6 14
  64. #define MARVELL_IRQ_SEC_SGI_7 15
  65. #define MARVELL_MAP_SHARED_RAM MAP_REGION_FLAT( \
  66. MARVELL_SHARED_RAM_BASE, \
  67. MARVELL_SHARED_RAM_SIZE, \
  68. MT_MEMORY | MT_RW | MT_SECURE)
  69. #define MARVELL_MAP_DRAM MAP_REGION_FLAT( \
  70. MARVELL_DRAM_BASE, \
  71. MARVELL_DRAM_SIZE, \
  72. MT_MEMORY | MT_RW | MT_NS)
  73. /*
  74. * The number of regions like RO(code), coherent and data required by
  75. * different BL stages which need to be mapped in the MMU.
  76. */
  77. #if USE_COHERENT_MEM
  78. #define MARVELL_BL_REGIONS 3
  79. #else
  80. #define MARVELL_BL_REGIONS 2
  81. #endif
  82. #define MAX_MMAP_REGIONS (PLAT_MARVELL_MMAP_ENTRIES + \
  83. MARVELL_BL_REGIONS)
  84. #define MARVELL_CONSOLE_BAUDRATE 115200
  85. /****************************************************************************
  86. * Required platform porting definitions common to all MARVELL std. platforms
  87. ****************************************************************************
  88. */
  89. #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32)
  90. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32)
  91. /*
  92. * This macro defines the deepest retention state possible. A higher state
  93. * id will represent an invalid or a power down state.
  94. */
  95. #define PLAT_MAX_RET_STATE MARVELL_LOCAL_STATE_RET
  96. /*
  97. * This macro defines the deepest power down states possible. Any state ID
  98. * higher than this is invalid.
  99. */
  100. #define PLAT_MAX_OFF_STATE MARVELL_LOCAL_STATE_OFF
  101. #define PLATFORM_CORE_COUNT PLAT_MARVELL_CLUSTER_CORE_COUNT
  102. /*
  103. * Some data must be aligned on the biggest cache line size in the platform.
  104. * This is known only to the platform as it might have a combination of
  105. * integrated and external caches.
  106. */
  107. #define CACHE_WRITEBACK_GRANULE (1 << MARVELL_CACHE_WRITEBACK_SHIFT)
  108. /*****************************************************************************
  109. * BL1 specific defines.
  110. * BL1 RW data is relocated from ROM to RAM at runtime so we need 2 sets of
  111. * addresses.
  112. *****************************************************************************
  113. */
  114. #define BL1_RO_BASE PLAT_MARVELL_TRUSTED_ROM_BASE
  115. #define BL1_RO_LIMIT (PLAT_MARVELL_TRUSTED_ROM_BASE \
  116. + PLAT_MARVELL_TRUSTED_ROM_SIZE)
  117. /*
  118. * Put BL1 RW at the top of the Trusted SRAM.
  119. */
  120. #define BL1_RW_BASE (MARVELL_BL_RAM_BASE + \
  121. MARVELL_BL_RAM_SIZE - \
  122. PLAT_MARVELL_MAX_BL1_RW_SIZE)
  123. #define BL1_RW_LIMIT (MARVELL_BL_RAM_BASE + MARVELL_BL_RAM_SIZE)
  124. /*****************************************************************************
  125. * BL2 specific defines.
  126. *****************************************************************************
  127. */
  128. /*
  129. * Put BL2 just below BL31.
  130. */
  131. #define BL2_BASE (BL31_BASE - PLAT_MARVELL_MAX_BL2_SIZE)
  132. #define BL2_LIMIT BL31_BASE
  133. /*****************************************************************************
  134. * BL31 specific defines.
  135. *****************************************************************************
  136. */
  137. /*
  138. * Put BL31 at the top of the Trusted SRAM.
  139. */
  140. #define BL31_BASE (MARVELL_BL_RAM_BASE + \
  141. MARVELL_BL_RAM_SIZE - \
  142. PLAT_MARVEL_MAX_BL31_SIZE)
  143. #define BL31_PROGBITS_LIMIT BL1_RW_BASE
  144. #define BL31_LIMIT (MARVELL_BL_RAM_BASE + \
  145. MARVELL_BL_RAM_SIZE)
  146. /*****************************************************************************
  147. * BL32 specific defines.
  148. *****************************************************************************
  149. */
  150. #define BL32_BASE PLAT_MARVELL_TRUSTED_RAM_BASE
  151. #define BL32_LIMIT (BL32_BASE + PLAT_MARVELL_TRUSTED_RAM_SIZE)
  152. #ifdef SPD_none
  153. #undef BL32_BASE
  154. #endif /* SPD_none */
  155. #endif /* MARVELL_DEF_H */