blob: ad0b47981b87bdcab39c0947f72416942c41b876 [file] [log] [blame]
Lokesh Vutla1e0a6012018-05-04 23:10:23 -07001// SPDX-License-Identifier: BSD-3-Clause
Nishanth Menonaa276782016-10-18 18:08:34 -05002/*
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) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/
Nishanth Menonaa276782016-10-18 18:08:34 -050010 */
11
12#ifndef __TI_SCI_H
13#define __TI_SCI_H
14
15/* Generic Messages */
16#define TI_SCI_MSG_ENABLE_WDT 0x0000
17#define TI_SCI_MSG_WAKE_RESET 0x0001
18#define TI_SCI_MSG_VERSION 0x0002
19#define TI_SCI_MSG_WAKE_REASON 0x0003
20#define TI_SCI_MSG_GOODBYE 0x0004
Nishanth Menon912cffb2016-10-18 18:08:37 -050021#define TI_SCI_MSG_SYS_RESET 0x0005
Nishanth Menonaa276782016-10-18 18:08:34 -050022
Nishanth Menon9e7d7562016-10-18 18:08:35 -050023/* Device requests */
24#define TI_SCI_MSG_SET_DEVICE_STATE 0x0200
25#define TI_SCI_MSG_GET_DEVICE_STATE 0x0201
26#define TI_SCI_MSG_SET_DEVICE_RESETS 0x0202
27
Nishanth Menon9f723222016-10-18 18:08:36 -050028/* Clock requests */
29#define TI_SCI_MSG_SET_CLOCK_STATE 0x0100
30#define TI_SCI_MSG_GET_CLOCK_STATE 0x0101
31#define TI_SCI_MSG_SET_CLOCK_PARENT 0x0102
32#define TI_SCI_MSG_GET_CLOCK_PARENT 0x0103
33#define TI_SCI_MSG_GET_NUM_CLOCK_PARENTS 0x0104
34#define TI_SCI_MSG_SET_CLOCK_FREQ 0x010c
35#define TI_SCI_MSG_QUERY_CLOCK_FREQ 0x010d
36#define TI_SCI_MSG_GET_CLOCK_FREQ 0x010e
37
Lokesh Vutla9c19fb62019-04-30 15:42:18 +053038/* Resource Management Requests */
39#define TI_SCI_MSG_GET_RESOURCE_RANGE 0x1500
40
Lokesh Vutla997b0012019-04-30 15:42:19 +053041/* IRQ requests */
42#define TI_SCI_MSG_SET_IRQ 0x1000
43#define TI_SCI_MSG_FREE_IRQ 0x1001
44
Nishanth Menonaa276782016-10-18 18:08:34 -050045/**
46 * struct ti_sci_msg_hdr - Generic Message Header for All messages and responses
47 * @type: Type of messages: One of TI_SCI_MSG* values
48 * @host: Host of the message
49 * @seq: Message identifier indicating a transfer sequence
50 * @flags: Flag for the message
51 */
52struct ti_sci_msg_hdr {
53 u16 type;
54 u8 host;
55 u8 seq;
56#define TI_SCI_MSG_FLAG(val) (1 << (val))
57#define TI_SCI_FLAG_REQ_GENERIC_NORESPONSE 0x0
58#define TI_SCI_FLAG_REQ_ACK_ON_RECEIVED TI_SCI_MSG_FLAG(0)
59#define TI_SCI_FLAG_REQ_ACK_ON_PROCESSED TI_SCI_MSG_FLAG(1)
60#define TI_SCI_FLAG_RESP_GENERIC_NACK 0x0
61#define TI_SCI_FLAG_RESP_GENERIC_ACK TI_SCI_MSG_FLAG(1)
62 /* Additional Flags */
63 u32 flags;
64} __packed;
65
66/**
67 * struct ti_sci_msg_resp_version - Response for a message
68 * @hdr: Generic header
69 * @firmware_description: String describing the firmware
70 * @firmware_revision: Firmware revision
71 * @abi_major: Major version of the ABI that firmware supports
72 * @abi_minor: Minor version of the ABI that firmware supports
73 *
74 * In general, ABI version changes follow the rule that minor version increments
75 * are backward compatible. Major revision changes in ABI may not be
76 * backward compatible.
77 *
78 * Response to a generic message with message type TI_SCI_MSG_VERSION
79 */
80struct ti_sci_msg_resp_version {
81 struct ti_sci_msg_hdr hdr;
82 char firmware_description[32];
83 u16 firmware_revision;
84 u8 abi_major;
85 u8 abi_minor;
86} __packed;
87
Nishanth Menon9e7d7562016-10-18 18:08:35 -050088/**
Nishanth Menon912cffb2016-10-18 18:08:37 -050089 * struct ti_sci_msg_req_reboot - Reboot the SoC
90 * @hdr: Generic Header
91 *
92 * Request type is TI_SCI_MSG_SYS_RESET, responded with a generic
93 * ACK/NACK message.
94 */
95struct ti_sci_msg_req_reboot {
96 struct ti_sci_msg_hdr hdr;
97} __packed;
98
99/**
Nishanth Menon9e7d7562016-10-18 18:08:35 -0500100 * struct ti_sci_msg_req_set_device_state - Set the desired state of the device
101 * @hdr: Generic header
102 * @id: Indicates which device to modify
103 * @reserved: Reserved space in message, must be 0 for backward compatibility
104 * @state: The desired state of the device.
105 *
106 * Certain flags can also be set to alter the device state:
107 * + MSG_FLAG_DEVICE_WAKE_ENABLED - Configure the device to be a wake source.
108 * The meaning of this flag will vary slightly from device to device and from
109 * SoC to SoC but it generally allows the device to wake the SoC out of deep
110 * suspend states.
111 * + MSG_FLAG_DEVICE_RESET_ISO - Enable reset isolation for this device.
112 * + MSG_FLAG_DEVICE_EXCLUSIVE - Claim this device exclusively. When passed
113 * with STATE_RETENTION or STATE_ON, it will claim the device exclusively.
114 * If another host already has this device set to STATE_RETENTION or STATE_ON,
115 * the message will fail. Once successful, other hosts attempting to set
116 * STATE_RETENTION or STATE_ON will fail.
117 *
118 * Request type is TI_SCI_MSG_SET_DEVICE_STATE, responded with a generic
119 * ACK/NACK message.
120 */
121struct ti_sci_msg_req_set_device_state {
122 /* Additional hdr->flags options */
123#define MSG_FLAG_DEVICE_WAKE_ENABLED TI_SCI_MSG_FLAG(8)
124#define MSG_FLAG_DEVICE_RESET_ISO TI_SCI_MSG_FLAG(9)
125#define MSG_FLAG_DEVICE_EXCLUSIVE TI_SCI_MSG_FLAG(10)
126 struct ti_sci_msg_hdr hdr;
127 u32 id;
128 u32 reserved;
129
130#define MSG_DEVICE_SW_STATE_AUTO_OFF 0
131#define MSG_DEVICE_SW_STATE_RETENTION 1
132#define MSG_DEVICE_SW_STATE_ON 2
133 u8 state;
134} __packed;
135
136/**
137 * struct ti_sci_msg_req_get_device_state - Request to get device.
138 * @hdr: Generic header
139 * @id: Device Identifier
140 *
141 * Request type is TI_SCI_MSG_GET_DEVICE_STATE, responded device state
142 * information
143 */
144struct ti_sci_msg_req_get_device_state {
145 struct ti_sci_msg_hdr hdr;
146 u32 id;
147} __packed;
148
149/**
150 * struct ti_sci_msg_resp_get_device_state - Response to get device request.
151 * @hdr: Generic header
152 * @context_loss_count: Indicates how many times the device has lost context. A
153 * driver can use this monotonic counter to determine if the device has
154 * lost context since the last time this message was exchanged.
155 * @resets: Programmed state of the reset lines.
156 * @programmed_state: The state as programmed by set_device.
157 * - Uses the MSG_DEVICE_SW_* macros
158 * @current_state: The actual state of the hardware.
159 *
160 * Response to request TI_SCI_MSG_GET_DEVICE_STATE.
161 */
162struct ti_sci_msg_resp_get_device_state {
163 struct ti_sci_msg_hdr hdr;
164 u32 context_loss_count;
165 u32 resets;
166 u8 programmed_state;
167#define MSG_DEVICE_HW_STATE_OFF 0
168#define MSG_DEVICE_HW_STATE_ON 1
169#define MSG_DEVICE_HW_STATE_TRANS 2
170 u8 current_state;
171} __packed;
172
173/**
174 * struct ti_sci_msg_req_set_device_resets - Set the desired resets
175 * configuration of the device
176 * @hdr: Generic header
177 * @id: Indicates which device to modify
178 * @resets: A bit field of resets for the device. The meaning, behavior,
179 * and usage of the reset flags are device specific. 0 for a bit
180 * indicates releasing the reset represented by that bit while 1
181 * indicates keeping it held.
182 *
183 * Request type is TI_SCI_MSG_SET_DEVICE_RESETS, responded with a generic
184 * ACK/NACK message.
185 */
186struct ti_sci_msg_req_set_device_resets {
187 struct ti_sci_msg_hdr hdr;
188 u32 id;
189 u32 resets;
190} __packed;
191
Nishanth Menon9f723222016-10-18 18:08:36 -0500192/**
193 * struct ti_sci_msg_req_set_clock_state - Request to setup a Clock state
194 * @hdr: Generic Header, Certain flags can be set specific to the clocks:
195 * MSG_FLAG_CLOCK_ALLOW_SSC: Allow this clock to be modified
196 * via spread spectrum clocking.
197 * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE: Allow this clock's
198 * frequency to be changed while it is running so long as it
199 * is within the min/max limits.
200 * MSG_FLAG_CLOCK_INPUT_TERM: Enable input termination, this
201 * is only applicable to clock inputs on the SoC pseudo-device.
202 * @dev_id: Device identifier this request is for
203 * @clk_id: Clock identifier for the device for this request.
204 * Each device has it's own set of clock inputs. This indexes
Tero Kristo81f44582019-05-28 16:10:24 +0300205 * which clock input to modify. Set to 255 if clock ID is
206 * greater than or equal to 255.
Nishanth Menon9f723222016-10-18 18:08:36 -0500207 * @request_state: Request the state for the clock to be set to.
208 * MSG_CLOCK_SW_STATE_UNREQ: The IP does not require this clock,
209 * it can be disabled, regardless of the state of the device
210 * MSG_CLOCK_SW_STATE_AUTO: Allow the System Controller to
211 * automatically manage the state of this clock. If the device
212 * is enabled, then the clock is enabled. If the device is set
213 * to off or retention, then the clock is internally set as not
214 * being required by the device.(default)
215 * MSG_CLOCK_SW_STATE_REQ: Configure the clock to be enabled,
216 * regardless of the state of the device.
Tero Kristo81f44582019-05-28 16:10:24 +0300217 * @clk_id_32: Clock identifier for the device for this request.
218 * Only to be used if the clock ID is greater than or equal to
219 * 255.
Nishanth Menon9f723222016-10-18 18:08:36 -0500220 *
221 * Normally, all required clocks are managed by TISCI entity, this is used
222 * only for specific control *IF* required. Auto managed state is
223 * MSG_CLOCK_SW_STATE_AUTO, in other states, TISCI entity assume remote
224 * will explicitly control.
225 *
226 * Request type is TI_SCI_MSG_SET_CLOCK_STATE, response is a generic
227 * ACK or NACK message.
228 */
229struct ti_sci_msg_req_set_clock_state {
230 /* Additional hdr->flags options */
231#define MSG_FLAG_CLOCK_ALLOW_SSC TI_SCI_MSG_FLAG(8)
232#define MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE TI_SCI_MSG_FLAG(9)
233#define MSG_FLAG_CLOCK_INPUT_TERM TI_SCI_MSG_FLAG(10)
234 struct ti_sci_msg_hdr hdr;
235 u32 dev_id;
236 u8 clk_id;
237#define MSG_CLOCK_SW_STATE_UNREQ 0
238#define MSG_CLOCK_SW_STATE_AUTO 1
239#define MSG_CLOCK_SW_STATE_REQ 2
240 u8 request_state;
Tero Kristo81f44582019-05-28 16:10:24 +0300241 u32 clk_id_32;
Nishanth Menon9f723222016-10-18 18:08:36 -0500242} __packed;
243
244/**
245 * struct ti_sci_msg_req_get_clock_state - Request for clock state
246 * @hdr: Generic Header
247 * @dev_id: Device identifier this request is for
248 * @clk_id: Clock identifier for the device for this request.
249 * Each device has it's own set of clock inputs. This indexes
Tero Kristo81f44582019-05-28 16:10:24 +0300250 * which clock input to get state of. Set to 255 if the clock
251 * ID is greater than or equal to 255.
252 * @clk_id_32: Clock identifier for the device for the request.
253 * Only to be used if the clock ID is greater than or equal to
254 * 255.
Nishanth Menon9f723222016-10-18 18:08:36 -0500255 *
256 * Request type is TI_SCI_MSG_GET_CLOCK_STATE, response is state
257 * of the clock
258 */
259struct ti_sci_msg_req_get_clock_state {
260 struct ti_sci_msg_hdr hdr;
261 u32 dev_id;
262 u8 clk_id;
Tero Kristo81f44582019-05-28 16:10:24 +0300263 u32 clk_id_32;
Nishanth Menon9f723222016-10-18 18:08:36 -0500264} __packed;
265
266/**
267 * struct ti_sci_msg_resp_get_clock_state - Response to get clock state
268 * @hdr: Generic Header
269 * @programmed_state: Any programmed state of the clock. This is one of
270 * MSG_CLOCK_SW_STATE* values.
271 * @current_state: Current state of the clock. This is one of:
272 * MSG_CLOCK_HW_STATE_NOT_READY: Clock is not ready
273 * MSG_CLOCK_HW_STATE_READY: Clock is ready
274 *
275 * Response to TI_SCI_MSG_GET_CLOCK_STATE.
276 */
277struct ti_sci_msg_resp_get_clock_state {
278 struct ti_sci_msg_hdr hdr;
279 u8 programmed_state;
280#define MSG_CLOCK_HW_STATE_NOT_READY 0
281#define MSG_CLOCK_HW_STATE_READY 1
282 u8 current_state;
283} __packed;
284
285/**
286 * struct ti_sci_msg_req_set_clock_parent - Set the clock parent
287 * @hdr: Generic Header
288 * @dev_id: Device identifier this request is for
289 * @clk_id: Clock identifier for the device for this request.
290 * Each device has it's own set of clock inputs. This indexes
Tero Kristo81f44582019-05-28 16:10:24 +0300291 * which clock input to modify. Set to 255 if clock ID is
292 * greater than or equal to 255.
Nishanth Menon9f723222016-10-18 18:08:36 -0500293 * @parent_id: The new clock parent is selectable by an index via this
Tero Kristo81f44582019-05-28 16:10:24 +0300294 * parameter. Set to 255 if clock ID is greater than or
295 * equal to 255.
296 * @clk_id_32: Clock identifier if @clk_id field is 255.
297 * @parent_id_32: Parent identifier if @parent_id is 255.
Nishanth Menon9f723222016-10-18 18:08:36 -0500298 *
299 * Request type is TI_SCI_MSG_SET_CLOCK_PARENT, response is generic
300 * ACK / NACK message.
301 */
302struct ti_sci_msg_req_set_clock_parent {
303 struct ti_sci_msg_hdr hdr;
304 u32 dev_id;
305 u8 clk_id;
306 u8 parent_id;
Tero Kristo81f44582019-05-28 16:10:24 +0300307 u32 clk_id_32;
308 u32 parent_id_32;
Nishanth Menon9f723222016-10-18 18:08:36 -0500309} __packed;
310
311/**
312 * struct ti_sci_msg_req_get_clock_parent - Get the clock parent
313 * @hdr: Generic Header
314 * @dev_id: Device identifier this request is for
315 * @clk_id: Clock identifier for the device for this request.
316 * Each device has it's own set of clock inputs. This indexes
Tero Kristo81f44582019-05-28 16:10:24 +0300317 * which clock input to get the parent for. If this field
318 * contains 255, the actual clock identifier is stored in
319 * @clk_id_32.
320 * @clk_id_32: Clock identifier if the @clk_id field contains 255.
Nishanth Menon9f723222016-10-18 18:08:36 -0500321 *
322 * Request type is TI_SCI_MSG_GET_CLOCK_PARENT, response is parent information
323 */
324struct ti_sci_msg_req_get_clock_parent {
325 struct ti_sci_msg_hdr hdr;
326 u32 dev_id;
327 u8 clk_id;
Tero Kristo81f44582019-05-28 16:10:24 +0300328 u32 clk_id_32;
Nishanth Menon9f723222016-10-18 18:08:36 -0500329} __packed;
330
331/**
332 * struct ti_sci_msg_resp_get_clock_parent - Response with clock parent
333 * @hdr: Generic Header
Tero Kristo81f44582019-05-28 16:10:24 +0300334 * @parent_id: The current clock parent. If set to 255, the current parent
335 * ID can be found from the @parent_id_32 field.
336 * @parent_id_32: Current clock parent if @parent_id field is set to
337 * 255.
Nishanth Menon9f723222016-10-18 18:08:36 -0500338 *
339 * Response to TI_SCI_MSG_GET_CLOCK_PARENT.
340 */
341struct ti_sci_msg_resp_get_clock_parent {
342 struct ti_sci_msg_hdr hdr;
343 u8 parent_id;
Tero Kristo81f44582019-05-28 16:10:24 +0300344 u32 parent_id_32;
Nishanth Menon9f723222016-10-18 18:08:36 -0500345} __packed;
346
347/**
348 * struct ti_sci_msg_req_get_clock_num_parents - Request to get clock parents
349 * @hdr: Generic header
350 * @dev_id: Device identifier this request is for
Tero Kristo81f44582019-05-28 16:10:24 +0300351 * @clk_id: Clock identifier for the device for this request. Set to
352 * 255 if clock ID is greater than or equal to 255.
353 * @clk_id_32: Clock identifier if the @clk_id field contains 255.
Nishanth Menon9f723222016-10-18 18:08:36 -0500354 *
355 * This request provides information about how many clock parent options
356 * are available for a given clock to a device. This is typically used
357 * for input clocks.
358 *
359 * Request type is TI_SCI_MSG_GET_NUM_CLOCK_PARENTS, response is appropriate
360 * message, or NACK in case of inability to satisfy request.
361 */
362struct ti_sci_msg_req_get_clock_num_parents {
363 struct ti_sci_msg_hdr hdr;
364 u32 dev_id;
365 u8 clk_id;
Tero Kristo81f44582019-05-28 16:10:24 +0300366 u32 clk_id_32;
Nishanth Menon9f723222016-10-18 18:08:36 -0500367} __packed;
368
369/**
370 * struct ti_sci_msg_resp_get_clock_num_parents - Response for get clk parents
371 * @hdr: Generic header
Tero Kristo81f44582019-05-28 16:10:24 +0300372 * @num_parents: Number of clock parents. If set to 255, the actual
373 * number of parents is stored into @num_parents_32
374 * field instead.
375 * @num_parents_32: Number of clock parents if @num_parents field is
376 * set to 255.
Nishanth Menon9f723222016-10-18 18:08:36 -0500377 *
378 * Response to TI_SCI_MSG_GET_NUM_CLOCK_PARENTS
379 */
380struct ti_sci_msg_resp_get_clock_num_parents {
381 struct ti_sci_msg_hdr hdr;
382 u8 num_parents;
Tero Kristo81f44582019-05-28 16:10:24 +0300383 u32 num_parents_32;
Nishanth Menon9f723222016-10-18 18:08:36 -0500384} __packed;
385
386/**
387 * struct ti_sci_msg_req_query_clock_freq - Request to query a frequency
388 * @hdr: Generic Header
389 * @dev_id: Device identifier this request is for
390 * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum
391 * allowable programmed frequency and does not account for clock
392 * tolerances and jitter.
393 * @target_freq_hz: The target clock frequency. A frequency will be found
394 * as close to this target frequency as possible.
395 * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum
396 * allowable programmed frequency and does not account for clock
397 * tolerances and jitter.
Tero Kristo81f44582019-05-28 16:10:24 +0300398 * @clk_id: Clock identifier for the device for this request. Set to
399 * 255 if clock identifier is greater than or equal to 255.
400 * @clk_id_32: Clock identifier if @clk_id is set to 255.
Nishanth Menon9f723222016-10-18 18:08:36 -0500401 *
402 * NOTE: Normally clock frequency management is automatically done by TISCI
403 * entity. In case of specific requests, TISCI evaluates capability to achieve
404 * requested frequency within provided range and responds with
405 * result message.
406 *
407 * Request type is TI_SCI_MSG_QUERY_CLOCK_FREQ, response is appropriate message,
408 * or NACK in case of inability to satisfy request.
409 */
410struct ti_sci_msg_req_query_clock_freq {
411 struct ti_sci_msg_hdr hdr;
412 u32 dev_id;
413 u64 min_freq_hz;
414 u64 target_freq_hz;
415 u64 max_freq_hz;
416 u8 clk_id;
Tero Kristo81f44582019-05-28 16:10:24 +0300417 u32 clk_id_32;
Nishanth Menon9f723222016-10-18 18:08:36 -0500418} __packed;
419
420/**
421 * struct ti_sci_msg_resp_query_clock_freq - Response to a clock frequency query
422 * @hdr: Generic Header
423 * @freq_hz: Frequency that is the best match in Hz.
424 *
425 * Response to request type TI_SCI_MSG_QUERY_CLOCK_FREQ. NOTE: if the request
426 * cannot be satisfied, the message will be of type NACK.
427 */
428struct ti_sci_msg_resp_query_clock_freq {
429 struct ti_sci_msg_hdr hdr;
430 u64 freq_hz;
431} __packed;
432
433/**
434 * struct ti_sci_msg_req_set_clock_freq - Request to setup a clock frequency
435 * @hdr: Generic Header
436 * @dev_id: Device identifier this request is for
437 * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum
438 * allowable programmed frequency and does not account for clock
439 * tolerances and jitter.
440 * @target_freq_hz: The target clock frequency. The clock will be programmed
441 * at a rate as close to this target frequency as possible.
442 * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum
443 * allowable programmed frequency and does not account for clock
444 * tolerances and jitter.
Tero Kristo81f44582019-05-28 16:10:24 +0300445 * @clk_id: Clock identifier for the device for this request. Set to
446 * 255 if clock ID is greater than or equal to 255.
447 * @clk_id_32: Clock identifier if @clk_id field is set to 255.
Nishanth Menon9f723222016-10-18 18:08:36 -0500448 *
449 * NOTE: Normally clock frequency management is automatically done by TISCI
450 * entity. In case of specific requests, TISCI evaluates capability to achieve
451 * requested range and responds with success/failure message.
452 *
453 * This sets the desired frequency for a clock within an allowable
454 * range. This message will fail on an enabled clock unless
455 * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE is set for the clock. Additionally,
456 * if other clocks have their frequency modified due to this message,
457 * they also must have the MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE or be disabled.
458 *
459 * Calling set frequency on a clock input to the SoC pseudo-device will
460 * inform the PMMC of that clock's frequency. Setting a frequency of
461 * zero will indicate the clock is disabled.
462 *
463 * Calling set frequency on clock outputs from the SoC pseudo-device will
464 * function similarly to setting the clock frequency on a device.
465 *
466 * Request type is TI_SCI_MSG_SET_CLOCK_FREQ, response is a generic ACK/NACK
467 * message.
468 */
469struct ti_sci_msg_req_set_clock_freq {
470 struct ti_sci_msg_hdr hdr;
471 u32 dev_id;
472 u64 min_freq_hz;
473 u64 target_freq_hz;
474 u64 max_freq_hz;
475 u8 clk_id;
Tero Kristo81f44582019-05-28 16:10:24 +0300476 u32 clk_id_32;
Nishanth Menon9f723222016-10-18 18:08:36 -0500477} __packed;
478
479/**
480 * struct ti_sci_msg_req_get_clock_freq - Request to get the clock frequency
481 * @hdr: Generic Header
482 * @dev_id: Device identifier this request is for
Tero Kristo81f44582019-05-28 16:10:24 +0300483 * @clk_id: Clock identifier for the device for this request. Set to
484 * 255 if clock ID is greater than or equal to 255.
485 * @clk_id_32: Clock identifier if @clk_id field is set to 255.
Nishanth Menon9f723222016-10-18 18:08:36 -0500486 *
487 * NOTE: Normally clock frequency management is automatically done by TISCI
488 * entity. In some cases, clock frequencies are configured by host.
489 *
490 * Request type is TI_SCI_MSG_GET_CLOCK_FREQ, responded with clock frequency
491 * that the clock is currently at.
492 */
493struct ti_sci_msg_req_get_clock_freq {
494 struct ti_sci_msg_hdr hdr;
495 u32 dev_id;
496 u8 clk_id;
Tero Kristo81f44582019-05-28 16:10:24 +0300497 u32 clk_id_32;
Nishanth Menon9f723222016-10-18 18:08:36 -0500498} __packed;
499
500/**
501 * struct ti_sci_msg_resp_get_clock_freq - Response of clock frequency request
502 * @hdr: Generic Header
503 * @freq_hz: Frequency that the clock is currently on, in Hz.
504 *
505 * Response to request type TI_SCI_MSG_GET_CLOCK_FREQ.
506 */
507struct ti_sci_msg_resp_get_clock_freq {
508 struct ti_sci_msg_hdr hdr;
509 u64 freq_hz;
510} __packed;
511
Lokesh Vutla9c19fb62019-04-30 15:42:18 +0530512#define TI_SCI_IRQ_SECONDARY_HOST_INVALID 0xff
513
514/**
515 * struct ti_sci_msg_req_get_resource_range - Request to get a host's assigned
516 * range of resources.
517 * @hdr: Generic Header
518 * @type: Unique resource assignment type
519 * @subtype: Resource assignment subtype within the resource type.
520 * @secondary_host: Host processing entity to which the resources are
521 * allocated. This is required only when the destination
522 * host id id different from ti sci interface host id,
523 * else TI_SCI_IRQ_SECONDARY_HOST_INVALID can be passed.
524 *
525 * Request type is TI_SCI_MSG_GET_RESOURCE_RANGE. Responded with requested
526 * resource range which is of type TI_SCI_MSG_GET_RESOURCE_RANGE.
527 */
528struct ti_sci_msg_req_get_resource_range {
529 struct ti_sci_msg_hdr hdr;
530#define MSG_RM_RESOURCE_TYPE_MASK GENMASK(9, 0)
531#define MSG_RM_RESOURCE_SUBTYPE_MASK GENMASK(5, 0)
532 u16 type;
533 u8 subtype;
534 u8 secondary_host;
535} __packed;
536
537/**
538 * struct ti_sci_msg_resp_get_resource_range - Response to resource get range.
539 * @hdr: Generic Header
540 * @range_start: Start index of the resource range.
541 * @range_num: Number of resources in the range.
542 *
543 * Response to request TI_SCI_MSG_GET_RESOURCE_RANGE.
544 */
545struct ti_sci_msg_resp_get_resource_range {
546 struct ti_sci_msg_hdr hdr;
547 u16 range_start;
548 u16 range_num;
549} __packed;
550
Lokesh Vutla997b0012019-04-30 15:42:19 +0530551/**
552 * struct ti_sci_msg_req_manage_irq - Request to configure/release the route
553 * between the dev and the host.
554 * @hdr: Generic Header
555 * @valid_params: Bit fields defining the validity of interrupt source
556 * parameters. If a bit is not set, then corresponding
557 * field is not valid and will not be used for route set.
558 * Bit field definitions:
559 * 0 - Valid bit for @dst_id
560 * 1 - Valid bit for @dst_host_irq
561 * 2 - Valid bit for @ia_id
562 * 3 - Valid bit for @vint
563 * 4 - Valid bit for @global_event
564 * 5 - Valid bit for @vint_status_bit_index
565 * 31 - Valid bit for @secondary_host
566 * @src_id: IRQ source peripheral ID.
567 * @src_index: IRQ source index within the peripheral
568 * @dst_id: IRQ Destination ID. Based on the architecture it can be
569 * IRQ controller or host processor ID.
570 * @dst_host_irq: IRQ number of the destination host IRQ controller
571 * @ia_id: Device ID of the interrupt aggregator in which the
572 * vint resides.
573 * @vint: Virtual interrupt number if the interrupt route
574 * is through an interrupt aggregator.
575 * @global_event: Global event that is to be mapped to interrupt
576 * aggregator virtual interrupt status bit.
577 * @vint_status_bit: Virtual interrupt status bit if the interrupt route
578 * utilizes an interrupt aggregator status bit.
579 * @secondary_host: Host ID of the IRQ destination computing entity. This is
580 * required only when destination host id is different
581 * from ti sci interface host id.
582 *
583 * Request type is TI_SCI_MSG_SET/RELEASE_IRQ.
584 * Response is generic ACK / NACK message.
585 */
586struct ti_sci_msg_req_manage_irq {
587 struct ti_sci_msg_hdr hdr;
588#define MSG_FLAG_DST_ID_VALID TI_SCI_MSG_FLAG(0)
589#define MSG_FLAG_DST_HOST_IRQ_VALID TI_SCI_MSG_FLAG(1)
590#define MSG_FLAG_IA_ID_VALID TI_SCI_MSG_FLAG(2)
591#define MSG_FLAG_VINT_VALID TI_SCI_MSG_FLAG(3)
592#define MSG_FLAG_GLB_EVNT_VALID TI_SCI_MSG_FLAG(4)
593#define MSG_FLAG_VINT_STS_BIT_VALID TI_SCI_MSG_FLAG(5)
594#define MSG_FLAG_SHOST_VALID TI_SCI_MSG_FLAG(31)
595 u32 valid_params;
596 u16 src_id;
597 u16 src_index;
598 u16 dst_id;
599 u16 dst_host_irq;
600 u16 ia_id;
601 u16 vint;
602 u16 global_event;
603 u8 vint_status_bit;
604 u8 secondary_host;
605} __packed;
606
Nishanth Menonaa276782016-10-18 18:08:34 -0500607#endif /* __TI_SCI_H */