platform_def.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /*
  2. * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef PLATFORM_DEF_H
  7. #define PLATFORM_DEF_H
  8. #include <arch.h>
  9. #include <common/tbbr/tbbr_img_def.h>
  10. #include <plat/common/common_def.h>
  11. #define PLATFORM_STACK_SIZE 0x1000
  12. #define PLATFORM_MAX_CPUS_PER_CLUSTER U(2)
  13. #define PLATFORM_CLUSTER_COUNT U(1)
  14. #define PLATFORM_CLUSTER0_CORE_COUNT PLATFORM_MAX_CPUS_PER_CLUSTER
  15. #define PLATFORM_CORE_COUNT PLATFORM_CLUSTER0_CORE_COUNT
  16. #define PICOPI_PRIMARY_CPU U(0)
  17. #define PLAT_NUM_PWR_DOMAINS (PLATFORM_CLUSTER_COUNT + \
  18. PLATFORM_CORE_COUNT)
  19. #define PLAT_MAX_PWR_LVL MPIDR_AFFLVL1
  20. #define PLAT_MAX_RET_STATE 1
  21. #define PLAT_MAX_OFF_STATE 2
  22. /* Local power state for power domains in Run state. */
  23. #define PLAT_LOCAL_STATE_RUN 0
  24. /* Local power state for retention. Valid only for CPU power domains */
  25. #define PLAT_LOCAL_STATE_RET 1
  26. /*
  27. * Local power state for OFF/power-down. Valid for CPU and cluster power
  28. * domains.
  29. */
  30. #define PLAT_LOCAL_STATE_OFF 2
  31. /*
  32. * Macros used to parse state information from State-ID if it is using the
  33. * recommended encoding for State-ID.
  34. */
  35. #define PLAT_LOCAL_PSTATE_WIDTH 4
  36. #define PLAT_LOCAL_PSTATE_MASK ((1 << PLAT_LOCAL_PSTATE_WIDTH) - 1)
  37. /*
  38. * Some data must be aligned on the biggest cache line size in the platform.
  39. * This is known only to the platform as it might have a combination of
  40. * integrated and external caches.
  41. * i.MX7 has a 32 byte cacheline size
  42. * i.MX 7Dual Applications Processor Reference Manual, Rev. 1, 01/2018 pg 298
  43. */
  44. #define CACHE_WRITEBACK_SHIFT 4
  45. #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
  46. /*
  47. * Partition memory into secure BootROM, OCRAM_S, non-secure DRAM, secure DRAM
  48. */
  49. #define BOOT_ROM_BASE 0x00000000
  50. #define BOOT_ROM_SIZE 0x00020000
  51. #define OCRAM_S_BASE 0x00180000
  52. #define OCRAM_S_SIZE 0x00008000
  53. /* Controller maps 2GB, board contains 512 MB. 0x80000000 - 0xa0000000 */
  54. #define DRAM_BASE 0x80000000
  55. #define DRAM_SIZE 0x20000000
  56. #define DRAM_LIMIT (DRAM_BASE + DRAM_SIZE)
  57. /* Place OPTEE at minus 32 MB from the end of memory. 0x9e000000 - 0xa0000000 */
  58. #define IMX7_OPTEE_SIZE 0x02000000
  59. #define IMX7_OPTEE_BASE (DRAM_LIMIT - IMX7_OPTEE_SIZE)
  60. #define IMX7_OPTEE_LIMIT (IMX7_OPTEE_BASE + IMX7_OPTEE_SIZE)
  61. /* Place ATF directly beneath OPTEE. 0x9df00000 - 0x9e000000 */
  62. #define BL2_RAM_SIZE 0x00100000
  63. #define BL2_RAM_BASE (IMX7_OPTEE_BASE - BL2_RAM_SIZE)
  64. #define BL2_RAM_LIMIT (BL2_RAM_BASE + BL2_RAM_SIZE)
  65. /* Optional Mailbox. Only relevant on i.MX7D. 0x9deff000 - 0x9df00000*/
  66. #define SHARED_RAM_SIZE 0x00001000
  67. #define SHARED_RAM_BASE (BL2_RAM_BASE - SHARED_RAM_SIZE)
  68. #define SHARED_RAM_LIMIT (SHARED_RAM_BASE + SHARED_RAM_SIZE)
  69. /* Define the absolute location of u-boot 0x87800000 - 0x87900000 */
  70. #define IMX7_UBOOT_SIZE 0x00100000
  71. #define IMX7_UBOOT_BASE (DRAM_BASE + 0x7800000)
  72. #define IMX7_UBOOT_LIMIT (IMX7_UBOOT_BASE + IMX7_UBOOT_SIZE)
  73. /* Define FIP image absolute location 0x80000000 - 0x80100000 */
  74. #define IMX_FIP_SIZE 0x00100000
  75. #define IMX_FIP_BASE (DRAM_BASE)
  76. #define IMX_FIP_LIMIT (IMX_FIP_BASE + IMX_FIP_SIZE)
  77. /* Define FIP image location at 1MB offset */
  78. #define IMX_FIP_MMC_BASE (1024 * 1024)
  79. /* Define the absolute location of DTB 0x83000000 - 0x83100000 */
  80. #define IMX7_DTB_SIZE 0x00100000
  81. #define IMX7_DTB_BASE (DRAM_BASE + 0x03000000)
  82. #define IMX7_DTB_LIMIT (IMX7_DTB_BASE + IMX7_DTB_SIZE)
  83. /* Define the absolute location of DTB Overlay 0x83100000 - 0x83101000 */
  84. #define IMX7_DTB_OVERLAY_SIZE 0x00001000
  85. #define IMX7_DTB_OVERLAY_BASE IMX7_DTB_LIMIT
  86. #define IMX7_DTB_OVERLAY_LIMIT (IMX7_DTB_OVERLAY_BASE + \
  87. IMX7_DTB_OVERLAY_SIZE)
  88. /*
  89. * BL2 specific defines.
  90. *
  91. * Put BL2 just below BL3-1. BL2_BASE is calculated using the current BL2 debug
  92. * size plus a little space for growth.
  93. */
  94. #define BL2_BASE BL2_RAM_BASE
  95. #define BL2_LIMIT (BL2_RAM_BASE + BL2_RAM_SIZE)
  96. /*
  97. * BL3-2/OPTEE
  98. */
  99. # define BL32_BASE IMX7_OPTEE_BASE
  100. # define BL32_LIMIT (IMX7_OPTEE_BASE + IMX7_OPTEE_SIZE)
  101. /*
  102. * BL3-3/U-BOOT
  103. */
  104. #define BL33_BASE IMX7_UBOOT_BASE
  105. #define BL33_LIMIT (IMX7_UBOOT_BASE + IMX7_UBOOT_SIZE)
  106. /*
  107. * ATF's view of memory
  108. *
  109. * 0xa0000000 +-----------------+
  110. * | DDR | BL32/OPTEE
  111. * 0x9e000000 +-----------------+
  112. * | DDR | BL23 ATF
  113. * 0x9df00000 +-----------------+
  114. * | DDR | Shared MBOX RAM
  115. * 0x9de00000 +-----------------+
  116. * | DDR | Unallocated
  117. * 0x87900000 +-----------------+
  118. * | DDR | BL33/U-BOOT
  119. * 0x87800000 +-----------------+
  120. * | DDR | Unallocated
  121. * 0x83100000 +-----------------+
  122. * | DDR | DTB
  123. * 0x83000000 +-----------------+
  124. * | DDR | Unallocated
  125. * 0x80100000 +-----------------+
  126. * | DDR | FIP
  127. * 0x80000000 +-----------------+
  128. * | SOC I/0 |
  129. * 0x00a00000 +-----------------+
  130. * | OCRAM | Not used
  131. * 0x00900000 +-----------------+
  132. * | SOC I/0 |
  133. * 0x00188000 +-----------------+
  134. * | OCRAM_S | Not used
  135. * 0x00180000 +-----------------+
  136. * | SOC I/0 |
  137. * 0x00020000 +-----------------+
  138. * | BootROM | BL1
  139. * 0x00000000 +-----------------+
  140. */
  141. #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32)
  142. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32)
  143. #define MAX_MMAP_REGIONS 10
  144. #define MAX_XLAT_TABLES 6
  145. #define MAX_IO_DEVICES 2
  146. #define MAX_IO_HANDLES 3
  147. #define MAX_IO_BLOCK_DEVICES 1
  148. /* UART defines */
  149. #define PLAT_IMX7_BOOT_UART_BASE MXC_UART5_BASE
  150. #define PLAT_IMX7_BOOT_UART_CLK_IN_HZ 24000000
  151. #define PLAT_IMX7_CONSOLE_BAUDRATE 115200
  152. /* MMC defines */
  153. #ifndef PLAT_PICOPI_SD
  154. #define PLAT_PICOPI_SD 3
  155. #endif
  156. #if PLAT_PICOPI_SD == 1
  157. #define PLAT_PICOPI_BOOT_MMC_BASE USDHC1_BASE
  158. #endif /* PLAT_PICOPI_SD == 1 */
  159. #if PLAT_PICOPI_SD == 2
  160. #define PLAT_PICOPI_BOOT_MMC_BASE USDHC2_BASE
  161. #endif /* PLAT_PICOPI_SD == 2 */
  162. #if PLAT_PICOPI_SD == 3
  163. #define PLAT_PICOPI_BOOT_MMC_BASE USDHC3_BASE
  164. #endif /* PLAT_PICOPI_SD == 3 */
  165. /*
  166. * System counter
  167. */
  168. #define SYS_COUNTER_FREQ_IN_TICKS 8000000 /* 8 MHz */
  169. #endif /* PLATFORM_DEF_H */