1 /*
2 * Arm SCP/MCP Software
3 * Copyright (c) 2022, Linaro Limited and Contributors. All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8 #include <fwk_module.h>
9 #include <fwk_module_idx.h>
10 #include <mod_clock.h>
11 #include <mod_system_pll.h>
12 #include <mod_mock_clock.h>
13 #include "clock_devices.h"
14
15 static struct fwk_element clock_dev_desc_table[] = {
16 [CLOCK_DEV_IDX_BIG] = {
17 .name = "CPU_GROUP_BIG",
18 .data = &((struct mod_clock_dev_config) {
19 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_SYSTEM_PLL, 0),
20 .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_SYSTEM_PLL,
21 MOD_SYSTEM_PLL_API_TYPE_DEFAULT),
22 }),
23 },
24 [CLOCK_DEV_IDX_LITTLE] = {
25 .name = "CPU_GROUP_LITTLE",
26 .data = &((struct mod_clock_dev_config) {
27 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_SYSTEM_PLL, 1),
28 .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_SYSTEM_PLL,
29 MOD_SYSTEM_PLL_API_TYPE_DEFAULT),
30 }),
31 },
32 [CLOCK_DEV_IDX_GPU] = {
33 .name = "GPU",
34 .data = &((struct mod_clock_dev_config) {
35 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_SYSTEM_PLL, 2),
36 .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_SYSTEM_PLL,
37 MOD_SYSTEM_PLL_API_TYPE_DEFAULT),
38 }),
39 },
40 [CLOCK_DEV_IDX_VPU] = {
41 .name = "VPU",
42 .data = &((struct mod_clock_dev_config) {
43 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_SYSTEM_PLL, 3),
44 .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_SYSTEM_PLL,
45 MOD_SYSTEM_PLL_API_TYPE_DEFAULT),
46 }),
47 },
48 [CLOCK_DEV_IDX_DPU] = {
49 .name = "DPU",
50 .data = &((struct mod_clock_dev_config) {
51 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_SYSTEM_PLL, 4),
52 .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_SYSTEM_PLL,
53 MOD_SYSTEM_PLL_API_TYPE_DEFAULT),
54 }),
55 },
56 [CLOCK_DEV_IDX_PIXEL_0] = {
57 .name = "PIXEL_0",
58 .data = &((struct mod_clock_dev_config) {
59 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_SYSTEM_PLL, 5),
60 .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_SYSTEM_PLL,
61 MOD_SYSTEM_PLL_API_TYPE_DEFAULT),
62 }),
63 },
64 [CLOCK_DEV_IDX_PIXEL_1] = {
65 .name = "PIXEL_1",
66 .data = &((struct mod_clock_dev_config) {
67 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_SYSTEM_PLL, 6),
68 .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_SYSTEM_PLL,
69 MOD_SYSTEM_PLL_API_TYPE_DEFAULT),
70 }),
71 },
72 [CLOCK_DEV_IDX_MOCK_0] = {
73 .name = "CLOCK_0",
74 .data = &((struct mod_clock_dev_config) {
75 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_MOCK_CLOCK, 0),
76 .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_MOCK_CLOCK,
77 MOD_MOCK_CLOCK_API_TYPE_DRIVER),
78 }),
79 },
80 [CLOCK_DEV_IDX_MOCK_1] = {
81 .name = "CLOCK_1",
82 .data = &((struct mod_clock_dev_config) {
83 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_MOCK_CLOCK, 1),
84 .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_MOCK_CLOCK,
85 MOD_MOCK_CLOCK_API_TYPE_DRIVER),
86 }),
87 },
88 [CLOCK_DEV_IDX_MOCK_2] = {
89 .name = "CLOCK_2",
90 .data = &((struct mod_clock_dev_config) {
91 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_MOCK_CLOCK, 2),
92 .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_MOCK_CLOCK,
93 MOD_MOCK_CLOCK_API_TYPE_DRIVER),
94 }),
95 },
96 [CLOCK_DEV_IDX_MOCK_3] = {
97 .name = "CLOCK_3",
98 .data = &((struct mod_clock_dev_config) {
99 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_MOCK_CLOCK, 3),
100 .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_MOCK_CLOCK,
101 MOD_MOCK_CLOCK_API_TYPE_DRIVER),
102 }),
103 },
104 [CLOCK_DEV_IDX_COUNT] = { 0 }, /* Termination description. */
105 };
106
clock_get_dev_desc_table(fwk_id_t module_id)107 static const struct fwk_element *clock_get_dev_desc_table(fwk_id_t module_id)
108 {
109 unsigned int i;
110 struct mod_clock_dev_config *dev_config;
111
112 /* Configure all clocks to respond to changes in SYSTOP power state */
113 for (i = 0; i < CLOCK_DEV_IDX_COUNT; i++) {
114 dev_config =
115 (struct mod_clock_dev_config *)clock_dev_desc_table[i].data;
116 dev_config->pd_source_id = FWK_ID_NONE;
117 }
118 return clock_dev_desc_table;
119 }
120
121 struct fwk_module_config config_clock = {
122 .data = &((struct mod_clock_config){
123 .pd_transition_notification_id = FWK_ID_NONE_INIT,
124 .pd_pre_transition_notification_id = FWK_ID_NONE_INIT,
125 }),
126 .elements = FWK_MODULE_DYNAMIC_ELEMENTS(clock_get_dev_desc_table),
127 };
128