Merge branch 'master' of git://git.denx.de/u-boot-sunxi
[oweals/u-boot.git] / drivers / firmware / ti_sci.h
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Texas Instruments System Control Interface (TISCI) Protocol
4  *
5  * Communication protocol with TI SCI hardware
6  * The system works in a message response protocol
7  * See: http://processors.wiki.ti.com/index.php/TISCI for details
8  *
9  * Copyright (C)  2018 Texas Instruments Incorporated - http://www.ti.com/
10  * Based on drivers/firmware/ti_sci.h from Linux.
11  *
12  */
13
14 #ifndef __TI_SCI_H
15 #define __TI_SCI_H
16
17 /* Generic Messages */
18 #define TI_SCI_MSG_ENABLE_WDT           0x0000
19 #define TI_SCI_MSG_WAKE_RESET           0x0001
20 #define TI_SCI_MSG_VERSION              0x0002
21 #define TI_SCI_MSG_WAKE_REASON          0x0003
22 #define TI_SCI_MSG_GOODBYE              0x0004
23 #define TI_SCI_MSG_SYS_RESET            0x0005
24 #define TI_SCI_MSG_BOARD_CONFIG         0x000b
25 #define TI_SCI_MSG_BOARD_CONFIG_RM      0x000c
26 #define TI_SCI_MSG_BOARD_CONFIG_SECURITY  0x000d
27 #define TI_SCI_MSG_BOARD_CONFIG_PM      0x000e
28 #define TISCI_MSG_QUERY_MSMC            0x0020
29
30 /* Device requests */
31 #define TI_SCI_MSG_SET_DEVICE_STATE     0x0200
32 #define TI_SCI_MSG_GET_DEVICE_STATE     0x0201
33 #define TI_SCI_MSG_SET_DEVICE_RESETS    0x0202
34
35 /* Clock requests */
36 #define TI_SCI_MSG_SET_CLOCK_STATE      0x0100
37 #define TI_SCI_MSG_GET_CLOCK_STATE      0x0101
38 #define TI_SCI_MSG_SET_CLOCK_PARENT     0x0102
39 #define TI_SCI_MSG_GET_CLOCK_PARENT     0x0103
40 #define TI_SCI_MSG_GET_NUM_CLOCK_PARENTS 0x0104
41 #define TI_SCI_MSG_SET_CLOCK_FREQ       0x010c
42 #define TI_SCI_MSG_QUERY_CLOCK_FREQ     0x010d
43 #define TI_SCI_MSG_GET_CLOCK_FREQ       0x010e
44
45 /* Processor Control Messages */
46 #define TISCI_MSG_PROC_REQUEST          0xc000
47 #define TISCI_MSG_PROC_RELEASE          0xc001
48 #define TISCI_MSG_PROC_HANDOVER         0xc005
49 #define TISCI_MSG_SET_PROC_BOOT_CONFIG  0xc100
50 #define TISCI_MSG_SET_PROC_BOOT_CTRL    0xc101
51 #define TISCI_MSG_PROC_AUTH_BOOT_IMIAGE 0xc120
52 #define TISCI_MSG_GET_PROC_BOOT_STATUS  0xc400
53
54 /* Resource Management Requests */
55 #define TI_SCI_MSG_GET_RESOURCE_RANGE   0x1500
56
57 /* NAVSS resource management */
58 /* Ringacc requests */
59 #define TI_SCI_MSG_RM_RING_CFG                  0x1110
60 #define TI_SCI_MSG_RM_RING_GET_CFG              0x1111
61
62 /* PSI-L requests */
63 #define TI_SCI_MSG_RM_PSIL_PAIR                 0x1280
64 #define TI_SCI_MSG_RM_PSIL_UNPAIR               0x1281
65
66 #define TI_SCI_MSG_RM_UDMAP_TX_ALLOC            0x1200
67 #define TI_SCI_MSG_RM_UDMAP_TX_FREE             0x1201
68 #define TI_SCI_MSG_RM_UDMAP_RX_ALLOC            0x1210
69 #define TI_SCI_MSG_RM_UDMAP_RX_FREE             0x1211
70 #define TI_SCI_MSG_RM_UDMAP_FLOW_CFG            0x1220
71 #define TI_SCI_MSG_RM_UDMAP_OPT_FLOW_CFG        0x1221
72
73 #define TISCI_MSG_RM_UDMAP_TX_CH_CFG            0x1205
74 #define TISCI_MSG_RM_UDMAP_TX_CH_GET_CFG        0x1206
75 #define TISCI_MSG_RM_UDMAP_RX_CH_CFG            0x1215
76 #define TISCI_MSG_RM_UDMAP_RX_CH_GET_CFG        0x1216
77 #define TISCI_MSG_RM_UDMAP_FLOW_CFG             0x1230
78 #define TISCI_MSG_RM_UDMAP_FLOW_SIZE_THRESH_CFG 0x1231
79 #define TISCI_MSG_RM_UDMAP_FLOW_GET_CFG         0x1232
80 #define TISCI_MSG_RM_UDMAP_FLOW_SIZE_THRESH_GET_CFG     0x1233
81
82 /**
83  * struct ti_sci_msg_hdr - Generic Message Header for All messages and responses
84  * @type:       Type of messages: One of TI_SCI_MSG* values
85  * @host:       Host of the message
86  * @seq:        Message identifier indicating a transfer sequence
87  * @flags:      Flag for the message
88  */
89 struct ti_sci_msg_hdr {
90         u16 type;
91         u8 host;
92         u8 seq;
93 #define TI_SCI_MSG_FLAG(val)                    (1 << (val))
94 #define TI_SCI_FLAG_REQ_GENERIC_NORESPONSE      0x0
95 #define TI_SCI_FLAG_REQ_ACK_ON_RECEIVED         TI_SCI_MSG_FLAG(0)
96 #define TI_SCI_FLAG_REQ_ACK_ON_PROCESSED        TI_SCI_MSG_FLAG(1)
97 #define TI_SCI_FLAG_RESP_GENERIC_NACK           0x0
98 #define TI_SCI_FLAG_RESP_GENERIC_ACK            TI_SCI_MSG_FLAG(1)
99         /* Additional Flags */
100         u32 flags;
101 } __packed;
102
103 /**
104  * struct ti_sci_secure_msg_hdr - Header that prefixes all TISCI messages sent
105  *                                via secure transport.
106  * @checksum:   crc16 checksum for the entire message
107  * @reserved:   Reserved for future use.
108  */
109 struct ti_sci_secure_msg_hdr {
110         u16 checksum;
111         u16 reserved;
112 } __packed;
113
114 /**
115  * struct ti_sci_msg_resp_version - Response for a message
116  * @hdr:                Generic header
117  * @firmware_description: String describing the firmware
118  * @firmware_revision:  Firmware revision
119  * @abi_major:          Major version of the ABI that firmware supports
120  * @abi_minor:          Minor version of the ABI that firmware supports
121  *
122  * In general, ABI version changes follow the rule that minor version increments
123  * are backward compatible. Major revision changes in ABI may not be
124  * backward compatible.
125  *
126  * Response to a generic message with message type TI_SCI_MSG_VERSION
127  */
128 struct ti_sci_msg_resp_version {
129         struct ti_sci_msg_hdr hdr;
130         char firmware_description[32];
131         u16 firmware_revision;
132         u8 abi_major;
133         u8 abi_minor;
134 } __packed;
135
136 /**
137  * struct ti_sci_msg_req_reboot - Reboot the SoC
138  * @hdr:        Generic Header
139  *
140  * Request type is TI_SCI_MSG_SYS_RESET, responded with a generic
141  * ACK/NACK message.
142  */
143 struct ti_sci_msg_req_reboot {
144         struct ti_sci_msg_hdr hdr;
145 } __packed;
146
147 /**
148  * struct ti_sci_msg_board_config - Board configuration message
149  * @hdr:                Generic Header
150  * @boardcfgp_low:      Lower 32 bit of the pointer pointing to the board
151  *                      configuration data
152  * @boardcfgp_high:     Upper 32 bit of the pointer pointing to the board
153  *                      configuration data
154  * @boardcfg_size:      Size of board configuration data object
155  * Request type is TI_SCI_MSG_BOARD_CONFIG, responded with a generic
156  * ACK/NACK message.
157  */
158 struct ti_sci_msg_board_config {
159         struct ti_sci_msg_hdr hdr;
160         u32 boardcfgp_low;
161         u32 boardcfgp_high;
162         u16 boardcfg_size;
163 } __packed;
164
165 /**
166  * struct ti_sci_msg_resp_query_msmc - Query msmc message response structure
167  * @hdr:                Generic Header
168  * @msmc_start_low:     Lower 32 bit of msmc start
169  * @msmc_start_high:    Upper 32 bit of msmc start
170  * @msmc_end_low:       Lower 32 bit of msmc end
171  * @msmc_end_high:      Upper 32 bit of msmc end
172  *
173  * Response to a generic message with message type TISCI_MSG_QUERY_MSMC
174  */
175 struct ti_sci_msg_resp_query_msmc {
176         struct ti_sci_msg_hdr hdr;
177         u32 msmc_start_low;
178         u32 msmc_start_high;
179         u32 msmc_end_low;
180         u32 msmc_end_high;
181 } __packed;
182
183 /**
184  * struct ti_sci_msg_req_set_device_state - Set the desired state of the device
185  * @hdr:                Generic header
186  * @id: Indicates which device to modify
187  * @reserved: Reserved space in message, must be 0 for backward compatibility
188  * @state: The desired state of the device.
189  *
190  * Certain flags can also be set to alter the device state:
191  * + MSG_FLAG_DEVICE_WAKE_ENABLED - Configure the device to be a wake source.
192  * The meaning of this flag will vary slightly from device to device and from
193  * SoC to SoC but it generally allows the device to wake the SoC out of deep
194  * suspend states.
195  * + MSG_FLAG_DEVICE_RESET_ISO - Enable reset isolation for this device.
196  * + MSG_FLAG_DEVICE_EXCLUSIVE - Claim this device exclusively. When passed
197  * with STATE_RETENTION or STATE_ON, it will claim the device exclusively.
198  * If another host already has this device set to STATE_RETENTION or STATE_ON,
199  * the message will fail. Once successful, other hosts attempting to set
200  * STATE_RETENTION or STATE_ON will fail.
201  *
202  * Request type is TI_SCI_MSG_SET_DEVICE_STATE, responded with a generic
203  * ACK/NACK message.
204  */
205 struct ti_sci_msg_req_set_device_state {
206         /* Additional hdr->flags options */
207 #define MSG_FLAG_DEVICE_WAKE_ENABLED    TI_SCI_MSG_FLAG(8)
208 #define MSG_FLAG_DEVICE_RESET_ISO       TI_SCI_MSG_FLAG(9)
209 #define MSG_FLAG_DEVICE_EXCLUSIVE       TI_SCI_MSG_FLAG(10)
210         struct ti_sci_msg_hdr hdr;
211         u32 id;
212         u32 reserved;
213
214 #define MSG_DEVICE_SW_STATE_AUTO_OFF    0
215 #define MSG_DEVICE_SW_STATE_RETENTION   1
216 #define MSG_DEVICE_SW_STATE_ON          2
217         u8 state;
218 } __packed;
219
220 /**
221  * struct ti_sci_msg_req_get_device_state - Request to get device.
222  * @hdr:                Generic header
223  * @id:         Device Identifier
224  *
225  * Request type is TI_SCI_MSG_GET_DEVICE_STATE, responded device state
226  * information
227  */
228 struct ti_sci_msg_req_get_device_state {
229         struct ti_sci_msg_hdr hdr;
230         u32 id;
231 } __packed;
232
233 /**
234  * struct ti_sci_msg_resp_get_device_state - Response to get device request.
235  * @hdr:                Generic header
236  * @context_loss_count: Indicates how many times the device has lost context. A
237  *      driver can use this monotonic counter to determine if the device has
238  *      lost context since the last time this message was exchanged.
239  * @resets: Programmed state of the reset lines.
240  * @programmed_state:   The state as programmed by set_device.
241  *                      - Uses the MSG_DEVICE_SW_* macros
242  * @current_state:      The actual state of the hardware.
243  *
244  * Response to request TI_SCI_MSG_GET_DEVICE_STATE.
245  */
246 struct ti_sci_msg_resp_get_device_state {
247         struct ti_sci_msg_hdr hdr;
248         u32 context_loss_count;
249         u32 resets;
250         u8 programmed_state;
251 #define MSG_DEVICE_HW_STATE_OFF         0
252 #define MSG_DEVICE_HW_STATE_ON          1
253 #define MSG_DEVICE_HW_STATE_TRANS       2
254         u8 current_state;
255 } __packed;
256
257 /**
258  * struct ti_sci_msg_req_set_device_resets - Set the desired resets
259  *                              configuration of the device
260  * @hdr:                Generic header
261  * @id: Indicates which device to modify
262  * @resets: A bit field of resets for the device. The meaning, behavior,
263  *      and usage of the reset flags are device specific. 0 for a bit
264  *      indicates releasing the reset represented by that bit while 1
265  *      indicates keeping it held.
266  *
267  * Request type is TI_SCI_MSG_SET_DEVICE_RESETS, responded with a generic
268  * ACK/NACK message.
269  */
270 struct ti_sci_msg_req_set_device_resets {
271         struct ti_sci_msg_hdr hdr;
272         u32 id;
273         u32 resets;
274 } __packed;
275
276 /**
277  * struct ti_sci_msg_req_set_clock_state - Request to setup a Clock state
278  * @hdr:        Generic Header, Certain flags can be set specific to the clocks:
279  *              MSG_FLAG_CLOCK_ALLOW_SSC: Allow this clock to be modified
280  *              via spread spectrum clocking.
281  *              MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE: Allow this clock's
282  *              frequency to be changed while it is running so long as it
283  *              is within the min/max limits.
284  *              MSG_FLAG_CLOCK_INPUT_TERM: Enable input termination, this
285  *              is only applicable to clock inputs on the SoC pseudo-device.
286  * @dev_id:     Device identifier this request is for
287  * @clk_id:     Clock identifier for the device for this request.
288  *              Each device has it's own set of clock inputs. This indexes
289  *              which clock input to modify.
290  * @request_state: Request the state for the clock to be set to.
291  *              MSG_CLOCK_SW_STATE_UNREQ: The IP does not require this clock,
292  *              it can be disabled, regardless of the state of the device
293  *              MSG_CLOCK_SW_STATE_AUTO: Allow the System Controller to
294  *              automatically manage the state of this clock. If the device
295  *              is enabled, then the clock is enabled. If the device is set
296  *              to off or retention, then the clock is internally set as not
297  *              being required by the device.(default)
298  *              MSG_CLOCK_SW_STATE_REQ:  Configure the clock to be enabled,
299  *              regardless of the state of the device.
300  *
301  * Normally, all required clocks are managed by TISCI entity, this is used
302  * only for specific control *IF* required. Auto managed state is
303  * MSG_CLOCK_SW_STATE_AUTO, in other states, TISCI entity assume remote
304  * will explicitly control.
305  *
306  * Request type is TI_SCI_MSG_SET_CLOCK_STATE, response is a generic
307  * ACK or NACK message.
308  */
309 struct ti_sci_msg_req_set_clock_state {
310         /* Additional hdr->flags options */
311 #define MSG_FLAG_CLOCK_ALLOW_SSC                TI_SCI_MSG_FLAG(8)
312 #define MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE        TI_SCI_MSG_FLAG(9)
313 #define MSG_FLAG_CLOCK_INPUT_TERM               TI_SCI_MSG_FLAG(10)
314         struct ti_sci_msg_hdr hdr;
315         u32 dev_id;
316         u8 clk_id;
317 #define MSG_CLOCK_SW_STATE_UNREQ        0
318 #define MSG_CLOCK_SW_STATE_AUTO         1
319 #define MSG_CLOCK_SW_STATE_REQ          2
320         u8 request_state;
321 } __packed;
322
323 /**
324  * struct ti_sci_msg_req_get_clock_state - Request for clock state
325  * @hdr:        Generic Header
326  * @dev_id:     Device identifier this request is for
327  * @clk_id:     Clock identifier for the device for this request.
328  *              Each device has it's own set of clock inputs. This indexes
329  *              which clock input to get state of.
330  *
331  * Request type is TI_SCI_MSG_GET_CLOCK_STATE, response is state
332  * of the clock
333  */
334 struct ti_sci_msg_req_get_clock_state {
335         struct ti_sci_msg_hdr hdr;
336         u32 dev_id;
337         u8 clk_id;
338 } __packed;
339
340 /**
341  * struct ti_sci_msg_resp_get_clock_state - Response to get clock state
342  * @hdr:        Generic Header
343  * @programmed_state: Any programmed state of the clock. This is one of
344  *              MSG_CLOCK_SW_STATE* values.
345  * @current_state: Current state of the clock. This is one of:
346  *              MSG_CLOCK_HW_STATE_NOT_READY: Clock is not ready
347  *              MSG_CLOCK_HW_STATE_READY: Clock is ready
348  *
349  * Response to TI_SCI_MSG_GET_CLOCK_STATE.
350  */
351 struct ti_sci_msg_resp_get_clock_state {
352         struct ti_sci_msg_hdr hdr;
353         u8 programmed_state;
354 #define MSG_CLOCK_HW_STATE_NOT_READY    0
355 #define MSG_CLOCK_HW_STATE_READY        1
356         u8 current_state;
357 } __packed;
358
359 /**
360  * struct ti_sci_msg_req_set_clock_parent - Set the clock parent
361  * @hdr:        Generic Header
362  * @dev_id:     Device identifier this request is for
363  * @clk_id:     Clock identifier for the device for this request.
364  *              Each device has it's own set of clock inputs. This indexes
365  *              which clock input to modify.
366  * @parent_id:  The new clock parent is selectable by an index via this
367  *              parameter.
368  *
369  * Request type is TI_SCI_MSG_SET_CLOCK_PARENT, response is generic
370  * ACK / NACK message.
371  */
372 struct ti_sci_msg_req_set_clock_parent {
373         struct ti_sci_msg_hdr hdr;
374         u32 dev_id;
375         u8 clk_id;
376         u8 parent_id;
377 } __packed;
378
379 /**
380  * struct ti_sci_msg_req_get_clock_parent - Get the clock parent
381  * @hdr:        Generic Header
382  * @dev_id:     Device identifier this request is for
383  * @clk_id:     Clock identifier for the device for this request.
384  *              Each device has it's own set of clock inputs. This indexes
385  *              which clock input to get the parent for.
386  *
387  * Request type is TI_SCI_MSG_GET_CLOCK_PARENT, response is parent information
388  */
389 struct ti_sci_msg_req_get_clock_parent {
390         struct ti_sci_msg_hdr hdr;
391         u32 dev_id;
392         u8 clk_id;
393 } __packed;
394
395 /**
396  * struct ti_sci_msg_resp_get_clock_parent - Response with clock parent
397  * @hdr:        Generic Header
398  * @parent_id:  The current clock parent
399  *
400  * Response to TI_SCI_MSG_GET_CLOCK_PARENT.
401  */
402 struct ti_sci_msg_resp_get_clock_parent {
403         struct ti_sci_msg_hdr hdr;
404         u8 parent_id;
405 } __packed;
406
407 /**
408  * struct ti_sci_msg_req_get_clock_num_parents - Request to get clock parents
409  * @hdr:        Generic header
410  * @dev_id:     Device identifier this request is for
411  * @clk_id:     Clock identifier for the device for this request.
412  *
413  * This request provides information about how many clock parent options
414  * are available for a given clock to a device. This is typically used
415  * for input clocks.
416  *
417  * Request type is TI_SCI_MSG_GET_NUM_CLOCK_PARENTS, response is appropriate
418  * message, or NACK in case of inability to satisfy request.
419  */
420 struct ti_sci_msg_req_get_clock_num_parents {
421         struct ti_sci_msg_hdr hdr;
422         u32 dev_id;
423         u8 clk_id;
424 } __packed;
425
426 /**
427  * struct ti_sci_msg_resp_get_clock_num_parents - Response for get clk parents
428  * @hdr:                Generic header
429  * @num_parents:        Number of clock parents
430  *
431  * Response to TI_SCI_MSG_GET_NUM_CLOCK_PARENTS
432  */
433 struct ti_sci_msg_resp_get_clock_num_parents {
434         struct ti_sci_msg_hdr hdr;
435         u8 num_parents;
436 } __packed;
437
438 /**
439  * struct ti_sci_msg_req_query_clock_freq - Request to query a frequency
440  * @hdr:        Generic Header
441  * @dev_id:     Device identifier this request is for
442  * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum
443  *              allowable programmed frequency and does not account for clock
444  *              tolerances and jitter.
445  * @target_freq_hz: The target clock frequency. A frequency will be found
446  *              as close to this target frequency as possible.
447  * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum
448  *              allowable programmed frequency and does not account for clock
449  *              tolerances and jitter.
450  * @clk_id:     Clock identifier for the device for this request.
451  *
452  * NOTE: Normally clock frequency management is automatically done by TISCI
453  * entity. In case of specific requests, TISCI evaluates capability to achieve
454  * requested frequency within provided range and responds with
455  * result message.
456  *
457  * Request type is TI_SCI_MSG_QUERY_CLOCK_FREQ, response is appropriate message,
458  * or NACK in case of inability to satisfy request.
459  */
460 struct ti_sci_msg_req_query_clock_freq {
461         struct ti_sci_msg_hdr hdr;
462         u32 dev_id;
463         u64 min_freq_hz;
464         u64 target_freq_hz;
465         u64 max_freq_hz;
466         u8 clk_id;
467 } __packed;
468
469 /**
470  * struct ti_sci_msg_resp_query_clock_freq - Response to a clock frequency query
471  * @hdr:        Generic Header
472  * @freq_hz:    Frequency that is the best match in Hz.
473  *
474  * Response to request type TI_SCI_MSG_QUERY_CLOCK_FREQ. NOTE: if the request
475  * cannot be satisfied, the message will be of type NACK.
476  */
477 struct ti_sci_msg_resp_query_clock_freq {
478         struct ti_sci_msg_hdr hdr;
479         u64 freq_hz;
480 } __packed;
481
482 /**
483  * struct ti_sci_msg_req_set_clock_freq - Request to setup a clock frequency
484  * @hdr:        Generic Header
485  * @dev_id:     Device identifier this request is for
486  * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum
487  *              allowable programmed frequency and does not account for clock
488  *              tolerances and jitter.
489  * @target_freq_hz: The target clock frequency. The clock will be programmed
490  *              at a rate as close to this target frequency as possible.
491  * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum
492  *              allowable programmed frequency and does not account for clock
493  *              tolerances and jitter.
494  * @clk_id:     Clock identifier for the device for this request.
495  *
496  * NOTE: Normally clock frequency management is automatically done by TISCI
497  * entity. In case of specific requests, TISCI evaluates capability to achieve
498  * requested range and responds with success/failure message.
499  *
500  * This sets the desired frequency for a clock within an allowable
501  * range. This message will fail on an enabled clock unless
502  * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE is set for the clock. Additionally,
503  * if other clocks have their frequency modified due to this message,
504  * they also must have the MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE or be disabled.
505  *
506  * Calling set frequency on a clock input to the SoC pseudo-device will
507  * inform the PMMC of that clock's frequency. Setting a frequency of
508  * zero will indicate the clock is disabled.
509  *
510  * Calling set frequency on clock outputs from the SoC pseudo-device will
511  * function similarly to setting the clock frequency on a device.
512  *
513  * Request type is TI_SCI_MSG_SET_CLOCK_FREQ, response is a generic ACK/NACK
514  * message.
515  */
516 struct ti_sci_msg_req_set_clock_freq {
517         struct ti_sci_msg_hdr hdr;
518         u32 dev_id;
519         u64 min_freq_hz;
520         u64 target_freq_hz;
521         u64 max_freq_hz;
522         u8 clk_id;
523 } __packed;
524
525 /**
526  * struct ti_sci_msg_req_get_clock_freq - Request to get the clock frequency
527  * @hdr:        Generic Header
528  * @dev_id:     Device identifier this request is for
529  * @clk_id:     Clock identifier for the device for this request.
530  *
531  * NOTE: Normally clock frequency management is automatically done by TISCI
532  * entity. In some cases, clock frequencies are configured by host.
533  *
534  * Request type is TI_SCI_MSG_GET_CLOCK_FREQ, responded with clock frequency
535  * that the clock is currently at.
536  */
537 struct ti_sci_msg_req_get_clock_freq {
538         struct ti_sci_msg_hdr hdr;
539         u32 dev_id;
540         u8 clk_id;
541 } __packed;
542
543 /**
544  * struct ti_sci_msg_resp_get_clock_freq - Response of clock frequency request
545  * @hdr:        Generic Header
546  * @freq_hz:    Frequency that the clock is currently on, in Hz.
547  *
548  * Response to request type TI_SCI_MSG_GET_CLOCK_FREQ.
549  */
550 struct ti_sci_msg_resp_get_clock_freq {
551         struct ti_sci_msg_hdr hdr;
552         u64 freq_hz;
553 } __packed;
554
555 #define TI_SCI_IRQ_SECONDARY_HOST_INVALID       0xff
556
557 /**
558  * struct ti_sci_msg_req_get_resource_range - Request to get a host's assigned
559  *                                            range of resources.
560  * @hdr:                Generic Header
561  * @type:               Unique resource assignment type
562  * @subtype:            Resource assignment subtype within the resource type.
563  * @secondary_host:     Host processing entity to which the resources are
564  *                      allocated. This is required only when the destination
565  *                      host id id different from ti sci interface host id,
566  *                      else TI_SCI_IRQ_SECONDARY_HOST_INVALID can be passed.
567  *
568  * Request type is TI_SCI_MSG_GET_RESOURCE_RANGE. Responded with requested
569  * resource range which is of type TI_SCI_MSG_GET_RESOURCE_RANGE.
570  */
571 struct ti_sci_msg_req_get_resource_range {
572         struct ti_sci_msg_hdr hdr;
573 #define MSG_RM_RESOURCE_TYPE_MASK       GENMASK(9, 0)
574 #define MSG_RM_RESOURCE_SUBTYPE_MASK    GENMASK(5, 0)
575         u16 type;
576         u8 subtype;
577         u8 secondary_host;
578 } __packed;
579
580 /**
581  * struct ti_sci_msg_resp_get_resource_range - Response to resource get range.
582  * @hdr:                Generic Header
583  * @range_start:        Start index of the resource range.
584  * @range_num:          Number of resources in the range.
585  *
586  * Response to request TI_SCI_MSG_GET_RESOURCE_RANGE.
587  */
588 struct ti_sci_msg_resp_get_resource_range {
589         struct ti_sci_msg_hdr hdr;
590         u16 range_start;
591         u16 range_num;
592 } __packed;
593
594 #define TISCI_ADDR_LOW_MASK             GENMASK_ULL(31, 0)
595 #define TISCI_ADDR_HIGH_MASK            GENMASK_ULL(63, 32)
596 #define TISCI_ADDR_HIGH_SHIFT           32
597
598 /**
599  * struct ti_sci_msg_req_proc_request - Request a processor
600  *
601  * @hdr:                Generic Header
602  * @processor_id:       ID of processor
603  *
604  * Request type is TISCI_MSG_PROC_REQUEST, response is a generic ACK/NACK
605  * message.
606  */
607 struct ti_sci_msg_req_proc_request {
608         struct ti_sci_msg_hdr hdr;
609         u8 processor_id;
610 } __packed;
611
612 /**
613  * struct ti_sci_msg_req_proc_release - Release a processor
614  *
615  * @hdr:                Generic Header
616  * @processor_id:       ID of processor
617  *
618  * Request type is TISCI_MSG_PROC_RELEASE, response is a generic ACK/NACK
619  * message.
620  */
621 struct ti_sci_msg_req_proc_release {
622         struct ti_sci_msg_hdr hdr;
623         u8 processor_id;
624 } __packed;
625
626 /**
627  * struct ti_sci_msg_req_proc_handover - Handover a processor to a host
628  *
629  * @hdr:                Generic Header
630  * @processor_id:       ID of processor
631  * @host_id:            New Host we want to give control to
632  *
633  * Request type is TISCI_MSG_PROC_HANDOVER, response is a generic ACK/NACK
634  * message.
635  */
636 struct ti_sci_msg_req_proc_handover {
637         struct ti_sci_msg_hdr hdr;
638         u8 processor_id;
639         u8 host_id;
640 } __packed;
641
642 /* A53 Config Flags */
643 #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_EN         0x00000001
644 #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_NIDEN      0x00000002
645 #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_SPIDEN     0x00000004
646 #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_SPNIDEN    0x00000008
647 #define PROC_BOOT_CFG_FLAG_ARMV8_AARCH32        0x00000100
648
649 /* R5 Config Flags */
650 #define PROC_BOOT_CFG_FLAG_R5_DBG_EN            0x00000001
651 #define PROC_BOOT_CFG_FLAG_R5_DBG_NIDEN         0x00000002
652 #define PROC_BOOT_CFG_FLAG_R5_LOCKSTEP          0x00000100
653 #define PROC_BOOT_CFG_FLAG_R5_TEINIT            0x00000200
654 #define PROC_BOOT_CFG_FLAG_R5_NMFI_EN           0x00000400
655 #define PROC_BOOT_CFG_FLAG_R5_TCM_RSTBASE       0x00000800
656 #define PROC_BOOT_CFG_FLAG_R5_BTCM_EN           0x00001000
657 #define PROC_BOOT_CFG_FLAG_R5_ATCM_EN           0x00002000
658
659 /**
660  * struct ti_sci_msg_req_set_proc_boot_config - Set Processor boot configuration
661  * @hdr:                Generic Header
662  * @processor_id:       ID of processor
663  * @bootvector_low:     Lower 32bit (Little Endian) of boot vector
664  * @bootvector_high:    Higher 32bit (Little Endian) of boot vector
665  * @config_flags_set:   Optional Processor specific Config Flags to set.
666  *                      Setting a bit here implies required bit sets to 1.
667  * @config_flags_clear: Optional Processor specific Config Flags to clear.
668  *                      Setting a bit here implies required bit gets cleared.
669  *
670  * Request type is TISCI_MSG_SET_PROC_BOOT_CONFIG, response is a generic
671  * ACK/NACK message.
672  */
673 struct ti_sci_msg_req_set_proc_boot_config {
674         struct ti_sci_msg_hdr hdr;
675         u8 processor_id;
676         u32 bootvector_low;
677         u32 bootvector_high;
678         u32 config_flags_set;
679         u32 config_flags_clear;
680 } __packed;
681
682 /* R5 Control Flags */
683 #define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT                0x00000001
684
685 /**
686  * struct ti_sci_msg_req_set_proc_boot_ctrl - Set Processor boot control flags
687  * @hdr:                Generic Header
688  * @processor_id:       ID of processor
689  * @control_flags_set:  Optional Processor specific Control Flags to set.
690  *                      Setting a bit here implies required bit sets to 1.
691  * @control_flags_clear:Optional Processor specific Control Flags to clear.
692  *                      Setting a bit here implies required bit gets cleared.
693  *
694  * Request type is TISCI_MSG_SET_PROC_BOOT_CTRL, response is a generic ACK/NACK
695  * message.
696  */
697 struct ti_sci_msg_req_set_proc_boot_ctrl {
698         struct ti_sci_msg_hdr hdr;
699         u8 processor_id;
700         u32 control_flags_set;
701         u32 control_flags_clear;
702 } __packed;
703
704 /**
705  * struct ti_sci_msg_req_proc_auth_start_image - Authenticate and start image
706  * @hdr:                Generic Header
707  * @processor_id:       ID of processor
708  * @cert_addr_low:      Lower 32bit (Little Endian) of certificate
709  * @cert_addr_high:     Higher 32bit (Little Endian) of certificate
710  *
711  * Request type is TISCI_MSG_PROC_AUTH_BOOT_IMAGE, response is a generic
712  * ACK/NACK message.
713  */
714 struct ti_sci_msg_req_proc_auth_boot_image {
715         struct ti_sci_msg_hdr hdr;
716         u8 processor_id;
717         u32 cert_addr_low;
718         u32 cert_addr_high;
719 } __packed;
720
721 /**
722  * struct ti_sci_msg_req_get_proc_boot_status - Get processor boot status
723  * @hdr:                Generic Header
724  * @processor_id:       ID of processor
725  *
726  * Request type is TISCI_MSG_GET_PROC_BOOT_STATUS, response is appropriate
727  * message, or NACK in case of inability to satisfy request.
728  */
729 struct ti_sci_msg_req_get_proc_boot_status {
730         struct ti_sci_msg_hdr hdr;
731         u8 processor_id;
732 } __packed;
733
734 /* ARMv8 Status Flags */
735 #define PROC_BOOT_STATUS_FLAG_ARMV8_WFE                 0x00000001
736 #define PROC_BOOT_STATUS_FLAG_ARMV8_WFI                 0x00000002
737
738 /* R5 Status Flags */
739 #define PROC_BOOT_STATUS_FLAG_R5_WFE                    0x00000001
740 #define PROC_BOOT_STATUS_FLAG_R5_WFI                    0x00000002
741 #define PROC_BOOT_STATUS_FLAG_R5_CLK_GATED              0x00000004
742 #define PROC_BOOT_STATUS_FLAG_R5_LOCKSTEP_PERMITTED     0x00000100
743
744 /**
745  * struct ti_sci_msg_resp_get_proc_boot_status - Processor boot status response
746  * @hdr:                Generic Header
747  * @processor_id:       ID of processor
748  * @bootvector_low:     Lower 32bit (Little Endian) of boot vector
749  * @bootvector_high:    Higher 32bit (Little Endian) of boot vector
750  * @config_flags:       Optional Processor specific Config Flags set.
751  * @control_flags:      Optional Processor specific Control Flags.
752  * @status_flags:       Optional Processor specific Status Flags set.
753  *
754  * Response to TISCI_MSG_GET_PROC_BOOT_STATUS.
755  */
756 struct ti_sci_msg_resp_get_proc_boot_status {
757         struct ti_sci_msg_hdr hdr;
758         u8 processor_id;
759         u32 bootvector_low;
760         u32 bootvector_high;
761         u32 config_flags;
762         u32 control_flags;
763         u32 status_flags;
764 } __packed;
765
766 /**
767  * struct ti_sci_msg_rm_ring_cfg_req - Configure a Navigator Subsystem ring
768  *
769  * Configures the non-real-time registers of a Navigator Subsystem ring.
770  * @hdr:        Generic Header
771  * @valid_params: Bitfield defining validity of ring configuration parameters.
772  *      The ring configuration fields are not valid, and will not be used for
773  *      ring configuration, if their corresponding valid bit is zero.
774  *      Valid bit usage:
775  *      0 - Valid bit for @tisci_msg_rm_ring_cfg_req addr_lo
776  *      1 - Valid bit for @tisci_msg_rm_ring_cfg_req addr_hi
777  *      2 - Valid bit for @tisci_msg_rm_ring_cfg_req count
778  *      3 - Valid bit for @tisci_msg_rm_ring_cfg_req mode
779  *      4 - Valid bit for @tisci_msg_rm_ring_cfg_req size
780  *      5 - Valid bit for @tisci_msg_rm_ring_cfg_req order_id
781  * @nav_id: Device ID of Navigator Subsystem from which the ring is allocated
782  * @index: ring index to be configured.
783  * @addr_lo: 32 LSBs of ring base address to be programmed into the ring's
784  *      RING_BA_LO register
785  * @addr_hi: 16 MSBs of ring base address to be programmed into the ring's
786  *      RING_BA_HI register.
787  * @count: Number of ring elements. Must be even if mode is CREDENTIALS or QM
788  *      modes.
789  * @mode: Specifies the mode the ring is to be configured.
790  * @size: Specifies encoded ring element size. To calculate the encoded size use
791  *      the formula (log2(size_bytes) - 2), where size_bytes cannot be
792  *      greater than 256.
793  * @order_id: Specifies the ring's bus order ID.
794  */
795 struct ti_sci_msg_rm_ring_cfg_req {
796         struct ti_sci_msg_hdr hdr;
797         u32 valid_params;
798         u16 nav_id;
799         u16 index;
800         u32 addr_lo;
801         u32 addr_hi;
802         u32 count;
803         u8 mode;
804         u8 size;
805         u8 order_id;
806 } __packed;
807
808 /**
809  * struct ti_sci_msg_rm_ring_cfg_resp - Response to configuring a ring.
810  *
811  * @hdr:        Generic Header
812  */
813 struct ti_sci_msg_rm_ring_cfg_resp {
814         struct ti_sci_msg_hdr hdr;
815 } __packed;
816
817 /**
818  * struct ti_sci_msg_rm_ring_get_cfg_req - Get RA ring's configuration
819  *
820  * Gets the configuration of the non-real-time register fields of a ring.  The
821  * host, or a supervisor of the host, who owns the ring must be the requesting
822  * host.  The values of the non-real-time registers are returned in
823  * @ti_sci_msg_rm_ring_get_cfg_resp.
824  *
825  * @hdr: Generic Header
826  * @nav_id: Device ID of Navigator Subsystem from which the ring is allocated
827  * @index: ring index.
828  */
829 struct ti_sci_msg_rm_ring_get_cfg_req {
830         struct ti_sci_msg_hdr hdr;
831         u16 nav_id;
832         u16 index;
833 } __packed;
834
835 /**
836  * struct ti_sci_msg_rm_ring_get_cfg_resp -  Ring get configuration response
837  *
838  * Response received by host processor after RM has handled
839  * @ti_sci_msg_rm_ring_get_cfg_req. The response contains the ring's
840  * non-real-time register values.
841  *
842  * @hdr: Generic Header
843  * @addr_lo: Ring 32 LSBs of base address
844  * @addr_hi: Ring 16 MSBs of base address.
845  * @count: Ring number of elements.
846  * @mode: Ring mode.
847  * @size: encoded Ring element size
848  * @order_id: ing order ID.
849  */
850 struct ti_sci_msg_rm_ring_get_cfg_resp {
851         struct ti_sci_msg_hdr hdr;
852         u32 addr_lo;
853         u32 addr_hi;
854         u32 count;
855         u8 mode;
856         u8 size;
857         u8 order_id;
858 } __packed;
859
860 /**
861  * struct ti_sci_msg_psil_pair - Pairs a PSI-L source thread to a destination
862  *                               thread
863  * @hdr:        Generic Header
864  * @nav_id:     SoC Navigator Subsystem device ID whose PSI-L config proxy is
865  *              used to pair the source and destination threads.
866  * @src_thread: PSI-L source thread ID within the PSI-L System thread map.
867  *
868  * UDMAP transmit channels mapped to source threads will have their
869  * TCHAN_THRD_ID register programmed with the destination thread if the pairing
870  * is successful.
871
872  * @dst_thread: PSI-L destination thread ID within the PSI-L System thread map.
873  * PSI-L destination threads start at index 0x8000.  The request is NACK'd if
874  * the destination thread is not greater than or equal to 0x8000.
875  *
876  * UDMAP receive channels mapped to destination threads will have their
877  * RCHAN_THRD_ID register programmed with the source thread if the pairing
878  * is successful.
879  *
880  * Request type is TI_SCI_MSG_RM_PSIL_PAIR, response is a generic ACK or NACK
881  * message.
882  */
883 struct ti_sci_msg_psil_pair {
884         struct ti_sci_msg_hdr hdr;
885         u32 nav_id;
886         u32 src_thread;
887         u32 dst_thread;
888 } __packed;
889
890 /**
891  * struct ti_sci_msg_psil_unpair - Unpairs a PSI-L source thread from a
892  *                                 destination thread
893  * @hdr:        Generic Header
894  * @nav_id:     SoC Navigator Subsystem device ID whose PSI-L config proxy is
895  *              used to unpair the source and destination threads.
896  * @src_thread: PSI-L source thread ID within the PSI-L System thread map.
897  *
898  * UDMAP transmit channels mapped to source threads will have their
899  * TCHAN_THRD_ID register cleared if the unpairing is successful.
900  *
901  * @dst_thread: PSI-L destination thread ID within the PSI-L System thread map.
902  * PSI-L destination threads start at index 0x8000.  The request is NACK'd if
903  * the destination thread is not greater than or equal to 0x8000.
904  *
905  * UDMAP receive channels mapped to destination threads will have their
906  * RCHAN_THRD_ID register cleared if the unpairing is successful.
907  *
908  * Request type is TI_SCI_MSG_RM_PSIL_UNPAIR, response is a generic ACK or NACK
909  * message.
910  */
911 struct ti_sci_msg_psil_unpair {
912         struct ti_sci_msg_hdr hdr;
913         u32 nav_id;
914         u32 src_thread;
915         u32 dst_thread;
916 } __packed;
917
918 /**
919  * Configures a Navigator Subsystem UDMAP transmit channel
920  *
921  * Configures the non-real-time registers of a Navigator Subsystem UDMAP
922  * transmit channel.  The channel index must be assigned to the host defined
923  * in the TISCI header via the RM board configuration resource assignment
924  * range list.
925  *
926  * @hdr: Generic Header
927  *
928  * @valid_params: Bitfield defining validity of tx channel configuration
929  * parameters. The tx channel configuration fields are not valid, and will not
930  * be used for ch configuration, if their corresponding valid bit is zero.
931  * Valid bit usage:
932  *    0 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_pause_on_err
933  *    1 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_atype
934  *    2 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_chan_type
935  *    3 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_fetch_size
936  *    4 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::txcq_qnum
937  *    5 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_priority
938  *    6 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_qos
939  *    7 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_orderid
940  *    8 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_sched_priority
941  *    9 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_filt_einfo
942  *   10 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_filt_pswords
943  *   11 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_supr_tdpkt
944  *   12 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_credit_count
945  *   13 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::fdepth
946  *
947  * @nav_id: SoC device ID of Navigator Subsystem where tx channel is located
948  *
949  * @index: UDMAP transmit channel index.
950  *
951  * @tx_pause_on_err: UDMAP transmit channel pause on error configuration to
952  * be programmed into the tx_pause_on_err field of the channel's TCHAN_TCFG
953  * register.
954  *
955  * @tx_filt_einfo: UDMAP transmit channel extended packet information passing
956  * configuration to be programmed into the tx_filt_einfo field of the
957  * channel's TCHAN_TCFG register.
958  *
959  * @tx_filt_pswords: UDMAP transmit channel protocol specific word passing
960  * configuration to be programmed into the tx_filt_pswords field of the
961  * channel's TCHAN_TCFG register.
962  *
963  * @tx_atype: UDMAP transmit channel non Ring Accelerator access pointer
964  * interpretation configuration to be programmed into the tx_atype field of
965  * the channel's TCHAN_TCFG register.
966  *
967  * @tx_chan_type: UDMAP transmit channel functional channel type and work
968  * passing mechanism configuration to be programmed into the tx_chan_type
969  * field of the channel's TCHAN_TCFG register.
970  *
971  * @tx_supr_tdpkt: UDMAP transmit channel teardown packet generation suppression
972  * configuration to be programmed into the tx_supr_tdpkt field of the channel's
973  * TCHAN_TCFG register.
974  *
975  * @tx_fetch_size: UDMAP transmit channel number of 32-bit descriptor words to
976  * fetch configuration to be programmed into the tx_fetch_size field of the
977  * channel's TCHAN_TCFG register.  The user must make sure to set the maximum
978  * word count that can pass through the channel for any allowed descriptor type.
979  *
980  * @tx_credit_count: UDMAP transmit channel transfer request credit count
981  * configuration to be programmed into the count field of the TCHAN_TCREDIT
982  * register.  Specifies how many credits for complete TRs are available.
983  *
984  * @txcq_qnum: UDMAP transmit channel completion queue configuration to be
985  * programmed into the txcq_qnum field of the TCHAN_TCQ register. The specified
986  * completion queue must be assigned to the host, or a subordinate of the host,
987  * requesting configuration of the transmit channel.
988  *
989  * @tx_priority: UDMAP transmit channel transmit priority value to be programmed
990  * into the priority field of the channel's TCHAN_TPRI_CTRL register.
991  *
992  * @tx_qos: UDMAP transmit channel transmit qos value to be programmed into the
993  * qos field of the channel's TCHAN_TPRI_CTRL register.
994  *
995  * @tx_orderid: UDMAP transmit channel bus order id value to be programmed into
996  * the orderid field of the channel's TCHAN_TPRI_CTRL register.
997  *
998  * @fdepth: UDMAP transmit channel FIFO depth configuration to be programmed
999  * into the fdepth field of the TCHAN_TFIFO_DEPTH register. Sets the number of
1000  * Tx FIFO bytes which are allowed to be stored for the channel. Check the UDMAP
1001  * section of the TRM for restrictions regarding this parameter.
1002  *
1003  * @tx_sched_priority: UDMAP transmit channel tx scheduling priority
1004  * configuration to be programmed into the priority field of the channel's
1005  * TCHAN_TST_SCHED register.
1006  */
1007 struct ti_sci_msg_rm_udmap_tx_ch_cfg_req {
1008         struct ti_sci_msg_hdr hdr;
1009         u32 valid_params;
1010         u16 nav_id;
1011         u16 index;
1012         u8 tx_pause_on_err;
1013         u8 tx_filt_einfo;
1014         u8 tx_filt_pswords;
1015         u8 tx_atype;
1016         u8 tx_chan_type;
1017         u8 tx_supr_tdpkt;
1018         u16 tx_fetch_size;
1019         u8 tx_credit_count;
1020         u16 txcq_qnum;
1021         u8 tx_priority;
1022         u8 tx_qos;
1023         u8 tx_orderid;
1024         u16 fdepth;
1025         u8 tx_sched_priority;
1026 } __packed;
1027
1028 /**
1029  *  Response to configuring a UDMAP transmit channel.
1030  *
1031  * @hdr: Standard TISCI header
1032  */
1033 struct ti_sci_msg_rm_udmap_tx_ch_cfg_resp {
1034         struct ti_sci_msg_hdr hdr;
1035 } __packed;
1036
1037 /**
1038  * Configures a Navigator Subsystem UDMAP receive channel
1039  *
1040  * Configures the non-real-time registers of a Navigator Subsystem UDMAP
1041  * receive channel.  The channel index must be assigned to the host defined
1042  * in the TISCI header via the RM board configuration resource assignment
1043  * range list.
1044  *
1045  * @hdr: Generic Header
1046  *
1047  * @valid_params: Bitfield defining validity of rx channel configuration
1048  * parameters.
1049  * The rx channel configuration fields are not valid, and will not be used for
1050  * ch configuration, if their corresponding valid bit is zero.
1051  * Valid bit usage:
1052  *    0 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_pause_on_err
1053  *    1 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_atype
1054  *    2 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_chan_type
1055  *    3 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_fetch_size
1056  *    4 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rxcq_qnum
1057  *    5 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_priority
1058  *    6 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_qos
1059  *    7 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_orderid
1060  *    8 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_sched_priority
1061  *    9 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::flowid_start
1062  *   10 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::flowid_cnt
1063  *   11 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_ignore_short
1064  *   12 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_ignore_long
1065  *
1066  * @nav_id: SoC device ID of Navigator Subsystem where rx channel is located
1067  *
1068  * @index: UDMAP receive channel index.
1069  *
1070  * @rx_fetch_size: UDMAP receive channel number of 32-bit descriptor words to
1071  * fetch configuration to be programmed into the rx_fetch_size field of the
1072  * channel's RCHAN_RCFG register.
1073  *
1074  * @rxcq_qnum: UDMAP receive channel completion queue configuration to be
1075  * programmed into the rxcq_qnum field of the RCHAN_RCQ register.
1076  * The specified completion queue must be assigned to the host, or a subordinate
1077  * of the host, requesting configuration of the receive channel.
1078  *
1079  * @rx_priority: UDMAP receive channel receive priority value to be programmed
1080  * into the priority field of the channel's RCHAN_RPRI_CTRL register.
1081  *
1082  * @rx_qos: UDMAP receive channel receive qos value to be programmed into the
1083  * qos field of the channel's RCHAN_RPRI_CTRL register.
1084  *
1085  * @rx_orderid: UDMAP receive channel bus order id value to be programmed into
1086  * the orderid field of the channel's RCHAN_RPRI_CTRL register.
1087  *
1088  * @rx_sched_priority: UDMAP receive channel rx scheduling priority
1089  * configuration to be programmed into the priority field of the channel's
1090  * RCHAN_RST_SCHED register.
1091  *
1092  * @flowid_start: UDMAP receive channel additional flows starting index
1093  * configuration to program into the flow_start field of the RCHAN_RFLOW_RNG
1094  * register. Specifies the starting index for flow IDs the receive channel is to
1095  * make use of beyond the default flow. flowid_start and @ref flowid_cnt must be
1096  * set as valid and configured together. The starting flow ID set by
1097  * @ref flowid_cnt must be a flow index within the Navigator Subsystem's subset
1098  * of flows beyond the default flows statically mapped to receive channels.
1099  * The additional flows must be assigned to the host, or a subordinate of the
1100  * host, requesting configuration of the receive channel.
1101  *
1102  * @flowid_cnt: UDMAP receive channel additional flows count configuration to
1103  * program into the flowid_cnt field of the RCHAN_RFLOW_RNG register.
1104  * This field specifies how many flow IDs are in the additional contiguous range
1105  * of legal flow IDs for the channel.  @ref flowid_start and flowid_cnt must be
1106  * set as valid and configured together. Disabling the valid_params field bit
1107  * for flowid_cnt indicates no flow IDs other than the default are to be
1108  * allocated and used by the receive channel. @ref flowid_start plus flowid_cnt
1109  * cannot be greater than the number of receive flows in the receive channel's
1110  * Navigator Subsystem.  The additional flows must be assigned to the host, or a
1111  * subordinate of the host, requesting configuration of the receive channel.
1112  *
1113  * @rx_pause_on_err: UDMAP receive channel pause on error configuration to be
1114  * programmed into the rx_pause_on_err field of the channel's RCHAN_RCFG
1115  * register.
1116  *
1117  * @rx_atype: UDMAP receive channel non Ring Accelerator access pointer
1118  * interpretation configuration to be programmed into the rx_atype field of the
1119  * channel's RCHAN_RCFG register.
1120  *
1121  * @rx_chan_type: UDMAP receive channel functional channel type and work passing
1122  * mechanism configuration to be programmed into the rx_chan_type field of the
1123  * channel's RCHAN_RCFG register.
1124  *
1125  * @rx_ignore_short: UDMAP receive channel short packet treatment configuration
1126  * to be programmed into the rx_ignore_short field of the RCHAN_RCFG register.
1127  *
1128  * @rx_ignore_long: UDMAP receive channel long packet treatment configuration to
1129  * be programmed into the rx_ignore_long field of the RCHAN_RCFG register.
1130  */
1131 struct ti_sci_msg_rm_udmap_rx_ch_cfg_req {
1132         struct ti_sci_msg_hdr hdr;
1133         u32 valid_params;
1134         u16 nav_id;
1135         u16 index;
1136         u16 rx_fetch_size;
1137         u16 rxcq_qnum;
1138         u8 rx_priority;
1139         u8 rx_qos;
1140         u8 rx_orderid;
1141         u8 rx_sched_priority;
1142         u16 flowid_start;
1143         u16 flowid_cnt;
1144         u8 rx_pause_on_err;
1145         u8 rx_atype;
1146         u8 rx_chan_type;
1147         u8 rx_ignore_short;
1148         u8 rx_ignore_long;
1149 } __packed;
1150
1151 /**
1152  * Response to configuring a UDMAP receive channel.
1153  *
1154  * @hdr: Standard TISCI header
1155  */
1156 struct ti_sci_msg_rm_udmap_rx_ch_cfg_resp {
1157         struct ti_sci_msg_hdr hdr;
1158 } __packed;
1159
1160 /**
1161  * Configures a Navigator Subsystem UDMAP receive flow
1162  *
1163  * Configures a Navigator Subsystem UDMAP receive flow's registers.
1164  * Configuration does not include the flow registers which handle size-based
1165  * free descriptor queue routing.
1166  *
1167  * The flow index must be assigned to the host defined in the TISCI header via
1168  * the RM board configuration resource assignment range list.
1169  *
1170  * @hdr: Standard TISCI header
1171  *
1172  * @valid_params
1173  * Bitfield defining validity of rx flow configuration parameters.  The
1174  * rx flow configuration fields are not valid, and will not be used for flow
1175  * configuration, if their corresponding valid bit is zero.  Valid bit usage:
1176  *     0 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_einfo_present
1177  *     1 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_psinfo_present
1178  *     2 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_error_handling
1179  *     3 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_desc_type
1180  *     4 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_sop_offset
1181  *     5 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_dest_qnum
1182  *     6 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_hi
1183  *     7 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_lo
1184  *     8 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_hi
1185  *     9 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_lo
1186  *    10 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_hi_sel
1187  *    11 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_lo_sel
1188  *    12 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_hi_sel
1189  *    13 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_lo_sel
1190  *    14 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_fdq0_sz0_qnum
1191  *    15 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_fdq1_sz0_qnum
1192  *    16 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_fdq2_sz0_qnum
1193  *    17 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_fdq3_sz0_qnum
1194  *    18 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_ps_location
1195  *
1196  * @nav_id: SoC device ID of Navigator Subsystem from which the receive flow is
1197  * allocated
1198  *
1199  * @flow_index: UDMAP receive flow index for non-optional configuration.
1200  *
1201  * @rx_einfo_present:
1202  * UDMAP receive flow extended packet info present configuration to be
1203  * programmed into the rx_einfo_present field of the flow's RFLOW_RFA register.
1204  *
1205  * @rx_psinfo_present:
1206  * UDMAP receive flow PS words present configuration to be programmed into the
1207  * rx_psinfo_present field of the flow's RFLOW_RFA register.
1208  *
1209  * @rx_error_handling:
1210  * UDMAP receive flow error handling configuration to be programmed into the
1211  * rx_error_handling field of the flow's RFLOW_RFA register.
1212  *
1213  * @rx_desc_type:
1214  * UDMAP receive flow descriptor type configuration to be programmed into the
1215  * rx_desc_type field field of the flow's RFLOW_RFA register.
1216  *
1217  * @rx_sop_offset:
1218  * UDMAP receive flow start of packet offset configuration to be programmed
1219  * into the rx_sop_offset field of the RFLOW_RFA register.  See the UDMAP
1220  * section of the TRM for more information on this setting.  Valid values for
1221  * this field are 0-255 bytes.
1222  *
1223  * @rx_dest_qnum:
1224  * UDMAP receive flow destination queue configuration to be programmed into the
1225  * rx_dest_qnum field of the flow's RFLOW_RFA register.  The specified
1226  * destination queue must be valid within the Navigator Subsystem and must be
1227  * owned by the host, or a subordinate of the host, requesting allocation and
1228  * configuration of the receive flow.
1229  *
1230  * @rx_src_tag_hi:
1231  * UDMAP receive flow source tag high byte constant configuration to be
1232  * programmed into the rx_src_tag_hi field of the flow's RFLOW_RFB register.
1233  * See the UDMAP section of the TRM for more information on this setting.
1234  *
1235  * @rx_src_tag_lo:
1236  * UDMAP receive flow source tag low byte constant configuration to be
1237  * programmed into the rx_src_tag_lo field of the flow's RFLOW_RFB register.
1238  * See the UDMAP section of the TRM for more information on this setting.
1239  *
1240  * @rx_dest_tag_hi:
1241  * UDMAP receive flow destination tag high byte constant configuration to be
1242  * programmed into the rx_dest_tag_hi field of the flow's RFLOW_RFB register.
1243  * See the UDMAP section of the TRM for more information on this setting.
1244  *
1245  * @rx_dest_tag_lo:
1246  * UDMAP receive flow destination tag low byte constant configuration to be
1247  * programmed into the rx_dest_tag_lo field of the flow's RFLOW_RFB register.
1248  * See the UDMAP section of the TRM for more information on this setting.
1249  *
1250  * @rx_src_tag_hi_sel:
1251  * UDMAP receive flow source tag high byte selector configuration to be
1252  * programmed into the rx_src_tag_hi_sel field of the RFLOW_RFC register.  See
1253  * the UDMAP section of the TRM for more information on this setting.
1254  *
1255  * @rx_src_tag_lo_sel:
1256  * UDMAP receive flow source tag low byte selector configuration to be
1257  * programmed into the rx_src_tag_lo_sel field of the RFLOW_RFC register.  See
1258  * the UDMAP section of the TRM for more information on this setting.
1259  *
1260  * @rx_dest_tag_hi_sel:
1261  * UDMAP receive flow destination tag high byte selector configuration to be
1262  * programmed into the rx_dest_tag_hi_sel field of the RFLOW_RFC register.  See
1263  * the UDMAP section of the TRM for more information on this setting.
1264  *
1265  * @rx_dest_tag_lo_sel:
1266  * UDMAP receive flow destination tag low byte selector configuration to be
1267  * programmed into the rx_dest_tag_lo_sel field of the RFLOW_RFC register.  See
1268  * the UDMAP section of the TRM for more information on this setting.
1269  *
1270  * @rx_fdq0_sz0_qnum:
1271  * UDMAP receive flow free descriptor queue 0 configuration to be programmed
1272  * into the rx_fdq0_sz0_qnum field of the flow's RFLOW_RFD register.  See the
1273  * UDMAP section of the TRM for more information on this setting. The specified
1274  * free queue must be valid within the Navigator Subsystem and must be owned
1275  * by the host, or a subordinate of the host, requesting allocation and
1276  * configuration of the receive flow.
1277  *
1278  * @rx_fdq1_qnum:
1279  * UDMAP receive flow free descriptor queue 1 configuration to be programmed
1280  * into the rx_fdq1_qnum field of the flow's RFLOW_RFD register.  See the
1281  * UDMAP section of the TRM for more information on this setting.  The specified
1282  * free queue must be valid within the Navigator Subsystem and must be owned
1283  * by the host, or a subordinate of the host, requesting allocation and
1284  * configuration of the receive flow.
1285  *
1286  * @rx_fdq2_qnum:
1287  * UDMAP receive flow free descriptor queue 2 configuration to be programmed
1288  * into the rx_fdq2_qnum field of the flow's RFLOW_RFE register.  See the
1289  * UDMAP section of the TRM for more information on this setting.  The specified
1290  * free queue must be valid within the Navigator Subsystem and must be owned
1291  * by the host, or a subordinate of the host, requesting allocation and
1292  * configuration of the receive flow.
1293  *
1294  * @rx_fdq3_qnum:
1295  * UDMAP receive flow free descriptor queue 3 configuration to be programmed
1296  * into the rx_fdq3_qnum field of the flow's RFLOW_RFE register.  See the
1297  * UDMAP section of the TRM for more information on this setting.  The specified
1298  * free queue must be valid within the Navigator Subsystem and must be owned
1299  * by the host, or a subordinate of the host, requesting allocation and
1300  * configuration of the receive flow.
1301  *
1302  * @rx_ps_location:
1303  * UDMAP receive flow PS words location configuration to be programmed into the
1304  * rx_ps_location field of the flow's RFLOW_RFA register.
1305  */
1306 struct ti_sci_msg_rm_udmap_flow_cfg_req {
1307         struct ti_sci_msg_hdr hdr;
1308         u32 valid_params;
1309         u16 nav_id;
1310         u16 flow_index;
1311         u8 rx_einfo_present;
1312         u8 rx_psinfo_present;
1313         u8 rx_error_handling;
1314         u8 rx_desc_type;
1315         u16 rx_sop_offset;
1316         u16 rx_dest_qnum;
1317         u8 rx_src_tag_hi;
1318         u8 rx_src_tag_lo;
1319         u8 rx_dest_tag_hi;
1320         u8 rx_dest_tag_lo;
1321         u8 rx_src_tag_hi_sel;
1322         u8 rx_src_tag_lo_sel;
1323         u8 rx_dest_tag_hi_sel;
1324         u8 rx_dest_tag_lo_sel;
1325         u16 rx_fdq0_sz0_qnum;
1326         u16 rx_fdq1_qnum;
1327         u16 rx_fdq2_qnum;
1328         u16 rx_fdq3_qnum;
1329         u8 rx_ps_location;
1330 } __packed;
1331
1332 /**
1333  *  Response to configuring a Navigator Subsystem UDMAP receive flow
1334  *
1335  * @hdr: Standard TISCI header
1336  */
1337 struct ti_sci_msg_rm_udmap_flow_cfg_resp {
1338         struct ti_sci_msg_hdr hdr;
1339 } __packed;
1340
1341 #endif /* __TI_SCI_H */