scmi.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright 2021-2024 NXP
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <assert.h>
  7. #include <stdint.h>
  8. #include <drivers/scmi-msg.h>
  9. #include <drivers/scmi.h>
  10. #include <platform_def.h>
  11. #define SMT_BUFFER_BASE 0x2201f000
  12. #define SMT_BUFFER0_BASE SMT_BUFFER_BASE
  13. #define SMT_BUFFER1_BASE (SMT_BUFFER_BASE + 0x200)
  14. static struct scmi_msg_channel scmi_channel[] = {
  15. [0] = {
  16. .shm_addr = SMT_BUFFER0_BASE,
  17. .shm_size = SMT_BUF_SLOT_SIZE,
  18. },
  19. };
  20. struct scmi_msg_channel *plat_scmi_get_channel(unsigned int agent_id)
  21. {
  22. assert(agent_id < ARRAY_SIZE(scmi_channel));
  23. return &scmi_channel[agent_id];
  24. }
  25. static const char vendor[] = "NXP";
  26. static const char sub_vendor[] = "";
  27. const char *plat_scmi_vendor_name(void)
  28. {
  29. return vendor;
  30. }
  31. const char *plat_scmi_sub_vendor_name(void)
  32. {
  33. return sub_vendor;
  34. }
  35. /* Currently supporting Clocks and Reset Domains */
  36. static const uint8_t plat_protocol_list[] = {
  37. SCMI_PROTOCOL_ID_POWER_DOMAIN,
  38. SCMI_PROTOCOL_ID_SENSOR,
  39. 0U /* Null termination */
  40. };
  41. size_t plat_scmi_protocol_count(void)
  42. {
  43. return ARRAY_SIZE(plat_protocol_list) - 1U;
  44. }
  45. const uint8_t *plat_scmi_protocol_list(unsigned int agent_id __unused)
  46. {
  47. return plat_protocol_list;
  48. }
  49. void imx8ulp_init_scmi_server(void)
  50. {
  51. size_t i;
  52. for (i = 0U; i < ARRAY_SIZE(scmi_channel); i++) {
  53. scmi_smt_init_agent_channel(&scmi_channel[i]);
  54. }
  55. }