mt8173_def.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * Copyright (c) 2014-2015, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef MT8173_DEF_H
  7. #define MT8173_DEF_H
  8. #if RESET_TO_BL31
  9. #error "MT8173 is incompatible with RESET_TO_BL31!"
  10. #endif
  11. #define MT8173_PRIMARY_CPU 0x0
  12. /* Register base address */
  13. #define IO_PHYS (0x10000000)
  14. #define INFRACFG_AO_BASE (IO_PHYS + 0x1000)
  15. #define SRAMROM_SEC_BASE (IO_PHYS + 0x1800)
  16. #define PERI_CON_BASE (IO_PHYS + 0x3000)
  17. #define GPIO_BASE (IO_PHYS + 0x5000)
  18. #define SPM_BASE (IO_PHYS + 0x6000)
  19. #define RGU_BASE (IO_PHYS + 0x7000)
  20. #define PMIC_WRAP_BASE (IO_PHYS + 0xD000)
  21. #define DEVAPC0_BASE (IO_PHYS + 0xE000)
  22. #define MCUCFG_BASE (IO_PHYS + 0x200000)
  23. #define APMIXED_BASE (IO_PHYS + 0x209000)
  24. #define TRNG_BASE (IO_PHYS + 0x20F000)
  25. #define CRYPT_BASE (IO_PHYS + 0x210000)
  26. #define MT_GIC_BASE (IO_PHYS + 0x220000)
  27. #define PLAT_MT_CCI_BASE (IO_PHYS + 0x390000)
  28. /* Aggregate of all devices in the first GB */
  29. #define MTK_DEV_RNG0_BASE IO_PHYS
  30. #define MTK_DEV_RNG0_SIZE 0x400000
  31. #define MTK_DEV_RNG1_BASE (IO_PHYS + 0x1000000)
  32. #define MTK_DEV_RNG1_SIZE 0x4000000
  33. /* SRAMROM related registers */
  34. #define SRAMROM_SEC_CTRL (SRAMROM_SEC_BASE + 0x4)
  35. #define SRAMROM_SEC_ADDR (SRAMROM_SEC_BASE + 0x8)
  36. /* DEVAPC0 related registers */
  37. #define DEVAPC0_MAS_SEC_0 (DEVAPC0_BASE + 0x500)
  38. #define DEVAPC0_APC_CON (DEVAPC0_BASE + 0xF00)
  39. /*******************************************************************************
  40. * UART related constants
  41. ******************************************************************************/
  42. #define MT8173_UART0_BASE (IO_PHYS + 0x01002000)
  43. #define MT8173_UART1_BASE (IO_PHYS + 0x01003000)
  44. #define MT8173_UART2_BASE (IO_PHYS + 0x01004000)
  45. #define MT8173_UART3_BASE (IO_PHYS + 0x01005000)
  46. #define MT8173_BAUDRATE (115200)
  47. #define MT8173_UART_CLOCK (26000000)
  48. /*******************************************************************************
  49. * System counter frequency related constants
  50. ******************************************************************************/
  51. #define SYS_COUNTER_FREQ_IN_TICKS 13000000
  52. /*******************************************************************************
  53. * GIC-400 & interrupt handling related constants
  54. ******************************************************************************/
  55. /* Base MTK_platform compatible GIC memory map */
  56. #define BASE_GICD_BASE (MT_GIC_BASE + 0x1000)
  57. #define BASE_GICC_BASE (MT_GIC_BASE + 0x2000)
  58. #define BASE_GICR_BASE 0 /* no GICR in GIC-400 */
  59. #define BASE_GICH_BASE (MT_GIC_BASE + 0x4000)
  60. #define BASE_GICV_BASE (MT_GIC_BASE + 0x6000)
  61. #define INT_POL_CTL0 0x10200620
  62. #define GIC_PRIVATE_SIGNALS (32)
  63. /*******************************************************************************
  64. * CCI-400 related constants
  65. ******************************************************************************/
  66. #define PLAT_MT_CCI_CLUSTER0_SL_IFACE_IX 4
  67. #define PLAT_MT_CCI_CLUSTER1_SL_IFACE_IX 3
  68. /* FIQ platform related define */
  69. #define MT_IRQ_SEC_SGI_0 8
  70. #define MT_IRQ_SEC_SGI_1 9
  71. #define MT_IRQ_SEC_SGI_2 10
  72. #define MT_IRQ_SEC_SGI_3 11
  73. #define MT_IRQ_SEC_SGI_4 12
  74. #define MT_IRQ_SEC_SGI_5 13
  75. #define MT_IRQ_SEC_SGI_6 14
  76. #define MT_IRQ_SEC_SGI_7 15
  77. /*
  78. * Macros for local power states in MTK platforms encoded by State-ID field
  79. * within the power-state parameter.
  80. */
  81. /* Local power state for power domains in Run state. */
  82. #define MTK_LOCAL_STATE_RUN 0
  83. /* Local power state for retention. Valid only for CPU power domains */
  84. #define MTK_LOCAL_STATE_RET 1
  85. /* Local power state for OFF/power-down. Valid for CPU and cluster power
  86. * domains
  87. */
  88. #define MTK_LOCAL_STATE_OFF 2
  89. #if PSCI_EXTENDED_STATE_ID
  90. /*
  91. * Macros used to parse state information from State-ID if it is using the
  92. * recommended encoding for State-ID.
  93. */
  94. #define MTK_LOCAL_PSTATE_WIDTH 4
  95. #define MTK_LOCAL_PSTATE_MASK ((1 << MTK_LOCAL_PSTATE_WIDTH) - 1)
  96. /* Macros to construct the composite power state */
  97. /* Make composite power state parameter till power level 0 */
  98. #define mtk_make_pwrstate_lvl0(lvl0_state, pwr_lvl, type) \
  99. (((lvl0_state) << PSTATE_ID_SHIFT) | ((type) << PSTATE_TYPE_SHIFT))
  100. #else
  101. #define mtk_make_pwrstate_lvl0(lvl0_state, pwr_lvl, type) \
  102. (((lvl0_state) << PSTATE_ID_SHIFT) | \
  103. ((pwr_lvl) << PSTATE_PWR_LVL_SHIFT) | \
  104. ((type) << PSTATE_TYPE_SHIFT))
  105. #endif /* __PSCI_EXTENDED_STATE_ID__ */
  106. /* Make composite power state parameter till power level 1 */
  107. #define mtk_make_pwrstate_lvl1(lvl1_state, lvl0_state, pwr_lvl, type) \
  108. (((lvl1_state) << MTK_LOCAL_PSTATE_WIDTH) | \
  109. mtk_make_pwrstate_lvl0(lvl0_state, pwr_lvl, type))
  110. /* Make composite power state parameter till power level 2 */
  111. #define mtk_make_pwrstate_lvl2( \
  112. lvl2_state, lvl1_state, lvl0_state, pwr_lvl, type) \
  113. (((lvl2_state) << (MTK_LOCAL_PSTATE_WIDTH * 2)) | \
  114. mtk_make_pwrstate_lvl1(lvl1_state, lvl0_state, pwr_lvl, type))
  115. #endif /* MT8173_DEF_H */