xref: /rk3399_ARM-atf/drivers/ti/ti_sci/ti_sci_protocol.h (revision 06bf26bc1f76265237df2303d78a8f475eab703d)
1936afd9fSDhruva Gole /*
2936afd9fSDhruva Gole  * Texas Instruments System Control Interface (TISCI) Protocol
3936afd9fSDhruva Gole  *
4936afd9fSDhruva Gole  * Communication protocol with TI SCI hardware
5936afd9fSDhruva Gole  * The system works in a message response protocol
6936afd9fSDhruva Gole  * See: http://processors.wiki.ti.com/index.php/TISCI for details
7936afd9fSDhruva Gole  *
8936afd9fSDhruva Gole  * Copyright (C) 2018-2025 Texas Instruments Incorporated - https://www.ti.com/
9936afd9fSDhruva Gole  *
10936afd9fSDhruva Gole  * SPDX-License-Identifier: BSD-3-Clause
11936afd9fSDhruva Gole  */
12936afd9fSDhruva Gole 
13936afd9fSDhruva Gole #ifndef TI_SCI_PROTOCOL_H
14936afd9fSDhruva Gole #define TI_SCI_PROTOCOL_H
15936afd9fSDhruva Gole 
16936afd9fSDhruva Gole #include <stdint.h>
17936afd9fSDhruva Gole 
18936afd9fSDhruva Gole /* Generic Messages */
19936afd9fSDhruva Gole #define TI_SCI_MSG_ENABLE_WDT		0x0000
20936afd9fSDhruva Gole #define TI_SCI_MSG_WAKE_RESET		0x0001
21936afd9fSDhruva Gole #define TI_SCI_MSG_VERSION		0x0002
22936afd9fSDhruva Gole #define TI_SCI_MSG_WAKE_REASON		0x0003
23936afd9fSDhruva Gole #define TI_SCI_MSG_GOODBYE		0x0004
24936afd9fSDhruva Gole #define TI_SCI_MSG_SYS_RESET		0x0005
25*7d3c700fSDhruva Gole #define TI_SCI_MSG_BOOT_NOTIFICATION	0x000A
26936afd9fSDhruva Gole #define TI_SCI_MSG_QUERY_FW_CAPS	0x0022
27936afd9fSDhruva Gole 
28936afd9fSDhruva Gole /* Device requests */
29936afd9fSDhruva Gole #define TI_SCI_MSG_SET_DEVICE_STATE	0x0200
30936afd9fSDhruva Gole #define TI_SCI_MSG_GET_DEVICE_STATE	0x0201
31936afd9fSDhruva Gole #define TI_SCI_MSG_SET_DEVICE_RESETS	0x0202
32936afd9fSDhruva Gole 
33936afd9fSDhruva Gole /* Low Power Mode Requests */
34936afd9fSDhruva Gole #define TI_SCI_MSG_ENTER_SLEEP		0x0301
35936afd9fSDhruva Gole #define TI_SCI_MSG_LPM_GET_NEXT_SYS_MODE 0x030d
36936afd9fSDhruva Gole 
37936afd9fSDhruva Gole /* Clock requests */
38936afd9fSDhruva Gole #define TI_SCI_MSG_SET_CLOCK_STATE	0x0100
39936afd9fSDhruva Gole #define TI_SCI_MSG_GET_CLOCK_STATE	0x0101
40936afd9fSDhruva Gole #define TI_SCI_MSG_SET_CLOCK_PARENT	0x0102
41936afd9fSDhruva Gole #define TI_SCI_MSG_GET_CLOCK_PARENT	0x0103
42936afd9fSDhruva Gole #define TI_SCI_MSG_GET_NUM_CLOCK_PARENTS 0x0104
43936afd9fSDhruva Gole #define TI_SCI_MSG_SET_CLOCK_FREQ	0x010c
44936afd9fSDhruva Gole #define TI_SCI_MSG_QUERY_CLOCK_FREQ	0x010d
45936afd9fSDhruva Gole #define TI_SCI_MSG_GET_CLOCK_FREQ	0x010e
46936afd9fSDhruva Gole 
47936afd9fSDhruva Gole /* Processor Control Messages */
48936afd9fSDhruva Gole #define TISCI_MSG_PROC_REQUEST		0xc000
49936afd9fSDhruva Gole #define TISCI_MSG_PROC_RELEASE		0xc001
50936afd9fSDhruva Gole #define TISCI_MSG_PROC_HANDOVER		0xc005
51936afd9fSDhruva Gole #define TISCI_MSG_SET_PROC_BOOT_CONFIG	0xc100
52936afd9fSDhruva Gole #define TISCI_MSG_SET_PROC_BOOT_CTRL	0xc101
53936afd9fSDhruva Gole #define TISCI_MSG_PROC_AUTH_BOOT_IMAGE	0xc120
54936afd9fSDhruva Gole #define TISCI_MSG_GET_PROC_BOOT_STATUS	0xc400
55936afd9fSDhruva Gole #define TISCI_MSG_WAIT_PROC_BOOT_STATUS	0xc401
56936afd9fSDhruva Gole 
57936afd9fSDhruva Gole /**
58c2dcc599SDhruva Gole  * struct ti_sci_secure_msg_hdr - Header that prefixes all TISCI messages sent
59c2dcc599SDhruva Gole  *				  via secure transport.
60c2dcc599SDhruva Gole  * @checksum:	crc16 checksum for the entire message
61c2dcc599SDhruva Gole  * @reserved:	Reserved for future use.
62c2dcc599SDhruva Gole  */
63c2dcc599SDhruva Gole struct ti_sci_secure_msg_hdr {
64c2dcc599SDhruva Gole 	uint16_t checksum;
65c2dcc599SDhruva Gole 	uint16_t reserved;
66c2dcc599SDhruva Gole } __packed;
67c2dcc599SDhruva Gole 
68c2dcc599SDhruva Gole /**
69936afd9fSDhruva Gole  * struct ti_sci_msg_hdr - Generic Message Header for All messages and responses
70936afd9fSDhruva Gole  * @type:	Type of messages: One of TI_SCI_MSG* values
71936afd9fSDhruva Gole  * @host:	Host of the message
72936afd9fSDhruva Gole  * @seq:	Message identifier indicating a transfer sequence
73936afd9fSDhruva Gole  * @flags:	Flag for the message
74936afd9fSDhruva Gole  */
75936afd9fSDhruva Gole struct ti_sci_msg_hdr {
76c2dcc599SDhruva Gole 	struct ti_sci_secure_msg_hdr sec_hdr;
77936afd9fSDhruva Gole 	uint16_t type;
78936afd9fSDhruva Gole 	uint8_t host;
79936afd9fSDhruva Gole 	uint8_t seq;
80936afd9fSDhruva Gole #define TI_SCI_MSG_FLAG(val)			(1 << (val))
81936afd9fSDhruva Gole #define TI_SCI_FLAG_REQ_GENERIC_NORESPONSE	0x0
82936afd9fSDhruva Gole #define TI_SCI_FLAG_REQ_ACK_ON_RECEIVED		TI_SCI_MSG_FLAG(0)
83936afd9fSDhruva Gole #define TI_SCI_FLAG_REQ_ACK_ON_PROCESSED	TI_SCI_MSG_FLAG(1)
84936afd9fSDhruva Gole #define TI_SCI_FLAG_RESP_GENERIC_NACK		0x0
85936afd9fSDhruva Gole #define TI_SCI_FLAG_RESP_GENERIC_ACK		TI_SCI_MSG_FLAG(1)
86936afd9fSDhruva Gole 	/* Additional Flags */
87936afd9fSDhruva Gole 	uint32_t flags;
88936afd9fSDhruva Gole } __packed;
89936afd9fSDhruva Gole 
90936afd9fSDhruva Gole /**
91936afd9fSDhruva Gole  * struct ti_sci_msg_version_req - Request for firmware version information
92936afd9fSDhruva Gole  * @hdr:	Generic header
93936afd9fSDhruva Gole  *
94936afd9fSDhruva Gole  * Request for TI_SCI_MSG_VERSION
95936afd9fSDhruva Gole  */
96936afd9fSDhruva Gole struct ti_sci_msg_req_version {
97936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
98936afd9fSDhruva Gole } __packed;
99936afd9fSDhruva Gole 
100936afd9fSDhruva Gole /**
101936afd9fSDhruva Gole  * struct ti_sci_msg_resp_version - Response for firmware version information
102936afd9fSDhruva Gole  * @hdr:		Generic header
103936afd9fSDhruva Gole  * @firmware_description: String describing the firmware
104936afd9fSDhruva Gole  * @firmware_revision:	Firmware revision
105936afd9fSDhruva Gole  * @abi_major:		Major version of the ABI that firmware supports
106936afd9fSDhruva Gole  * @abi_minor:		Minor version of the ABI that firmware supports
107936afd9fSDhruva Gole  * @sub_version:	Sub-version number of the firmware
108936afd9fSDhruva Gole  * @patch_version:	Patch-version number of the firmware.
109936afd9fSDhruva Gole  *
110936afd9fSDhruva Gole  * In general, ABI version changes follow the rule that minor version increments
111936afd9fSDhruva Gole  * are backward compatible. Major revision changes in ABI may not be
112936afd9fSDhruva Gole  * backward compatible.
113936afd9fSDhruva Gole  *
114936afd9fSDhruva Gole  * Response to request TI_SCI_MSG_VERSION
115936afd9fSDhruva Gole  */
116936afd9fSDhruva Gole struct ti_sci_msg_resp_version {
117936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
118936afd9fSDhruva Gole #define FIRMWARE_DESCRIPTION_LENGTH 32
119936afd9fSDhruva Gole 	char firmware_description[FIRMWARE_DESCRIPTION_LENGTH];
120936afd9fSDhruva Gole 	uint16_t firmware_revision;
121936afd9fSDhruva Gole 	uint8_t abi_major;
122936afd9fSDhruva Gole 	uint8_t abi_minor;
123936afd9fSDhruva Gole 	uint8_t sub_version;
124936afd9fSDhruva Gole 	uint8_t patch_version;
125936afd9fSDhruva Gole } __packed;
126936afd9fSDhruva Gole 
127936afd9fSDhruva Gole /**
128936afd9fSDhruva Gole  * struct ti_sci_msg_req_reboot - Reboot the SoC
129936afd9fSDhruva Gole  * @hdr:	Generic Header
130936afd9fSDhruva Gole  * @domain:	Domain to be reset, 0 for full SoC reboot
131936afd9fSDhruva Gole  *
132936afd9fSDhruva Gole  * Request type is TI_SCI_MSG_SYS_RESET, responded with a generic
133936afd9fSDhruva Gole  * ACK/NACK message.
134936afd9fSDhruva Gole  */
135936afd9fSDhruva Gole struct ti_sci_msg_req_reboot {
136936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
137936afd9fSDhruva Gole #define TI_SCI_DOMAIN_FULL_SOC_RESET	0x0
138936afd9fSDhruva Gole 	uint8_t domain;
139936afd9fSDhruva Gole } __packed;
140936afd9fSDhruva Gole 
141936afd9fSDhruva Gole /**
142936afd9fSDhruva Gole  * struct ti_sci_msg_resp_query_fw_caps - Response for query firmware caps
143936afd9fSDhruva Gole  * @hdr:	Generic header
144936afd9fSDhruva Gole  * @fw_caps:	Each bit in fw_caps indicating one FW/SOC capability
145936afd9fSDhruva Gole  *		MSG_FLAG_CAPS_GENERIC: Generic capability (LPM not supported)
146936afd9fSDhruva Gole  *		MSG_FLAG_CAPS_LPM_DEEP_SLEEP: Deep Sleep LPM
147936afd9fSDhruva Gole  *		MSG_FLAG_CAPS_LPM_MCU_ONLY: MCU only LPM
148936afd9fSDhruva Gole  *		MSG_FLAG_CAPS_LPM_STANDBY: Standby LPM
149936afd9fSDhruva Gole  *		MSG_FLAG_CAPS_LPM_PARTIAL_IO: Partial IO in LPM
150936afd9fSDhruva Gole  *		MSG_FLAG_CAPS_LPM_DM_MANAGED: LPM can be managed by DM
151936afd9fSDhruva Gole  *
152936afd9fSDhruva Gole  * Response to a generic message with message type TI_SCI_MSG_QUERY_FW_CAPS
153936afd9fSDhruva Gole  * providing currently available SOC/firmware capabilities. SoC that don't
154936afd9fSDhruva Gole  * support low power modes return only MSG_FLAG_CAPS_GENERIC capability.
155936afd9fSDhruva Gole  */
156936afd9fSDhruva Gole struct ti_sci_msg_resp_query_fw_caps {
157936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
158936afd9fSDhruva Gole #define MSG_FLAG_CAPS_GENERIC		TI_SCI_MSG_FLAG(0)
159936afd9fSDhruva Gole #define MSG_FLAG_CAPS_LPM_DEEP_SLEEP	TI_SCI_MSG_FLAG(1)
160936afd9fSDhruva Gole #define MSG_FLAG_CAPS_LPM_MCU_ONLY	TI_SCI_MSG_FLAG(2)
161936afd9fSDhruva Gole #define MSG_FLAG_CAPS_LPM_STANDBY	TI_SCI_MSG_FLAG(3)
162936afd9fSDhruva Gole #define MSG_FLAG_CAPS_LPM_PARTIAL_IO	TI_SCI_MSG_FLAG(4)
163936afd9fSDhruva Gole #define MSG_FLAG_CAPS_LPM_DM_MANAGED	TI_SCI_MSG_FLAG(5)
164936afd9fSDhruva Gole 	uint64_t fw_caps;
165936afd9fSDhruva Gole } __packed;
166936afd9fSDhruva Gole 
167936afd9fSDhruva Gole /**
168936afd9fSDhruva Gole  * struct ti_sci_msg_req_set_device_state - Set the desired state of the device
169936afd9fSDhruva Gole  * @hdr:		Generic header
170936afd9fSDhruva Gole  * @id:	Indicates which device to modify
171936afd9fSDhruva Gole  * @reserved: Reserved space in message, must be 0 for backward compatibility
172936afd9fSDhruva Gole  * @state: The desired state of the device.
173936afd9fSDhruva Gole  *
174936afd9fSDhruva Gole  * Certain flags can also be set to alter the device state:
175936afd9fSDhruva Gole  * + MSG_FLAG_DEVICE_WAKE_ENABLED - Configure the device to be a wake source.
176936afd9fSDhruva Gole  * The meaning of this flag will vary slightly from device to device and from
177936afd9fSDhruva Gole  * SoC to SoC but it generally allows the device to wake the SoC out of deep
178936afd9fSDhruva Gole  * suspend states.
179936afd9fSDhruva Gole  * + MSG_FLAG_DEVICE_RESET_ISO - Enable reset isolation for this device.
180936afd9fSDhruva Gole  * + MSG_FLAG_DEVICE_EXCLUSIVE - Claim this device exclusively. When passed
181936afd9fSDhruva Gole  * with STATE_RETENTION or STATE_ON, it will claim the device exclusively.
182936afd9fSDhruva Gole  * If another host already has this device set to STATE_RETENTION or STATE_ON,
183936afd9fSDhruva Gole  * the message will fail. Once successful, other hosts attempting to set
184936afd9fSDhruva Gole  * STATE_RETENTION or STATE_ON will fail.
185936afd9fSDhruva Gole  *
186936afd9fSDhruva Gole  * Request type is TI_SCI_MSG_SET_DEVICE_STATE, responded with a generic
187936afd9fSDhruva Gole  * ACK/NACK message.
188936afd9fSDhruva Gole  */
189936afd9fSDhruva Gole struct ti_sci_msg_req_set_device_state {
190936afd9fSDhruva Gole 	/* Additional hdr->flags options */
191936afd9fSDhruva Gole #define MSG_FLAG_DEVICE_WAKE_ENABLED	TI_SCI_MSG_FLAG(8)
192936afd9fSDhruva Gole #define MSG_FLAG_DEVICE_RESET_ISO	TI_SCI_MSG_FLAG(9)
193936afd9fSDhruva Gole #define MSG_FLAG_DEVICE_EXCLUSIVE	TI_SCI_MSG_FLAG(10)
194936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
195936afd9fSDhruva Gole 	uint32_t id;
196936afd9fSDhruva Gole 	uint32_t reserved;
197936afd9fSDhruva Gole 
198936afd9fSDhruva Gole #define MSG_DEVICE_SW_STATE_AUTO_OFF	0
199936afd9fSDhruva Gole #define MSG_DEVICE_SW_STATE_RETENTION	1
200936afd9fSDhruva Gole #define MSG_DEVICE_SW_STATE_ON		2
201936afd9fSDhruva Gole 	uint8_t state;
202936afd9fSDhruva Gole } __packed;
203936afd9fSDhruva Gole 
204936afd9fSDhruva Gole /**
205936afd9fSDhruva Gole  * struct ti_sci_msg_req_get_device_state - Request to get device.
206936afd9fSDhruva Gole  * @hdr:		Generic header
207936afd9fSDhruva Gole  * @id:		Device Identifier
208936afd9fSDhruva Gole  *
209936afd9fSDhruva Gole  * Request type is TI_SCI_MSG_GET_DEVICE_STATE, responded device state
210936afd9fSDhruva Gole  * information
211936afd9fSDhruva Gole  */
212936afd9fSDhruva Gole struct ti_sci_msg_req_get_device_state {
213936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
214936afd9fSDhruva Gole 	uint32_t id;
215936afd9fSDhruva Gole } __packed;
216936afd9fSDhruva Gole 
217936afd9fSDhruva Gole /**
218936afd9fSDhruva Gole  * struct ti_sci_msg_resp_get_device_state - Response to get device request.
219936afd9fSDhruva Gole  * @hdr:		Generic header
220936afd9fSDhruva Gole  * @context_loss_count: Indicates how many times the device has lost context. A
221936afd9fSDhruva Gole  *	driver can use this monotonic counter to determine if the device has
222936afd9fSDhruva Gole  *	lost context since the last time this message was exchanged.
223936afd9fSDhruva Gole  * @resets: Programmed state of the reset lines.
224936afd9fSDhruva Gole  * @programmed_state:	The state as programmed by set_device.
225936afd9fSDhruva Gole  *			- Uses the MSG_DEVICE_SW_* macros
226936afd9fSDhruva Gole  * @current_state:	The actual state of the hardware.
227936afd9fSDhruva Gole  *
228936afd9fSDhruva Gole  * Response to request TI_SCI_MSG_GET_DEVICE_STATE.
229936afd9fSDhruva Gole  */
230936afd9fSDhruva Gole struct ti_sci_msg_resp_get_device_state {
231936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
232936afd9fSDhruva Gole 	uint32_t context_loss_count;
233936afd9fSDhruva Gole 	uint32_t resets;
234936afd9fSDhruva Gole 	uint8_t programmed_state;
235936afd9fSDhruva Gole #define MSG_DEVICE_HW_STATE_OFF		0
236936afd9fSDhruva Gole #define MSG_DEVICE_HW_STATE_ON		1
237936afd9fSDhruva Gole #define MSG_DEVICE_HW_STATE_TRANS	2
238936afd9fSDhruva Gole 	uint8_t current_state;
239936afd9fSDhruva Gole } __packed;
240936afd9fSDhruva Gole 
241936afd9fSDhruva Gole /**
242936afd9fSDhruva Gole  * struct ti_sci_msg_req_set_device_resets - Set the desired resets
243936afd9fSDhruva Gole  *				configuration of the device
244936afd9fSDhruva Gole  * @hdr:		Generic header
245936afd9fSDhruva Gole  * @id:	Indicates which device to modify
246936afd9fSDhruva Gole  * @resets: A bit field of resets for the device. The meaning, behavior,
247936afd9fSDhruva Gole  *	and usage of the reset flags are device specific. 0 for a bit
248936afd9fSDhruva Gole  *	indicates releasing the reset represented by that bit while 1
249936afd9fSDhruva Gole  *	indicates keeping it held.
250936afd9fSDhruva Gole  *
251936afd9fSDhruva Gole  * Request type is TI_SCI_MSG_SET_DEVICE_RESETS, responded with a generic
252936afd9fSDhruva Gole  * ACK/NACK message.
253936afd9fSDhruva Gole  */
254936afd9fSDhruva Gole struct ti_sci_msg_req_set_device_resets {
255936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
256936afd9fSDhruva Gole 	uint32_t id;
257936afd9fSDhruva Gole 	uint32_t resets;
258936afd9fSDhruva Gole } __packed;
259936afd9fSDhruva Gole 
260936afd9fSDhruva Gole /**
261936afd9fSDhruva Gole  * struct ti_sci_msg_req_set_clock_state - Request to setup a Clock state
262936afd9fSDhruva Gole  * @hdr:	Generic Header, Certain flags can be set specific to the clocks:
263936afd9fSDhruva Gole  *		MSG_FLAG_CLOCK_ALLOW_SSC: Allow this clock to be modified
264936afd9fSDhruva Gole  *		via spread spectrum clocking.
265936afd9fSDhruva Gole  *		MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE: Allow this clock's
266936afd9fSDhruva Gole  *		frequency to be changed while it is running so long as it
267936afd9fSDhruva Gole  *		is within the min/max limits.
268936afd9fSDhruva Gole  *		MSG_FLAG_CLOCK_INPUT_TERM: Enable input termination, this
269936afd9fSDhruva Gole  *		is only applicable to clock inputs on the SoC pseudo-device.
270936afd9fSDhruva Gole  * @dev_id:	Device identifier this request is for
271936afd9fSDhruva Gole  * @clk_id:	Clock identifier for the device for this request.
272936afd9fSDhruva Gole  *		Each device has it's own set of clock inputs. This indexes
273936afd9fSDhruva Gole  *		which clock input to modify.
274936afd9fSDhruva Gole  * @request_state: Request the state for the clock to be set to.
275936afd9fSDhruva Gole  *		MSG_CLOCK_SW_STATE_UNREQ: The IP does not require this clock,
276936afd9fSDhruva Gole  *		it can be disabled, regardless of the state of the device
277936afd9fSDhruva Gole  *		MSG_CLOCK_SW_STATE_AUTO: Allow the System Controller to
278936afd9fSDhruva Gole  *		automatically manage the state of this clock. If the device
279936afd9fSDhruva Gole  *		is enabled, then the clock is enabled. If the device is set
280936afd9fSDhruva Gole  *		to off or retention, then the clock is internally set as not
281936afd9fSDhruva Gole  *		being required by the device.(default)
282936afd9fSDhruva Gole  *		MSG_CLOCK_SW_STATE_REQ:  Configure the clock to be enabled,
283936afd9fSDhruva Gole  *		regardless of the state of the device.
284936afd9fSDhruva Gole  *
285936afd9fSDhruva Gole  * Normally, all required clocks are managed by TISCI entity, this is used
286936afd9fSDhruva Gole  * only for specific control *IF* required. Auto managed state is
287936afd9fSDhruva Gole  * MSG_CLOCK_SW_STATE_AUTO, in other states, TISCI entity assume remote
288936afd9fSDhruva Gole  * will explicitly control.
289936afd9fSDhruva Gole  *
290936afd9fSDhruva Gole  * Request type is TI_SCI_MSG_SET_CLOCK_STATE, response is a generic
291936afd9fSDhruva Gole  * ACK or NACK message.
292936afd9fSDhruva Gole  */
293936afd9fSDhruva Gole struct ti_sci_msg_req_set_clock_state {
294936afd9fSDhruva Gole 	/* Additional hdr->flags options */
295936afd9fSDhruva Gole #define MSG_FLAG_CLOCK_ALLOW_SSC		TI_SCI_MSG_FLAG(8)
296936afd9fSDhruva Gole #define MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE	TI_SCI_MSG_FLAG(9)
297936afd9fSDhruva Gole #define MSG_FLAG_CLOCK_INPUT_TERM		TI_SCI_MSG_FLAG(10)
298936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
299936afd9fSDhruva Gole 	uint32_t dev_id;
300936afd9fSDhruva Gole 	uint8_t clk_id;
301936afd9fSDhruva Gole #define MSG_CLOCK_SW_STATE_UNREQ	0
302936afd9fSDhruva Gole #define MSG_CLOCK_SW_STATE_AUTO		1
303936afd9fSDhruva Gole #define MSG_CLOCK_SW_STATE_REQ		2
304936afd9fSDhruva Gole 	uint8_t request_state;
305936afd9fSDhruva Gole } __packed;
306936afd9fSDhruva Gole 
307936afd9fSDhruva Gole /**
308936afd9fSDhruva Gole  * struct ti_sci_msg_req_get_clock_state - Request for clock state
309936afd9fSDhruva Gole  * @hdr:	Generic Header
310936afd9fSDhruva Gole  * @dev_id:	Device identifier this request is for
311936afd9fSDhruva Gole  * @clk_id:	Clock identifier for the device for this request.
312936afd9fSDhruva Gole  *		Each device has it's own set of clock inputs. This indexes
313936afd9fSDhruva Gole  *		which clock input to get state of.
314936afd9fSDhruva Gole  *
315936afd9fSDhruva Gole  * Request type is TI_SCI_MSG_GET_CLOCK_STATE, response is state
316936afd9fSDhruva Gole  * of the clock
317936afd9fSDhruva Gole  */
318936afd9fSDhruva Gole struct ti_sci_msg_req_get_clock_state {
319936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
320936afd9fSDhruva Gole 	uint32_t dev_id;
321936afd9fSDhruva Gole 	uint8_t clk_id;
322936afd9fSDhruva Gole } __packed;
323936afd9fSDhruva Gole 
324936afd9fSDhruva Gole /**
325936afd9fSDhruva Gole  * struct ti_sci_msg_resp_get_clock_state - Response to get clock state
326936afd9fSDhruva Gole  * @hdr:	Generic Header
327936afd9fSDhruva Gole  * @programmed_state: Any programmed state of the clock. This is one of
328936afd9fSDhruva Gole  *		MSG_CLOCK_SW_STATE* values.
329936afd9fSDhruva Gole  * @current_state: Current state of the clock. This is one of:
330936afd9fSDhruva Gole  *		MSG_CLOCK_HW_STATE_NOT_READY: Clock is not ready
331936afd9fSDhruva Gole  *		MSG_CLOCK_HW_STATE_READY: Clock is ready
332936afd9fSDhruva Gole  *
333936afd9fSDhruva Gole  * Response to TI_SCI_MSG_GET_CLOCK_STATE.
334936afd9fSDhruva Gole  */
335936afd9fSDhruva Gole struct ti_sci_msg_resp_get_clock_state {
336936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
337936afd9fSDhruva Gole 	uint8_t programmed_state;
338936afd9fSDhruva Gole #define MSG_CLOCK_HW_STATE_NOT_READY	0
339936afd9fSDhruva Gole #define MSG_CLOCK_HW_STATE_READY	1
340936afd9fSDhruva Gole 	uint8_t current_state;
341936afd9fSDhruva Gole } __packed;
342936afd9fSDhruva Gole 
343936afd9fSDhruva Gole /**
344936afd9fSDhruva Gole  * struct ti_sci_msg_req_set_clock_parent - Set the clock parent
345936afd9fSDhruva Gole  * @hdr:	Generic Header
346936afd9fSDhruva Gole  * @dev_id:	Device identifier this request is for
347936afd9fSDhruva Gole  * @clk_id:	Clock identifier for the device for this request.
348936afd9fSDhruva Gole  *		Each device has it's own set of clock inputs. This indexes
349936afd9fSDhruva Gole  *		which clock input to modify.
350936afd9fSDhruva Gole  * @parent_id:	The new clock parent is selectable by an index via this
351936afd9fSDhruva Gole  *		parameter.
352936afd9fSDhruva Gole  *
353936afd9fSDhruva Gole  * Request type is TI_SCI_MSG_SET_CLOCK_PARENT, response is generic
354936afd9fSDhruva Gole  * ACK / NACK message.
355936afd9fSDhruva Gole  */
356936afd9fSDhruva Gole struct ti_sci_msg_req_set_clock_parent {
357936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
358936afd9fSDhruva Gole 	uint32_t dev_id;
359936afd9fSDhruva Gole 	uint8_t clk_id;
360936afd9fSDhruva Gole 	uint8_t parent_id;
361936afd9fSDhruva Gole } __packed;
362936afd9fSDhruva Gole 
363936afd9fSDhruva Gole /**
364936afd9fSDhruva Gole  * struct ti_sci_msg_req_get_clock_parent - Get the clock parent
365936afd9fSDhruva Gole  * @hdr:	Generic Header
366936afd9fSDhruva Gole  * @dev_id:	Device identifier this request is for
367936afd9fSDhruva Gole  * @clk_id:	Clock identifier for the device for this request.
368936afd9fSDhruva Gole  *		Each device has it's own set of clock inputs. This indexes
369936afd9fSDhruva Gole  *		which clock input to get the parent for.
370936afd9fSDhruva Gole  *
371936afd9fSDhruva Gole  * Request type is TI_SCI_MSG_GET_CLOCK_PARENT, response is parent information
372936afd9fSDhruva Gole  */
373936afd9fSDhruva Gole struct ti_sci_msg_req_get_clock_parent {
374936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
375936afd9fSDhruva Gole 	uint32_t dev_id;
376936afd9fSDhruva Gole 	uint8_t clk_id;
377936afd9fSDhruva Gole } __packed;
378936afd9fSDhruva Gole 
379936afd9fSDhruva Gole /**
380936afd9fSDhruva Gole  * struct ti_sci_msg_resp_get_clock_parent - Response with clock parent
381936afd9fSDhruva Gole  * @hdr:	Generic Header
382936afd9fSDhruva Gole  * @parent_id:	The current clock parent
383936afd9fSDhruva Gole  *
384936afd9fSDhruva Gole  * Response to TI_SCI_MSG_GET_CLOCK_PARENT.
385936afd9fSDhruva Gole  */
386936afd9fSDhruva Gole struct ti_sci_msg_resp_get_clock_parent {
387936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
388936afd9fSDhruva Gole 	uint8_t parent_id;
389936afd9fSDhruva Gole } __packed;
390936afd9fSDhruva Gole 
391936afd9fSDhruva Gole /**
392936afd9fSDhruva Gole  * struct ti_sci_msg_req_get_clock_num_parents - Request to get clock parents
393936afd9fSDhruva Gole  * @hdr:	Generic header
394936afd9fSDhruva Gole  * @dev_id:	Device identifier this request is for
395936afd9fSDhruva Gole  * @clk_id:	Clock identifier for the device for this request.
396936afd9fSDhruva Gole  *
397936afd9fSDhruva Gole  * This request provides information about how many clock parent options
398936afd9fSDhruva Gole  * are available for a given clock to a device. This is typically used
399936afd9fSDhruva Gole  * for input clocks.
400936afd9fSDhruva Gole  *
401936afd9fSDhruva Gole  * Request type is TI_SCI_MSG_GET_NUM_CLOCK_PARENTS, response is appropriate
402936afd9fSDhruva Gole  * message, or NACK in case of inability to satisfy request.
403936afd9fSDhruva Gole  */
404936afd9fSDhruva Gole struct ti_sci_msg_req_get_clock_num_parents {
405936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
406936afd9fSDhruva Gole 	uint32_t dev_id;
407936afd9fSDhruva Gole 	uint8_t clk_id;
408936afd9fSDhruva Gole } __packed;
409936afd9fSDhruva Gole 
410936afd9fSDhruva Gole /**
411936afd9fSDhruva Gole  * struct ti_sci_msg_resp_get_clock_num_parents - Response for get clk parents
412936afd9fSDhruva Gole  * @hdr:		Generic header
413936afd9fSDhruva Gole  * @num_parents:	Number of clock parents
414936afd9fSDhruva Gole  *
415936afd9fSDhruva Gole  * Response to TI_SCI_MSG_GET_NUM_CLOCK_PARENTS
416936afd9fSDhruva Gole  */
417936afd9fSDhruva Gole struct ti_sci_msg_resp_get_clock_num_parents {
418936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
419936afd9fSDhruva Gole 	uint8_t num_parents;
420936afd9fSDhruva Gole } __packed;
421936afd9fSDhruva Gole 
422936afd9fSDhruva Gole /**
423936afd9fSDhruva Gole  * struct ti_sci_msg_req_query_clock_freq - Request to query a frequency
424936afd9fSDhruva Gole  * @hdr:	Generic Header
425936afd9fSDhruva Gole  * @dev_id:	Device identifier this request is for
426936afd9fSDhruva Gole  * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum
427936afd9fSDhruva Gole  *		allowable programmed frequency and does not account for clock
428936afd9fSDhruva Gole  *		tolerances and jitter.
429936afd9fSDhruva Gole  * @target_freq_hz: The target clock frequency. A frequency will be found
430936afd9fSDhruva Gole  *		as close to this target frequency as possible.
431936afd9fSDhruva Gole  * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum
432936afd9fSDhruva Gole  *		allowable programmed frequency and does not account for clock
433936afd9fSDhruva Gole  *		tolerances and jitter.
434936afd9fSDhruva Gole  * @clk_id:	Clock identifier for the device for this request.
435936afd9fSDhruva Gole  *
436936afd9fSDhruva Gole  * NOTE: Normally clock frequency management is automatically done by TISCI
437936afd9fSDhruva Gole  * entity. In case of specific requests, TISCI evaluates capability to achieve
438936afd9fSDhruva Gole  * requested frequency within provided range and responds with
439936afd9fSDhruva Gole  * result message.
440936afd9fSDhruva Gole  *
441936afd9fSDhruva Gole  * Request type is TI_SCI_MSG_QUERY_CLOCK_FREQ, response is appropriate message,
442936afd9fSDhruva Gole  * or NACK in case of inability to satisfy request.
443936afd9fSDhruva Gole  */
444936afd9fSDhruva Gole struct ti_sci_msg_req_query_clock_freq {
445936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
446936afd9fSDhruva Gole 	uint32_t dev_id;
447936afd9fSDhruva Gole 	uint64_t min_freq_hz;
448936afd9fSDhruva Gole 	uint64_t target_freq_hz;
449936afd9fSDhruva Gole 	uint64_t max_freq_hz;
450936afd9fSDhruva Gole 	uint8_t clk_id;
451936afd9fSDhruva Gole } __packed;
452936afd9fSDhruva Gole 
453936afd9fSDhruva Gole /**
454936afd9fSDhruva Gole  * struct ti_sci_msg_resp_query_clock_freq - Response to a clock frequency query
455936afd9fSDhruva Gole  * @hdr:	Generic Header
456936afd9fSDhruva Gole  * @freq_hz:	Frequency that is the best match in Hz.
457936afd9fSDhruva Gole  *
458936afd9fSDhruva Gole  * Response to request type TI_SCI_MSG_QUERY_CLOCK_FREQ. NOTE: if the request
459936afd9fSDhruva Gole  * cannot be satisfied, the message will be of type NACK.
460936afd9fSDhruva Gole  */
461936afd9fSDhruva Gole struct ti_sci_msg_resp_query_clock_freq {
462936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
463936afd9fSDhruva Gole 	uint64_t freq_hz;
464936afd9fSDhruva Gole } __packed;
465936afd9fSDhruva Gole 
466936afd9fSDhruva Gole /**
467936afd9fSDhruva Gole  * struct ti_sci_msg_req_set_clock_freq - Request to setup a clock frequency
468936afd9fSDhruva Gole  * @hdr:	Generic Header
469936afd9fSDhruva Gole  * @dev_id:	Device identifier this request is for
470936afd9fSDhruva Gole  * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum
471936afd9fSDhruva Gole  *		allowable programmed frequency and does not account for clock
472936afd9fSDhruva Gole  *		tolerances and jitter.
473936afd9fSDhruva Gole  * @target_freq_hz: The target clock frequency. The clock will be programmed
474936afd9fSDhruva Gole  *		at a rate as close to this target frequency as possible.
475936afd9fSDhruva Gole  * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum
476936afd9fSDhruva Gole  *		allowable programmed frequency and does not account for clock
477936afd9fSDhruva Gole  *		tolerances and jitter.
478936afd9fSDhruva Gole  * @clk_id:	Clock identifier for the device for this request.
479936afd9fSDhruva Gole  *
480936afd9fSDhruva Gole  * NOTE: Normally clock frequency management is automatically done by TISCI
481936afd9fSDhruva Gole  * entity. In case of specific requests, TISCI evaluates capability to achieve
482936afd9fSDhruva Gole  * requested range and responds with success/failure message.
483936afd9fSDhruva Gole  *
484936afd9fSDhruva Gole  * This sets the desired frequency for a clock within an allowable
485936afd9fSDhruva Gole  * range. This message will fail on an enabled clock unless
486936afd9fSDhruva Gole  * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE is set for the clock. Additionally,
487936afd9fSDhruva Gole  * if other clocks have their frequency modified due to this message,
488936afd9fSDhruva Gole  * they also must have the MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE or be disabled.
489936afd9fSDhruva Gole  *
490936afd9fSDhruva Gole  * Calling set frequency on a clock input to the SoC pseudo-device will
491936afd9fSDhruva Gole  * inform the PMMC of that clock's frequency. Setting a frequency of
492936afd9fSDhruva Gole  * zero will indicate the clock is disabled.
493936afd9fSDhruva Gole  *
494936afd9fSDhruva Gole  * Calling set frequency on clock outputs from the SoC pseudo-device will
495936afd9fSDhruva Gole  * function similarly to setting the clock frequency on a device.
496936afd9fSDhruva Gole  *
497936afd9fSDhruva Gole  * Request type is TI_SCI_MSG_SET_CLOCK_FREQ, response is a generic ACK/NACK
498936afd9fSDhruva Gole  * message.
499936afd9fSDhruva Gole  */
500936afd9fSDhruva Gole struct ti_sci_msg_req_set_clock_freq {
501936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
502936afd9fSDhruva Gole 	uint32_t dev_id;
503936afd9fSDhruva Gole 	uint64_t min_freq_hz;
504936afd9fSDhruva Gole 	uint64_t target_freq_hz;
505936afd9fSDhruva Gole 	uint64_t max_freq_hz;
506936afd9fSDhruva Gole 	uint8_t clk_id;
507936afd9fSDhruva Gole } __packed;
508936afd9fSDhruva Gole 
509936afd9fSDhruva Gole /**
510936afd9fSDhruva Gole  * struct ti_sci_msg_req_get_clock_freq - Request to get the clock frequency
511936afd9fSDhruva Gole  * @hdr:	Generic Header
512936afd9fSDhruva Gole  * @dev_id:	Device identifier this request is for
513936afd9fSDhruva Gole  * @clk_id:	Clock identifier for the device for this request.
514936afd9fSDhruva Gole  *
515936afd9fSDhruva Gole  * NOTE: Normally clock frequency management is automatically done by TISCI
516936afd9fSDhruva Gole  * entity. In some cases, clock frequencies are configured by host.
517936afd9fSDhruva Gole  *
518936afd9fSDhruva Gole  * Request type is TI_SCI_MSG_GET_CLOCK_FREQ, responded with clock frequency
519936afd9fSDhruva Gole  * that the clock is currently at.
520936afd9fSDhruva Gole  */
521936afd9fSDhruva Gole struct ti_sci_msg_req_get_clock_freq {
522936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
523936afd9fSDhruva Gole 	uint32_t dev_id;
524936afd9fSDhruva Gole 	uint8_t clk_id;
525936afd9fSDhruva Gole } __packed;
526936afd9fSDhruva Gole 
527936afd9fSDhruva Gole /**
528936afd9fSDhruva Gole  * struct ti_sci_msg_resp_get_clock_freq - Response of clock frequency request
529936afd9fSDhruva Gole  * @hdr:	Generic Header
530936afd9fSDhruva Gole  * @freq_hz:	Frequency that the clock is currently on, in Hz.
531936afd9fSDhruva Gole  *
532936afd9fSDhruva Gole  * Response to request type TI_SCI_MSG_GET_CLOCK_FREQ.
533936afd9fSDhruva Gole  */
534936afd9fSDhruva Gole struct ti_sci_msg_resp_get_clock_freq {
535936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
536936afd9fSDhruva Gole 	uint64_t freq_hz;
537936afd9fSDhruva Gole } __packed;
538936afd9fSDhruva Gole 
539936afd9fSDhruva Gole #define TISCI_ADDR_LOW_MASK		0x00000000ffffffff
540936afd9fSDhruva Gole #define TISCI_ADDR_HIGH_MASK		0xffffffff00000000
541936afd9fSDhruva Gole #define TISCI_ADDR_HIGH_SHIFT		32
542936afd9fSDhruva Gole 
543936afd9fSDhruva Gole /**
544936afd9fSDhruva Gole  * struct ti_sci_msg_req_proc_request - Request a processor
545936afd9fSDhruva Gole  *
546936afd9fSDhruva Gole  * @hdr:		Generic Header
547936afd9fSDhruva Gole  * @processor_id:	ID of processor
548936afd9fSDhruva Gole  *
549936afd9fSDhruva Gole  * Request type is TISCI_MSG_PROC_REQUEST, response is a generic ACK/NACK
550936afd9fSDhruva Gole  * message.
551936afd9fSDhruva Gole  */
552936afd9fSDhruva Gole struct ti_sci_msg_req_proc_request {
553936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
554936afd9fSDhruva Gole 	uint8_t processor_id;
555936afd9fSDhruva Gole } __packed;
556936afd9fSDhruva Gole 
557936afd9fSDhruva Gole /**
558936afd9fSDhruva Gole  * struct ti_sci_msg_req_proc_release - Release a processor
559936afd9fSDhruva Gole  *
560936afd9fSDhruva Gole  * @hdr:		Generic Header
561936afd9fSDhruva Gole  * @processor_id:	ID of processor
562936afd9fSDhruva Gole  *
563936afd9fSDhruva Gole  * Request type is TISCI_MSG_PROC_RELEASE, response is a generic ACK/NACK
564936afd9fSDhruva Gole  * message.
565936afd9fSDhruva Gole  */
566936afd9fSDhruva Gole struct ti_sci_msg_req_proc_release {
567936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
568936afd9fSDhruva Gole 	uint8_t processor_id;
569936afd9fSDhruva Gole } __packed;
570936afd9fSDhruva Gole 
571936afd9fSDhruva Gole /**
572936afd9fSDhruva Gole  * struct ti_sci_msg_req_proc_handover - Handover a processor to a host
573936afd9fSDhruva Gole  *
574936afd9fSDhruva Gole  * @hdr:		Generic Header
575936afd9fSDhruva Gole  * @processor_id:	ID of processor
576936afd9fSDhruva Gole  * @host_id:		New Host we want to give control to
577936afd9fSDhruva Gole  *
578936afd9fSDhruva Gole  * Request type is TISCI_MSG_PROC_HANDOVER, response is a generic ACK/NACK
579936afd9fSDhruva Gole  * message.
580936afd9fSDhruva Gole  */
581936afd9fSDhruva Gole struct ti_sci_msg_req_proc_handover {
582936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
583936afd9fSDhruva Gole 	uint8_t processor_id;
584936afd9fSDhruva Gole 	uint8_t host_id;
585936afd9fSDhruva Gole } __packed;
586936afd9fSDhruva Gole 
587936afd9fSDhruva Gole /* A53 Config Flags */
588936afd9fSDhruva Gole #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_EN         0x00000001
589936afd9fSDhruva Gole #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_NIDEN      0x00000002
590936afd9fSDhruva Gole #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_SPIDEN     0x00000004
591936afd9fSDhruva Gole #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_SPNIDEN    0x00000008
592936afd9fSDhruva Gole #define PROC_BOOT_CFG_FLAG_ARMV8_AARCH32        0x00000100
593936afd9fSDhruva Gole 
594936afd9fSDhruva Gole /* R5 Config Flags */
595936afd9fSDhruva Gole #define PROC_BOOT_CFG_FLAG_R5_DBG_EN            0x00000001
596936afd9fSDhruva Gole #define PROC_BOOT_CFG_FLAG_R5_DBG_NIDEN         0x00000002
597936afd9fSDhruva Gole #define PROC_BOOT_CFG_FLAG_R5_LOCKSTEP          0x00000100
598936afd9fSDhruva Gole #define PROC_BOOT_CFG_FLAG_R5_TEINIT            0x00000200
599936afd9fSDhruva Gole #define PROC_BOOT_CFG_FLAG_R5_NMFI_EN           0x00000400
600936afd9fSDhruva Gole #define PROC_BOOT_CFG_FLAG_R5_TCM_RSTBASE       0x00000800
601936afd9fSDhruva Gole #define PROC_BOOT_CFG_FLAG_R5_BTCM_EN           0x00001000
602936afd9fSDhruva Gole #define PROC_BOOT_CFG_FLAG_R5_ATCM_EN           0x00002000
603936afd9fSDhruva Gole 
604936afd9fSDhruva Gole /**
605936afd9fSDhruva Gole  * struct ti_sci_msg_req_set_proc_boot_config - Set Processor boot configuration
606936afd9fSDhruva Gole  * @hdr:		Generic Header
607936afd9fSDhruva Gole  * @processor_id:	ID of processor
608936afd9fSDhruva Gole  * @bootvector_low:	Lower 32bit (Little Endian) of boot vector
609936afd9fSDhruva Gole  * @bootvector_high:	Higher 32bit (Little Endian) of boot vector
610936afd9fSDhruva Gole  * @config_flags_set:	Optional Processor specific Config Flags to set.
611936afd9fSDhruva Gole  *			Setting a bit here implies required bit sets to 1.
612936afd9fSDhruva Gole  * @config_flags_clear:	Optional Processor specific Config Flags to clear.
613936afd9fSDhruva Gole  *			Setting a bit here implies required bit gets cleared.
614936afd9fSDhruva Gole  *
615936afd9fSDhruva Gole  * Request type is TISCI_MSG_SET_PROC_BOOT_CONFIG, response is a generic
616936afd9fSDhruva Gole  * ACK/NACK message.
617936afd9fSDhruva Gole  */
618936afd9fSDhruva Gole struct ti_sci_msg_req_set_proc_boot_config {
619936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
620936afd9fSDhruva Gole 	uint8_t processor_id;
621936afd9fSDhruva Gole 	uint32_t bootvector_low;
622936afd9fSDhruva Gole 	uint32_t bootvector_high;
623936afd9fSDhruva Gole 	uint32_t config_flags_set;
624936afd9fSDhruva Gole 	uint32_t config_flags_clear;
625936afd9fSDhruva Gole } __packed;
626936afd9fSDhruva Gole 
627936afd9fSDhruva Gole /* ARMV8 Control Flags */
628936afd9fSDhruva Gole #define PROC_BOOT_CTRL_FLAG_ARMV8_ACINACTM      0x00000001
629936afd9fSDhruva Gole #define PROC_BOOT_CTRL_FLAG_ARMV8_AINACTS       0x00000002
630936afd9fSDhruva Gole #define PROC_BOOT_CTRL_FLAG_ARMV8_L2FLUSHREQ    0x00000100
631936afd9fSDhruva Gole 
632936afd9fSDhruva Gole /* R5 Control Flags */
633936afd9fSDhruva Gole #define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT        0x00000001
634936afd9fSDhruva Gole 
635936afd9fSDhruva Gole /**
636936afd9fSDhruva Gole  * struct ti_sci_msg_req_set_proc_boot_ctrl - Set Processor boot control flags
637936afd9fSDhruva Gole  * @hdr:		Generic Header
638936afd9fSDhruva Gole  * @processor_id:	ID of processor
639936afd9fSDhruva Gole  * @config_flags_set:	Optional Processor specific Config Flags to set.
640936afd9fSDhruva Gole  *			Setting a bit here implies required bit sets to 1.
641936afd9fSDhruva Gole  * @config_flags_clear:	Optional Processor specific Config Flags to clear.
642936afd9fSDhruva Gole  *			Setting a bit here implies required bit gets cleared.
643936afd9fSDhruva Gole  *
644936afd9fSDhruva Gole  * Request type is TISCI_MSG_SET_PROC_BOOT_CTRL, response is a generic ACK/NACK
645936afd9fSDhruva Gole  * message.
646936afd9fSDhruva Gole  */
647936afd9fSDhruva Gole struct ti_sci_msg_req_set_proc_boot_ctrl {
648936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
649936afd9fSDhruva Gole 	uint8_t processor_id;
650936afd9fSDhruva Gole 	uint32_t control_flags_set;
651936afd9fSDhruva Gole 	uint32_t control_flags_clear;
652936afd9fSDhruva Gole } __packed;
653936afd9fSDhruva Gole 
654936afd9fSDhruva Gole /**
655936afd9fSDhruva Gole  * struct ti_sci_msg_req_proc_auth_start_image - Authenticate and start image
656936afd9fSDhruva Gole  * @hdr:		Generic Header
657936afd9fSDhruva Gole  * @processor_id:	ID of processor
658936afd9fSDhruva Gole  * @cert_addr_low:	Lower 32bit (Little Endian) of certificate
659936afd9fSDhruva Gole  * @cert_addr_high:	Higher 32bit (Little Endian) of certificate
660936afd9fSDhruva Gole  *
661936afd9fSDhruva Gole  * Request type is TISCI_MSG_PROC_AUTH_BOOT_IMAGE, response is a generic
662936afd9fSDhruva Gole  * ACK/NACK message.
663936afd9fSDhruva Gole  */
664936afd9fSDhruva Gole struct ti_sci_msg_req_proc_auth_boot_image {
665936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
666936afd9fSDhruva Gole 	uint8_t processor_id;
667936afd9fSDhruva Gole 	uint32_t cert_addr_low;
668936afd9fSDhruva Gole 	uint32_t cert_addr_high;
669936afd9fSDhruva Gole } __packed;
670936afd9fSDhruva Gole 
671936afd9fSDhruva Gole /**
672936afd9fSDhruva Gole  * struct ti_sci_msg_req_get_proc_boot_status - Get processor boot status
673936afd9fSDhruva Gole  * @hdr:		Generic Header
674936afd9fSDhruva Gole  * @processor_id:	ID of processor
675936afd9fSDhruva Gole  *
676936afd9fSDhruva Gole  * Request type is TISCI_MSG_GET_PROC_BOOT_STATUS, response is appropriate
677936afd9fSDhruva Gole  * message, or NACK in case of inability to satisfy request.
678936afd9fSDhruva Gole  */
679936afd9fSDhruva Gole struct ti_sci_msg_req_get_proc_boot_status {
680936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
681936afd9fSDhruva Gole 	uint8_t processor_id;
682936afd9fSDhruva Gole } __packed;
683936afd9fSDhruva Gole 
684936afd9fSDhruva Gole /* ARMv8 Status Flags */
685936afd9fSDhruva Gole #define PROC_BOOT_STATUS_FLAG_ARMV8_WFE			0x00000001
686936afd9fSDhruva Gole #define PROC_BOOT_STATUS_FLAG_ARMV8_WFI			0x00000002
687936afd9fSDhruva Gole #define PROC_BOOT_STATUS_FLAG_ARMV8_L2F_DONE		0x00000010
688936afd9fSDhruva Gole #define PROC_BOOT_STATUS_FLAG_ARMV8_STANDBYWFIL2	0x00000020
689936afd9fSDhruva Gole 
690936afd9fSDhruva Gole /* R5 Status Flags */
691936afd9fSDhruva Gole #define PROC_BOOT_STATUS_FLAG_R5_WFE			0x00000001
692936afd9fSDhruva Gole #define PROC_BOOT_STATUS_FLAG_R5_WFI			0x00000002
693936afd9fSDhruva Gole #define PROC_BOOT_STATUS_FLAG_R5_CLK_GATED		0x00000004
694936afd9fSDhruva Gole #define PROC_BOOT_STATUS_FLAG_R5_LOCKSTEP_PERMITTED	0x00000100
695936afd9fSDhruva Gole 
696936afd9fSDhruva Gole /**
697936afd9fSDhruva Gole  * \brief Processor Status Response
698936afd9fSDhruva Gole  * struct ti_sci_msg_resp_get_proc_boot_status - Processor boot status response
699936afd9fSDhruva Gole  * @hdr:		Generic Header
700936afd9fSDhruva Gole  * @processor_id:	ID of processor
701936afd9fSDhruva Gole  * @bootvector_low:	Lower 32bit (Little Endian) of boot vector
702936afd9fSDhruva Gole  * @bootvector_high:	Higher 32bit (Little Endian) of boot vector
703936afd9fSDhruva Gole  * @config_flags:	Optional Processor specific Config Flags set.
704936afd9fSDhruva Gole  * @control_flags:	Optional Processor specific Control Flags.
705936afd9fSDhruva Gole  * @status_flags:	Optional Processor specific Status Flags set.
706936afd9fSDhruva Gole  *
707936afd9fSDhruva Gole  * Response to TISCI_MSG_GET_PROC_BOOT_STATUS.
708936afd9fSDhruva Gole  */
709936afd9fSDhruva Gole struct ti_sci_msg_resp_get_proc_boot_status {
710936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
711936afd9fSDhruva Gole 	uint8_t processor_id;
712936afd9fSDhruva Gole 	uint32_t bootvector_low;
713936afd9fSDhruva Gole 	uint32_t bootvector_high;
714936afd9fSDhruva Gole 	uint32_t config_flags;
715936afd9fSDhruva Gole 	uint32_t control_flags;
716936afd9fSDhruva Gole 	uint32_t status_flags;
717936afd9fSDhruva Gole } __packed;
718936afd9fSDhruva Gole 
719936afd9fSDhruva Gole /**
720936afd9fSDhruva Gole  * struct ti_sci_msg_req_wait_proc_boot_status - Wait for a processor boot status
721936afd9fSDhruva Gole  * @hdr:			Generic Header
722936afd9fSDhruva Gole  * @processor_id:		ID of processor
723936afd9fSDhruva Gole  * @num_wait_iterations		Total number of iterations we will check before
724936afd9fSDhruva Gole  *				we will timeout and give up
725936afd9fSDhruva Gole  * @num_match_iterations	How many iterations should we have continued
726936afd9fSDhruva Gole  *				status to account for status bits glitching.
727936afd9fSDhruva Gole  *				This is to make sure that match occurs for
728936afd9fSDhruva Gole  *				consecutive checks. This implies that the
729936afd9fSDhruva Gole  *				worst case should consider that the stable
730936afd9fSDhruva Gole  *				time should at the worst be num_wait_iterations
731936afd9fSDhruva Gole  *				num_match_iterations to prevent timeout.
732936afd9fSDhruva Gole  * @delay_per_iteration_us	Specifies how long to wait (in micro seconds)
733936afd9fSDhruva Gole  *				between each status checks. This is the minimum
734936afd9fSDhruva Gole  *				duration, and overhead of register reads and
735936afd9fSDhruva Gole  *				checks are on top of this and can vary based on
736936afd9fSDhruva Gole  *				varied conditions.
737936afd9fSDhruva Gole  * @delay_before_iterations_us	Specifies how long to wait (in micro seconds)
738936afd9fSDhruva Gole  *				before the very first check in the first
739936afd9fSDhruva Gole  *				iteration of status check loop. This is the
740936afd9fSDhruva Gole  *				minimum duration, and overhead of register
741936afd9fSDhruva Gole  *				reads and checks are.
742936afd9fSDhruva Gole  * @status_flags_1_set_all_wait	If non-zero, Specifies that all bits of the
743936afd9fSDhruva Gole  *				status matching this field requested MUST be 1.
744936afd9fSDhruva Gole  * @status_flags_1_set_any_wait	If non-zero, Specifies that at least one of the
745936afd9fSDhruva Gole  *				bits matching this field requested MUST be 1.
746936afd9fSDhruva Gole  * @status_flags_1_clr_all_wait	If non-zero, Specifies that all bits of the
747936afd9fSDhruva Gole  *				status matching this field requested MUST be 0.
748936afd9fSDhruva Gole  * @status_flags_1_clr_any_wait	If non-zero, Specifies that at least one of the
749936afd9fSDhruva Gole  *				bits matching this field requested MUST be 0.
750936afd9fSDhruva Gole  *
751936afd9fSDhruva Gole  * Request type is TISCI_MSG_WAIT_PROC_BOOT_STATUS, response is appropriate
752936afd9fSDhruva Gole  * message, or NACK in case of inability to satisfy request.
753936afd9fSDhruva Gole  */
754936afd9fSDhruva Gole struct ti_sci_msg_req_wait_proc_boot_status {
755936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
756936afd9fSDhruva Gole 	uint8_t processor_id;
757936afd9fSDhruva Gole 	uint8_t num_wait_iterations;
758936afd9fSDhruva Gole 	uint8_t num_match_iterations;
759936afd9fSDhruva Gole 	uint8_t delay_per_iteration_us;
760936afd9fSDhruva Gole 	uint8_t delay_before_iterations_us;
761936afd9fSDhruva Gole 	uint32_t status_flags_1_set_all_wait;
762936afd9fSDhruva Gole 	uint32_t status_flags_1_set_any_wait;
763936afd9fSDhruva Gole 	uint32_t status_flags_1_clr_all_wait;
764936afd9fSDhruva Gole 	uint32_t status_flags_1_clr_any_wait;
765936afd9fSDhruva Gole } __packed;
766936afd9fSDhruva Gole 
767936afd9fSDhruva Gole /**
768936afd9fSDhruva Gole  * struct ti_sci_msg_req_enter_sleep - Request for TI_SCI_MSG_ENTER_SLEEP.
769936afd9fSDhruva Gole  *
770936afd9fSDhruva Gole  * @hdr		    Generic Header
771936afd9fSDhruva Gole  * @mode	    Low power mode to enter.
772936afd9fSDhruva Gole  * @proc_id	    Processor id to be restored.
773936afd9fSDhruva Gole  * @core_resume_lo  Low 32-bits of physical pointer to address for core
774936afd9fSDhruva Gole  *		    to begin execution upon resume.
775936afd9fSDhruva Gole  * @core_resume_hi  High 32-bits of physical pointer to address for core
776936afd9fSDhruva Gole  *		    to begin execution upon resume.
777936afd9fSDhruva Gole  *
778936afd9fSDhruva Gole  * This message is to be sent after TI_SCI_MSG_PREPARE_SLEEP is sent from OS
779936afd9fSDhruva Gole  * and is what actually triggers entry into the specified low power mode.
780936afd9fSDhruva Gole  */
781936afd9fSDhruva Gole struct ti_sci_msg_req_enter_sleep {
782936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
783936afd9fSDhruva Gole #define MSG_VALUE_SLEEP_MODE_DEEP_SLEEP 0x0
784936afd9fSDhruva Gole 	uint8_t mode;
785936afd9fSDhruva Gole 	uint8_t processor_id;
786936afd9fSDhruva Gole 	uint32_t core_resume_lo;
787936afd9fSDhruva Gole 	uint32_t core_resume_hi;
788936afd9fSDhruva Gole } __packed;
789936afd9fSDhruva Gole 
790936afd9fSDhruva Gole /**
791936afd9fSDhruva Gole  * struct ti_sci_msg_req_lpm_get_next_sys_mode - Request for TI_SCI_MSG_LPM_GET_NEXT_SYS_MODE.
792936afd9fSDhruva Gole  *
793936afd9fSDhruva Gole  * @hdr Generic Header
794936afd9fSDhruva Gole  *
795936afd9fSDhruva Gole  * This message is used to enquire DM for selected system wide low power mode.
796936afd9fSDhruva Gole  */
797936afd9fSDhruva Gole struct ti_sci_msg_req_lpm_get_next_sys_mode {
798936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
799936afd9fSDhruva Gole } __packed;
800936afd9fSDhruva Gole 
801936afd9fSDhruva Gole /**
802936afd9fSDhruva Gole  * struct ti_sci_msg_resp_lpm_get_next_sys_mode - Response for TI_SCI_MSG_LPM_GET_NEXT_SYS_MODE.
803936afd9fSDhruva Gole  *
804936afd9fSDhruva Gole  * @hdr Generic Header
805936afd9fSDhruva Gole  * @mode The selected system wide low power mode.
806936afd9fSDhruva Gole  *
807936afd9fSDhruva Gole  * Note: If the mode selection is not yet locked, this API returns "not selected" mode.
808936afd9fSDhruva Gole  */
809936afd9fSDhruva Gole struct ti_sci_msg_resp_lpm_get_next_sys_mode {
810936afd9fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
811936afd9fSDhruva Gole 	uint8_t mode;
812936afd9fSDhruva Gole } __packed;
813936afd9fSDhruva Gole 
814*7d3c700fSDhruva Gole /**
815*7d3c700fSDhruva Gole  * struct tisci_msg_boot_notification_msg - Response to TIFS boot notification
816*7d3c700fSDhruva Gole  *
817*7d3c700fSDhruva Gole  * This structure is used to consume the self initiated boot notification message
818*7d3c700fSDhruva Gole  * from TIFS(TI Foundation Security) firmware which indicates that it is available.
819*7d3c700fSDhruva Gole  *
820*7d3c700fSDhruva Gole  * @hdr: Standard TISCI message header.
821*7d3c700fSDhruva Gole  * @extboot_status: Status of extended boot. Applicable only for combined image
822*7d3c700fSDhruva Gole  */
823*7d3c700fSDhruva Gole struct tisci_msg_boot_notification_msg {
824*7d3c700fSDhruva Gole 	struct ti_sci_msg_hdr hdr;
825*7d3c700fSDhruva Gole 	uint32_t extboot_status;
826*7d3c700fSDhruva Gole } __packed;
827*7d3c700fSDhruva Gole 
828936afd9fSDhruva Gole #endif /* TI_SCI_PROTOCOL_H */
829