tcs.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef __SOC_QCOM_TCS_H__
  7. #define __SOC_QCOM_TCS_H__
  8. #define MAX_RPMH_PAYLOAD 16
  9. /**
  10. * rpmh_state: state for the request
  11. *
  12. * RPMH_SLEEP_STATE: State of the resource when the processor subsystem
  13. * is powered down. There is no client using the
  14. * resource actively.
  15. * RPMH_WAKE_ONLY_STATE: Resume resource state to the value previously
  16. * requested before the processor was powered down.
  17. * RPMH_ACTIVE_ONLY_STATE: Active or AMC mode requests. Resource state
  18. * is aggregated immediately.
  19. */
  20. enum rpmh_state {
  21. RPMH_SLEEP_STATE,
  22. RPMH_WAKE_ONLY_STATE,
  23. RPMH_ACTIVE_ONLY_STATE,
  24. };
  25. /**
  26. * struct tcs_cmd: an individual request to RPMH.
  27. *
  28. * @addr: the address of the resource slv_id:18:16 | offset:0:15
  29. * @data: the resource state request
  30. * @wait: wait for this request to be complete before sending the next
  31. */
  32. struct tcs_cmd {
  33. u32 addr;
  34. u32 data;
  35. u32 wait;
  36. };
  37. /**
  38. * struct tcs_request: A set of tcs_cmds sent together in a TCS
  39. *
  40. * @state: state for the request.
  41. * @wait_for_compl: wait until we get a response from the h/w accelerator
  42. * @num_cmds: the number of @cmds in this request
  43. * @cmds: an array of tcs_cmds
  44. */
  45. struct tcs_request {
  46. enum rpmh_state state;
  47. u32 wait_for_compl;
  48. u32 num_cmds;
  49. struct tcs_cmd *cmds;
  50. };
  51. #define BCM_TCS_CMD_COMMIT_SHFT 30
  52. #define BCM_TCS_CMD_COMMIT_MASK 0x40000000
  53. #define BCM_TCS_CMD_VALID_SHFT 29
  54. #define BCM_TCS_CMD_VALID_MASK 0x20000000
  55. #define BCM_TCS_CMD_VOTE_X_SHFT 14
  56. #define BCM_TCS_CMD_VOTE_MASK 0x3fff
  57. #define BCM_TCS_CMD_VOTE_Y_SHFT 0
  58. #define BCM_TCS_CMD_VOTE_Y_MASK 0xfffc000
  59. /* Construct a Bus Clock Manager (BCM) specific TCS command */
  60. #define BCM_TCS_CMD(commit, valid, vote_x, vote_y) \
  61. (((commit) << BCM_TCS_CMD_COMMIT_SHFT) | \
  62. ((valid) << BCM_TCS_CMD_VALID_SHFT) | \
  63. ((cpu_to_le32(vote_x) & \
  64. BCM_TCS_CMD_VOTE_MASK) << BCM_TCS_CMD_VOTE_X_SHFT) | \
  65. ((cpu_to_le32(vote_y) & \
  66. BCM_TCS_CMD_VOTE_MASK) << BCM_TCS_CMD_VOTE_Y_SHFT))
  67. #endif /* __SOC_QCOM_TCS_H__ */