xref: /arm-trusted-firmware/plat/ti/k3/common/drivers/ti_sci/ti_sci_protocol.h (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700Schasinglulu /*
2*91f16700Schasinglulu  * Texas Instruments System Control Interface (TISCI) Protocol
3*91f16700Schasinglulu  *
4*91f16700Schasinglulu  * Communication protocol with TI SCI hardware
5*91f16700Schasinglulu  * The system works in a message response protocol
6*91f16700Schasinglulu  * See: http://processors.wiki.ti.com/index.php/TISCI for details
7*91f16700Schasinglulu  *
8*91f16700Schasinglulu  * Copyright (C) 2018-2022 Texas Instruments Incorporated - https://www.ti.com/
9*91f16700Schasinglulu  *
10*91f16700Schasinglulu  * SPDX-License-Identifier: BSD-3-Clause
11*91f16700Schasinglulu  */
12*91f16700Schasinglulu 
13*91f16700Schasinglulu #ifndef TI_SCI_PROTOCOL_H
14*91f16700Schasinglulu #define TI_SCI_PROTOCOL_H
15*91f16700Schasinglulu 
16*91f16700Schasinglulu #include <stdint.h>
17*91f16700Schasinglulu 
18*91f16700Schasinglulu /* Generic Messages */
19*91f16700Schasinglulu #define TI_SCI_MSG_ENABLE_WDT		0x0000
20*91f16700Schasinglulu #define TI_SCI_MSG_WAKE_RESET		0x0001
21*91f16700Schasinglulu #define TI_SCI_MSG_VERSION		0x0002
22*91f16700Schasinglulu #define TI_SCI_MSG_WAKE_REASON		0x0003
23*91f16700Schasinglulu #define TI_SCI_MSG_GOODBYE		0x0004
24*91f16700Schasinglulu #define TI_SCI_MSG_SYS_RESET		0x0005
25*91f16700Schasinglulu #define TI_SCI_MSG_QUERY_FW_CAPS	0x0022
26*91f16700Schasinglulu 
27*91f16700Schasinglulu /* Device requests */
28*91f16700Schasinglulu #define TI_SCI_MSG_SET_DEVICE_STATE	0x0200
29*91f16700Schasinglulu #define TI_SCI_MSG_GET_DEVICE_STATE	0x0201
30*91f16700Schasinglulu #define TI_SCI_MSG_SET_DEVICE_RESETS	0x0202
31*91f16700Schasinglulu 
32*91f16700Schasinglulu /* Low Power Mode Requests */
33*91f16700Schasinglulu #define TI_SCI_MSG_ENTER_SLEEP		0x0301
34*91f16700Schasinglulu 
35*91f16700Schasinglulu /* Clock requests */
36*91f16700Schasinglulu #define TI_SCI_MSG_SET_CLOCK_STATE	0x0100
37*91f16700Schasinglulu #define TI_SCI_MSG_GET_CLOCK_STATE	0x0101
38*91f16700Schasinglulu #define TI_SCI_MSG_SET_CLOCK_PARENT	0x0102
39*91f16700Schasinglulu #define TI_SCI_MSG_GET_CLOCK_PARENT	0x0103
40*91f16700Schasinglulu #define TI_SCI_MSG_GET_NUM_CLOCK_PARENTS 0x0104
41*91f16700Schasinglulu #define TI_SCI_MSG_SET_CLOCK_FREQ	0x010c
42*91f16700Schasinglulu #define TI_SCI_MSG_QUERY_CLOCK_FREQ	0x010d
43*91f16700Schasinglulu #define TI_SCI_MSG_GET_CLOCK_FREQ	0x010e
44*91f16700Schasinglulu 
45*91f16700Schasinglulu /* Processor Control Messages */
46*91f16700Schasinglulu #define TISCI_MSG_PROC_REQUEST		0xc000
47*91f16700Schasinglulu #define TISCI_MSG_PROC_RELEASE		0xc001
48*91f16700Schasinglulu #define TISCI_MSG_PROC_HANDOVER		0xc005
49*91f16700Schasinglulu #define TISCI_MSG_SET_PROC_BOOT_CONFIG	0xc100
50*91f16700Schasinglulu #define TISCI_MSG_SET_PROC_BOOT_CTRL	0xc101
51*91f16700Schasinglulu #define TISCI_MSG_PROC_AUTH_BOOT_IMAGE	0xc120
52*91f16700Schasinglulu #define TISCI_MSG_GET_PROC_BOOT_STATUS	0xc400
53*91f16700Schasinglulu #define TISCI_MSG_WAIT_PROC_BOOT_STATUS	0xc401
54*91f16700Schasinglulu 
55*91f16700Schasinglulu /**
56*91f16700Schasinglulu  * struct ti_sci_msg_hdr - Generic Message Header for All messages and responses
57*91f16700Schasinglulu  * @type:	Type of messages: One of TI_SCI_MSG* values
58*91f16700Schasinglulu  * @host:	Host of the message
59*91f16700Schasinglulu  * @seq:	Message identifier indicating a transfer sequence
60*91f16700Schasinglulu  * @flags:	Flag for the message
61*91f16700Schasinglulu  */
62*91f16700Schasinglulu struct ti_sci_msg_hdr {
63*91f16700Schasinglulu 	uint16_t type;
64*91f16700Schasinglulu 	uint8_t host;
65*91f16700Schasinglulu 	uint8_t seq;
66*91f16700Schasinglulu #define TI_SCI_MSG_FLAG(val)			(1 << (val))
67*91f16700Schasinglulu #define TI_SCI_FLAG_REQ_GENERIC_NORESPONSE	0x0
68*91f16700Schasinglulu #define TI_SCI_FLAG_REQ_ACK_ON_RECEIVED		TI_SCI_MSG_FLAG(0)
69*91f16700Schasinglulu #define TI_SCI_FLAG_REQ_ACK_ON_PROCESSED	TI_SCI_MSG_FLAG(1)
70*91f16700Schasinglulu #define TI_SCI_FLAG_RESP_GENERIC_NACK		0x0
71*91f16700Schasinglulu #define TI_SCI_FLAG_RESP_GENERIC_ACK		TI_SCI_MSG_FLAG(1)
72*91f16700Schasinglulu 	/* Additional Flags */
73*91f16700Schasinglulu 	uint32_t flags;
74*91f16700Schasinglulu } __packed;
75*91f16700Schasinglulu 
76*91f16700Schasinglulu /**
77*91f16700Schasinglulu  * struct ti_sci_msg_version_req - Request for firmware version information
78*91f16700Schasinglulu  * @hdr:	Generic header
79*91f16700Schasinglulu  *
80*91f16700Schasinglulu  * Request for TI_SCI_MSG_VERSION
81*91f16700Schasinglulu  */
82*91f16700Schasinglulu struct ti_sci_msg_req_version {
83*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
84*91f16700Schasinglulu } __packed;
85*91f16700Schasinglulu 
86*91f16700Schasinglulu /**
87*91f16700Schasinglulu  * struct ti_sci_msg_resp_version - Response for firmware version information
88*91f16700Schasinglulu  * @hdr:		Generic header
89*91f16700Schasinglulu  * @firmware_description: String describing the firmware
90*91f16700Schasinglulu  * @firmware_revision:	Firmware revision
91*91f16700Schasinglulu  * @abi_major:		Major version of the ABI that firmware supports
92*91f16700Schasinglulu  * @abi_minor:		Minor version of the ABI that firmware supports
93*91f16700Schasinglulu  * @sub_version:	Sub-version number of the firmware
94*91f16700Schasinglulu  * @patch_version:	Patch-version number of the firmware.
95*91f16700Schasinglulu  *
96*91f16700Schasinglulu  * In general, ABI version changes follow the rule that minor version increments
97*91f16700Schasinglulu  * are backward compatible. Major revision changes in ABI may not be
98*91f16700Schasinglulu  * backward compatible.
99*91f16700Schasinglulu  *
100*91f16700Schasinglulu  * Response to request TI_SCI_MSG_VERSION
101*91f16700Schasinglulu  */
102*91f16700Schasinglulu struct ti_sci_msg_resp_version {
103*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
104*91f16700Schasinglulu #define FIRMWARE_DESCRIPTION_LENGTH 32
105*91f16700Schasinglulu 	char firmware_description[FIRMWARE_DESCRIPTION_LENGTH];
106*91f16700Schasinglulu 	uint16_t firmware_revision;
107*91f16700Schasinglulu 	uint8_t abi_major;
108*91f16700Schasinglulu 	uint8_t abi_minor;
109*91f16700Schasinglulu 	uint8_t sub_version;
110*91f16700Schasinglulu 	uint8_t patch_version;
111*91f16700Schasinglulu } __packed;
112*91f16700Schasinglulu 
113*91f16700Schasinglulu /**
114*91f16700Schasinglulu  * struct ti_sci_msg_req_reboot - Reboot the SoC
115*91f16700Schasinglulu  * @hdr:	Generic Header
116*91f16700Schasinglulu  * @domain:	Domain to be reset, 0 for full SoC reboot
117*91f16700Schasinglulu  *
118*91f16700Schasinglulu  * Request type is TI_SCI_MSG_SYS_RESET, responded with a generic
119*91f16700Schasinglulu  * ACK/NACK message.
120*91f16700Schasinglulu  */
121*91f16700Schasinglulu struct ti_sci_msg_req_reboot {
122*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
123*91f16700Schasinglulu #define TI_SCI_DOMAIN_FULL_SOC_RESET	0x0
124*91f16700Schasinglulu 	uint8_t domain;
125*91f16700Schasinglulu } __packed;
126*91f16700Schasinglulu 
127*91f16700Schasinglulu /**
128*91f16700Schasinglulu  * struct ti_sci_msg_resp_query_fw_caps - Response for query firmware caps
129*91f16700Schasinglulu  * @hdr:	Generic header
130*91f16700Schasinglulu  * @fw_caps:	Each bit in fw_caps indicating one FW/SOC capability
131*91f16700Schasinglulu  *		MSG_FLAG_CAPS_GENERIC: Generic capability (LPM not supported)
132*91f16700Schasinglulu  *		MSG_FLAG_CAPS_LPM_DEEP_SLEEP: Deep Sleep LPM
133*91f16700Schasinglulu  *		MSG_FLAG_CAPS_LPM_MCU_ONLY: MCU only LPM
134*91f16700Schasinglulu  *		MSG_FLAG_CAPS_LPM_STANDBY: Standby LPM
135*91f16700Schasinglulu  *		MSG_FLAG_CAPS_LPM_PARTIAL_IO: Partial IO in LPM
136*91f16700Schasinglulu  *
137*91f16700Schasinglulu  * Response to a generic message with message type TI_SCI_MSG_QUERY_FW_CAPS
138*91f16700Schasinglulu  * providing currently available SOC/firmware capabilities. SoC that don't
139*91f16700Schasinglulu  * support low power modes return only MSG_FLAG_CAPS_GENERIC capability.
140*91f16700Schasinglulu  */
141*91f16700Schasinglulu struct ti_sci_msg_resp_query_fw_caps {
142*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
143*91f16700Schasinglulu #define MSG_FLAG_CAPS_GENERIC		TI_SCI_MSG_FLAG(0)
144*91f16700Schasinglulu #define MSG_FLAG_CAPS_LPM_DEEP_SLEEP	TI_SCI_MSG_FLAG(1)
145*91f16700Schasinglulu #define MSG_FLAG_CAPS_LPM_MCU_ONLY	TI_SCI_MSG_FLAG(2)
146*91f16700Schasinglulu #define MSG_FLAG_CAPS_LPM_STANDBY	TI_SCI_MSG_FLAG(3)
147*91f16700Schasinglulu #define MSG_FLAG_CAPS_LPM_PARTIAL_IO	TI_SCI_MSG_FLAG(4)
148*91f16700Schasinglulu 	uint64_t fw_caps;
149*91f16700Schasinglulu } __packed;
150*91f16700Schasinglulu 
151*91f16700Schasinglulu /**
152*91f16700Schasinglulu  * struct ti_sci_msg_req_set_device_state - Set the desired state of the device
153*91f16700Schasinglulu  * @hdr:		Generic header
154*91f16700Schasinglulu  * @id:	Indicates which device to modify
155*91f16700Schasinglulu  * @reserved: Reserved space in message, must be 0 for backward compatibility
156*91f16700Schasinglulu  * @state: The desired state of the device.
157*91f16700Schasinglulu  *
158*91f16700Schasinglulu  * Certain flags can also be set to alter the device state:
159*91f16700Schasinglulu  * + MSG_FLAG_DEVICE_WAKE_ENABLED - Configure the device to be a wake source.
160*91f16700Schasinglulu  * The meaning of this flag will vary slightly from device to device and from
161*91f16700Schasinglulu  * SoC to SoC but it generally allows the device to wake the SoC out of deep
162*91f16700Schasinglulu  * suspend states.
163*91f16700Schasinglulu  * + MSG_FLAG_DEVICE_RESET_ISO - Enable reset isolation for this device.
164*91f16700Schasinglulu  * + MSG_FLAG_DEVICE_EXCLUSIVE - Claim this device exclusively. When passed
165*91f16700Schasinglulu  * with STATE_RETENTION or STATE_ON, it will claim the device exclusively.
166*91f16700Schasinglulu  * If another host already has this device set to STATE_RETENTION or STATE_ON,
167*91f16700Schasinglulu  * the message will fail. Once successful, other hosts attempting to set
168*91f16700Schasinglulu  * STATE_RETENTION or STATE_ON will fail.
169*91f16700Schasinglulu  *
170*91f16700Schasinglulu  * Request type is TI_SCI_MSG_SET_DEVICE_STATE, responded with a generic
171*91f16700Schasinglulu  * ACK/NACK message.
172*91f16700Schasinglulu  */
173*91f16700Schasinglulu struct ti_sci_msg_req_set_device_state {
174*91f16700Schasinglulu 	/* Additional hdr->flags options */
175*91f16700Schasinglulu #define MSG_FLAG_DEVICE_WAKE_ENABLED	TI_SCI_MSG_FLAG(8)
176*91f16700Schasinglulu #define MSG_FLAG_DEVICE_RESET_ISO	TI_SCI_MSG_FLAG(9)
177*91f16700Schasinglulu #define MSG_FLAG_DEVICE_EXCLUSIVE	TI_SCI_MSG_FLAG(10)
178*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
179*91f16700Schasinglulu 	uint32_t id;
180*91f16700Schasinglulu 	uint32_t reserved;
181*91f16700Schasinglulu 
182*91f16700Schasinglulu #define MSG_DEVICE_SW_STATE_AUTO_OFF	0
183*91f16700Schasinglulu #define MSG_DEVICE_SW_STATE_RETENTION	1
184*91f16700Schasinglulu #define MSG_DEVICE_SW_STATE_ON		2
185*91f16700Schasinglulu 	uint8_t state;
186*91f16700Schasinglulu } __packed;
187*91f16700Schasinglulu 
188*91f16700Schasinglulu /**
189*91f16700Schasinglulu  * struct ti_sci_msg_req_get_device_state - Request to get device.
190*91f16700Schasinglulu  * @hdr:		Generic header
191*91f16700Schasinglulu  * @id:		Device Identifier
192*91f16700Schasinglulu  *
193*91f16700Schasinglulu  * Request type is TI_SCI_MSG_GET_DEVICE_STATE, responded device state
194*91f16700Schasinglulu  * information
195*91f16700Schasinglulu  */
196*91f16700Schasinglulu struct ti_sci_msg_req_get_device_state {
197*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
198*91f16700Schasinglulu 	uint32_t id;
199*91f16700Schasinglulu } __packed;
200*91f16700Schasinglulu 
201*91f16700Schasinglulu /**
202*91f16700Schasinglulu  * struct ti_sci_msg_resp_get_device_state - Response to get device request.
203*91f16700Schasinglulu  * @hdr:		Generic header
204*91f16700Schasinglulu  * @context_loss_count: Indicates how many times the device has lost context. A
205*91f16700Schasinglulu  *	driver can use this monotonic counter to determine if the device has
206*91f16700Schasinglulu  *	lost context since the last time this message was exchanged.
207*91f16700Schasinglulu  * @resets: Programmed state of the reset lines.
208*91f16700Schasinglulu  * @programmed_state:	The state as programmed by set_device.
209*91f16700Schasinglulu  *			- Uses the MSG_DEVICE_SW_* macros
210*91f16700Schasinglulu  * @current_state:	The actual state of the hardware.
211*91f16700Schasinglulu  *
212*91f16700Schasinglulu  * Response to request TI_SCI_MSG_GET_DEVICE_STATE.
213*91f16700Schasinglulu  */
214*91f16700Schasinglulu struct ti_sci_msg_resp_get_device_state {
215*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
216*91f16700Schasinglulu 	uint32_t context_loss_count;
217*91f16700Schasinglulu 	uint32_t resets;
218*91f16700Schasinglulu 	uint8_t programmed_state;
219*91f16700Schasinglulu #define MSG_DEVICE_HW_STATE_OFF		0
220*91f16700Schasinglulu #define MSG_DEVICE_HW_STATE_ON		1
221*91f16700Schasinglulu #define MSG_DEVICE_HW_STATE_TRANS	2
222*91f16700Schasinglulu 	uint8_t current_state;
223*91f16700Schasinglulu } __packed;
224*91f16700Schasinglulu 
225*91f16700Schasinglulu /**
226*91f16700Schasinglulu  * struct ti_sci_msg_req_set_device_resets - Set the desired resets
227*91f16700Schasinglulu  *				configuration of the device
228*91f16700Schasinglulu  * @hdr:		Generic header
229*91f16700Schasinglulu  * @id:	Indicates which device to modify
230*91f16700Schasinglulu  * @resets: A bit field of resets for the device. The meaning, behavior,
231*91f16700Schasinglulu  *	and usage of the reset flags are device specific. 0 for a bit
232*91f16700Schasinglulu  *	indicates releasing the reset represented by that bit while 1
233*91f16700Schasinglulu  *	indicates keeping it held.
234*91f16700Schasinglulu  *
235*91f16700Schasinglulu  * Request type is TI_SCI_MSG_SET_DEVICE_RESETS, responded with a generic
236*91f16700Schasinglulu  * ACK/NACK message.
237*91f16700Schasinglulu  */
238*91f16700Schasinglulu struct ti_sci_msg_req_set_device_resets {
239*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
240*91f16700Schasinglulu 	uint32_t id;
241*91f16700Schasinglulu 	uint32_t resets;
242*91f16700Schasinglulu } __packed;
243*91f16700Schasinglulu 
244*91f16700Schasinglulu /**
245*91f16700Schasinglulu  * struct ti_sci_msg_req_set_clock_state - Request to setup a Clock state
246*91f16700Schasinglulu  * @hdr:	Generic Header, Certain flags can be set specific to the clocks:
247*91f16700Schasinglulu  *		MSG_FLAG_CLOCK_ALLOW_SSC: Allow this clock to be modified
248*91f16700Schasinglulu  *		via spread spectrum clocking.
249*91f16700Schasinglulu  *		MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE: Allow this clock's
250*91f16700Schasinglulu  *		frequency to be changed while it is running so long as it
251*91f16700Schasinglulu  *		is within the min/max limits.
252*91f16700Schasinglulu  *		MSG_FLAG_CLOCK_INPUT_TERM: Enable input termination, this
253*91f16700Schasinglulu  *		is only applicable to clock inputs on the SoC pseudo-device.
254*91f16700Schasinglulu  * @dev_id:	Device identifier this request is for
255*91f16700Schasinglulu  * @clk_id:	Clock identifier for the device for this request.
256*91f16700Schasinglulu  *		Each device has it's own set of clock inputs. This indexes
257*91f16700Schasinglulu  *		which clock input to modify.
258*91f16700Schasinglulu  * @request_state: Request the state for the clock to be set to.
259*91f16700Schasinglulu  *		MSG_CLOCK_SW_STATE_UNREQ: The IP does not require this clock,
260*91f16700Schasinglulu  *		it can be disabled, regardless of the state of the device
261*91f16700Schasinglulu  *		MSG_CLOCK_SW_STATE_AUTO: Allow the System Controller to
262*91f16700Schasinglulu  *		automatically manage the state of this clock. If the device
263*91f16700Schasinglulu  *		is enabled, then the clock is enabled. If the device is set
264*91f16700Schasinglulu  *		to off or retention, then the clock is internally set as not
265*91f16700Schasinglulu  *		being required by the device.(default)
266*91f16700Schasinglulu  *		MSG_CLOCK_SW_STATE_REQ:  Configure the clock to be enabled,
267*91f16700Schasinglulu  *		regardless of the state of the device.
268*91f16700Schasinglulu  *
269*91f16700Schasinglulu  * Normally, all required clocks are managed by TISCI entity, this is used
270*91f16700Schasinglulu  * only for specific control *IF* required. Auto managed state is
271*91f16700Schasinglulu  * MSG_CLOCK_SW_STATE_AUTO, in other states, TISCI entity assume remote
272*91f16700Schasinglulu  * will explicitly control.
273*91f16700Schasinglulu  *
274*91f16700Schasinglulu  * Request type is TI_SCI_MSG_SET_CLOCK_STATE, response is a generic
275*91f16700Schasinglulu  * ACK or NACK message.
276*91f16700Schasinglulu  */
277*91f16700Schasinglulu struct ti_sci_msg_req_set_clock_state {
278*91f16700Schasinglulu 	/* Additional hdr->flags options */
279*91f16700Schasinglulu #define MSG_FLAG_CLOCK_ALLOW_SSC		TI_SCI_MSG_FLAG(8)
280*91f16700Schasinglulu #define MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE	TI_SCI_MSG_FLAG(9)
281*91f16700Schasinglulu #define MSG_FLAG_CLOCK_INPUT_TERM		TI_SCI_MSG_FLAG(10)
282*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
283*91f16700Schasinglulu 	uint32_t dev_id;
284*91f16700Schasinglulu 	uint8_t clk_id;
285*91f16700Schasinglulu #define MSG_CLOCK_SW_STATE_UNREQ	0
286*91f16700Schasinglulu #define MSG_CLOCK_SW_STATE_AUTO		1
287*91f16700Schasinglulu #define MSG_CLOCK_SW_STATE_REQ		2
288*91f16700Schasinglulu 	uint8_t request_state;
289*91f16700Schasinglulu } __packed;
290*91f16700Schasinglulu 
291*91f16700Schasinglulu /**
292*91f16700Schasinglulu  * struct ti_sci_msg_req_get_clock_state - Request for clock state
293*91f16700Schasinglulu  * @hdr:	Generic Header
294*91f16700Schasinglulu  * @dev_id:	Device identifier this request is for
295*91f16700Schasinglulu  * @clk_id:	Clock identifier for the device for this request.
296*91f16700Schasinglulu  *		Each device has it's own set of clock inputs. This indexes
297*91f16700Schasinglulu  *		which clock input to get state of.
298*91f16700Schasinglulu  *
299*91f16700Schasinglulu  * Request type is TI_SCI_MSG_GET_CLOCK_STATE, response is state
300*91f16700Schasinglulu  * of the clock
301*91f16700Schasinglulu  */
302*91f16700Schasinglulu struct ti_sci_msg_req_get_clock_state {
303*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
304*91f16700Schasinglulu 	uint32_t dev_id;
305*91f16700Schasinglulu 	uint8_t clk_id;
306*91f16700Schasinglulu } __packed;
307*91f16700Schasinglulu 
308*91f16700Schasinglulu /**
309*91f16700Schasinglulu  * struct ti_sci_msg_resp_get_clock_state - Response to get clock state
310*91f16700Schasinglulu  * @hdr:	Generic Header
311*91f16700Schasinglulu  * @programmed_state: Any programmed state of the clock. This is one of
312*91f16700Schasinglulu  *		MSG_CLOCK_SW_STATE* values.
313*91f16700Schasinglulu  * @current_state: Current state of the clock. This is one of:
314*91f16700Schasinglulu  *		MSG_CLOCK_HW_STATE_NOT_READY: Clock is not ready
315*91f16700Schasinglulu  *		MSG_CLOCK_HW_STATE_READY: Clock is ready
316*91f16700Schasinglulu  *
317*91f16700Schasinglulu  * Response to TI_SCI_MSG_GET_CLOCK_STATE.
318*91f16700Schasinglulu  */
319*91f16700Schasinglulu struct ti_sci_msg_resp_get_clock_state {
320*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
321*91f16700Schasinglulu 	uint8_t programmed_state;
322*91f16700Schasinglulu #define MSG_CLOCK_HW_STATE_NOT_READY	0
323*91f16700Schasinglulu #define MSG_CLOCK_HW_STATE_READY	1
324*91f16700Schasinglulu 	uint8_t current_state;
325*91f16700Schasinglulu } __packed;
326*91f16700Schasinglulu 
327*91f16700Schasinglulu /**
328*91f16700Schasinglulu  * struct ti_sci_msg_req_set_clock_parent - Set the clock parent
329*91f16700Schasinglulu  * @hdr:	Generic Header
330*91f16700Schasinglulu  * @dev_id:	Device identifier this request is for
331*91f16700Schasinglulu  * @clk_id:	Clock identifier for the device for this request.
332*91f16700Schasinglulu  *		Each device has it's own set of clock inputs. This indexes
333*91f16700Schasinglulu  *		which clock input to modify.
334*91f16700Schasinglulu  * @parent_id:	The new clock parent is selectable by an index via this
335*91f16700Schasinglulu  *		parameter.
336*91f16700Schasinglulu  *
337*91f16700Schasinglulu  * Request type is TI_SCI_MSG_SET_CLOCK_PARENT, response is generic
338*91f16700Schasinglulu  * ACK / NACK message.
339*91f16700Schasinglulu  */
340*91f16700Schasinglulu struct ti_sci_msg_req_set_clock_parent {
341*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
342*91f16700Schasinglulu 	uint32_t dev_id;
343*91f16700Schasinglulu 	uint8_t clk_id;
344*91f16700Schasinglulu 	uint8_t parent_id;
345*91f16700Schasinglulu } __packed;
346*91f16700Schasinglulu 
347*91f16700Schasinglulu /**
348*91f16700Schasinglulu  * struct ti_sci_msg_req_get_clock_parent - Get the clock parent
349*91f16700Schasinglulu  * @hdr:	Generic Header
350*91f16700Schasinglulu  * @dev_id:	Device identifier this request is for
351*91f16700Schasinglulu  * @clk_id:	Clock identifier for the device for this request.
352*91f16700Schasinglulu  *		Each device has it's own set of clock inputs. This indexes
353*91f16700Schasinglulu  *		which clock input to get the parent for.
354*91f16700Schasinglulu  *
355*91f16700Schasinglulu  * Request type is TI_SCI_MSG_GET_CLOCK_PARENT, response is parent information
356*91f16700Schasinglulu  */
357*91f16700Schasinglulu struct ti_sci_msg_req_get_clock_parent {
358*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
359*91f16700Schasinglulu 	uint32_t dev_id;
360*91f16700Schasinglulu 	uint8_t clk_id;
361*91f16700Schasinglulu } __packed;
362*91f16700Schasinglulu 
363*91f16700Schasinglulu /**
364*91f16700Schasinglulu  * struct ti_sci_msg_resp_get_clock_parent - Response with clock parent
365*91f16700Schasinglulu  * @hdr:	Generic Header
366*91f16700Schasinglulu  * @parent_id:	The current clock parent
367*91f16700Schasinglulu  *
368*91f16700Schasinglulu  * Response to TI_SCI_MSG_GET_CLOCK_PARENT.
369*91f16700Schasinglulu  */
370*91f16700Schasinglulu struct ti_sci_msg_resp_get_clock_parent {
371*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
372*91f16700Schasinglulu 	uint8_t parent_id;
373*91f16700Schasinglulu } __packed;
374*91f16700Schasinglulu 
375*91f16700Schasinglulu /**
376*91f16700Schasinglulu  * struct ti_sci_msg_req_get_clock_num_parents - Request to get clock parents
377*91f16700Schasinglulu  * @hdr:	Generic header
378*91f16700Schasinglulu  * @dev_id:	Device identifier this request is for
379*91f16700Schasinglulu  * @clk_id:	Clock identifier for the device for this request.
380*91f16700Schasinglulu  *
381*91f16700Schasinglulu  * This request provides information about how many clock parent options
382*91f16700Schasinglulu  * are available for a given clock to a device. This is typically used
383*91f16700Schasinglulu  * for input clocks.
384*91f16700Schasinglulu  *
385*91f16700Schasinglulu  * Request type is TI_SCI_MSG_GET_NUM_CLOCK_PARENTS, response is appropriate
386*91f16700Schasinglulu  * message, or NACK in case of inability to satisfy request.
387*91f16700Schasinglulu  */
388*91f16700Schasinglulu struct ti_sci_msg_req_get_clock_num_parents {
389*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
390*91f16700Schasinglulu 	uint32_t dev_id;
391*91f16700Schasinglulu 	uint8_t clk_id;
392*91f16700Schasinglulu } __packed;
393*91f16700Schasinglulu 
394*91f16700Schasinglulu /**
395*91f16700Schasinglulu  * struct ti_sci_msg_resp_get_clock_num_parents - Response for get clk parents
396*91f16700Schasinglulu  * @hdr:		Generic header
397*91f16700Schasinglulu  * @num_parents:	Number of clock parents
398*91f16700Schasinglulu  *
399*91f16700Schasinglulu  * Response to TI_SCI_MSG_GET_NUM_CLOCK_PARENTS
400*91f16700Schasinglulu  */
401*91f16700Schasinglulu struct ti_sci_msg_resp_get_clock_num_parents {
402*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
403*91f16700Schasinglulu 	uint8_t num_parents;
404*91f16700Schasinglulu } __packed;
405*91f16700Schasinglulu 
406*91f16700Schasinglulu /**
407*91f16700Schasinglulu  * struct ti_sci_msg_req_query_clock_freq - Request to query a frequency
408*91f16700Schasinglulu  * @hdr:	Generic Header
409*91f16700Schasinglulu  * @dev_id:	Device identifier this request is for
410*91f16700Schasinglulu  * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum
411*91f16700Schasinglulu  *		allowable programmed frequency and does not account for clock
412*91f16700Schasinglulu  *		tolerances and jitter.
413*91f16700Schasinglulu  * @target_freq_hz: The target clock frequency. A frequency will be found
414*91f16700Schasinglulu  *		as close to this target frequency as possible.
415*91f16700Schasinglulu  * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum
416*91f16700Schasinglulu  *		allowable programmed frequency and does not account for clock
417*91f16700Schasinglulu  *		tolerances and jitter.
418*91f16700Schasinglulu  * @clk_id:	Clock identifier for the device for this request.
419*91f16700Schasinglulu  *
420*91f16700Schasinglulu  * NOTE: Normally clock frequency management is automatically done by TISCI
421*91f16700Schasinglulu  * entity. In case of specific requests, TISCI evaluates capability to achieve
422*91f16700Schasinglulu  * requested frequency within provided range and responds with
423*91f16700Schasinglulu  * result message.
424*91f16700Schasinglulu  *
425*91f16700Schasinglulu  * Request type is TI_SCI_MSG_QUERY_CLOCK_FREQ, response is appropriate message,
426*91f16700Schasinglulu  * or NACK in case of inability to satisfy request.
427*91f16700Schasinglulu  */
428*91f16700Schasinglulu struct ti_sci_msg_req_query_clock_freq {
429*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
430*91f16700Schasinglulu 	uint32_t dev_id;
431*91f16700Schasinglulu 	uint64_t min_freq_hz;
432*91f16700Schasinglulu 	uint64_t target_freq_hz;
433*91f16700Schasinglulu 	uint64_t max_freq_hz;
434*91f16700Schasinglulu 	uint8_t clk_id;
435*91f16700Schasinglulu } __packed;
436*91f16700Schasinglulu 
437*91f16700Schasinglulu /**
438*91f16700Schasinglulu  * struct ti_sci_msg_resp_query_clock_freq - Response to a clock frequency query
439*91f16700Schasinglulu  * @hdr:	Generic Header
440*91f16700Schasinglulu  * @freq_hz:	Frequency that is the best match in Hz.
441*91f16700Schasinglulu  *
442*91f16700Schasinglulu  * Response to request type TI_SCI_MSG_QUERY_CLOCK_FREQ. NOTE: if the request
443*91f16700Schasinglulu  * cannot be satisfied, the message will be of type NACK.
444*91f16700Schasinglulu  */
445*91f16700Schasinglulu struct ti_sci_msg_resp_query_clock_freq {
446*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
447*91f16700Schasinglulu 	uint64_t freq_hz;
448*91f16700Schasinglulu } __packed;
449*91f16700Schasinglulu 
450*91f16700Schasinglulu /**
451*91f16700Schasinglulu  * struct ti_sci_msg_req_set_clock_freq - Request to setup a clock frequency
452*91f16700Schasinglulu  * @hdr:	Generic Header
453*91f16700Schasinglulu  * @dev_id:	Device identifier this request is for
454*91f16700Schasinglulu  * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum
455*91f16700Schasinglulu  *		allowable programmed frequency and does not account for clock
456*91f16700Schasinglulu  *		tolerances and jitter.
457*91f16700Schasinglulu  * @target_freq_hz: The target clock frequency. The clock will be programmed
458*91f16700Schasinglulu  *		at a rate as close to this target frequency as possible.
459*91f16700Schasinglulu  * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum
460*91f16700Schasinglulu  *		allowable programmed frequency and does not account for clock
461*91f16700Schasinglulu  *		tolerances and jitter.
462*91f16700Schasinglulu  * @clk_id:	Clock identifier for the device for this request.
463*91f16700Schasinglulu  *
464*91f16700Schasinglulu  * NOTE: Normally clock frequency management is automatically done by TISCI
465*91f16700Schasinglulu  * entity. In case of specific requests, TISCI evaluates capability to achieve
466*91f16700Schasinglulu  * requested range and responds with success/failure message.
467*91f16700Schasinglulu  *
468*91f16700Schasinglulu  * This sets the desired frequency for a clock within an allowable
469*91f16700Schasinglulu  * range. This message will fail on an enabled clock unless
470*91f16700Schasinglulu  * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE is set for the clock. Additionally,
471*91f16700Schasinglulu  * if other clocks have their frequency modified due to this message,
472*91f16700Schasinglulu  * they also must have the MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE or be disabled.
473*91f16700Schasinglulu  *
474*91f16700Schasinglulu  * Calling set frequency on a clock input to the SoC pseudo-device will
475*91f16700Schasinglulu  * inform the PMMC of that clock's frequency. Setting a frequency of
476*91f16700Schasinglulu  * zero will indicate the clock is disabled.
477*91f16700Schasinglulu  *
478*91f16700Schasinglulu  * Calling set frequency on clock outputs from the SoC pseudo-device will
479*91f16700Schasinglulu  * function similarly to setting the clock frequency on a device.
480*91f16700Schasinglulu  *
481*91f16700Schasinglulu  * Request type is TI_SCI_MSG_SET_CLOCK_FREQ, response is a generic ACK/NACK
482*91f16700Schasinglulu  * message.
483*91f16700Schasinglulu  */
484*91f16700Schasinglulu struct ti_sci_msg_req_set_clock_freq {
485*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
486*91f16700Schasinglulu 	uint32_t dev_id;
487*91f16700Schasinglulu 	uint64_t min_freq_hz;
488*91f16700Schasinglulu 	uint64_t target_freq_hz;
489*91f16700Schasinglulu 	uint64_t max_freq_hz;
490*91f16700Schasinglulu 	uint8_t clk_id;
491*91f16700Schasinglulu } __packed;
492*91f16700Schasinglulu 
493*91f16700Schasinglulu /**
494*91f16700Schasinglulu  * struct ti_sci_msg_req_get_clock_freq - Request to get the clock frequency
495*91f16700Schasinglulu  * @hdr:	Generic Header
496*91f16700Schasinglulu  * @dev_id:	Device identifier this request is for
497*91f16700Schasinglulu  * @clk_id:	Clock identifier for the device for this request.
498*91f16700Schasinglulu  *
499*91f16700Schasinglulu  * NOTE: Normally clock frequency management is automatically done by TISCI
500*91f16700Schasinglulu  * entity. In some cases, clock frequencies are configured by host.
501*91f16700Schasinglulu  *
502*91f16700Schasinglulu  * Request type is TI_SCI_MSG_GET_CLOCK_FREQ, responded with clock frequency
503*91f16700Schasinglulu  * that the clock is currently at.
504*91f16700Schasinglulu  */
505*91f16700Schasinglulu struct ti_sci_msg_req_get_clock_freq {
506*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
507*91f16700Schasinglulu 	uint32_t dev_id;
508*91f16700Schasinglulu 	uint8_t clk_id;
509*91f16700Schasinglulu } __packed;
510*91f16700Schasinglulu 
511*91f16700Schasinglulu /**
512*91f16700Schasinglulu  * struct ti_sci_msg_resp_get_clock_freq - Response of clock frequency request
513*91f16700Schasinglulu  * @hdr:	Generic Header
514*91f16700Schasinglulu  * @freq_hz:	Frequency that the clock is currently on, in Hz.
515*91f16700Schasinglulu  *
516*91f16700Schasinglulu  * Response to request type TI_SCI_MSG_GET_CLOCK_FREQ.
517*91f16700Schasinglulu  */
518*91f16700Schasinglulu struct ti_sci_msg_resp_get_clock_freq {
519*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
520*91f16700Schasinglulu 	uint64_t freq_hz;
521*91f16700Schasinglulu } __packed;
522*91f16700Schasinglulu 
523*91f16700Schasinglulu #define TISCI_ADDR_LOW_MASK		0x00000000ffffffff
524*91f16700Schasinglulu #define TISCI_ADDR_HIGH_MASK		0xffffffff00000000
525*91f16700Schasinglulu #define TISCI_ADDR_HIGH_SHIFT		32
526*91f16700Schasinglulu 
527*91f16700Schasinglulu /**
528*91f16700Schasinglulu  * struct ti_sci_msg_req_proc_request - Request a processor
529*91f16700Schasinglulu  *
530*91f16700Schasinglulu  * @hdr:		Generic Header
531*91f16700Schasinglulu  * @processor_id:	ID of processor
532*91f16700Schasinglulu  *
533*91f16700Schasinglulu  * Request type is TISCI_MSG_PROC_REQUEST, response is a generic ACK/NACK
534*91f16700Schasinglulu  * message.
535*91f16700Schasinglulu  */
536*91f16700Schasinglulu struct ti_sci_msg_req_proc_request {
537*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
538*91f16700Schasinglulu 	uint8_t processor_id;
539*91f16700Schasinglulu } __packed;
540*91f16700Schasinglulu 
541*91f16700Schasinglulu /**
542*91f16700Schasinglulu  * struct ti_sci_msg_req_proc_release - Release a processor
543*91f16700Schasinglulu  *
544*91f16700Schasinglulu  * @hdr:		Generic Header
545*91f16700Schasinglulu  * @processor_id:	ID of processor
546*91f16700Schasinglulu  *
547*91f16700Schasinglulu  * Request type is TISCI_MSG_PROC_RELEASE, response is a generic ACK/NACK
548*91f16700Schasinglulu  * message.
549*91f16700Schasinglulu  */
550*91f16700Schasinglulu struct ti_sci_msg_req_proc_release {
551*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
552*91f16700Schasinglulu 	uint8_t processor_id;
553*91f16700Schasinglulu } __packed;
554*91f16700Schasinglulu 
555*91f16700Schasinglulu /**
556*91f16700Schasinglulu  * struct ti_sci_msg_req_proc_handover - Handover a processor to a host
557*91f16700Schasinglulu  *
558*91f16700Schasinglulu  * @hdr:		Generic Header
559*91f16700Schasinglulu  * @processor_id:	ID of processor
560*91f16700Schasinglulu  * @host_id:		New Host we want to give control to
561*91f16700Schasinglulu  *
562*91f16700Schasinglulu  * Request type is TISCI_MSG_PROC_HANDOVER, response is a generic ACK/NACK
563*91f16700Schasinglulu  * message.
564*91f16700Schasinglulu  */
565*91f16700Schasinglulu struct ti_sci_msg_req_proc_handover {
566*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
567*91f16700Schasinglulu 	uint8_t processor_id;
568*91f16700Schasinglulu 	uint8_t host_id;
569*91f16700Schasinglulu } __packed;
570*91f16700Schasinglulu 
571*91f16700Schasinglulu /* A53 Config Flags */
572*91f16700Schasinglulu #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_EN         0x00000001
573*91f16700Schasinglulu #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_NIDEN      0x00000002
574*91f16700Schasinglulu #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_SPIDEN     0x00000004
575*91f16700Schasinglulu #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_SPNIDEN    0x00000008
576*91f16700Schasinglulu #define PROC_BOOT_CFG_FLAG_ARMV8_AARCH32        0x00000100
577*91f16700Schasinglulu 
578*91f16700Schasinglulu /* R5 Config Flags */
579*91f16700Schasinglulu #define PROC_BOOT_CFG_FLAG_R5_DBG_EN            0x00000001
580*91f16700Schasinglulu #define PROC_BOOT_CFG_FLAG_R5_DBG_NIDEN         0x00000002
581*91f16700Schasinglulu #define PROC_BOOT_CFG_FLAG_R5_LOCKSTEP          0x00000100
582*91f16700Schasinglulu #define PROC_BOOT_CFG_FLAG_R5_TEINIT            0x00000200
583*91f16700Schasinglulu #define PROC_BOOT_CFG_FLAG_R5_NMFI_EN           0x00000400
584*91f16700Schasinglulu #define PROC_BOOT_CFG_FLAG_R5_TCM_RSTBASE       0x00000800
585*91f16700Schasinglulu #define PROC_BOOT_CFG_FLAG_R5_BTCM_EN           0x00001000
586*91f16700Schasinglulu #define PROC_BOOT_CFG_FLAG_R5_ATCM_EN           0x00002000
587*91f16700Schasinglulu 
588*91f16700Schasinglulu /**
589*91f16700Schasinglulu  * struct ti_sci_msg_req_set_proc_boot_config - Set Processor boot configuration
590*91f16700Schasinglulu  * @hdr:		Generic Header
591*91f16700Schasinglulu  * @processor_id:	ID of processor
592*91f16700Schasinglulu  * @bootvector_low:	Lower 32bit (Little Endian) of boot vector
593*91f16700Schasinglulu  * @bootvector_high:	Higher 32bit (Little Endian) of boot vector
594*91f16700Schasinglulu  * @config_flags_set:	Optional Processor specific Config Flags to set.
595*91f16700Schasinglulu  *			Setting a bit here implies required bit sets to 1.
596*91f16700Schasinglulu  * @config_flags_clear:	Optional Processor specific Config Flags to clear.
597*91f16700Schasinglulu  *			Setting a bit here implies required bit gets cleared.
598*91f16700Schasinglulu  *
599*91f16700Schasinglulu  * Request type is TISCI_MSG_SET_PROC_BOOT_CONFIG, response is a generic
600*91f16700Schasinglulu  * ACK/NACK message.
601*91f16700Schasinglulu  */
602*91f16700Schasinglulu struct ti_sci_msg_req_set_proc_boot_config {
603*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
604*91f16700Schasinglulu 	uint8_t processor_id;
605*91f16700Schasinglulu 	uint32_t bootvector_low;
606*91f16700Schasinglulu 	uint32_t bootvector_high;
607*91f16700Schasinglulu 	uint32_t config_flags_set;
608*91f16700Schasinglulu 	uint32_t config_flags_clear;
609*91f16700Schasinglulu } __packed;
610*91f16700Schasinglulu 
611*91f16700Schasinglulu /* ARMV8 Control Flags */
612*91f16700Schasinglulu #define PROC_BOOT_CTRL_FLAG_ARMV8_ACINACTM      0x00000001
613*91f16700Schasinglulu #define PROC_BOOT_CTRL_FLAG_ARMV8_AINACTS       0x00000002
614*91f16700Schasinglulu #define PROC_BOOT_CTRL_FLAG_ARMV8_L2FLUSHREQ    0x00000100
615*91f16700Schasinglulu 
616*91f16700Schasinglulu /* R5 Control Flags */
617*91f16700Schasinglulu #define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT        0x00000001
618*91f16700Schasinglulu 
619*91f16700Schasinglulu /**
620*91f16700Schasinglulu  * struct ti_sci_msg_req_set_proc_boot_ctrl - Set Processor boot control flags
621*91f16700Schasinglulu  * @hdr:		Generic Header
622*91f16700Schasinglulu  * @processor_id:	ID of processor
623*91f16700Schasinglulu  * @config_flags_set:	Optional Processor specific Config Flags to set.
624*91f16700Schasinglulu  *			Setting a bit here implies required bit sets to 1.
625*91f16700Schasinglulu  * @config_flags_clear:	Optional Processor specific Config Flags to clear.
626*91f16700Schasinglulu  *			Setting a bit here implies required bit gets cleared.
627*91f16700Schasinglulu  *
628*91f16700Schasinglulu  * Request type is TISCI_MSG_SET_PROC_BOOT_CTRL, response is a generic ACK/NACK
629*91f16700Schasinglulu  * message.
630*91f16700Schasinglulu  */
631*91f16700Schasinglulu struct ti_sci_msg_req_set_proc_boot_ctrl {
632*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
633*91f16700Schasinglulu 	uint8_t processor_id;
634*91f16700Schasinglulu 	uint32_t control_flags_set;
635*91f16700Schasinglulu 	uint32_t control_flags_clear;
636*91f16700Schasinglulu } __packed;
637*91f16700Schasinglulu 
638*91f16700Schasinglulu /**
639*91f16700Schasinglulu  * struct ti_sci_msg_req_proc_auth_start_image - Authenticate and start image
640*91f16700Schasinglulu  * @hdr:		Generic Header
641*91f16700Schasinglulu  * @processor_id:	ID of processor
642*91f16700Schasinglulu  * @cert_addr_low:	Lower 32bit (Little Endian) of certificate
643*91f16700Schasinglulu  * @cert_addr_high:	Higher 32bit (Little Endian) of certificate
644*91f16700Schasinglulu  *
645*91f16700Schasinglulu  * Request type is TISCI_MSG_PROC_AUTH_BOOT_IMAGE, response is a generic
646*91f16700Schasinglulu  * ACK/NACK message.
647*91f16700Schasinglulu  */
648*91f16700Schasinglulu struct ti_sci_msg_req_proc_auth_boot_image {
649*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
650*91f16700Schasinglulu 	uint8_t processor_id;
651*91f16700Schasinglulu 	uint32_t cert_addr_low;
652*91f16700Schasinglulu 	uint32_t cert_addr_high;
653*91f16700Schasinglulu } __packed;
654*91f16700Schasinglulu 
655*91f16700Schasinglulu /**
656*91f16700Schasinglulu  * struct ti_sci_msg_req_get_proc_boot_status - Get processor boot status
657*91f16700Schasinglulu  * @hdr:		Generic Header
658*91f16700Schasinglulu  * @processor_id:	ID of processor
659*91f16700Schasinglulu  *
660*91f16700Schasinglulu  * Request type is TISCI_MSG_GET_PROC_BOOT_STATUS, response is appropriate
661*91f16700Schasinglulu  * message, or NACK in case of inability to satisfy request.
662*91f16700Schasinglulu  */
663*91f16700Schasinglulu struct ti_sci_msg_req_get_proc_boot_status {
664*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
665*91f16700Schasinglulu 	uint8_t processor_id;
666*91f16700Schasinglulu } __packed;
667*91f16700Schasinglulu 
668*91f16700Schasinglulu /* ARMv8 Status Flags */
669*91f16700Schasinglulu #define PROC_BOOT_STATUS_FLAG_ARMV8_WFE			0x00000001
670*91f16700Schasinglulu #define PROC_BOOT_STATUS_FLAG_ARMV8_WFI			0x00000002
671*91f16700Schasinglulu #define PROC_BOOT_STATUS_FLAG_ARMV8_L2F_DONE		0x00000010
672*91f16700Schasinglulu #define PROC_BOOT_STATUS_FLAG_ARMV8_STANDBYWFIL2	0x00000020
673*91f16700Schasinglulu 
674*91f16700Schasinglulu /* R5 Status Flags */
675*91f16700Schasinglulu #define PROC_BOOT_STATUS_FLAG_R5_WFE			0x00000001
676*91f16700Schasinglulu #define PROC_BOOT_STATUS_FLAG_R5_WFI			0x00000002
677*91f16700Schasinglulu #define PROC_BOOT_STATUS_FLAG_R5_CLK_GATED		0x00000004
678*91f16700Schasinglulu #define PROC_BOOT_STATUS_FLAG_R5_LOCKSTEP_PERMITTED	0x00000100
679*91f16700Schasinglulu 
680*91f16700Schasinglulu /**
681*91f16700Schasinglulu  * \brief Processor Status Response
682*91f16700Schasinglulu  * struct ti_sci_msg_resp_get_proc_boot_status - Processor boot status response
683*91f16700Schasinglulu  * @hdr:		Generic Header
684*91f16700Schasinglulu  * @processor_id:	ID of processor
685*91f16700Schasinglulu  * @bootvector_low:	Lower 32bit (Little Endian) of boot vector
686*91f16700Schasinglulu  * @bootvector_high:	Higher 32bit (Little Endian) of boot vector
687*91f16700Schasinglulu  * @config_flags:	Optional Processor specific Config Flags set.
688*91f16700Schasinglulu  * @control_flags:	Optional Processor specific Control Flags.
689*91f16700Schasinglulu  * @status_flags:	Optional Processor specific Status Flags set.
690*91f16700Schasinglulu  *
691*91f16700Schasinglulu  * Response to TISCI_MSG_GET_PROC_BOOT_STATUS.
692*91f16700Schasinglulu  */
693*91f16700Schasinglulu struct ti_sci_msg_resp_get_proc_boot_status {
694*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
695*91f16700Schasinglulu 	uint8_t processor_id;
696*91f16700Schasinglulu 	uint32_t bootvector_low;
697*91f16700Schasinglulu 	uint32_t bootvector_high;
698*91f16700Schasinglulu 	uint32_t config_flags;
699*91f16700Schasinglulu 	uint32_t control_flags;
700*91f16700Schasinglulu 	uint32_t status_flags;
701*91f16700Schasinglulu } __packed;
702*91f16700Schasinglulu 
703*91f16700Schasinglulu /**
704*91f16700Schasinglulu  * struct ti_sci_msg_req_wait_proc_boot_status - Wait for a processor boot status
705*91f16700Schasinglulu  * @hdr:			Generic Header
706*91f16700Schasinglulu  * @processor_id:		ID of processor
707*91f16700Schasinglulu  * @num_wait_iterations		Total number of iterations we will check before
708*91f16700Schasinglulu  *				we will timeout and give up
709*91f16700Schasinglulu  * @num_match_iterations	How many iterations should we have continued
710*91f16700Schasinglulu  *				status to account for status bits glitching.
711*91f16700Schasinglulu  *				This is to make sure that match occurs for
712*91f16700Schasinglulu  *				consecutive checks. This implies that the
713*91f16700Schasinglulu  *				worst case should consider that the stable
714*91f16700Schasinglulu  *				time should at the worst be num_wait_iterations
715*91f16700Schasinglulu  *				num_match_iterations to prevent timeout.
716*91f16700Schasinglulu  * @delay_per_iteration_us	Specifies how long to wait (in micro seconds)
717*91f16700Schasinglulu  *				between each status checks. This is the minimum
718*91f16700Schasinglulu  *				duration, and overhead of register reads and
719*91f16700Schasinglulu  *				checks are on top of this and can vary based on
720*91f16700Schasinglulu  *				varied conditions.
721*91f16700Schasinglulu  * @delay_before_iterations_us	Specifies how long to wait (in micro seconds)
722*91f16700Schasinglulu  *				before the very first check in the first
723*91f16700Schasinglulu  *				iteration of status check loop. This is the
724*91f16700Schasinglulu  *				minimum duration, and overhead of register
725*91f16700Schasinglulu  *				reads and checks are.
726*91f16700Schasinglulu  * @status_flags_1_set_all_wait	If non-zero, Specifies that all bits of the
727*91f16700Schasinglulu  *				status matching this field requested MUST be 1.
728*91f16700Schasinglulu  * @status_flags_1_set_any_wait	If non-zero, Specifies that at least one of the
729*91f16700Schasinglulu  *				bits matching this field requested MUST be 1.
730*91f16700Schasinglulu  * @status_flags_1_clr_all_wait	If non-zero, Specifies that all bits of the
731*91f16700Schasinglulu  *				status matching this field requested MUST be 0.
732*91f16700Schasinglulu  * @status_flags_1_clr_any_wait	If non-zero, Specifies that at least one of the
733*91f16700Schasinglulu  *				bits matching this field requested MUST be 0.
734*91f16700Schasinglulu  *
735*91f16700Schasinglulu  * Request type is TISCI_MSG_WAIT_PROC_BOOT_STATUS, response is appropriate
736*91f16700Schasinglulu  * message, or NACK in case of inability to satisfy request.
737*91f16700Schasinglulu  */
738*91f16700Schasinglulu struct ti_sci_msg_req_wait_proc_boot_status {
739*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
740*91f16700Schasinglulu 	uint8_t processor_id;
741*91f16700Schasinglulu 	uint8_t num_wait_iterations;
742*91f16700Schasinglulu 	uint8_t num_match_iterations;
743*91f16700Schasinglulu 	uint8_t delay_per_iteration_us;
744*91f16700Schasinglulu 	uint8_t delay_before_iterations_us;
745*91f16700Schasinglulu 	uint32_t status_flags_1_set_all_wait;
746*91f16700Schasinglulu 	uint32_t status_flags_1_set_any_wait;
747*91f16700Schasinglulu 	uint32_t status_flags_1_clr_all_wait;
748*91f16700Schasinglulu 	uint32_t status_flags_1_clr_any_wait;
749*91f16700Schasinglulu } __packed;
750*91f16700Schasinglulu 
751*91f16700Schasinglulu /**
752*91f16700Schasinglulu  * struct ti_sci_msg_req_enter_sleep - Request for TI_SCI_MSG_ENTER_SLEEP.
753*91f16700Schasinglulu  *
754*91f16700Schasinglulu  * @hdr		    Generic Header
755*91f16700Schasinglulu  * @mode	    Low power mode to enter.
756*91f16700Schasinglulu  * @proc_id	    Processor id to be restored.
757*91f16700Schasinglulu  * @core_resume_lo  Low 32-bits of physical pointer to address for core
758*91f16700Schasinglulu  *		    to begin execution upon resume.
759*91f16700Schasinglulu  * @core_resume_hi  High 32-bits of physical pointer to address for core
760*91f16700Schasinglulu  *		    to begin execution upon resume.
761*91f16700Schasinglulu  *
762*91f16700Schasinglulu  * This message is to be sent after TI_SCI_MSG_PREPARE_SLEEP is sent from OS
763*91f16700Schasinglulu  * and is what actually triggers entry into the specified low power mode.
764*91f16700Schasinglulu  */
765*91f16700Schasinglulu struct ti_sci_msg_req_enter_sleep {
766*91f16700Schasinglulu 	struct ti_sci_msg_hdr hdr;
767*91f16700Schasinglulu 	uint8_t mode;
768*91f16700Schasinglulu 	uint8_t processor_id;
769*91f16700Schasinglulu 	uint32_t core_resume_lo;
770*91f16700Schasinglulu 	uint32_t core_resume_hi;
771*91f16700Schasinglulu } __packed;
772*91f16700Schasinglulu 
773*91f16700Schasinglulu #endif /* TI_SCI_PROTOCOL_H */
774