Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 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 | struct udevice; |
| 10 | struct sandbox_scmi_agent; |
| 11 | struct sandbox_scmi_service; |
| 12 | |
| 13 | /** |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame^] | 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 |
| 18 | */ |
| 19 | struct sandbox_scmi_clk { |
| 20 | uint id; |
| 21 | bool enabled; |
| 22 | ulong rate; |
| 23 | }; |
| 24 | |
| 25 | /** |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 26 | * struct sandbox_scmi_agent - Simulated SCMI service seen by SCMI agent |
| 27 | * @idx: Identifier for the SCMI agent, its index |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame^] | 28 | * @clk: Simulated clocks |
| 29 | * @clk_count: Simulated clocks array size |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 30 | */ |
| 31 | struct sandbox_scmi_agent { |
| 32 | uint idx; |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame^] | 33 | struct sandbox_scmi_clk *clk; |
| 34 | size_t clk_count; |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | /** |
| 38 | * struct sandbox_scmi_service - Reference to simutaed SCMI agents/services |
| 39 | * @agent: Pointer to SCMI sandbox agent pointers array |
| 40 | * @agent_count: Number of emulated agents exposed in array @agent. |
| 41 | */ |
| 42 | struct sandbox_scmi_service { |
| 43 | struct sandbox_scmi_agent **agent; |
| 44 | size_t agent_count; |
| 45 | }; |
| 46 | |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame^] | 47 | /** |
| 48 | * struct sandbox_scmi_devices - Reference to devices probed through SCMI |
| 49 | * @clk: Array the clock devices |
| 50 | * @clk_count: Number of clock devices probed |
| 51 | */ |
| 52 | struct sandbox_scmi_devices { |
| 53 | struct clk *clk; |
| 54 | size_t clk_count; |
| 55 | }; |
| 56 | |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 57 | #ifdef CONFIG_SCMI_FIRMWARE |
| 58 | /** |
| 59 | * sandbox_scmi_service_context - Get the simulated SCMI services context |
| 60 | * @return: Reference to backend simulated resources state |
| 61 | */ |
| 62 | struct sandbox_scmi_service *sandbox_scmi_service_ctx(void); |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame^] | 63 | |
| 64 | /** |
| 65 | * sandbox_scmi_devices_get_ref - Get references to devices accessed through SCMI |
| 66 | * @dev: Reference to the test device used get test resources |
| 67 | * @return: Reference to the devices probed by the SCMI test |
| 68 | */ |
| 69 | struct sandbox_scmi_devices *sandbox_scmi_devices_ctx(struct udevice *dev); |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 70 | #else |
| 71 | static inline struct sandbox_scmi_service *sandbox_scmi_service_ctx(void) |
| 72 | { |
| 73 | return NULL; |
| 74 | } |
Etienne Carriere | 2d94c08fa | 2020-09-09 18:44:05 +0200 | [diff] [blame^] | 75 | |
| 76 | static inline |
| 77 | struct sandbox_scmi_devices *sandbox_scmi_devices_ctx(struct udevice *dev) |
| 78 | { |
| 79 | return NULL; |
| 80 | } |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 81 | #endif /* CONFIG_SCMI_FIRMWARE */ |
| 82 | #endif /* __SANDBOX_SCMI_TEST_H */ |