n5x_system_manager.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /*
  2. * Copyright (c) 2019-2023, Intel Corporation. All rights reserved.
  3. * Copyright (c) 2024, Altera Corporation. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: BSD-3-Clause
  6. */
  7. #ifndef N5X_SOCFPGA_SYSTEMMANAGER_H
  8. #define N5X_SOCFPGA_SYSTEMMANAGER_H
  9. #include "socfpga_plat_def.h"
  10. /* System Manager Register Map */
  11. #define SOCFPGA_SYSMGR_SILICONID_1 0x00
  12. #define SOCFPGA_SYSMGR_SILICONID_2 0x04
  13. #define SOCFPGA_SYSMGR_WDDBG 0x08
  14. #define SOCFPGA_SYSMGR_MPU_STATUS 0x10
  15. #define SOCFPGA_SYSMGR_SDMMC_L3_MASTER 0x2C
  16. #define SOCFPGA_SYSMGR_NAND_L3_MASTER 0x34
  17. #define SOCFPGA_SYSMGR_USB0_L3_MASTER 0x38
  18. #define SOCFPGA_SYSMGR_USB1_L3_MASTER 0x3C
  19. #define SOCFPGA_SYSMGR_TSN_GLOBAL 0x40
  20. #define SOCFPGA_SYSMGR_EMAC_0 0x44 /* TSN_0 */
  21. #define SOCFPGA_SYSMGR_EMAC_1 0x48 /* TSN_1 */
  22. #define SOCFPGA_SYSMGR_EMAC_2 0x4C /* TSN_2 */
  23. #define SOCFPGA_SYSMGR_TSN_0_ACE 0x50
  24. #define SOCFPGA_SYSMGR_TSN_1_ACE 0x54
  25. #define SOCFPGA_SYSMGR_TSN_2_ACE 0x58
  26. #define SOCFPGA_SYSMGR_FPGAINTF_EN_1 0x68
  27. #define SOCFPGA_SYSMGR_FPGAINTF_EN_2 0x6C
  28. #define SOCFPGA_SYSMGR_FPGAINTF_EN_3 0x70
  29. #define SOCFPGA_SYSMGR_DMAC0_L3_MASTER 0x74
  30. #define SOCFPGA_SYSMGR_ETR_L3_MASTER 0x78
  31. #define SOCFPGA_SYSMGR_DMAC1_L3_MASTER 0x7C
  32. #define SOCFPGA_SYSMGR_SEC_CTRL_SLT 0x80
  33. #define SOCFPGA_SYSMGR_OSC_TRIM 0x84
  34. #define SOCFPGA_SYSMGR_DMAC0_CTRL_STATUS_REG 0x88
  35. #define SOCFPGA_SYSMGR_DMAC1_CTRL_STATUS_REG 0x8C
  36. #define SOCFPGA_SYSMGR_ECC_INTMASK_VALUE 0x90
  37. #define SOCFPGA_SYSMGR_ECC_INTMASK_SET 0x94
  38. #define SOCFPGA_SYSMGR_ECC_INTMASK_CLR 0x98
  39. #define SOCFPGA_SYSMGR_ECC_INTMASK_SERR 0x9C
  40. #define SOCFPGA_SYSMGR_ECC_INTMASK_DERR 0xA0
  41. /* NOC configuration value for Agilex5 */
  42. #define SOCFPGA_SYSMGR_NOC_TIMEOUT 0xC0
  43. #define SOCFPGA_SYSMGR_NOC_IDLEREQ_SET 0xC4
  44. #define SOCFPGA_SYSMGR_NOC_IDLEREQ_CLR 0xC8
  45. #define SOCFPGA_SYSMGR_NOC_IDLEREQ_VAL 0xCC
  46. #define SOCFPGA_SYSMGR_NOC_IDLEACK 0xD0
  47. #define SOCFPGA_SYSMGR_NOC_IDLESTATUS 0xD4
  48. #define SOCFPGA_SYSMGR_FPGA2SOC_CTRL 0xD8
  49. #define SOCFPGA_SYSMGR_FPGA_CFG 0xDC
  50. #define SOCFPGA_SYSMGR_GPO 0xE4
  51. #define SOCFPGA_SYSMGR_GPI 0xE8
  52. #define SOCFPGA_SYSMGR_MPU 0xF0
  53. #define SOCFPGA_SYSMGR_SDM_HPS_SPARE 0xF4
  54. #define SOCFPGA_SYSMGR_HPS_SDM_SPARE 0xF8
  55. #define SOCFPGA_SYSMGR_DFI_INTF 0xFC
  56. #define SOCFPGA_SYSMGR_NAND_DD_CTRL 0x100
  57. #define SOCFPGA_SYSMGR_NAND_PHY_CTRL_REG 0x104
  58. #define SOCFPGA_SYSMGR_NAND_PHY_TSEL_REG 0x108
  59. #define SOCFPGA_SYSMGR_NAND_DQ_TIMING_REG 0x10C
  60. #define SOCFPGA_SYSMGR_PHY_DQS_TIMING_REG 0x110
  61. #define SOCFPGA_SYSMGR_NAND_PHY_GATE_LPBK_CTRL_REG 0x114
  62. #define SOCFPGA_SYSMGR_NAND_PHY_DLL_MASTER_CTRL_REG 0x118
  63. #define SOCFPGA_SYSMGR_NAND_PHY_DLL_SLAVE_CTRL_REG 0x11C
  64. #define SOCFPGA_SYSMGR_NAND_DD_DEFAULT_SETTING_REG0 0x120
  65. #define SOCFPGA_SYSMGR_NAND_DD_DEFAULT_SETTING_REG1 0x124
  66. #define SOCFPGA_SYSMGR_NAND_DD_STATUS_REG 0x128
  67. #define SOCFPGA_SYSMGR_NAND_DD_ID_LOW_REG 0x12C
  68. #define SOCFPGA_SYSMGR_NAND_DD_ID_HIGH_REG 0x130
  69. #define SOCFPGA_SYSMGR_NAND_WRITE_PROT_EN_REG 0x134
  70. #define SOCFPGA_SYSMGR_SDMMC_CMD_QUEUE_SETTING_REG 0x138
  71. #define SOCFPGA_SYSMGR_I3C_SLV_PID_LOW 0x13C
  72. #define SOCFPGA_SYSMGR_I3C_SLV_PID_HIGH 0x140
  73. #define SOCFPGA_SYSMGR_I3C_SLV_CTRL_0 0x144
  74. #define SOCFPGA_SYSMGR_I3C_SLV_CTRL_1 0x148
  75. #define SOCFPGA_SYSMGR_F2S_BRIDGE_CTRL 0x14C
  76. #define SOCFPGA_SYSMGR_DMA_TBU_STASH_CTRL_REG_0_DMA0 0x150
  77. #define SOCFPGA_SYSMGR_DMA_TBU_STASH_CTRL_REG_0_DMA1 0x154
  78. #define SOCFPGA_SYSMGR_SDM_TBU_STASH_CTRL_REG_1_SDM 0x158
  79. #define SOCFPGA_SYSMGR_IO_TBU_STASH_CTRL_REG_2_USB2 0x15C
  80. #define SOCFPGA_SYSMGR_IO_TBU_STASH_CTRL_REG_2_USB3 0x160
  81. #define SOCFPGA_SYSMGR_IO_TBU_STASH_CTRL_REG_2_SDMMC 0x164
  82. #define SOCFPGA_SYSMGR_IO_TBU_STASH_CTRL_REG_2_NAND 0x168
  83. #define SOCFPGA_SYSMGR_IO_TBU_STASH_CTRL_REG_2_ETR 0x16C
  84. #define SOCFPGA_SYSMGR_TSN_TBU_STASH_CTRL_REG_3_TSN0 0x170
  85. #define SOCFPGA_SYSMGR_TSN_TBU_STASH_CTRL_REG_3_TSN1 0x174
  86. #define SOCFPGA_SYSMGR_TSN_TBU_STASH_CTRL_REG_3_TSN2 0x178
  87. #define SOCFPGA_SYSMGR_DMA_TBU_STREAM_CTRL_REG_0_DMA0 0x17C
  88. #define SOCFPGA_SYSMGR_DMA_TBU_STREAM_CTRL_REG_0_DMA1 0x180
  89. #define SOCFPGA_SYSMGR_SDM_TBU_STREAM_CTRL_REG_1_SDM 0x184
  90. #define SOCFPGA_SYSMGR_IO_TBU_STREAM_CTRL_REG_2_USB2 0x188
  91. #define SOCFPGA_SYSMGR_IO_TBU_STREAM_CTRL_REG_2_USB3 0x18C
  92. #define SOCFPGA_SYSMGR_IO_TBU_STREAM_CTRL_REG_2_SDMMC 0x190
  93. #define SOCFPGA_SYSMGR_IO_TBU_STREAM_CTRL_REG_2_NAND 0x194
  94. #define SOCFPGA_SYSMGR_IO_TBU_STREAM_CTRL_REG_2_ETR 0x198
  95. #define SOCFPGA_SYSMGR_TSN_TBU_STREAM_CTRL_REG_3_TSN0 0x19C
  96. #define SOCFPGA_SYSMGR_TSN_TBU_STREAM_CTRL_REG_3_TSN1 0x1A0
  97. #define SOCFPGA_SYSMGR_TSN_TBU_STREAM_CTRL_REG_3_TSN2 0x1A4
  98. #define SOCFPGA_SYSMGR_DMA_TBU_STREAM_ID_AX_REG_0_DMA0 0x1A8
  99. #define SOCFPGA_SYSMGR_DMA_TBU_STREAM_ID_AX_REG_0_DMA1 0x1AC
  100. #define SOCFPGA_SYSMGR_SDM_TBU_STREAM_ID_AX_REG_1_SDM 0x1B0
  101. #define SOCFPGA_SYSMGR_IO_TBU_STREAM_ID_AX_REG_2_USB2 0x1B4
  102. #define SOCFPGA_SYSMGR_IO_TBU_STREAM_ID_AX_REG_2_USB3 0x1B8
  103. #define SOCFPGA_SYSMGR_IO_TBU_STREAM_ID_AX_REG_2_SDMMC 0x1BC
  104. #define SOCFPGA_SYSMGR_IO_TBU_STREAM_ID_AX_REG_2_NAND 0x1C0
  105. #define SOCFPGA_SYSMGR_IO_TBU_STREAM_ID_AX_REG_2_ETR 0x1C4
  106. #define SOCFPGA_SYSMGR_IO_TBU_STREAM_ID_AX_REG_2_TSN0 0x1C8
  107. #define SOCFPGA_SYSMGR_IO_TBU_STREAM_ID_AX_REG_2_TSN1 0x1CC
  108. #define SOCFPGA_SYSMGR_IO_TBU_STREAM_ID_AX_REG_2_TSN2 0x1D0
  109. #define SOCFPGA_SYSMGR_USB3_MISC_CTRL_REG0 0x1F0
  110. #define SOCFPGA_SYSMGR_USB3_MISC_CTRL_REG1 0x1F4
  111. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_COLD_0 0x200
  112. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_COLD_1 0x204
  113. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_COLD_2 0x208
  114. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_COLD_3 0x20C
  115. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_COLD_4 0x210
  116. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_COLD_5 0x214
  117. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_COLD_6 0x218
  118. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_COLD_7 0x21C
  119. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_COLD_8 0x220
  120. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_COLD_9 0x224
  121. #define SOCFPGA_SYSMGR_MPFE_CONFIG 0x228
  122. #define SOCFPGA_SYSMGR_MPFE_STATUS 0x22C
  123. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_WARM_0 0x230
  124. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_WARM_1 0x234
  125. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_WARM_2 0x238
  126. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_WARM_3 0x23C
  127. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_WARM_4 0x240
  128. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_WARM_5 0x244
  129. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_WARM_6 0x248
  130. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_WARM_7 0x24C
  131. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_WARM_8 0x250
  132. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_WARM_9 0x254
  133. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_POR_0 0x258
  134. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_POR_1 0x25C
  135. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_POR_2 0x260
  136. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_POR_3 0x264
  137. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_POR_4 0x268
  138. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_POR_5 0x26C
  139. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_POR_6 0x270
  140. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_POR_7 0x274
  141. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_POR_8 0x278
  142. #define SOCFPGA_SYSMGR_BOOT_SCRATCH_POR_9 0x27C
  143. /* QSPI ECC from SDM register */
  144. #define SOCFPGA_ECC_QSPI_CTRL 0x08
  145. #define SOCFPGA_ECC_QSPI_ERRINTEN 0x10
  146. #define SOCFPGA_ECC_QSPI_ERRINTENS 0x14
  147. #define SOCFPGA_ECC_QSPI_ERRINTENR 0x18
  148. #define SOCFPGA_ECC_QSPI_INTMODE 0x1C
  149. #define SOCFPGA_ECC_QSPI_INTSTAT 0x20
  150. #define SOCFPGA_ECC_QSPI_INTTEST 0x24
  151. #define SOCFPGA_ECC_QSPI_ECC_ACCCTRL 0x78
  152. #define SOCFPGA_ECC_QSPI_ECC_STARTACC 0x7C
  153. #define SOCFPGA_ECC_QSPI_ECC_WDCTRL 0x80
  154. #define DMA0_STREAM_CTRL_REG 0x10D1217C
  155. #define DMA1_STREAM_CTRL_REG 0x10D12180
  156. #define SDM_STREAM_CTRL_REG 0x10D12184
  157. #define USB2_STREAM_CTRL_REG 0x10D12188
  158. #define USB3_STREAM_CTRL_REG 0x10D1218C
  159. #define SDMMC_STREAM_CTRL_REG 0x10D12190
  160. #define NAND_STREAM_CTRL_REG 0x10D12194
  161. #define ETR_STREAM_CTRL_REG 0x10D12198
  162. #define TSN0_STREAM_CTRL_REG 0x10D1219C
  163. #define TSN1_STREAM_CTRL_REG 0x10D121A0
  164. #define TSN2_STREAM_CTRL_REG 0x10D121A4
  165. /* Stream ID configuration value for Agilex5 */
  166. #define TSN0 0x00010001
  167. #define TSN1 0x00020002
  168. #define TSN2 0x00030003
  169. #define NAND 0x00040004
  170. #define SDMMC 0x00050005
  171. #define USB0 0x00060006
  172. #define USB1 0x00070007
  173. #define DMA0 0x00080008
  174. #define DMA1 0x00090009
  175. #define SDM 0x000A000A
  176. #define CORE_SIGHT_DEBUG 0x000B000B
  177. /* Field Masking */
  178. #define SYSMGR_SDMMC_DRVSEL(x) (((x) & 0x7) << 0)
  179. #define SYSMGR_SDMMC_SMPLSEL(x) (((x) & 0x7) << 4)
  180. #define IDLE_DATA_LWSOC2FPGA BIT(4)
  181. #define IDLE_DATA_SOC2FPGA BIT(0)
  182. #define IDLE_DATA_MASK (IDLE_DATA_LWSOC2FPGA | IDLE_DATA_SOC2FPGA)
  183. #define SYSMGR_ECC_OCRAM_MASK BIT(1)
  184. #define SYSMGR_ECC_DDR0_MASK BIT(16)
  185. #define SYSMGR_ECC_DDR1_MASK BIT(17)
  186. #define WSTREAMIDEN_REG_CTRL BIT(0)
  187. #define RSTREAMIDEN_REG_CTRL BIT(1)
  188. #define WMMUSECSID_REG_VAL BIT(4)
  189. #define RMMUSECSID_REG_VAL BIT(5)
  190. /* Macros */
  191. #define SOCFPGA_ECC_QSPI(_reg) (SOCFPGA_ECC_QSPI_REG_BASE \
  192. + (SOCFPGA_ECC_QSPI_##_reg))
  193. #define SOCFPGA_SYSMGR(_reg) (SOCFPGA_SYSMGR_REG_BASE \
  194. + (SOCFPGA_SYSMGR_##_reg))
  195. #define ENABLE_STREAMID WSTREAMIDEN_REG_CTRL | \
  196. RSTREAMIDEN_REG_CTRL
  197. #define ENABLE_STREAMID_SECURE_TX WSTREAMIDEN_REG_CTRL | \
  198. RSTREAMIDEN_REG_CTRL | \
  199. WMMUSECSID_REG_VAL | RMMUSECSID_REG_VAL
  200. #endif /* N5X_SOCFPGA_SYSTEMMANAGER_H */