xref: /rk3399_ARM-atf/drivers/scmi-msg/reset_domain.h (revision 26dccba6dd1313113252357f433c8085f2c63a09)
1*b4734308SPeng Fan /* SPDX-License-Identifier: BSD-3-Clause */
2*b4734308SPeng Fan /*
3*b4734308SPeng Fan  * Copyright (c) 2015-2019, Arm Limited and Contributors. All rights reserved.
4*b4734308SPeng Fan  * Copyright (c) 2019, Linaro Limited
5*b4734308SPeng Fan  */
6*b4734308SPeng Fan #ifndef SCMI_MSG_RESET_DOMAIN_H
7*b4734308SPeng Fan #define SCMI_MSG_RESET_DOMAIN_H
8*b4734308SPeng Fan 
9*b4734308SPeng Fan #include <stdbool.h>
10*b4734308SPeng Fan #include <stdint.h>
11*b4734308SPeng Fan 
12*b4734308SPeng Fan #include <lib/utils_def.h>
13*b4734308SPeng Fan 
14*b4734308SPeng Fan #define SCMI_PROTOCOL_VERSION_RESET_DOMAIN	0x10000U
15*b4734308SPeng Fan 
16*b4734308SPeng Fan #define SCMI_RESET_STATE_ARCH			BIT(31)
17*b4734308SPeng Fan #define SCMI_RESET_STATE_IMPL			0U
18*b4734308SPeng Fan 
19*b4734308SPeng Fan /*
20*b4734308SPeng Fan  * Identifiers of the SCMI Reset Domain Management Protocol commands
21*b4734308SPeng Fan  */
22*b4734308SPeng Fan enum scmi_reset_domain_command_id {
23*b4734308SPeng Fan 	SCMI_RESET_DOMAIN_ATTRIBUTES = 0x03,
24*b4734308SPeng Fan 	SCMI_RESET_DOMAIN_REQUEST = 0x04,
25*b4734308SPeng Fan 	SCMI_RESET_DOMAIN_NOTIFY = 0x05,
26*b4734308SPeng Fan };
27*b4734308SPeng Fan 
28*b4734308SPeng Fan /*
29*b4734308SPeng Fan  * Identifiers of the SCMI Reset Domain Management Protocol responses
30*b4734308SPeng Fan  */
31*b4734308SPeng Fan enum scmi_reset_domain_response_id {
32*b4734308SPeng Fan 	SCMI_RESET_ISSUED = 0x00,
33*b4734308SPeng Fan 	SCMI_RESET_COMPLETE = 0x04,
34*b4734308SPeng Fan };
35*b4734308SPeng Fan 
36*b4734308SPeng Fan /*
37*b4734308SPeng Fan  * PROTOCOL_ATTRIBUTES
38*b4734308SPeng Fan  */
39*b4734308SPeng Fan 
40*b4734308SPeng Fan #define SCMI_RESET_DOMAIN_COUNT_MASK		GENMASK_32(15, 0)
41*b4734308SPeng Fan 
42*b4734308SPeng Fan struct scmi_reset_domain_protocol_attributes_p2a {
43*b4734308SPeng Fan 	int32_t status;
44*b4734308SPeng Fan 	uint32_t attributes;
45*b4734308SPeng Fan };
46*b4734308SPeng Fan 
47*b4734308SPeng Fan /* Value for scmi_reset_domain_attributes_p2a:flags */
48*b4734308SPeng Fan #define SCMI_RESET_DOMAIN_ATTR_ASYNC		BIT(31)
49*b4734308SPeng Fan #define SCMI_RESET_DOMAIN_ATTR_NOTIF		BIT(30)
50*b4734308SPeng Fan 
51*b4734308SPeng Fan /* Value for scmi_reset_domain_attributes_p2a:latency */
52*b4734308SPeng Fan #define SCMI_RESET_DOMAIN_ATTR_UNK_LAT		0x7fffffffU
53*b4734308SPeng Fan #define SCMI_RESET_DOMAIN_ATTR_MAX_LAT		0x7ffffffeU
54*b4734308SPeng Fan 
55*b4734308SPeng Fan /* Macro for scmi_reset_domain_attributes_p2a:name */
56*b4734308SPeng Fan #define SCMI_RESET_DOMAIN_ATTR_NAME_SZ		16U
57*b4734308SPeng Fan 
58*b4734308SPeng Fan struct scmi_reset_domain_attributes_a2p {
59*b4734308SPeng Fan 	uint32_t domain_id;
60*b4734308SPeng Fan };
61*b4734308SPeng Fan 
62*b4734308SPeng Fan struct scmi_reset_domain_attributes_p2a {
63*b4734308SPeng Fan 	int32_t status;
64*b4734308SPeng Fan 	uint32_t flags;
65*b4734308SPeng Fan 	uint32_t latency;
66*b4734308SPeng Fan 	char name[SCMI_RESET_DOMAIN_ATTR_NAME_SZ];
67*b4734308SPeng Fan };
68*b4734308SPeng Fan 
69*b4734308SPeng Fan /*
70*b4734308SPeng Fan  * RESET
71*b4734308SPeng Fan  */
72*b4734308SPeng Fan 
73*b4734308SPeng Fan /* Values for scmi_reset_domain_request_a2p:flags */
74*b4734308SPeng Fan #define SCMI_RESET_DOMAIN_ASYNC			BIT(2)
75*b4734308SPeng Fan #define SCMI_RESET_DOMAIN_EXPLICIT		BIT(1)
76*b4734308SPeng Fan #define SCMI_RESET_DOMAIN_AUTO			BIT(0)
77*b4734308SPeng Fan 
78*b4734308SPeng Fan struct scmi_reset_domain_request_a2p {
79*b4734308SPeng Fan 	uint32_t domain_id;
80*b4734308SPeng Fan 	uint32_t flags;
81*b4734308SPeng Fan 	uint32_t reset_state;
82*b4734308SPeng Fan };
83*b4734308SPeng Fan 
84*b4734308SPeng Fan struct scmi_reset_domain_request_p2a {
85*b4734308SPeng Fan 	int32_t status;
86*b4734308SPeng Fan };
87*b4734308SPeng Fan 
88*b4734308SPeng Fan /*
89*b4734308SPeng Fan  * RESET_NOTIFY
90*b4734308SPeng Fan  */
91*b4734308SPeng Fan 
92*b4734308SPeng Fan /* Values for scmi_reset_notify_p2a:flags */
93*b4734308SPeng Fan #define SCMI_RESET_DOMAIN_DO_NOTIFY		BIT(0)
94*b4734308SPeng Fan 
95*b4734308SPeng Fan struct scmi_reset_domain_notify_a2p {
96*b4734308SPeng Fan 	uint32_t domain_id;
97*b4734308SPeng Fan 	uint32_t notify_enable;
98*b4734308SPeng Fan };
99*b4734308SPeng Fan 
100*b4734308SPeng Fan struct scmi_reset_domain_notify_p2a {
101*b4734308SPeng Fan 	int32_t status;
102*b4734308SPeng Fan };
103*b4734308SPeng Fan 
104*b4734308SPeng Fan /*
105*b4734308SPeng Fan  * RESET_COMPLETE
106*b4734308SPeng Fan  */
107*b4734308SPeng Fan 
108*b4734308SPeng Fan struct scmi_reset_domain_complete_p2a {
109*b4734308SPeng Fan 	int32_t status;
110*b4734308SPeng Fan 	uint32_t domain_id;
111*b4734308SPeng Fan };
112*b4734308SPeng Fan 
113*b4734308SPeng Fan /*
114*b4734308SPeng Fan  * RESET_ISSUED
115*b4734308SPeng Fan  */
116*b4734308SPeng Fan 
117*b4734308SPeng Fan struct scmi_reset_domain_issued_p2a {
118*b4734308SPeng Fan 	uint32_t domain_id;
119*b4734308SPeng Fan 	uint32_t reset_state;
120*b4734308SPeng Fan };
121*b4734308SPeng Fan 
122*b4734308SPeng Fan #endif /* SCMI_MSG_RESET_DOMAIN_H */
123