2020-09-09 16:44:00 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2020, Linaro Limited
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SANDBOX_SCMI_TEST_H
|
|
|
|
#define __SANDBOX_SCMI_TEST_H
|
|
|
|
|
|
|
|
struct udevice;
|
|
|
|
struct sandbox_scmi_agent;
|
|
|
|
struct sandbox_scmi_service;
|
|
|
|
|
2020-09-09 16:44:05 +00:00
|
|
|
/**
|
|
|
|
* struct sandbox_scmi_clk - Simulated clock exposed by SCMI
|
|
|
|
* @id: Identifier of the clock used in the SCMI protocol
|
|
|
|
* @enabled: Clock state: true if enabled, false if disabled
|
|
|
|
* @rate: Clock rate in Hertz
|
|
|
|
*/
|
|
|
|
struct sandbox_scmi_clk {
|
|
|
|
uint id;
|
|
|
|
bool enabled;
|
|
|
|
ulong rate;
|
|
|
|
};
|
|
|
|
|
2020-09-09 16:44:07 +00:00
|
|
|
/**
|
|
|
|
* struct sandbox_scmi_reset - Simulated reset controller exposed by SCMI
|
2021-03-08 21:38:08 +00:00
|
|
|
* @id: Identifier of the reset controller used in the SCMI protocol
|
2020-09-09 16:44:07 +00:00
|
|
|
* @asserted: Reset control state: true if asserted, false if desasserted
|
|
|
|
*/
|
|
|
|
struct sandbox_scmi_reset {
|
|
|
|
uint id;
|
|
|
|
bool asserted;
|
|
|
|
};
|
|
|
|
|
2021-03-08 21:38:07 +00:00
|
|
|
/**
|
|
|
|
* struct sandbox_scmi_voltd - Simulated voltage regulator exposed by SCMI
|
|
|
|
* @id: Identifier of the voltage domain used in the SCMI protocol
|
|
|
|
* @enabled: Regulator state: true if on, false if off
|
|
|
|
* @voltage_uv: Regulator current voltage in microvoltd (uV)
|
|
|
|
*/
|
|
|
|
struct sandbox_scmi_voltd {
|
|
|
|
uint id;
|
|
|
|
bool enabled;
|
|
|
|
int voltage_uv;
|
|
|
|
};
|
|
|
|
|
2020-09-09 16:44:00 +00:00
|
|
|
/**
|
|
|
|
* struct sandbox_scmi_agent - Simulated SCMI service seen by SCMI agent
|
2020-09-09 16:44:05 +00:00
|
|
|
* @clk: Simulated clocks
|
|
|
|
* @clk_count: Simulated clocks array size
|
2021-03-08 21:38:08 +00:00
|
|
|
* @reset: Simulated reset domains
|
|
|
|
* @reset_count: Simulated reset domains array size
|
2021-03-08 21:38:07 +00:00
|
|
|
* @voltd: Simulated voltage domains (regulators)
|
|
|
|
* @voltd_count: Simulated voltage domains array size
|
2020-09-09 16:44:00 +00:00
|
|
|
*/
|
|
|
|
struct sandbox_scmi_agent {
|
2020-09-09 16:44:05 +00:00
|
|
|
struct sandbox_scmi_clk *clk;
|
|
|
|
size_t clk_count;
|
2020-09-09 16:44:07 +00:00
|
|
|
struct sandbox_scmi_reset *reset;
|
|
|
|
size_t reset_count;
|
2021-03-08 21:38:07 +00:00
|
|
|
struct sandbox_scmi_voltd *voltd;
|
|
|
|
size_t voltd_count;
|
2020-09-09 16:44:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct sandbox_scmi_service - Reference to simutaed SCMI agents/services
|
2022-02-21 08:22:39 +00:00
|
|
|
* @agent: Pointer to SCMI sandbox agent or NULL if not probed
|
2020-09-09 16:44:00 +00:00
|
|
|
*/
|
|
|
|
struct sandbox_scmi_service {
|
2022-02-21 08:22:39 +00:00
|
|
|
struct sandbox_scmi_agent *agent;
|
2020-09-09 16:44:00 +00:00
|
|
|
};
|
|
|
|
|
2020-09-09 16:44:05 +00:00
|
|
|
/**
|
|
|
|
* struct sandbox_scmi_devices - Reference to devices probed through SCMI
|
|
|
|
* @clk: Array the clock devices
|
|
|
|
* @clk_count: Number of clock devices probed
|
2020-09-09 16:44:07 +00:00
|
|
|
* @reset: Array the reset controller devices
|
|
|
|
* @reset_count: Number of reset controller devices probed
|
2021-03-08 21:38:07 +00:00
|
|
|
* @regul: Array regulator devices
|
|
|
|
* @regul_count: Number of regulator devices probed
|
2020-09-09 16:44:05 +00:00
|
|
|
*/
|
|
|
|
struct sandbox_scmi_devices {
|
|
|
|
struct clk *clk;
|
|
|
|
size_t clk_count;
|
2020-09-09 16:44:07 +00:00
|
|
|
struct reset_ctl *reset;
|
|
|
|
size_t reset_count;
|
2021-03-08 21:38:07 +00:00
|
|
|
struct udevice **regul;
|
|
|
|
size_t regul_count;
|
2020-09-09 16:44:05 +00:00
|
|
|
};
|
|
|
|
|
2020-09-09 16:44:00 +00:00
|
|
|
#ifdef CONFIG_SCMI_FIRMWARE
|
|
|
|
/**
|
2022-02-21 08:22:39 +00:00
|
|
|
* sandbox_scmi_service_ctx - Get the simulated SCMI services context
|
2020-09-09 16:44:00 +00:00
|
|
|
* @return: Reference to backend simulated resources state
|
|
|
|
*/
|
|
|
|
struct sandbox_scmi_service *sandbox_scmi_service_ctx(void);
|
2020-09-09 16:44:05 +00:00
|
|
|
|
|
|
|
/**
|
2022-02-21 08:22:39 +00:00
|
|
|
* sandbox_scmi_devices_ctx - Get references to devices accessed through SCMI
|
2020-09-09 16:44:05 +00:00
|
|
|
* @dev: Reference to the test device used get test resources
|
|
|
|
* @return: Reference to the devices probed by the SCMI test
|
|
|
|
*/
|
|
|
|
struct sandbox_scmi_devices *sandbox_scmi_devices_ctx(struct udevice *dev);
|
2020-09-09 16:44:00 +00:00
|
|
|
#else
|
|
|
|
static inline struct sandbox_scmi_service *sandbox_scmi_service_ctx(void)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2020-09-09 16:44:05 +00:00
|
|
|
|
|
|
|
static inline
|
|
|
|
struct sandbox_scmi_devices *sandbox_scmi_devices_ctx(struct udevice *dev)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2020-09-09 16:44:00 +00:00
|
|
|
#endif /* CONFIG_SCMI_FIRMWARE */
|
|
|
|
#endif /* __SANDBOX_SCMI_TEST_H */
|