ti_sci_protocol.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Texas Instruments System Control Interface Protocol
  4. *
  5. * Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/
  6. * Nishanth Menon
  7. */
  8. #ifndef __TISCI_PROTOCOL_H
  9. #define __TISCI_PROTOCOL_H
  10. /**
  11. * struct ti_sci_version_info - version information structure
  12. * @abi_major: Major ABI version. Change here implies risk of backward
  13. * compatibility break.
  14. * @abi_minor: Minor ABI version. Change here implies new feature addition,
  15. * or compatible change in ABI.
  16. * @firmware_revision: Firmware revision (not usually used).
  17. * @firmware_description: Firmware description (not usually used).
  18. */
  19. struct ti_sci_version_info {
  20. u8 abi_major;
  21. u8 abi_minor;
  22. u16 firmware_revision;
  23. char firmware_description[32];
  24. };
  25. struct ti_sci_handle;
  26. /**
  27. * struct ti_sci_core_ops - SoC Core Operations
  28. * @reboot_device: Reboot the SoC
  29. * Returns 0 for successful request(ideally should never return),
  30. * else returns corresponding error value.
  31. */
  32. struct ti_sci_core_ops {
  33. int (*reboot_device)(const struct ti_sci_handle *handle);
  34. };
  35. /**
  36. * struct ti_sci_dev_ops - Device control operations
  37. * @get_device: Command to request for device managed by TISCI
  38. * Returns 0 for successful exclusive request, else returns
  39. * corresponding error message.
  40. * @idle_device: Command to idle a device managed by TISCI
  41. * Returns 0 for successful exclusive request, else returns
  42. * corresponding error message.
  43. * @put_device: Command to release a device managed by TISCI
  44. * Returns 0 for successful release, else returns corresponding
  45. * error message.
  46. * @is_valid: Check if the device ID is a valid ID.
  47. * Returns 0 if the ID is valid, else returns corresponding error.
  48. * @get_context_loss_count: Command to retrieve context loss counter - this
  49. * increments every time the device looses context. Overflow
  50. * is possible.
  51. * - count: pointer to u32 which will retrieve counter
  52. * Returns 0 for successful information request and count has
  53. * proper data, else returns corresponding error message.
  54. * @is_idle: Reports back about device idle state
  55. * - req_state: Returns requested idle state
  56. * Returns 0 for successful information request and req_state and
  57. * current_state has proper data, else returns corresponding error
  58. * message.
  59. * @is_stop: Reports back about device stop state
  60. * - req_state: Returns requested stop state
  61. * - current_state: Returns current stop state
  62. * Returns 0 for successful information request and req_state and
  63. * current_state has proper data, else returns corresponding error
  64. * message.
  65. * @is_on: Reports back about device ON(or active) state
  66. * - req_state: Returns requested ON state
  67. * - current_state: Returns current ON state
  68. * Returns 0 for successful information request and req_state and
  69. * current_state has proper data, else returns corresponding error
  70. * message.
  71. * @is_transitioning: Reports back if the device is in the middle of transition
  72. * of state.
  73. * -current_state: Returns 'true' if currently transitioning.
  74. * @set_device_resets: Command to configure resets for device managed by TISCI.
  75. * -reset_state: Device specific reset bit field
  76. * Returns 0 for successful request, else returns
  77. * corresponding error message.
  78. * @get_device_resets: Command to read state of resets for device managed
  79. * by TISCI.
  80. * -reset_state: pointer to u32 which will retrieve resets
  81. * Returns 0 for successful request, else returns
  82. * corresponding error message.
  83. *
  84. * NOTE: for all these functions, the following parameters are generic in
  85. * nature:
  86. * -handle: Pointer to TISCI handle as retrieved by *ti_sci_get_handle
  87. * -id: Device Identifier
  88. *
  89. * Request for the device - NOTE: the client MUST maintain integrity of
  90. * usage count by balancing get_device with put_device. No refcounting is
  91. * managed by driver for that purpose.
  92. */
  93. struct ti_sci_dev_ops {
  94. int (*get_device)(const struct ti_sci_handle *handle, u32 id);
  95. int (*idle_device)(const struct ti_sci_handle *handle, u32 id);
  96. int (*put_device)(const struct ti_sci_handle *handle, u32 id);
  97. int (*is_valid)(const struct ti_sci_handle *handle, u32 id);
  98. int (*get_context_loss_count)(const struct ti_sci_handle *handle,
  99. u32 id, u32 *count);
  100. int (*is_idle)(const struct ti_sci_handle *handle, u32 id,
  101. bool *requested_state);
  102. int (*is_stop)(const struct ti_sci_handle *handle, u32 id,
  103. bool *req_state, bool *current_state);
  104. int (*is_on)(const struct ti_sci_handle *handle, u32 id,
  105. bool *req_state, bool *current_state);
  106. int (*is_transitioning)(const struct ti_sci_handle *handle, u32 id,
  107. bool *current_state);
  108. int (*set_device_resets)(const struct ti_sci_handle *handle, u32 id,
  109. u32 reset_state);
  110. int (*get_device_resets)(const struct ti_sci_handle *handle, u32 id,
  111. u32 *reset_state);
  112. };
  113. /**
  114. * struct ti_sci_clk_ops - Clock control operations
  115. * @get_clock: Request for activation of clock and manage by processor
  116. * - needs_ssc: 'true' if Spread Spectrum clock is desired.
  117. * - can_change_freq: 'true' if frequency change is desired.
  118. * - enable_input_term: 'true' if input termination is desired.
  119. * @idle_clock: Request for Idling a clock managed by processor
  120. * @put_clock: Release the clock to be auto managed by TISCI
  121. * @is_auto: Is the clock being auto managed
  122. * - req_state: state indicating if the clock is auto managed
  123. * @is_on: Is the clock ON
  124. * - req_state: if the clock is requested to be forced ON
  125. * - current_state: if the clock is currently ON
  126. * @is_off: Is the clock OFF
  127. * - req_state: if the clock is requested to be forced OFF
  128. * - current_state: if the clock is currently Gated
  129. * @set_parent: Set the clock source of a specific device clock
  130. * - parent_id: Parent clock identifier to set.
  131. * @get_parent: Get the current clock source of a specific device clock
  132. * - parent_id: Parent clock identifier which is the parent.
  133. * @get_num_parents: Get the number of parents of the current clock source
  134. * - num_parents: returns the number of parent clocks.
  135. * @get_best_match_freq: Find a best matching frequency for a frequency
  136. * range.
  137. * - match_freq: Best matching frequency in Hz.
  138. * @set_freq: Set the Clock frequency
  139. * @get_freq: Get the Clock frequency
  140. * - current_freq: Frequency in Hz that the clock is at.
  141. *
  142. * NOTE: for all these functions, the following parameters are generic in
  143. * nature:
  144. * -handle: Pointer to TISCI handle as retrieved by *ti_sci_get_handle
  145. * -did: Device identifier this request is for
  146. * -cid: Clock identifier for the device for this request.
  147. * Each device has it's own set of clock inputs. This indexes
  148. * which clock input to modify.
  149. * -min_freq: The minimum allowable frequency in Hz. This is the minimum
  150. * allowable programmed frequency and does not account for clock
  151. * tolerances and jitter.
  152. * -target_freq: The target clock frequency in Hz. A frequency will be
  153. * processed as close to this target frequency as possible.
  154. * -max_freq: The maximum allowable frequency in Hz. This is the maximum
  155. * allowable programmed frequency and does not account for clock
  156. * tolerances and jitter.
  157. *
  158. * Request for the clock - NOTE: the client MUST maintain integrity of
  159. * usage count by balancing get_clock with put_clock. No refcounting is
  160. * managed by driver for that purpose.
  161. */
  162. struct ti_sci_clk_ops {
  163. int (*get_clock)(const struct ti_sci_handle *handle, u32 did, u8 cid,
  164. bool needs_ssc, bool can_change_freq,
  165. bool enable_input_term);
  166. int (*idle_clock)(const struct ti_sci_handle *handle, u32 did, u8 cid);
  167. int (*put_clock)(const struct ti_sci_handle *handle, u32 did, u8 cid);
  168. int (*is_auto)(const struct ti_sci_handle *handle, u32 did, u8 cid,
  169. bool *req_state);
  170. int (*is_on)(const struct ti_sci_handle *handle, u32 did, u8 cid,
  171. bool *req_state, bool *current_state);
  172. int (*is_off)(const struct ti_sci_handle *handle, u32 did, u8 cid,
  173. bool *req_state, bool *current_state);
  174. int (*set_parent)(const struct ti_sci_handle *handle, u32 did, u8 cid,
  175. u8 parent_id);
  176. int (*get_parent)(const struct ti_sci_handle *handle, u32 did, u8 cid,
  177. u8 *parent_id);
  178. int (*get_num_parents)(const struct ti_sci_handle *handle, u32 did,
  179. u8 cid, u8 *num_parents);
  180. int (*get_best_match_freq)(const struct ti_sci_handle *handle, u32 did,
  181. u8 cid, u64 min_freq, u64 target_freq,
  182. u64 max_freq, u64 *match_freq);
  183. int (*set_freq)(const struct ti_sci_handle *handle, u32 did, u8 cid,
  184. u64 min_freq, u64 target_freq, u64 max_freq);
  185. int (*get_freq)(const struct ti_sci_handle *handle, u32 did, u8 cid,
  186. u64 *current_freq);
  187. };
  188. /**
  189. * struct ti_sci_rm_core_ops - Resource management core operations
  190. * @get_range: Get a range of resources belonging to ti sci host.
  191. * @get_rage_from_shost: Get a range of resources belonging to
  192. * specified host id.
  193. * - s_host: Host processing entity to which the
  194. * resources are allocated
  195. *
  196. * NOTE: for these functions, all the parameters are consolidated and defined
  197. * as below:
  198. * - handle: Pointer to TISCI handle as retrieved by *ti_sci_get_handle
  199. * - dev_id: TISCI device ID.
  200. * - subtype: Resource assignment subtype that is being requested
  201. * from the given device.
  202. * - range_start: Start index of the resource range
  203. * - range_end: Number of resources in the range
  204. */
  205. struct ti_sci_rm_core_ops {
  206. int (*get_range)(const struct ti_sci_handle *handle, u32 dev_id,
  207. u8 subtype, u16 *range_start, u16 *range_num);
  208. int (*get_range_from_shost)(const struct ti_sci_handle *handle,
  209. u32 dev_id, u8 subtype, u8 s_host,
  210. u16 *range_start, u16 *range_num);
  211. };
  212. /**
  213. * struct ti_sci_rm_irq_ops: IRQ management operations
  214. * @set_direct_irq: Set Non-event Sourced direct irq to destination
  215. * host(same host as ti sci interface id).
  216. * @set_event_irq: Set Event based peripheral irq to destination
  217. * host(same host as ti sci interface id).
  218. * @set_direct_irq_from_shost: Set Non-event Sourced direct irq to a
  219. * specified destination host.
  220. * @set_event_irq_from_shost: Set Event based peripheral irq to a
  221. * specified destination host.
  222. * @set_event_irq_to_poll: Set Event based peripheral irq to polling mode.
  223. * vint_status_bit is used for polling.
  224. * @free_direct_irq: Free a non-event sourced direct irq to
  225. * destination host(same as ti sci interface id)
  226. * @free_event_irq: Free an event based peripheral irq to
  227. * destination host(same as ti sci interface id)
  228. * @free_direct_irq_from_shost: Free non-event based direct irq from a
  229. * specified destination host.
  230. * @free_event_irq_from_shost: Free event based peripheral irq from a
  231. * specified destination host.
  232. * @free_event_irq_to_poll: Free an event based peripheral irq that is
  233. * configured in polling mode.
  234. *
  235. * NOTE: for these functions, all the parameters are consolidated and defined
  236. * as below:
  237. * - handle: Pointer to TISCI handle as retrieved by *ti_sci_get_handle
  238. * - src_id: Device ID of the IRQ source
  239. * - src_index: IRQ source index within the source device
  240. * - dst_id: Device ID of the IRQ destination.
  241. * - dst_host_irq: IRQ number of the destination device.
  242. * - ia_id: Device ID of the IA, if the IRQ flows through this IA
  243. * - vint: Virtual interrupt to be used within the IA
  244. * - global_event: Global event number to be used for the requesting event.
  245. * - vint_status_bit: Virtual interrupt status bit to be used for the event.
  246. * - s_host: Secondary host ID to which the irq/event is being requested.
  247. */
  248. struct ti_sci_rm_irq_ops {
  249. int (*set_direct_irq)(const struct ti_sci_handle *handle, u16 src_id,
  250. u16 src_index, u16 dst_id, u16 dst_host_irq);
  251. int (*set_event_irq)(const struct ti_sci_handle *handle, u16 src_id,
  252. u16 src_index, u16 dst_id, u16 dst_host_irq,
  253. u16 ia_id, u16 vint, u16 global_event,
  254. u8 vint_status_bit);
  255. int (*set_direct_irq_from_shost)(const struct ti_sci_handle *handle,
  256. u16 src_id, u16 src_index, u16 dst_id,
  257. u16 dst_host_irq, u8 s_host);
  258. int (*set_event_irq_from_shost)(const struct ti_sci_handle *handle,
  259. u16 src_id, u16 src_index, u16 dst_id,
  260. u16 dst_host_irq, u16 ia_id, u16 vint,
  261. u16 global_event, u8 vint_status_bit,
  262. u8 s_host);
  263. int (*set_event_irq_to_poll)(const struct ti_sci_handle *handle,
  264. u16 src_id, u16 src_index, u16 ia_id,
  265. u16 vint, u16 global_event,
  266. u8 vint_status_bit);
  267. int (*free_direct_irq)(const struct ti_sci_handle *handle, u16 src_id,
  268. u16 src_index, u16 dst_id, u16 dst_host_irq);
  269. int (*free_event_irq)(const struct ti_sci_handle *handle, u16 src_id,
  270. u16 src_index, u16 dst_id, u16 dst_host_irq,
  271. u16 ia_id, u16 vint, u16 global_event,
  272. u8 vint_status_bit);
  273. int (*free_direct_irq_from_shost)(const struct ti_sci_handle *handle,
  274. u16 src_id, u16 src_index, u16 dst_id,
  275. u16 dst_host_irq, u8 s_host);
  276. int (*free_event_irq_from_shost)(const struct ti_sci_handle *handle,
  277. u16 src_id, u16 src_index, u16 dst_id,
  278. u16 dst_host_irq, u16 ia_id, u16 vint,
  279. u16 global_event, u8 vint_status_bit,
  280. u8 s_host);
  281. int (*free_event_irq_to_poll)(const struct ti_sci_handle *handle,
  282. u16 src_id, u16 src_index, u16 ia_id,
  283. u16 vint, u16 global_event,
  284. u8 vint_status_bit);
  285. };
  286. /**
  287. * struct ti_sci_proc_ops - Processor Control operations
  288. * @request: Request to control a physical processor. The requesting host
  289. * should be in the processor access list
  290. * @release: Relinquish a physical processor control
  291. * @handover: Handover a physical processor control to another host
  292. * in the permitted list
  293. * @set_config: Set base configuration of a processor
  294. * @set_control: Setup limited control flags in specific cases
  295. * @get_status: Get the state of physical processor
  296. *
  297. * NOTE: The following paramteres are generic in nature for all these ops,
  298. * -handle: Pointer to TI SCI handle as retrieved by *ti_sci_get_handle
  299. * -pid: Processor ID
  300. * -hid: Host ID
  301. */
  302. struct ti_sci_proc_ops {
  303. int (*request)(const struct ti_sci_handle *handle, u8 pid);
  304. int (*release)(const struct ti_sci_handle *handle, u8 pid);
  305. int (*handover)(const struct ti_sci_handle *handle, u8 pid, u8 hid);
  306. int (*set_config)(const struct ti_sci_handle *handle, u8 pid,
  307. u64 boot_vector, u32 cfg_set, u32 cfg_clr);
  308. int (*set_control)(const struct ti_sci_handle *handle, u8 pid,
  309. u32 ctrl_set, u32 ctrl_clr);
  310. int (*get_status)(const struct ti_sci_handle *handle, u8 pid,
  311. u64 *boot_vector, u32 *cfg_flags, u32 *ctrl_flags,
  312. u32 *status_flags);
  313. };
  314. /* RA config.addr_lo parameter is valid for RM ring configure TI_SCI message */
  315. #define TI_SCI_MSG_VALUE_RM_RING_ADDR_LO_VALID BIT(0)
  316. /* RA config.addr_hi parameter is valid for RM ring configure TI_SCI message */
  317. #define TI_SCI_MSG_VALUE_RM_RING_ADDR_HI_VALID BIT(1)
  318. /* RA config.count parameter is valid for RM ring configure TI_SCI message */
  319. #define TI_SCI_MSG_VALUE_RM_RING_COUNT_VALID BIT(2)
  320. /* RA config.mode parameter is valid for RM ring configure TI_SCI message */
  321. #define TI_SCI_MSG_VALUE_RM_RING_MODE_VALID BIT(3)
  322. /* RA config.size parameter is valid for RM ring configure TI_SCI message */
  323. #define TI_SCI_MSG_VALUE_RM_RING_SIZE_VALID BIT(4)
  324. /* RA config.order_id parameter is valid for RM ring configure TISCI message */
  325. #define TI_SCI_MSG_VALUE_RM_RING_ORDER_ID_VALID BIT(5)
  326. #define TI_SCI_MSG_VALUE_RM_ALL_NO_ORDER \
  327. (TI_SCI_MSG_VALUE_RM_RING_ADDR_LO_VALID | \
  328. TI_SCI_MSG_VALUE_RM_RING_ADDR_HI_VALID | \
  329. TI_SCI_MSG_VALUE_RM_RING_COUNT_VALID | \
  330. TI_SCI_MSG_VALUE_RM_RING_MODE_VALID | \
  331. TI_SCI_MSG_VALUE_RM_RING_SIZE_VALID)
  332. /**
  333. * struct ti_sci_rm_ringacc_ops - Ring Accelerator Management operations
  334. * @config: configure the SoC Navigator Subsystem Ring Accelerator ring
  335. * @get_config: get the SoC Navigator Subsystem Ring Accelerator ring
  336. * configuration
  337. */
  338. struct ti_sci_rm_ringacc_ops {
  339. int (*config)(const struct ti_sci_handle *handle,
  340. u32 valid_params, u16 nav_id, u16 index,
  341. u32 addr_lo, u32 addr_hi, u32 count, u8 mode,
  342. u8 size, u8 order_id
  343. );
  344. int (*get_config)(const struct ti_sci_handle *handle,
  345. u32 nav_id, u32 index, u8 *mode,
  346. u32 *addr_lo, u32 *addr_hi, u32 *count,
  347. u8 *size, u8 *order_id);
  348. };
  349. /**
  350. * struct ti_sci_rm_psil_ops - PSI-L thread operations
  351. * @pair: pair PSI-L source thread to a destination thread.
  352. * If the src_thread is mapped to UDMA tchan, the corresponding channel's
  353. * TCHAN_THRD_ID register is updated.
  354. * If the dst_thread is mapped to UDMA rchan, the corresponding channel's
  355. * RCHAN_THRD_ID register is updated.
  356. * @unpair: unpair PSI-L source thread from a destination thread.
  357. * If the src_thread is mapped to UDMA tchan, the corresponding channel's
  358. * TCHAN_THRD_ID register is cleared.
  359. * If the dst_thread is mapped to UDMA rchan, the corresponding channel's
  360. * RCHAN_THRD_ID register is cleared.
  361. */
  362. struct ti_sci_rm_psil_ops {
  363. int (*pair)(const struct ti_sci_handle *handle, u32 nav_id,
  364. u32 src_thread, u32 dst_thread);
  365. int (*unpair)(const struct ti_sci_handle *handle, u32 nav_id,
  366. u32 src_thread, u32 dst_thread);
  367. };
  368. /* UDMAP channel types */
  369. #define TI_SCI_RM_UDMAP_CHAN_TYPE_PKT_PBRR 2
  370. #define TI_SCI_RM_UDMAP_CHAN_TYPE_PKT_PBRR_SB 3 /* RX only */
  371. #define TI_SCI_RM_UDMAP_CHAN_TYPE_3RDP_PBRR 10
  372. #define TI_SCI_RM_UDMAP_CHAN_TYPE_3RDP_PBVR 11
  373. #define TI_SCI_RM_UDMAP_CHAN_TYPE_3RDP_BCOPY_PBRR 12
  374. #define TI_SCI_RM_UDMAP_CHAN_TYPE_3RDP_BCOPY_PBVR 13
  375. #define TI_SCI_RM_UDMAP_RX_FLOW_DESC_HOST 0
  376. #define TI_SCI_RM_UDMAP_RX_FLOW_DESC_MONO 2
  377. /* UDMAP TX/RX channel valid_params common declarations */
  378. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_PAUSE_ON_ERR_VALID BIT(0)
  379. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_ATYPE_VALID BIT(1)
  380. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_CHAN_TYPE_VALID BIT(2)
  381. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_FETCH_SIZE_VALID BIT(3)
  382. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_CQ_QNUM_VALID BIT(4)
  383. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_PRIORITY_VALID BIT(5)
  384. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_QOS_VALID BIT(6)
  385. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_ORDER_ID_VALID BIT(7)
  386. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_SCHED_PRIORITY_VALID BIT(8)
  387. /**
  388. * Configures a Navigator Subsystem UDMAP transmit channel
  389. *
  390. * Configures a Navigator Subsystem UDMAP transmit channel registers.
  391. * See @ti_sci_msg_rm_udmap_tx_ch_cfg_req
  392. */
  393. struct ti_sci_msg_rm_udmap_tx_ch_cfg {
  394. u32 valid_params;
  395. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_TX_FILT_EINFO_VALID BIT(9)
  396. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_TX_FILT_PSWORDS_VALID BIT(10)
  397. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_TX_SUPR_TDPKT_VALID BIT(11)
  398. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_TX_CREDIT_COUNT_VALID BIT(12)
  399. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_TX_FDEPTH_VALID BIT(13)
  400. u16 nav_id;
  401. u16 index;
  402. u8 tx_pause_on_err;
  403. u8 tx_filt_einfo;
  404. u8 tx_filt_pswords;
  405. u8 tx_atype;
  406. u8 tx_chan_type;
  407. u8 tx_supr_tdpkt;
  408. u16 tx_fetch_size;
  409. u8 tx_credit_count;
  410. u16 txcq_qnum;
  411. u8 tx_priority;
  412. u8 tx_qos;
  413. u8 tx_orderid;
  414. u16 fdepth;
  415. u8 tx_sched_priority;
  416. };
  417. /**
  418. * Configures a Navigator Subsystem UDMAP receive channel
  419. *
  420. * Configures a Navigator Subsystem UDMAP receive channel registers.
  421. * See @ti_sci_msg_rm_udmap_rx_ch_cfg_req
  422. */
  423. struct ti_sci_msg_rm_udmap_rx_ch_cfg {
  424. u32 valid_params;
  425. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_RX_FLOWID_START_VALID BIT(9)
  426. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_RX_FLOWID_CNT_VALID BIT(10)
  427. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_RX_IGNORE_SHORT_VALID BIT(11)
  428. #define TI_SCI_MSG_VALUE_RM_UDMAP_CH_RX_IGNORE_LONG_VALID BIT(12)
  429. u16 nav_id;
  430. u16 index;
  431. u16 rx_fetch_size;
  432. u16 rxcq_qnum;
  433. u8 rx_priority;
  434. u8 rx_qos;
  435. u8 rx_orderid;
  436. u8 rx_sched_priority;
  437. u16 flowid_start;
  438. u16 flowid_cnt;
  439. u8 rx_pause_on_err;
  440. u8 rx_atype;
  441. u8 rx_chan_type;
  442. u8 rx_ignore_short;
  443. u8 rx_ignore_long;
  444. };
  445. /**
  446. * Configures a Navigator Subsystem UDMAP receive flow
  447. *
  448. * Configures a Navigator Subsystem UDMAP receive flow's registers.
  449. * See @tis_ci_msg_rm_udmap_flow_cfg_req
  450. */
  451. struct ti_sci_msg_rm_udmap_flow_cfg {
  452. u32 valid_params;
  453. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_EINFO_PRESENT_VALID BIT(0)
  454. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_PSINFO_PRESENT_VALID BIT(1)
  455. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_ERROR_HANDLING_VALID BIT(2)
  456. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_DESC_TYPE_VALID BIT(3)
  457. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_SOP_OFFSET_VALID BIT(4)
  458. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_DEST_QNUM_VALID BIT(5)
  459. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_SRC_TAG_HI_VALID BIT(6)
  460. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_SRC_TAG_LO_VALID BIT(7)
  461. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_DEST_TAG_HI_VALID BIT(8)
  462. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_DEST_TAG_LO_VALID BIT(9)
  463. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_SRC_TAG_HI_SEL_VALID BIT(10)
  464. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_SRC_TAG_LO_SEL_VALID BIT(11)
  465. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_DEST_TAG_HI_SEL_VALID BIT(12)
  466. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_DEST_TAG_LO_SEL_VALID BIT(13)
  467. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ0_SZ0_QNUM_VALID BIT(14)
  468. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ1_QNUM_VALID BIT(15)
  469. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ2_QNUM_VALID BIT(16)
  470. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ3_QNUM_VALID BIT(17)
  471. #define TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_PS_LOCATION_VALID BIT(18)
  472. u16 nav_id;
  473. u16 flow_index;
  474. u8 rx_einfo_present;
  475. u8 rx_psinfo_present;
  476. u8 rx_error_handling;
  477. u8 rx_desc_type;
  478. u16 rx_sop_offset;
  479. u16 rx_dest_qnum;
  480. u8 rx_src_tag_hi;
  481. u8 rx_src_tag_lo;
  482. u8 rx_dest_tag_hi;
  483. u8 rx_dest_tag_lo;
  484. u8 rx_src_tag_hi_sel;
  485. u8 rx_src_tag_lo_sel;
  486. u8 rx_dest_tag_hi_sel;
  487. u8 rx_dest_tag_lo_sel;
  488. u16 rx_fdq0_sz0_qnum;
  489. u16 rx_fdq1_qnum;
  490. u16 rx_fdq2_qnum;
  491. u16 rx_fdq3_qnum;
  492. u8 rx_ps_location;
  493. };
  494. /**
  495. * struct ti_sci_rm_udmap_ops - UDMA Management operations
  496. * @tx_ch_cfg: configure SoC Navigator Subsystem UDMA transmit channel.
  497. * @rx_ch_cfg: configure SoC Navigator Subsystem UDMA receive channel.
  498. * @rx_flow_cfg1: configure SoC Navigator Subsystem UDMA receive flow.
  499. */
  500. struct ti_sci_rm_udmap_ops {
  501. int (*tx_ch_cfg)(const struct ti_sci_handle *handle,
  502. const struct ti_sci_msg_rm_udmap_tx_ch_cfg *params);
  503. int (*rx_ch_cfg)(const struct ti_sci_handle *handle,
  504. const struct ti_sci_msg_rm_udmap_rx_ch_cfg *params);
  505. int (*rx_flow_cfg)(const struct ti_sci_handle *handle,
  506. const struct ti_sci_msg_rm_udmap_flow_cfg *params);
  507. };
  508. /**
  509. * struct ti_sci_ops - Function support for TI SCI
  510. * @dev_ops: Device specific operations
  511. * @clk_ops: Clock specific operations
  512. * @rm_core_ops: Resource management core operations.
  513. * @rm_irq_ops: IRQ management specific operations
  514. * @proc_ops: Processor Control specific operations
  515. */
  516. struct ti_sci_ops {
  517. struct ti_sci_core_ops core_ops;
  518. struct ti_sci_dev_ops dev_ops;
  519. struct ti_sci_clk_ops clk_ops;
  520. struct ti_sci_rm_core_ops rm_core_ops;
  521. struct ti_sci_rm_irq_ops rm_irq_ops;
  522. struct ti_sci_proc_ops proc_ops;
  523. struct ti_sci_rm_ringacc_ops rm_ring_ops;
  524. struct ti_sci_rm_psil_ops rm_psil_ops;
  525. struct ti_sci_rm_udmap_ops rm_udmap_ops;
  526. };
  527. /**
  528. * struct ti_sci_handle - Handle returned to TI SCI clients for usage.
  529. * @version: structure containing version information
  530. * @ops: operations that are made available to TI SCI clients
  531. */
  532. struct ti_sci_handle {
  533. struct ti_sci_version_info version;
  534. struct ti_sci_ops ops;
  535. };
  536. #define TI_SCI_RESOURCE_NULL 0xffff
  537. /**
  538. * struct ti_sci_resource_desc - Description of TI SCI resource instance range.
  539. * @start: Start index of the resource.
  540. * @num: Number of resources.
  541. * @res_map: Bitmap to manage the allocation of these resources.
  542. */
  543. struct ti_sci_resource_desc {
  544. u16 start;
  545. u16 num;
  546. unsigned long *res_map;
  547. };
  548. /**
  549. * struct ti_sci_resource - Structure representing a resource assigned
  550. * to a device.
  551. * @sets: Number of sets available from this resource type
  552. * @lock: Lock to guard the res map in each set.
  553. * @desc: Array of resource descriptors.
  554. */
  555. struct ti_sci_resource {
  556. u16 sets;
  557. raw_spinlock_t lock;
  558. struct ti_sci_resource_desc *desc;
  559. };
  560. #if IS_ENABLED(CONFIG_TI_SCI_PROTOCOL)
  561. const struct ti_sci_handle *ti_sci_get_handle(struct device *dev);
  562. int ti_sci_put_handle(const struct ti_sci_handle *handle);
  563. const struct ti_sci_handle *devm_ti_sci_get_handle(struct device *dev);
  564. const struct ti_sci_handle *ti_sci_get_by_phandle(struct device_node *np,
  565. const char *property);
  566. const struct ti_sci_handle *devm_ti_sci_get_by_phandle(struct device *dev,
  567. const char *property);
  568. u16 ti_sci_get_free_resource(struct ti_sci_resource *res);
  569. void ti_sci_release_resource(struct ti_sci_resource *res, u16 id);
  570. struct ti_sci_resource *
  571. devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
  572. struct device *dev, u32 dev_id, char *of_prop);
  573. #else /* CONFIG_TI_SCI_PROTOCOL */
  574. static inline const struct ti_sci_handle *ti_sci_get_handle(struct device *dev)
  575. {
  576. return ERR_PTR(-EINVAL);
  577. }
  578. static inline int ti_sci_put_handle(const struct ti_sci_handle *handle)
  579. {
  580. return -EINVAL;
  581. }
  582. static inline
  583. const struct ti_sci_handle *devm_ti_sci_get_handle(struct device *dev)
  584. {
  585. return ERR_PTR(-EINVAL);
  586. }
  587. static inline
  588. const struct ti_sci_handle *ti_sci_get_by_phandle(struct device_node *np,
  589. const char *property)
  590. {
  591. return ERR_PTR(-EINVAL);
  592. }
  593. static inline
  594. const struct ti_sci_handle *devm_ti_sci_get_by_phandle(struct device *dev,
  595. const char *property)
  596. {
  597. return ERR_PTR(-EINVAL);
  598. }
  599. static inline u16 ti_sci_get_free_resource(struct ti_sci_resource *res)
  600. {
  601. return TI_SCI_RESOURCE_NULL;
  602. }
  603. static inline void ti_sci_release_resource(struct ti_sci_resource *res, u16 id)
  604. {
  605. }
  606. static inline struct ti_sci_resource *
  607. devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
  608. struct device *dev, u32 dev_id, char *of_prop)
  609. {
  610. return ERR_PTR(-EINVAL);
  611. }
  612. #endif /* CONFIG_TI_SCI_PROTOCOL */
  613. #endif /* __TISCI_PROTOCOL_H */