platform_def.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /*
  2. * Copyright (c) 2021-2022, ARM Limited and Contributors. All rights reserved.
  3. * Copyright (c) 2021-2022, 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. * GIC-600 & interrupt handling related constants
  69. ******************************************************************************/
  70. /* Base MTK_platform compatible GIC memory map */
  71. #define BASE_GICD_BASE MT_GIC_BASE
  72. #define MT_GIC_RDIST_BASE (MT_GIC_BASE + 0x40000)
  73. #define SYS_CIRQ_BASE (IO_PHYS + 0x204000)
  74. #define CIRQ_REG_NUM (11)
  75. #define CIRQ_IRQ_NUM (326)
  76. #define CIRQ_SPI_START (64)
  77. #define MD_WDT_IRQ_BIT_ID (107)
  78. /*******************************************************************************
  79. * System counter frequency related constants
  80. ******************************************************************************/
  81. #define SYS_COUNTER_FREQ_IN_TICKS (13000000)
  82. #define SYS_COUNTER_FREQ_IN_MHZ (13)
  83. /*******************************************************************************
  84. * Platform binary types for linking
  85. ******************************************************************************/
  86. #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
  87. #define PLATFORM_LINKER_ARCH aarch64
  88. /*******************************************************************************
  89. * Generic platform constants
  90. ******************************************************************************/
  91. #define PLATFORM_STACK_SIZE 0x800
  92. #define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n"
  93. #define PLAT_MAX_PWR_LVL U(3)
  94. #define PLAT_MAX_RET_STATE U(1)
  95. #define PLAT_MAX_OFF_STATE U(9)
  96. #define PLATFORM_SYSTEM_COUNT U(1)
  97. #define PLATFORM_MCUSYS_COUNT U(1)
  98. #define PLATFORM_CLUSTER_COUNT U(1)
  99. #define PLATFORM_CLUSTER0_CORE_COUNT U(8)
  100. #define PLATFORM_CLUSTER1_CORE_COUNT U(0)
  101. #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER0_CORE_COUNT)
  102. #define PLATFORM_MAX_CPUS_PER_CLUSTER U(8)
  103. #define SOC_CHIP_ID U(0x8186)
  104. /*******************************************************************************
  105. * Platform memory map related constants
  106. ******************************************************************************/
  107. #define TZRAM_BASE (0x54600000)
  108. #define TZRAM_SIZE (0x00030000)
  109. /*******************************************************************************
  110. * BL31 specific defines.
  111. ******************************************************************************/
  112. /*
  113. * Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if
  114. * present). BL31_BASE is calculated using the current BL3-1 debug size plus a
  115. * little space for growth.
  116. */
  117. #define BL31_BASE (TZRAM_BASE + 0x1000)
  118. #define BL31_LIMIT (TZRAM_BASE + TZRAM_SIZE)
  119. /*******************************************************************************
  120. * Platform specific page table and MMU setup constants
  121. ******************************************************************************/
  122. #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32)
  123. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32)
  124. #define MAX_XLAT_TABLES (16)
  125. #define MAX_MMAP_REGIONS (16)
  126. /*******************************************************************************
  127. * Declarations and constants to access the mailboxes safely. Each mailbox is
  128. * aligned on the biggest cache line size in the platform. This is known only
  129. * to the platform as it might have a combination of integrated and external
  130. * caches. Such alignment ensures that two maiboxes do not sit on the same cache
  131. * line at any cache level. They could belong to different cpus/clusters &
  132. * get written while being protected by different locks causing corruption of
  133. * a valid mailbox address.
  134. ******************************************************************************/
  135. #define CACHE_WRITEBACK_SHIFT (6)
  136. #define CACHE_WRITEBACK_GRANULE BIT(CACHE_WRITEBACK_SHIFT)
  137. #endif /* PLATFORM_DEF_H */