mtk_apusys_apc_def.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Copyright (c) 2021, MediaTek Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef __MTK_APUSYS_APC_DEF_H__
  7. #define __MTK_APUSYS_APC_DEF_H__
  8. #include <lib/mmio.h>
  9. enum APUSYS_APC_ERR_STATUS {
  10. APUSYS_APC_OK = 0x0,
  11. APUSYS_APC_ERR_GENERIC = 0x1000,
  12. APUSYS_APC_ERR_INVALID_CMD = 0x1001,
  13. APUSYS_APC_ERR_SLAVE_TYPE_NOT_SUPPORTED = 0x1002,
  14. APUSYS_APC_ERR_SLAVE_IDX_NOT_SUPPORTED = 0x1003,
  15. APUSYS_APC_ERR_DOMAIN_NOT_SUPPORTED = 0x1004,
  16. APUSYS_APC_ERR_PERMISSION_NOT_SUPPORTED = 0x1005,
  17. APUSYS_APC_ERR_OUT_OF_BOUNDARY = 0x1006,
  18. APUSYS_APC_ERR_REQ_TYPE_NOT_SUPPORTED = 0x1007,
  19. };
  20. enum APUSYS_APC_PERM_TYPE {
  21. NO_PROTECTION = 0U,
  22. SEC_RW_ONLY = 1U,
  23. SEC_RW_NS_R = 2U,
  24. FORBIDDEN = 3U,
  25. PERM_NUM = 4U,
  26. };
  27. enum APUSYS_APC_DOMAIN_ID {
  28. DOMAIN_0 = 0U,
  29. DOMAIN_1 = 1U,
  30. DOMAIN_2 = 2U,
  31. DOMAIN_3 = 3U,
  32. DOMAIN_4 = 4U,
  33. DOMAIN_5 = 5U,
  34. DOMAIN_6 = 6U,
  35. DOMAIN_7 = 7U,
  36. DOMAIN_8 = 8U,
  37. DOMAIN_9 = 9U,
  38. DOMAIN_10 = 10U,
  39. DOMAIN_11 = 11U,
  40. DOMAIN_12 = 12U,
  41. DOMAIN_13 = 13U,
  42. DOMAIN_14 = 14U,
  43. DOMAIN_15 = 15U,
  44. };
  45. struct APC_DOM_16 {
  46. unsigned char d0_permission;
  47. unsigned char d1_permission;
  48. unsigned char d2_permission;
  49. unsigned char d3_permission;
  50. unsigned char d4_permission;
  51. unsigned char d5_permission;
  52. unsigned char d6_permission;
  53. unsigned char d7_permission;
  54. unsigned char d8_permission;
  55. unsigned char d9_permission;
  56. unsigned char d10_permission;
  57. unsigned char d11_permission;
  58. unsigned char d12_permission;
  59. unsigned char d13_permission;
  60. unsigned char d14_permission;
  61. unsigned char d15_permission;
  62. };
  63. #define APUSYS_APC_AO_ATTR(DEV_NAME, PERM_ATTR0, PERM_ATTR1, \
  64. PERM_ATTR2, PERM_ATTR3, PERM_ATTR4, PERM_ATTR5, \
  65. PERM_ATTR6, PERM_ATTR7, PERM_ATTR8, PERM_ATTR9, \
  66. PERM_ATTR10, PERM_ATTR11, PERM_ATTR12, PERM_ATTR13, \
  67. PERM_ATTR14, PERM_ATTR15) \
  68. {(unsigned char)PERM_ATTR0, (unsigned char)PERM_ATTR1, \
  69. (unsigned char)PERM_ATTR2, (unsigned char)PERM_ATTR3, \
  70. (unsigned char)PERM_ATTR4, (unsigned char)PERM_ATTR5, \
  71. (unsigned char)PERM_ATTR6, (unsigned char)PERM_ATTR7, \
  72. (unsigned char)PERM_ATTR8, (unsigned char)PERM_ATTR9, \
  73. (unsigned char)PERM_ATTR10, (unsigned char)PERM_ATTR11, \
  74. (unsigned char)PERM_ATTR12, (unsigned char)PERM_ATTR13, \
  75. (unsigned char)PERM_ATTR14, (unsigned char)PERM_ATTR15}
  76. #define apuapc_writel(VAL, REG) mmio_write_32((uintptr_t)REG, VAL)
  77. #define apuapc_readl(REG) mmio_read_32((uintptr_t)REG)
  78. /* APUSYS APC AO Registers */
  79. #define APUSYS_APC_AO_BASE APUSYS_APC_AO_WRAPPER_BASE
  80. #define APUSYS_APC_CON (APUSYS_APC_AO_BASE + 0x00F00)
  81. #define APUSYS_SYS0_APC_LOCK_0 (APUSYS_APC_AO_BASE + 0x00700)
  82. /* APUSYS NOC_DPAC_AO Registers */
  83. #define APUSYS_NOC_DAPC_CON (APUSYS_NOC_DAPC_AO_BASE + 0x00F00)
  84. #define APUSYS_NOC_DAPC_GAP_BOUNDARY 4U
  85. #define APUSYS_NOC_DAPC_JUMP_GAP 12U
  86. #define APUSYS_APC_SYS0_AO_SLAVE_NUM_IN_1_DOM 16U
  87. #define APUSYS_APC_SYS0_AO_DOM_NUM 16U
  88. #define APUSYS_APC_SYS0_AO_SLAVE_NUM 59U
  89. #define APUSYS_APC_SYS0_LOCK_BIT_APU_SCTRL_REVISER 11U
  90. #define APUSYS_APC_SYS0_LOCK_BIT_APUSYS_AO_5 5U
  91. #define APUSYS_NOC_DAPC_AO_SLAVE_NUM_IN_1_DOM 16U
  92. #define APUSYS_NOC_DAPC_AO_DOM_NUM 16U
  93. #define APUSYS_NOC_DAPC_AO_SLAVE_NUM 27U
  94. #endif /* __MTK_APUSYS_APC_DEF_H__ */