scmi.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright 2021-2024 NXP
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef IMX8_SCMI_H
  7. #define IMX8_SCMI_H
  8. #include <stdint.h>
  9. #define SCMI_SHMEM_CHANNEL_ERROR BIT_32(1)
  10. #define SCMI_SHMEM_CHANNEL_FREE BIT_32(0)
  11. #define SCMI_SHMEM_FLAG_INTR_ENABLED BIT_32(0)
  12. enum scmi_std_protocol {
  13. SCMI_PROTOCOL_BASE = 0x10,
  14. SCMI_PROTOCOL_POWER_DOMAIN = 0x11,
  15. SCMI_PROTOCOL_SYS_POWER = 0x12,
  16. SCMI_PROTOCOL_PERF_DOMAIN = 0x13,
  17. SCMI_PROTOCOL_CLK = 0x14,
  18. SCMI_PROTOCOL_SENSOR = 0x15,
  19. SCMI_PROTOCOL_RESET_DOMAIN = 0x16,
  20. };
  21. #define MSG_ID(m) ((m) & 0xff)
  22. #define MSG_TYPE(m) (((m) >> 8) & 0x3)
  23. #define MSG_PRO_ID(m) (((m) >> 10) & 0xff)
  24. #define MSG_TOKEN(m) (((m) >> 18) & 0x3ff)
  25. enum {
  26. SCMI_POWER_DOMAIN_PROTOCOL = 0x11,
  27. SCMI_SYS_PWR_DOMAIN_PROTOCOL = 0x12,
  28. SCMI_PER_DOMAIN_PROTOCOL = 0x13,
  29. SCMI_CLK_DOMAIN_PROTOCOL = 0x14,
  30. SCMI_SENSOR_PROTOCOL = 0x15,
  31. };
  32. #define PROTOCOL_VERSION 0
  33. #define PROTOCOL_ATTRIBUTES 1
  34. #define PROTOCOL_MESSAGE_ATTRIBUTES 2
  35. #define BASE_DISCOVER_VENDOR 3
  36. #define BASE_DISCOVER_SUB_VENDOR 4
  37. #define BASE_DISCOVER_IMPLEMENTATION_VERSION 5
  38. #define BASE_DISCOVER_LIST_PROTOCOLS 6
  39. #define BASE_DISCOVER_AGENT 7
  40. #define BASE_NOTIFY_ERRORS 8
  41. #define BASE_SET_DEVICE_PERMISSIONS 9
  42. #define BASE_SET_PROTOCOL_PERMISSIONS 0xA
  43. #define BASE_RESET_AGENT_CONFIGURATION 0xB
  44. enum {
  45. SCMI_RET_SUCCESS = 0,
  46. SCMI_RET_NOT_SUPPORTED = -1,
  47. SCMI_RET_INVALID_PARAMETERS = -2,
  48. SCMI_RET_DENIED = -3,
  49. SCMI_RET_NOT_FOUND = -4,
  50. SCMI_RET_OUT_OF_RANGE = -5,
  51. SCMI_RET_BUSY = -6,
  52. SCMI_RET_COMMS_ERROR = -7,
  53. SCMI_RET_GENERIC_ERROR = -8,
  54. SCMI_RET_HARDWARE_ERROR = -9,
  55. SCMI_RET_PROTOCOL_ERROR = -10,
  56. };
  57. #define POWER_DOMAIN_ATTRIBUTES 3
  58. #define POWER_DOMAIN_SUPPORT_NOTIFICATION BIT(31)
  59. #define POWER_DOMAIN_SUPPORT_ASYNCHRONOUS BIT(30)
  60. #define POWER_DOMAIN_SUPPORT_SYNCHRONOUS BIT(29)
  61. #define POWER_STATE_SET 4
  62. #define POWER_STATE_GET 5
  63. #define POWER_STATE_NOTIFY 6
  64. #define POWER_STATE_CHANGE_REQUESTED_NOTIFY 7
  65. int scmi_power_domain_handler(uint32_t msg_id, void *shmem);
  66. #define PERFORMANCE_DOMAIN_ATTRIBUTES 3
  67. #define PERFORMANCE_DESCRIBE_LEVELS 4
  68. #define PERFORMANCE_LIMITS_SET 5
  69. #define PERFORMANCE_LIMITS_GET 6
  70. #define PERFORMANCE_LEVEL_SET 7
  71. #define PERFORMANCE_LEVEL_GET 8
  72. #define PERFORMANCE_NOTIFY_LIMITS 9
  73. #define PERFORMANCE_NOTIFY_LEVEL 0xA
  74. #define PERFORMANCE_DESCRIBE_FAST_CHANNEL 0xB
  75. int scmi_perf_domain_handler(uint32_t msg_id, void *shmem);
  76. #define SENSOR_DESCRIPTION_GET 0x003
  77. #define SENSOR_CONFIG_SET 0x004
  78. #define SENSOR_TRIP_POINT_SET 0x005
  79. #define SENSOR_READING_GET 0x006
  80. int scmi_sensor_handler(uint32_t msg_id, void *shmem);
  81. #define SMC_SHMEM_BASE 0x2201f000
  82. #endif /* IMX8_SCMI_H */