1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2015-2022, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #include <mod_scmi_clock.h>
9 
10 #include <fwk_id.h>
11 #include <fwk_macros.h>
12 #include <fwk_module.h>
13 #include <fwk_module_idx.h>
14 
15 #define FAKE_MODULE_IDX 0x5
16 #define FAKE_SCMI_AGENT_IDX_PSCI 0x1
17 #define FAKE_SCMI_AGENT_IDX_OSPM 0x2
18 #define FAKE_SCMI_AGENT_IDX_COUNT 0x3
19 
20 /*!
21  * \brief Clock device indexes.
22  */
23 enum clock_dev_idx {
24     CLOCK_DEV_IDX_VPU,
25     CLOCK_DEV_IDX_DPU,
26     CLOCK_DEV_IDX_PIXEL_0,
27     CLOCK_DEV_IDX_PIXEL_1,
28     CLOCK_DEV_IDX_COUNT
29 };
30 
31 static const struct mod_scmi_clock_device agent_device_table_ospm[] = {
32     {
33         /* VPU */
34         .element_id =
35             FWK_ID_ELEMENT_INIT(FAKE_MODULE_IDX, CLOCK_DEV_IDX_VPU),
36         .starts_enabled = true,
37     },
38     {
39         /* DPU */
40         .element_id =
41             FWK_ID_ELEMENT_INIT(FAKE_MODULE_IDX, CLOCK_DEV_IDX_DPU),
42         .starts_enabled = true,
43     },
44     {
45         /* PIXEL_0 */
46         .element_id =
47             FWK_ID_ELEMENT_INIT(FAKE_MODULE_IDX, CLOCK_DEV_IDX_PIXEL_0),
48         .starts_enabled = true,
49     },
50     {
51         /* PIXEL_1 */
52         .element_id =
53             FWK_ID_ELEMENT_INIT(FAKE_MODULE_IDX, CLOCK_DEV_IDX_PIXEL_1),
54         .starts_enabled = true,
55     },
56 };
57 
58 static const struct mod_scmi_clock_agent agent_table[FAKE_SCMI_AGENT_IDX_COUNT] = {
59     [FAKE_SCMI_AGENT_IDX_PSCI] = { 0 /* No access */ },
60     [FAKE_SCMI_AGENT_IDX_OSPM] = {
61         .device_table = agent_device_table_ospm,
62         .device_count = FWK_ARRAY_SIZE(agent_device_table_ospm),
63     },
64 };
65 
66 struct fwk_module_config config_scmi_clock = {
67     .data = &((struct mod_scmi_clock_config) {
68         .max_pending_transactions = 0,
69         .agent_table = agent_table,
70         .agent_count = FWK_ARRAY_SIZE(agent_table),
71     }),
72 };
73