a8k_plat_def.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. /*
  2. * Copyright (C) 2018 Marvell International Ltd.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. * https://spdx.org/licenses
  6. */
  7. #ifndef A8K_PLAT_DEF_H
  8. #define A8K_PLAT_DEF_H
  9. #include <marvell_def.h>
  10. #define MVEBU_PRIMARY_CPU 0x0
  11. #define MVEBU_AP0 0x0
  12. /* APN806 revision ID */
  13. #define MVEBU_CSS_GWD_CTRL_IIDR2_REG (MVEBU_REGS_BASE + 0x610FCC)
  14. #define GWD_IIDR2_REV_ID_OFFSET 12
  15. #define GWD_IIDR2_REV_ID_MASK 0xF
  16. #define GWD_IIDR2_CHIP_ID_OFFSET 20
  17. #define GWD_IIDR2_CHIP_ID_MASK (0xFFFu << GWD_IIDR2_CHIP_ID_OFFSET)
  18. #define CHIP_ID_AP806 0x806
  19. #define CHIP_ID_AP807 0x807
  20. #define COUNTER_FREQUENCY 25000000
  21. #define MVEBU_REGS_BASE 0xF0000000
  22. #define MVEBU_REGS_BASE_MASK 0xF0000000
  23. #define MVEBU_REGS_BASE_AP(ap) MVEBU_REGS_BASE
  24. #define MVEBU_AP_IO_BASE(ap) 0xF2000000
  25. #define MVEBU_CP_OFFSET 0x2000000
  26. #define MVEBU_CP_REGS_BASE(cp_index) (MVEBU_AP_IO_BASE(0) + \
  27. (cp_index) * MVEBU_CP_OFFSET)
  28. #define MVEBU_RFU_BASE (MVEBU_REGS_BASE + 0x6F0000)
  29. #define MVEBU_IO_WIN_BASE(ap_index) (MVEBU_RFU_BASE)
  30. #define MVEBU_IO_WIN_GCR_OFFSET (0x70)
  31. #define MVEBU_IO_WIN_MAX_WINS (7)
  32. /* Misc SoC configurations Base */
  33. #define MVEBU_MISC_SOC_BASE (MVEBU_REGS_BASE + 0x6F4300)
  34. #define MVEBU_CCU_BASE(ap_index) (MVEBU_REGS_BASE + 0x4000)
  35. #define MVEBU_CCU_MAX_WINS (8)
  36. #define MVEBU_LLC_BASE(ap_index) (MVEBU_REGS_BASE + 0x8000)
  37. #define MVEBU_DRAM_MAC_BASE (MVEBU_REGS_BASE + 0x20000)
  38. #define MVEBU_DRAM_PHY_BASE (MVEBU_REGS_BASE + 0x20000)
  39. #define MVEBU_SMMU_BASE (MVEBU_REGS_BASE + 0x100000)
  40. #define MVEBU_CP_MPP_REGS(cp_index, n) (MVEBU_CP_REGS_BASE(cp_index) + \
  41. 0x440000 + ((n) << 2))
  42. #define MVEBU_PM_MPP_REGS(cp_index, n) (MVEBU_CP_REGS_BASE(cp_index) + \
  43. 0x440000 + ((n / 8) << 2))
  44. #define MVEBU_CP_GPIO_DATA_OUT(cp_index, n) \
  45. (MVEBU_CP_REGS_BASE(cp_index) + \
  46. 0x440100 + ((n > 31) ? 0x40 : 0x00))
  47. #define MVEBU_CP_GPIO_DATA_OUT_EN(cp_index, n) \
  48. (MVEBU_CP_REGS_BASE(cp_index) + \
  49. 0x440104 + ((n > 31) ? 0x40 : 0x00))
  50. #define MVEBU_CP_GPIO_DATA_IN(cp_index, n) (MVEBU_CP_REGS_BASE(cp_index) + \
  51. 0x440110 + ((n > 31) ? 0x40 : 0x00))
  52. #define MVEBU_AP_MPP_REGS(n) (MVEBU_RFU_BASE + 0x4000 + ((n) << 2))
  53. #define MVEBU_AP_GPIO_REGS (MVEBU_RFU_BASE + 0x5040)
  54. #define MVEBU_AP_GPIO_DATA_IN (MVEBU_AP_GPIO_REGS + 0x10)
  55. #define MVEBU_AP_I2C_BASE (MVEBU_REGS_BASE + 0x511000)
  56. #define MVEBU_CP0_I2C_BASE (MVEBU_CP_REGS_BASE(0) + 0x701000)
  57. #define MVEBU_AP_GEN_MGMT_BASE (MVEBU_RFU_BASE + 0x8000)
  58. #define MVEBU_AP_EXT_TSEN_BASE (MVEBU_AP_GEN_MGMT_BASE + 0x84)
  59. #define MVEBU_AP_MC_TRUSTZONE_REG_LOW(ap, win) (MVEBU_REGS_BASE_AP(ap) + \
  60. 0x20080 + ((win) * 0x8))
  61. #define MVEBU_AP_MC_TRUSTZONE_REG_HIGH(ap, win) (MVEBU_REGS_BASE_AP(ap) + \
  62. 0x20084 + ((win) * 0x8))
  63. /* MCI indirect access definitions */
  64. #define MCI_MAX_UNIT_ID 2
  65. /* SoC RFU / IHBx4 Control */
  66. #define MCIX4_REG_START_ADDRESS_REG(unit_id) (MVEBU_RFU_BASE + \
  67. 0x4218 + (unit_id * 0x20))
  68. #define MCI_REMAP_OFF_SHIFT 8
  69. #define MVEBU_MCI_REG_BASE_REMAP(index) (0xFD000000 + \
  70. ((index) * 0x1000000))
  71. #define MVEBU_PCIE_X4_MAC_BASE(x) (MVEBU_CP_REGS_BASE(x) + 0x600000)
  72. #define MVEBU_COMPHY_BASE(x) (MVEBU_CP_REGS_BASE(x) + 0x441000)
  73. #define MVEBU_HPIPE_BASE(x) (MVEBU_CP_REGS_BASE(x) + 0x120000)
  74. #define MVEBU_CP_DFX_OFFSET (0x400200)
  75. /*****************************************************************************
  76. * MVEBU memory map related constants
  77. *****************************************************************************
  78. */
  79. /* Aggregate of all devices in the first GB */
  80. #define DEVICE0_BASE MVEBU_REGS_BASE
  81. #define DEVICE0_SIZE 0x10000000
  82. /*****************************************************************************
  83. * GIC-400 & interrupt handling related constants
  84. *****************************************************************************
  85. */
  86. /* Base MVEBU compatible GIC memory map */
  87. #define MVEBU_GICD_BASE 0x210000
  88. #define MVEBU_GICC_BASE 0x220000
  89. /*****************************************************************************
  90. * AXI Configuration
  91. *****************************************************************************
  92. */
  93. #define MVEBU_AXI_ATTR_ARCACHE_OFFSET 4
  94. #define MVEBU_AXI_ATTR_ARCACHE_MASK (0xF << \
  95. MVEBU_AXI_ATTR_ARCACHE_OFFSET)
  96. #define MVEBU_AXI_ATTR_ARDOMAIN_OFFSET 12
  97. #define MVEBU_AXI_ATTR_ARDOMAIN_MASK (0x3 << \
  98. MVEBU_AXI_ATTR_ARDOMAIN_OFFSET)
  99. #define MVEBU_AXI_ATTR_AWCACHE_OFFSET 20
  100. #define MVEBU_AXI_ATTR_AWCACHE_MASK (0xF << \
  101. MVEBU_AXI_ATTR_AWCACHE_OFFSET)
  102. #define MVEBU_AXI_ATTR_AWDOMAIN_OFFSET 28
  103. #define MVEBU_AXI_ATTR_AWDOMAIN_MASK (0x3 << \
  104. MVEBU_AXI_ATTR_AWDOMAIN_OFFSET)
  105. /* SATA MBUS to AXI configuration */
  106. #define MVEBU_SATA_M2A_AXI_ARCACHE_OFFSET 1
  107. #define MVEBU_SATA_M2A_AXI_ARCACHE_MASK (0xF << \
  108. MVEBU_SATA_M2A_AXI_ARCACHE_OFFSET)
  109. #define MVEBU_SATA_M2A_AXI_AWCACHE_OFFSET 5
  110. #define MVEBU_SATA_M2A_AXI_AWCACHE_MASK (0xF << \
  111. MVEBU_SATA_M2A_AXI_AWCACHE_OFFSET)
  112. /* ARM cache attributes */
  113. #define CACHE_ATTR_BUFFERABLE 0x1
  114. #define CACHE_ATTR_CACHEABLE 0x2
  115. #define CACHE_ATTR_READ_ALLOC 0x4
  116. #define CACHE_ATTR_WRITE_ALLOC 0x8
  117. /* Domain */
  118. #define DOMAIN_NON_SHAREABLE 0x0
  119. #define DOMAIN_INNER_SHAREABLE 0x1
  120. #define DOMAIN_OUTER_SHAREABLE 0x2
  121. #define DOMAIN_SYSTEM_SHAREABLE 0x3
  122. /************************************************************************
  123. * Required platform porting definitions common to all
  124. * Management Compute SubSystems (MSS)
  125. ************************************************************************
  126. */
  127. /*
  128. * Load address of SCP_BL2
  129. * SCP_BL2 is loaded to the same place as BL31.
  130. * Once SCP_BL2 is transferred to the SCP,
  131. * it is discarded and BL31 is loaded over the top.
  132. */
  133. #ifdef SCP_IMAGE
  134. #define SCP_BL2_BASE BL31_BASE
  135. #define SCP_BL2_SIZE BL31_LIMIT
  136. #endif
  137. #ifndef __ASSEMBLER__
  138. enum ap806_sar_target_dev {
  139. SAR_PIDI_MCIX2 = 0x0,
  140. SAR_MCIX4 = 0x1,
  141. SAR_SPI = 0x2,
  142. SAR_SD = 0x3,
  143. SAR_PIDI_MCIX2_BD = 0x4, /* BootRom disabled */
  144. SAR_MCIX4_DB = 0x5, /* BootRom disabled */
  145. SAR_SPI_DB = 0x6, /* BootRom disabled */
  146. SAR_EMMC = 0x7
  147. };
  148. enum io_win_target_ids {
  149. MCI_0_TID = 0x0,
  150. MCI_1_TID = 0x1,
  151. MCI_2_TID = 0x2,
  152. PIDI_TID = 0x3,
  153. SPI_TID = 0x4,
  154. STM_TID = 0x5,
  155. BOOTROM_TID = 0x6,
  156. IO_WIN_MAX_TID
  157. };
  158. enum ccu_target_ids {
  159. IO_0_TID = 0x00,
  160. DRAM_0_TID = 0x03,
  161. IO_1_TID = 0x0F,
  162. CFG_REG_TID = 0x10,
  163. RAR_TID = 0x20,
  164. SRAM_TID = 0x40,
  165. DRAM_1_TID = 0xC0,
  166. CCU_MAX_TID,
  167. INVALID_TID = 0xFF
  168. };
  169. #endif /* __ASSEMBLER__ */
  170. #endif /* A8K_PLAT_DEF_H */