vcp_reg.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright (c) 2024, MediaTek Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef VCP_REG_H
  7. #define VCP_REG_H
  8. #include <platform_def.h>
  9. #define MTK_VCP_REG_BASE (IO_PHYS + 0x21800000)
  10. #define MTK_VCP_REG_BANK_SIZE (0x1000)
  11. /*******************************************************************************
  12. * VCP power related setting
  13. ******************************************************************************/
  14. #define VCP_POWER_STATUS (0xE60)
  15. #define MMUP_PWR_STA_BIT (30)
  16. #define MMUP_PWR_STA_EN ((uint32_t)(0x3))
  17. /*******************************************************************************
  18. * VCP registers
  19. ******************************************************************************/
  20. /* cfgreg */
  21. #define VCP_R_CFGREG (MTK_VCP_REG_BASE + 0x3d0000)
  22. #define VCP_R_CORE0_SW_RSTN_CLR (VCP_R_CFGREG + 0x0000)
  23. #define VCP_R_CORE0_SW_RSTN_SET (VCP_R_CFGREG + 0x0004)
  24. #define VCP_R_CORE1_SW_RSTN_CLR (VCP_R_CFGREG + 0x0008)
  25. #define VCP_R_CORE1_SW_RSTN_SET (VCP_R_CFGREG + 0x000c)
  26. #define VCP_R_GIPC_IN_SET (VCP_R_CFGREG + 0x0028)
  27. #define VCP_R_GIPC_IN_CLR (VCP_R_CFGREG + 0x002c)
  28. #define B_GIPC3_SETCLR_1 BIT(13)
  29. /* cfgreg_core0 */
  30. #define VCP_R_CFGREG_CORE0 (MTK_VCP_REG_BASE + 0x20a000)
  31. #define VCP_R_CORE0_STATUS (VCP_R_CFGREG_CORE0 + 0x0070)
  32. #define CORE0_R_GPR5 (VCP_R_CFGREG_CORE0 + 0x0054)
  33. #define VCP_GPR_C0_H0_REBOOT CORE0_R_GPR5
  34. #define CORE0_R_GPR6 (VCP_R_CFGREG_CORE0 + 0x0058)
  35. #define VCP_GPR_C0_H1_REBOOT CORE0_R_GPR6
  36. #define VCP_CORE_RDY_TO_REBOOT (0x34)
  37. #define VCP_CORE_REBOOT_OK BIT(0)
  38. /* cfgreg_core1 */
  39. #define VCP_R_CFGREG_CORE1 (MTK_VCP_REG_BASE + 0x20d000)
  40. #define VCP_R_CORE1_STATUS (VCP_R_CFGREG_CORE1 + 0x0070)
  41. #define CORE1_R_GPR5 (VCP_R_CFGREG_CORE1 + 0x0054)
  42. #define VCP_GPR_CORE1_REBOOT CORE1_R_GPR5
  43. /* sec */
  44. #define VCP_R_SEC_CTRL (MTK_VCP_REG_BASE + 0x270000)
  45. #define VCP_OFFSET_ENABLE_P BIT(13)
  46. #define VCP_OFFSET_ENABLE_B BIT(12)
  47. #define VCP_R_SEC_CTRL_2 (VCP_R_SEC_CTRL + 0x0004)
  48. #define CORE0_SEC_BIT_SEL BIT(0)
  49. #define CORE1_SEC_BIT_SEL BIT(8)
  50. #define VCP_GPR0_CFGREG_SEC (VCP_R_SEC_CTRL + 0x0040)
  51. #define VCP_GPR1_CFGREG_SEC (VCP_R_SEC_CTRL + 0x0044)
  52. #define VCP_GPR2_CFGREG_SEC (VCP_R_SEC_CTRL + 0x0048)
  53. #define VCP_GPR3_CFGREG_SEC (VCP_R_SEC_CTRL + 0x004C)
  54. #define VCP_R_SEC_DOMAIN (VCP_R_SEC_CTRL + 0x0080)
  55. #define VCP_DOMAIN_ID U(13)
  56. #define VCP_DOMAIN_MASK U(0xF)
  57. #define VCP_CORE0_TH0_PM_AXI_DOMAIN (0)
  58. #define VCP_CORE0_TH0_DM_AXI_DOMAIN (4)
  59. #define VCP_S_DMA0_DOMAIN (12)
  60. #define VCP_HWCCF_DOMAIN (16)
  61. #define VCP_CORE0_TH1_PM_AXI_DOMAIN (20)
  62. #define VCP_CORE0_TH1_DM_AXI_DOMAIN (24)
  63. #define VCP_DOMAIN_SET ((VCP_DOMAIN_ID << VCP_CORE0_TH0_PM_AXI_DOMAIN) | \
  64. (VCP_DOMAIN_ID << VCP_CORE0_TH0_DM_AXI_DOMAIN) | \
  65. (VCP_DOMAIN_ID << VCP_CORE0_TH1_PM_AXI_DOMAIN) | \
  66. (VCP_DOMAIN_ID << VCP_CORE0_TH1_DM_AXI_DOMAIN) | \
  67. (VCP_DOMAIN_ID << VCP_S_DMA0_DOMAIN))
  68. #define VCP_R_SEC_DOMAIN_MMPC (VCP_R_SEC_CTRL + 0x0084)
  69. #define VCP_CORE_MMPC_PM_AXI_DOMAIN (0)
  70. #define VCP_CORE_MMPC_DM_AXI_DOMAIN (4)
  71. #define VCP_DOMAIN_SET_MMPC ((VCP_DOMAIN_ID << VCP_CORE_MMPC_PM_AXI_DOMAIN) | \
  72. (VCP_DOMAIN_ID << VCP_CORE_MMPC_DM_AXI_DOMAIN))
  73. #define R_L2TCM_OFFSET_RANGE_0_LOW (VCP_R_SEC_CTRL + 0x00B0)
  74. #define R_L2TCM_OFFSET_RANGE_0_HIGH (VCP_R_SEC_CTRL + 0x00B4)
  75. #define R_L2TCM_OFFSET (VCP_R_SEC_CTRL + 0x00D0)
  76. #define VCP_R_DYN_SECURE (VCP_R_SEC_CTRL + 0x01d0)
  77. #define VCP_NS_I0 BIT(4)
  78. #define VCP_NS_D0 BIT(6)
  79. #define VCP_NS_SECURE_B_REGION_ENABLE (24)
  80. #define RESET_NS_SECURE_B_REGION U(0xFF)
  81. #define VCP_R_DYN_SECURE_TH1 (VCP_R_SEC_CTRL + 0x01d4)
  82. #define VCP_NS_I1 BIT(5)
  83. #define VCP_NS_D1 BIT(7)
  84. #define VCP_R_S_DOM_EN0_31 (VCP_R_SEC_CTRL + 0x0200)
  85. #define VCP_R_S_DOM_EN32_63 (VCP_R_SEC_CTRL + 0x0204)
  86. #define VCP_R_NS_DOM_EN0_31 (VCP_R_SEC_CTRL + 0x0208)
  87. #define VCP_R_NS_DOM_EN32_63 (VCP_R_SEC_CTRL + 0x020c)
  88. /* IOMMU */
  89. #define VCP_R_AXIOMMUEN_DEV_APC (VCP_R_SEC_CTRL + 0x0088)
  90. #define VCP_R_CFG_DEVAPC_AO_BASE (MTK_VCP_REG_BASE + 0x2d0000)
  91. #endif /* VCP_REG_H */