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