From 0124218b8b4762621f5ff74bd03eb1bcb1d4e733 Mon Sep 17 00:00:00 2001 From: Etienne Carriere Date: Mon, 8 Mar 2021 22:38:07 +0100 Subject: firmware: scmi: sandbox test for voltage regulator Implement sandbox regulator devices for SCMI voltage domains and test them in DM scmi tests. Signed-off-by: Etienne Carriere Reviewed-by: Simon Glass Reviewed-by: Jaehoon Chung --- arch/sandbox/dts/test.dts | 23 +++++++++++++++++++++++ arch/sandbox/include/asm/scmi_test.h | 20 ++++++++++++++++++++ 2 files changed, 43 insertions(+) (limited to 'arch/sandbox') diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 899e75f..8c4c2bf 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -497,6 +497,27 @@ reg = <0x16>; #reset-cells = <1>; }; + + protocol@17 { + reg = <0x17>; + + regulators { + #address-cells = <1>; + #size-cells = <0>; + + regul0_scmi0: reg@0 { + reg = <0>; + regulator-name = "sandbox-voltd0"; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <3300000>; + }; + regul1_scmi0: reg@1 { + reg = <0x1>; + regulator-name = "sandbox-voltd1"; + regulator-min-microvolt = <1800000>; + }; + }; + }; }; sandbox-scmi-agent@1 { @@ -1264,6 +1285,8 @@ compatible = "sandbox,scmi-devices"; clocks = <&clk_scmi0 7>, <&clk_scmi0 3>, <&clk_scmi1 1>; resets = <&reset_scmi0 3>; + regul0-supply = <®ul0_scmi0>; + regul1-supply = <®ul1_scmi0>; }; pinctrl { diff --git a/arch/sandbox/include/asm/scmi_test.h b/arch/sandbox/include/asm/scmi_test.h index 3e8b006..9b70315 100644 --- a/arch/sandbox/include/asm/scmi_test.h +++ b/arch/sandbox/include/asm/scmi_test.h @@ -32,12 +32,26 @@ struct sandbox_scmi_reset { }; /** + * 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; +}; + +/** * struct sandbox_scmi_agent - Simulated SCMI service seen by SCMI agent * @idx: Identifier for the SCMI agent, its index * @clk: Simulated clocks * @clk_count: Simulated clocks array size * @clk: Simulated reset domains * @clk_count: Simulated reset domains array size + * @voltd: Simulated voltage domains (regulators) + * @voltd_count: Simulated voltage domains array size */ struct sandbox_scmi_agent { uint idx; @@ -45,6 +59,8 @@ struct sandbox_scmi_agent { size_t clk_count; struct sandbox_scmi_reset *reset; size_t reset_count; + struct sandbox_scmi_voltd *voltd; + size_t voltd_count; }; /** @@ -63,12 +79,16 @@ struct sandbox_scmi_service { * @clk_count: Number of clock devices probed * @reset: Array the reset controller devices * @reset_count: Number of reset controller devices probed + * @regul: Array regulator devices + * @regul_count: Number of regulator devices probed */ struct sandbox_scmi_devices { struct clk *clk; size_t clk_count; struct reset_ctl *reset; size_t reset_count; + struct udevice **regul; + size_t regul_count; }; #ifdef CONFIG_SCMI_FIRMWARE -- cgit v1.1