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