1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2020, Linaro Limited
6 #ifndef __SANDBOX_SCMI_TEST_H
7 #define __SANDBOX_SCMI_TEST_H
9 #include <power-domain.h>
12 struct sandbox_scmi_agent;
13 struct sandbox_scmi_service;
16 * struct sandbox_scmi_pwd
17 * @id: Identifier of the power domain used in the SCMI protocol
18 * @pstate:: Power state of the domain
20 struct sandbox_scmi_pwd {
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
31 struct sandbox_scmi_clk {
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
41 struct sandbox_scmi_reset {
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)
52 struct sandbox_scmi_voltd {
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
69 struct sandbox_scmi_agent {
71 struct sandbox_scmi_pwd *pwdom;
73 struct sandbox_scmi_clk *clk;
75 struct sandbox_scmi_reset *reset;
77 struct sandbox_scmi_voltd *voltd;
82 * struct sandbox_scmi_service - Reference to simutaed SCMI agents/services
83 * @agent: Pointer to SCMI sandbox agent or NULL if not probed
85 struct sandbox_scmi_service {
86 struct sandbox_scmi_agent *agent;
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
100 struct sandbox_scmi_devices {
101 struct power_domain *pwdom;
105 struct reset_ctl *reset;
107 struct udevice **regul;
111 #ifdef CONFIG_SCMI_FIRMWARE
113 * sandbox_scmi_channel_id - Get the channel id
114 * @dev: Reference to the SCMI protocol device
118 unsigned int sandbox_scmi_channel_id(struct udevice *dev);
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
126 struct sandbox_scmi_agent *sandbox_scmi_agent_ctx(struct udevice *dev);
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
133 struct sandbox_scmi_devices *sandbox_scmi_devices_ctx(struct udevice *dev);
135 inline unsigned int sandbox_scmi_channel_id(struct udevice *dev);
140 static struct sandbox_scmi_agent *sandbox_scmi_agent_ctx(struct udevice *dev)
146 struct sandbox_scmi_devices *sandbox_scmi_devices_ctx(struct udevice *dev)
150 #endif /* CONFIG_SCMI_FIRMWARE */
151 #endif /* __SANDBOX_SCMI_TEST_H */