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
10 struct sandbox_scmi_agent;
11 struct sandbox_scmi_service;
14 * struct sandbox_scmi_clk - Simulated clock exposed by SCMI
15 * @id: Identifier of the clock used in the SCMI protocol
16 * @enabled: Clock state: true if enabled, false if disabled
17 * @rate: Clock rate in Hertz
19 struct sandbox_scmi_clk {
25 * struct sandbox_scmi_reset - Simulated reset controller exposed by SCMI
26 * @id: Identifier of the reset controller used in the SCMI protocol
27 * @asserted: Reset control state: true if asserted, false if desasserted
29 struct sandbox_scmi_reset {
35 * struct sandbox_scmi_voltd - Simulated voltage regulator exposed by SCMI
36 * @id: Identifier of the voltage domain used in the SCMI protocol
37 * @enabled: Regulator state: true if on, false if off
38 * @voltage_uv: Regulator current voltage in microvoltd (uV)
40 struct sandbox_scmi_voltd {
47 * struct sandbox_scmi_agent - Simulated SCMI service seen by SCMI agent
48 * @clk: Simulated clocks
49 * @clk_count: Simulated clocks array size
50 * @reset: Simulated reset domains
51 * @reset_count: Simulated reset domains array size
52 * @voltd: Simulated voltage domains (regulators)
53 * @voltd_count: Simulated voltage domains array size
55 struct sandbox_scmi_agent {
56 struct sandbox_scmi_clk *clk;
58 struct sandbox_scmi_reset *reset;
60 struct sandbox_scmi_voltd *voltd;
65 * struct sandbox_scmi_service - Reference to simutaed SCMI agents/services
66 * @agent: Pointer to SCMI sandbox agent or NULL if not probed
68 struct sandbox_scmi_service {
69 struct sandbox_scmi_agent *agent;
73 * struct sandbox_scmi_devices - Reference to devices probed through SCMI
74 * @clk: Array the clock devices
75 * @clk_count: Number of clock devices probed
76 * @reset: Array the reset controller devices
77 * @reset_count: Number of reset controller devices probed
78 * @regul: Array regulator devices
79 * @regul_count: Number of regulator devices probed
81 struct sandbox_scmi_devices {
84 struct reset_ctl *reset;
86 struct udevice **regul;
90 #ifdef CONFIG_SCMI_FIRMWARE
92 * sandbox_scmi_service_ctx - Get the simulated SCMI services context
93 * @return: Reference to backend simulated resources state
95 struct sandbox_scmi_service *sandbox_scmi_service_ctx(void);
98 * sandbox_scmi_devices_ctx - Get references to devices accessed through SCMI
99 * @dev: Reference to the test device used get test resources
100 * @return: Reference to the devices probed by the SCMI test
102 struct sandbox_scmi_devices *sandbox_scmi_devices_ctx(struct udevice *dev);
104 static inline struct sandbox_scmi_service *sandbox_scmi_service_ctx(void)
110 struct sandbox_scmi_devices *sandbox_scmi_devices_ctx(struct udevice *dev)
114 #endif /* CONFIG_SCMI_FIRMWARE */
115 #endif /* __SANDBOX_SCMI_TEST_H */