34
34
35
35
/* EPSS Register offsets */
36
36
#define EPSS_LUT_ROW_SIZE 4
37
+ #define EPSS_REG_L3_VOTE 0x90
37
38
#define EPSS_REG_FREQ_LUT 0x100
38
39
#define EPSS_REG_PERF_STATE 0x320
39
40
@@ -74,6 +75,11 @@ struct qcom_osm_l3_desc {
74
75
unsigned int reg_perf_state ;
75
76
};
76
77
78
+ enum {
79
+ OSM_L3_MASTER_NODE = 10000 ,
80
+ OSM_L3_SLAVE_NODE ,
81
+ };
82
+
77
83
#define DEFINE_QNODE (_name , _id , _buswidth , ...) \
78
84
static const struct qcom_osm_l3_node _name = { \
79
85
.name = #_name, \
@@ -83,123 +89,59 @@ struct qcom_osm_l3_desc {
83
89
.links = { __VA_ARGS__ }, \
84
90
}
85
91
86
- DEFINE_QNODE (sdm845_osm_apps_l3 , SDM845_MASTER_OSM_L3_APPS , 16 , SDM845_SLAVE_OSM_L3 );
87
- DEFINE_QNODE (sdm845_osm_l3 , SDM845_SLAVE_OSM_L3 , 16 );
88
-
89
- static const struct qcom_osm_l3_node * const sdm845_osm_l3_nodes [] = {
90
- [MASTER_OSM_L3_APPS ] = & sdm845_osm_apps_l3 ,
91
- [SLAVE_OSM_L3 ] = & sdm845_osm_l3 ,
92
- };
92
+ DEFINE_QNODE (osm_l3_master , OSM_L3_MASTER_NODE , 16 , OSM_L3_SLAVE_NODE );
93
+ DEFINE_QNODE (osm_l3_slave , OSM_L3_SLAVE_NODE , 16 );
93
94
94
- static const struct qcom_osm_l3_desc sdm845_icc_osm_l3 = {
95
- .nodes = sdm845_osm_l3_nodes ,
96
- .num_nodes = ARRAY_SIZE (sdm845_osm_l3_nodes ),
97
- .lut_row_size = OSM_LUT_ROW_SIZE ,
98
- .reg_freq_lut = OSM_REG_FREQ_LUT ,
99
- .reg_perf_state = OSM_REG_PERF_STATE ,
95
+ static const struct qcom_osm_l3_node * const osm_l3_nodes [] = {
96
+ [MASTER_OSM_L3_APPS ] = & osm_l3_master ,
97
+ [SLAVE_OSM_L3 ] = & osm_l3_slave ,
100
98
};
101
99
102
- DEFINE_QNODE (sc7180_osm_apps_l3 , SC7180_MASTER_OSM_L3_APPS , 16 , SC7180_SLAVE_OSM_L3 );
103
- DEFINE_QNODE (sc7180_osm_l3 , SC7180_SLAVE_OSM_L3 , 16 );
100
+ DEFINE_QNODE (epss_l3_master , OSM_L3_MASTER_NODE , 32 , OSM_L3_SLAVE_NODE );
101
+ DEFINE_QNODE (epss_l3_slave , OSM_L3_SLAVE_NODE , 32 );
104
102
105
- static const struct qcom_osm_l3_node * const sc7180_osm_l3_nodes [] = {
106
- [MASTER_OSM_L3_APPS ] = & sc7180_osm_apps_l3 ,
107
- [SLAVE_OSM_L3 ] = & sc7180_osm_l3 ,
103
+ static const struct qcom_osm_l3_node * const epss_l3_nodes [] = {
104
+ [MASTER_EPSS_L3_APPS ] = & epss_l3_master ,
105
+ [SLAVE_EPSS_L3_SHARED ] = & epss_l3_slave ,
108
106
};
109
107
110
- static const struct qcom_osm_l3_desc sc7180_icc_osm_l3 = {
111
- .nodes = sc7180_osm_l3_nodes ,
112
- .num_nodes = ARRAY_SIZE (sc7180_osm_l3_nodes ),
108
+ static const struct qcom_osm_l3_desc osm_l3 = {
109
+ .nodes = osm_l3_nodes ,
110
+ .num_nodes = ARRAY_SIZE (osm_l3_nodes ),
113
111
.lut_row_size = OSM_LUT_ROW_SIZE ,
114
112
.reg_freq_lut = OSM_REG_FREQ_LUT ,
115
113
.reg_perf_state = OSM_REG_PERF_STATE ,
116
114
};
117
115
118
- DEFINE_QNODE (sc7280_epss_apps_l3 , SC7280_MASTER_EPSS_L3_APPS , 32 , SC7280_SLAVE_EPSS_L3 );
119
- DEFINE_QNODE (sc7280_epss_l3 , SC7280_SLAVE_EPSS_L3 , 32 );
120
-
121
- static const struct qcom_osm_l3_node * const sc7280_epss_l3_nodes [] = {
122
- [MASTER_EPSS_L3_APPS ] = & sc7280_epss_apps_l3 ,
123
- [SLAVE_EPSS_L3_SHARED ] = & sc7280_epss_l3 ,
124
- };
125
-
126
- static const struct qcom_osm_l3_desc sc7280_icc_epss_l3 = {
127
- .nodes = sc7280_epss_l3_nodes ,
128
- .num_nodes = ARRAY_SIZE (sc7280_epss_l3_nodes ),
116
+ static const struct qcom_osm_l3_desc epss_l3_perf_state = {
117
+ .nodes = epss_l3_nodes ,
118
+ .num_nodes = ARRAY_SIZE (epss_l3_nodes ),
129
119
.lut_row_size = EPSS_LUT_ROW_SIZE ,
130
120
.reg_freq_lut = EPSS_REG_FREQ_LUT ,
131
121
.reg_perf_state = EPSS_REG_PERF_STATE ,
132
122
};
133
123
134
- DEFINE_QNODE (sc8180x_osm_apps_l3 , SC8180X_MASTER_OSM_L3_APPS , 32 , SC8180X_SLAVE_OSM_L3 );
135
- DEFINE_QNODE (sc8180x_osm_l3 , SC8180X_SLAVE_OSM_L3 , 32 );
136
-
137
- static const struct qcom_osm_l3_node * const sc8180x_osm_l3_nodes [] = {
138
- [MASTER_OSM_L3_APPS ] = & sc8180x_osm_apps_l3 ,
139
- [SLAVE_OSM_L3 ] = & sc8180x_osm_l3 ,
140
- };
141
-
142
- static const struct qcom_osm_l3_desc sc8180x_icc_osm_l3 = {
143
- .nodes = sc8180x_osm_l3_nodes ,
144
- .num_nodes = ARRAY_SIZE (sc8180x_osm_l3_nodes ),
145
- .lut_row_size = OSM_LUT_ROW_SIZE ,
146
- .reg_freq_lut = OSM_REG_FREQ_LUT ,
147
- .reg_perf_state = OSM_REG_PERF_STATE ,
148
- };
149
-
150
- DEFINE_QNODE (sm8150_osm_apps_l3 , SM8150_MASTER_OSM_L3_APPS , 32 , SM8150_SLAVE_OSM_L3 );
151
- DEFINE_QNODE (sm8150_osm_l3 , SM8150_SLAVE_OSM_L3 , 32 );
152
-
153
- static const struct qcom_osm_l3_node * const sm8150_osm_l3_nodes [] = {
154
- [MASTER_OSM_L3_APPS ] = & sm8150_osm_apps_l3 ,
155
- [SLAVE_OSM_L3 ] = & sm8150_osm_l3 ,
156
- };
157
-
158
- static const struct qcom_osm_l3_desc sm8150_icc_osm_l3 = {
159
- .nodes = sm8150_osm_l3_nodes ,
160
- .num_nodes = ARRAY_SIZE (sm8150_osm_l3_nodes ),
161
- .lut_row_size = OSM_LUT_ROW_SIZE ,
162
- .reg_freq_lut = OSM_REG_FREQ_LUT ,
163
- .reg_perf_state = OSM_REG_PERF_STATE ,
164
- };
165
-
166
- DEFINE_QNODE (sm8250_epss_apps_l3 , SM8250_MASTER_EPSS_L3_APPS , 32 , SM8250_SLAVE_EPSS_L3 );
167
- DEFINE_QNODE (sm8250_epss_l3 , SM8250_SLAVE_EPSS_L3 , 32 );
168
-
169
- static const struct qcom_osm_l3_node * const sm8250_epss_l3_nodes [] = {
170
- [MASTER_EPSS_L3_APPS ] = & sm8250_epss_apps_l3 ,
171
- [SLAVE_EPSS_L3_SHARED ] = & sm8250_epss_l3 ,
172
- };
173
-
174
- static const struct qcom_osm_l3_desc sm8250_icc_epss_l3 = {
175
- .nodes = sm8250_epss_l3_nodes ,
176
- .num_nodes = ARRAY_SIZE (sm8250_epss_l3_nodes ),
124
+ static const struct qcom_osm_l3_desc epss_l3_l3_vote = {
125
+ .nodes = epss_l3_nodes ,
126
+ .num_nodes = ARRAY_SIZE (epss_l3_nodes ),
177
127
.lut_row_size = EPSS_LUT_ROW_SIZE ,
178
128
.reg_freq_lut = EPSS_REG_FREQ_LUT ,
179
- .reg_perf_state = EPSS_REG_PERF_STATE ,
129
+ .reg_perf_state = EPSS_REG_L3_VOTE ,
180
130
};
181
131
182
132
static int qcom_osm_l3_set (struct icc_node * src , struct icc_node * dst )
183
133
{
184
134
struct qcom_osm_l3_icc_provider * qp ;
185
135
struct icc_provider * provider ;
186
136
const struct qcom_osm_l3_node * qn ;
187
- struct icc_node * n ;
188
137
unsigned int index ;
189
- u32 agg_peak = 0 ;
190
- u32 agg_avg = 0 ;
191
138
u64 rate ;
192
139
193
140
qn = src -> data ;
194
141
provider = src -> provider ;
195
142
qp = to_osm_l3_provider (provider );
196
143
197
- list_for_each_entry (n , & provider -> nodes , node_list )
198
- provider -> aggregate (n , 0 , n -> avg_bw , n -> peak_bw ,
199
- & agg_avg , & agg_peak );
200
-
201
- rate = max (agg_avg , agg_peak );
202
- rate = icc_units_to_bps (rate );
144
+ rate = icc_units_to_bps (dst -> peak_bw );
203
145
do_div (rate , qn -> buswidth );
204
146
205
147
for (index = 0 ; index < qp -> max_state - 1 ; index ++ ) {
@@ -344,12 +286,14 @@ static int qcom_osm_l3_probe(struct platform_device *pdev)
344
286
}
345
287
346
288
static const struct of_device_id osm_l3_of_match [] = {
347
- { .compatible = "qcom,sc7180-osm-l3" , .data = & sc7180_icc_osm_l3 },
348
- { .compatible = "qcom,sc7280-epss-l3" , .data = & sc7280_icc_epss_l3 },
349
- { .compatible = "qcom,sdm845-osm-l3" , .data = & sdm845_icc_osm_l3 },
350
- { .compatible = "qcom,sm8150-osm-l3" , .data = & sm8150_icc_osm_l3 },
351
- { .compatible = "qcom,sc8180x-osm-l3" , .data = & sc8180x_icc_osm_l3 },
352
- { .compatible = "qcom,sm8250-epss-l3" , .data = & sm8250_icc_epss_l3 },
289
+ { .compatible = "qcom,epss-l3" , .data = & epss_l3_l3_vote },
290
+ { .compatible = "qcom,osm-l3" , .data = & osm_l3 },
291
+ { .compatible = "qcom,sc7180-osm-l3" , .data = & osm_l3 },
292
+ { .compatible = "qcom,sc7280-epss-l3" , .data = & epss_l3_perf_state },
293
+ { .compatible = "qcom,sdm845-osm-l3" , .data = & osm_l3 },
294
+ { .compatible = "qcom,sm8150-osm-l3" , .data = & osm_l3 },
295
+ { .compatible = "qcom,sc8180x-osm-l3" , .data = & osm_l3 },
296
+ { .compatible = "qcom,sm8250-epss-l3" , .data = & epss_l3_perf_state },
353
297
{ }
354
298
};
355
299
MODULE_DEVICE_TABLE (of , osm_l3_of_match );
0 commit comments