intf.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef BPMP_INTF_H
  7. #define BPMP_INTF_H
  8. /**
  9. * Flags used in IPC req
  10. */
  11. #define FLAG_DO_ACK (U(1) << 0)
  12. #define FLAG_RING_DOORBELL (U(1) << 1)
  13. /* Bit 1 is designated for CCPlex in secure world */
  14. #define HSP_MASTER_CCPLEX_BIT (U(1) << 1)
  15. /* Bit 19 is designated for BPMP in non-secure world */
  16. #define HSP_MASTER_BPMP_BIT (U(1) << 19)
  17. /* Timeout to receive response from BPMP is 1 sec */
  18. #define TIMEOUT_RESPONSE_FROM_BPMP_US U(1000000) /* in microseconds */
  19. /**
  20. * IVC protocol defines and command/response frame
  21. */
  22. /**
  23. * IVC specific defines
  24. */
  25. #define IVC_CMD_SZ_BYTES U(128)
  26. #define IVC_DATA_SZ_BYTES U(120)
  27. /**
  28. * Holds frame data for an IPC request
  29. */
  30. struct frame_data {
  31. /* Identification as to what kind of data is being transmitted */
  32. uint32_t mrq;
  33. /* Flags for slave as to how to respond back */
  34. uint32_t flags;
  35. /* Actual data being sent */
  36. uint8_t data[IVC_DATA_SZ_BYTES];
  37. };
  38. /**
  39. * Commands send to the BPMP firmware
  40. */
  41. /**
  42. * MRQ command codes
  43. */
  44. #define MRQ_RESET U(20)
  45. #define MRQ_CLK U(22)
  46. /**
  47. * Reset sub-commands
  48. */
  49. #define CMD_RESET_ASSERT U(1)
  50. #define CMD_RESET_DEASSERT U(2)
  51. #define CMD_RESET_MODULE U(3)
  52. /**
  53. * Used by the sender of an #MRQ_RESET message to request BPMP to
  54. * assert or deassert a given reset line.
  55. */
  56. struct __attribute__((packed)) mrq_reset_request {
  57. /* reset action to perform (mrq_reset_commands) */
  58. uint32_t cmd;
  59. /* id of the reset to affected */
  60. uint32_t reset_id;
  61. };
  62. /**
  63. * MRQ_CLK sub-commands
  64. *
  65. */
  66. enum {
  67. CMD_CLK_GET_RATE = U(1),
  68. CMD_CLK_SET_RATE = U(2),
  69. CMD_CLK_ROUND_RATE = U(3),
  70. CMD_CLK_GET_PARENT = U(4),
  71. CMD_CLK_SET_PARENT = U(5),
  72. CMD_CLK_IS_ENABLED = U(6),
  73. CMD_CLK_ENABLE = U(7),
  74. CMD_CLK_DISABLE = U(8),
  75. CMD_CLK_GET_ALL_INFO = U(14),
  76. CMD_CLK_GET_MAX_CLK_ID = U(15),
  77. CMD_CLK_MAX,
  78. };
  79. /**
  80. * Used by the sender of an #MRQ_CLK message to control clocks. The
  81. * clk_request is split into several sub-commands. Some sub-commands
  82. * require no additional data. Others have a sub-command specific
  83. * payload
  84. *
  85. * |sub-command |payload |
  86. * |----------------------------|-----------------------|
  87. * |CMD_CLK_GET_RATE |- |
  88. * |CMD_CLK_SET_RATE |clk_set_rate |
  89. * |CMD_CLK_ROUND_RATE |clk_round_rate |
  90. * |CMD_CLK_GET_PARENT |- |
  91. * |CMD_CLK_SET_PARENT |clk_set_parent |
  92. * |CMD_CLK_IS_ENABLED |- |
  93. * |CMD_CLK_ENABLE |- |
  94. * |CMD_CLK_DISABLE |- |
  95. * |CMD_CLK_GET_ALL_INFO |- |
  96. * |CMD_CLK_GET_MAX_CLK_ID |- |
  97. *
  98. */
  99. struct mrq_clk_request {
  100. /**
  101. * sub-command and clock id concatenated to 32-bit word.
  102. * - bits[31..24] is the sub-cmd.
  103. * - bits[23..0] is the clock id
  104. */
  105. uint32_t cmd_and_id;
  106. };
  107. /**
  108. * Macro to prepare the MRQ_CLK sub-command
  109. */
  110. #define make_mrq_clk_cmd(cmd, id) (((cmd) << 24) | (id & 0xFFFFFF))
  111. #endif /* BPMP_INTF_H */