]> Git Repo - J-u-boot.git/blob - arch/sandbox/include/asm/scmi_test.h
Merge tag 'u-boot-imx-master-20250127' of https://gitlab.denx.de/u-boot/custodians...
[J-u-boot.git] / arch / sandbox / include / asm / scmi_test.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2020, Linaro Limited
4  */
5
6 #ifndef __SANDBOX_SCMI_TEST_H
7 #define __SANDBOX_SCMI_TEST_H
8
9 #include <power-domain.h>
10
11 struct udevice;
12 struct sandbox_scmi_agent;
13 struct sandbox_scmi_service;
14
15 /**
16  * struct sandbox_scmi_pwd
17  * @id:         Identifier of the power domain used in the SCMI protocol
18  * @pstate::    Power state of the domain
19  */
20 struct sandbox_scmi_pwd {
21         uint id;
22         u32 pstate;
23 };
24
25 /**
26  * struct sandbox_scmi_clk - Simulated clock exposed by SCMI
27  * @id:         Identifier of the clock used in the SCMI protocol
28  * @enabled:    Clock state: true if enabled, false if disabled
29  * @rate:       Clock rate in Hertz
30  */
31 struct sandbox_scmi_clk {
32         bool enabled;
33         ulong rate;
34 };
35
36 /**
37  * struct sandbox_scmi_reset - Simulated reset controller exposed by SCMI
38  * @id:         Identifier of the reset controller used in the SCMI protocol
39  * @asserted:   Reset control state: true if asserted, false if desasserted
40  */
41 struct sandbox_scmi_reset {
42         uint id;
43         bool asserted;
44 };
45
46 /**
47  * struct sandbox_scmi_voltd - Simulated voltage regulator exposed by SCMI
48  * @id:         Identifier of the voltage domain used in the SCMI protocol
49  * @enabled:    Regulator state: true if on, false if off
50  * @voltage_uv: Regulator current voltage in microvoltd (uV)
51  */
52 struct sandbox_scmi_voltd {
53         uint id;
54         bool enabled;
55         int voltage_uv;
56 };
57
58 /**
59  * struct sandbox_scmi_agent - Simulated SCMI service seen by SCMI agent
60  * @pwdom_version: Implemented power domain protocol version
61  * @pwdom_count:   Simulated power domains array size
62  * @clk:        Simulated clocks
63  * @clk_count:  Simulated clocks array size
64  * @reset:      Simulated reset domains
65  * @reset_count: Simulated reset domains array size
66  * @voltd:       Simulated voltage domains (regulators)
67  * @voltd_count: Simulated voltage domains array size
68  */
69 struct sandbox_scmi_agent {
70         int pwdom_version;
71         struct sandbox_scmi_pwd *pwdom;
72         size_t pwdom_count;
73         struct sandbox_scmi_clk *clk;
74         size_t clk_count;
75         struct sandbox_scmi_reset *reset;
76         size_t reset_count;
77         struct sandbox_scmi_voltd *voltd;
78         size_t voltd_count;
79 };
80
81 /**
82  * struct sandbox_scmi_service - Reference to simutaed SCMI agents/services
83  * @agent:              Pointer to SCMI sandbox agent or NULL if not probed
84  */
85 struct sandbox_scmi_service {
86         struct sandbox_scmi_agent *agent;
87 };
88
89 /**
90  * struct sandbox_scmi_devices - Reference to devices probed through SCMI
91  * @pwdom:              Array of power domains
92  * @pwdom_count:        Number of power domains probed
93  * @clk:                Array the clock devices
94  * @clk_count:          Number of clock devices probed
95  * @reset:              Array the reset controller devices
96  * @reset_count:        Number of reset controller devices probed
97  * @regul:              Array regulator devices
98  * @regul_count:        Number of regulator devices probed
99  */
100 struct sandbox_scmi_devices {
101         struct power_domain *pwdom;
102         size_t pwdom_count;
103         struct clk *clk;
104         size_t clk_count;
105         struct reset_ctl *reset;
106         size_t reset_count;
107         struct udevice **regul;
108         size_t regul_count;
109 };
110
111 #ifdef CONFIG_SCMI_FIRMWARE
112 /**
113  * sandbox_scmi_channel_id - Get the channel id
114  * @dev:        Reference to the SCMI protocol device
115  *
116  * Return:      Channel id
117  */
118 unsigned int sandbox_scmi_channel_id(struct udevice *dev);
119
120 /**
121  * sandbox_scmi_service_ctx - Get the simulated SCMI services context
122  * sandbox_scmi_agent_ctx - Get the simulated SCMI agent context
123  * @dev:        Reference to the test agent
124  * @return:     Reference to backend simulated resources state
125  */
126 struct sandbox_scmi_agent *sandbox_scmi_agent_ctx(struct udevice *dev);
127
128 /**
129  * sandbox_scmi_devices_ctx - Get references to devices accessed through SCMI
130  * @dev:        Reference to the test device used get test resources
131  * @return:     Reference to the devices probed by the SCMI test
132  */
133 struct sandbox_scmi_devices *sandbox_scmi_devices_ctx(struct udevice *dev);
134 #else
135 inline unsigned int sandbox_scmi_channel_id(struct udevice *dev);
136 {
137         return 0;
138 }
139
140 static struct sandbox_scmi_agent *sandbox_scmi_agent_ctx(struct udevice *dev)
141 {
142         return NULL;
143 }
144
145 static inline
146 struct sandbox_scmi_devices *sandbox_scmi_devices_ctx(struct udevice *dev)
147 {
148         return NULL;
149 }
150 #endif /* CONFIG_SCMI_FIRMWARE */
151 #endif /* __SANDBOX_SCMI_TEST_H */
This page took 0.035817 seconds and 4 git commands to generate.