platform_def.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. * Copyright (c) 2021-2024, ARM Limited and Contributors. All rights reserved.
  3. * Copyright (c) 2021-2024, MediaTek Inc. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: BSD-3-Clause
  6. */
  7. #ifndef PLATFORM_DEF_H
  8. #define PLATFORM_DEF_H
  9. #define PLAT_PRIMARY_CPU (0x0)
  10. #define MT_GIC_BASE (0x0C000000)
  11. #define MCUCFG_BASE (0x0C530000)
  12. #define IO_PHYS (0x10000000)
  13. /* Aggregate of all devices for MMU mapping */
  14. #define MTK_DEV_RNG0_BASE IO_PHYS
  15. #define MTK_DEV_RNG0_SIZE (0x10000000)
  16. #define MTK_DEV_RNG2_BASE MT_GIC_BASE
  17. #define MTK_DEV_RNG2_SIZE (0x600000)
  18. #define MTK_MCDI_SRAM_BASE (0x11B000)
  19. #define MTK_MCDI_SRAM_MAP_SIZE (0x1000)
  20. #define TOPCKGEN_BASE (IO_PHYS + 0x00000000)
  21. #define INFRACFG_AO_BASE (IO_PHYS + 0x00001000)
  22. #define SPM_BASE (IO_PHYS + 0x00006000)
  23. #define APMIXEDSYS (IO_PHYS + 0x0000C000)
  24. #define SSPM_MCDI_SHARE_SRAM (IO_PHYS + 0x00420000)
  25. #define SSPM_CFGREG_BASE (IO_PHYS + 0x00440000) /* SSPM view: 0x30040000 */
  26. #define SSPM_MBOX_BASE (IO_PHYS + 0x00480000)
  27. #define PERICFG_AO_BASE (IO_PHYS + 0x01003000)
  28. #define VPPSYS0_BASE (IO_PHYS + 0x04000000)
  29. #define VPPSYS1_BASE (IO_PHYS + 0x04f00000)
  30. #define VDOSYS0_BASE (IO_PHYS + 0x0C01A000)
  31. #define VDOSYS1_BASE (IO_PHYS + 0x0C100000)
  32. /*******************************************************************************
  33. * GPIO related constants
  34. ******************************************************************************/
  35. #define TOPCKGEN_BASE (IO_PHYS + 0x00000000)
  36. #define INFRACFG_AO_BASE (IO_PHYS + 0x00001000)
  37. #define GPIO_BASE (IO_PHYS + 0x00005000)
  38. #define SPM_BASE (IO_PHYS + 0x00006000)
  39. #define IOCFG_LT_BASE (IO_PHYS + 0x00002000)
  40. #define IOCFG_LM_BASE (IO_PHYS + 0x00002200)
  41. #define IOCFG_LB_BASE (IO_PHYS + 0x00002400)
  42. #define IOCFG_BL_BASE (IO_PHYS + 0x00002600)
  43. #define IOCFG_RB_BASE (IO_PHYS + 0x00002A00)
  44. #define IOCFG_RT_BASE (IO_PHYS + 0x00002C00)
  45. #define APMIXEDSYS (IO_PHYS + 0x0000C000)
  46. #define DVFSRC_BASE (IO_PHYS + 0x00012000)
  47. #define MMSYS_BASE (IO_PHYS + 0x04000000)
  48. #define MDPSYS_BASE (IO_PHYS + 0x0B000000)
  49. /*******************************************************************************
  50. * UART related constants
  51. ******************************************************************************/
  52. #define UART0_BASE (IO_PHYS + 0x01002000)
  53. #define UART1_BASE (IO_PHYS + 0x01003000)
  54. #define UART_BAUDRATE (115200)
  55. /*******************************************************************************
  56. * PWRAP related constants
  57. ******************************************************************************/
  58. #define PMIC_WRAP_BASE (IO_PHYS + 0x0000D000)
  59. /*******************************************************************************
  60. * EMI MPU related constants
  61. ******************************************************************************/
  62. #define EMI_MPU_BASE (IO_PHYS + 0x0021B000)
  63. /*******************************************************************************
  64. * MSDC related constants
  65. ******************************************************************************/
  66. #define MSDC0_BASE (IO_PHYS + 0x01230000)
  67. /*******************************************************************************
  68. * TRNG related constants
  69. ******************************************************************************/
  70. #define TRNG_BASE (IO_PHYS + 0x0020F000)
  71. /*******************************************************************************
  72. * GIC-600 & interrupt handling related constants
  73. ******************************************************************************/
  74. /* Base MTK_platform compatible GIC memory map */
  75. #define BASE_GICD_BASE MT_GIC_BASE
  76. #define MT_GIC_RDIST_BASE (MT_GIC_BASE + 0x40000)
  77. #define PLAT_MTK_G1S_IRQ_PROPS(grp)
  78. #define SYS_CIRQ_BASE (IO_PHYS + 0x204000)
  79. #define CIRQ_REG_NUM (11)
  80. #define CIRQ_IRQ_NUM (326)
  81. #define CIRQ_SPI_START (64)
  82. #define MD_WDT_IRQ_BIT_ID (107)
  83. /*******************************************************************************
  84. * System counter frequency related constants
  85. ******************************************************************************/
  86. #define SYS_COUNTER_FREQ_IN_TICKS (13000000)
  87. #define SYS_COUNTER_FREQ_IN_MHZ (13)
  88. /*******************************************************************************
  89. * Platform binary types for linking
  90. ******************************************************************************/
  91. #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
  92. #define PLATFORM_LINKER_ARCH aarch64
  93. /*******************************************************************************
  94. * Generic platform constants
  95. ******************************************************************************/
  96. #define PLATFORM_STACK_SIZE 0x800
  97. #define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n"
  98. #define PLAT_MAX_PWR_LVL U(3)
  99. #define PLAT_MAX_RET_STATE U(1)
  100. #define PLAT_MAX_OFF_STATE U(9)
  101. #define PLATFORM_SYSTEM_COUNT U(1)
  102. #define PLATFORM_MCUSYS_COUNT U(1)
  103. #define PLATFORM_CLUSTER_COUNT U(1)
  104. #define PLATFORM_CLUSTER0_CORE_COUNT U(8)
  105. #define PLATFORM_CLUSTER1_CORE_COUNT U(0)
  106. #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER0_CORE_COUNT)
  107. #define PLATFORM_MAX_CPUS_PER_CLUSTER U(8)
  108. #define SOC_CHIP_ID U(0x8186)
  109. /*******************************************************************************
  110. * Platform memory map related constants
  111. ******************************************************************************/
  112. #define TZRAM_BASE (0x54600000)
  113. #define TZRAM_SIZE (0x00030000)
  114. /*******************************************************************************
  115. * BL31 specific defines.
  116. ******************************************************************************/
  117. /*
  118. * Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if
  119. * present). BL31_BASE is calculated using the current BL3-1 debug size plus a
  120. * little space for growth.
  121. */
  122. #define BL31_BASE (TZRAM_BASE + 0x1000)
  123. #define BL31_LIMIT (TZRAM_BASE + TZRAM_SIZE)
  124. /*******************************************************************************
  125. * Platform specific page table and MMU setup constants
  126. ******************************************************************************/
  127. #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32)
  128. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32)
  129. #define MAX_XLAT_TABLES (16)
  130. #define MAX_MMAP_REGIONS (16)
  131. /*******************************************************************************
  132. * Declarations and constants to access the mailboxes safely. Each mailbox is
  133. * aligned on the biggest cache line size in the platform. This is known only
  134. * to the platform as it might have a combination of integrated and external
  135. * caches. Such alignment ensures that two maiboxes do not sit on the same cache
  136. * line at any cache level. They could belong to different cpus/clusters &
  137. * get written while being protected by different locks causing corruption of
  138. * a valid mailbox address.
  139. ******************************************************************************/
  140. #define CACHE_WRITEBACK_SHIFT (6)
  141. #define CACHE_WRITEBACK_GRANULE BIT(CACHE_WRITEBACK_SHIFT)
  142. #endif /* PLATFORM_DEF_H */