1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
|
/*
* Copyright (C) 2010-2012 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/*
* The code contained herein is licensed under the GNU General Public
* License. You may obtain a copy of the GNU General Public License
* Version 2 or later at the following locations:
*
* http://www.opensource.org/licenses/gpl-license.html
* http://www.gnu.org/copyleft/gpl.html
*/
#include <linux/types.h>
#include <linux/kernel.h>
#include <mach/hardware.h>
#include <mach/mxc_dvfs.h>
#include "cpu_op-mx6.h"
extern struct cpu_op *(*get_cpu_op)(int *op);
extern struct dvfs_op *(*get_dvfs_core_op)(int *wp);
extern void (*set_num_cpu_op)(int num);
extern u32 arm_max_freq;
static int num_cpu_op;
/* working point(wp): 0 - 1.2GHz; 1 - 792MHz, 2 - 498MHz 3 - 396MHz */
static struct cpu_op mx6q_cpu_op_1_2G[] = {
{
.pll_rate = 1200000000,
.cpu_rate = 1200000000,
.cpu_podf = 0,
.pu_voltage = 1275000,
.soc_voltage = 1275000,
.cpu_voltage = 1275000,},
{
.pll_rate = 792000000,
.cpu_rate = 792000000,
.cpu_podf = 0,
#ifdef CONFIG_MX6_VPU_352M
/*VPU 352Mhz need voltage 1.25V*/
.pu_voltage = 1250000,
.soc_voltage = 1250000,
#else
.pu_voltage = 1175000,
.soc_voltage = 1175000,
#endif
.cpu_voltage = 1150000,},
#ifdef CONFIG_MX6_VPU_352M
/*pll2_pfd_400M will be fix on 352M,to avoid modify other code
which assume ARM clock sourcing from pll2_pfd_400M, change cpu
freq from 396M to 352M.*/
{
.pll_rate = 352000000,
.cpu_rate = 352000000,
.cpu_podf = 0,
.pu_voltage = 1250000,
.soc_voltage = 1250000,
.cpu_voltage = 950000,},
#else
{
.pll_rate = 396000000,
.cpu_rate = 396000000,
.cpu_podf = 0,
.pu_voltage = 1175000,
.soc_voltage = 1175000,
.cpu_voltage = 950000,},
#endif
};
/* working point(wp): 0 - 1GHz; 1 - 792MHz, 2 - 498MHz 3 - 396MHz */
static struct cpu_op mx6q_cpu_op_1G[] = {
{
.pll_rate = 996000000,
.cpu_rate = 996000000,
.cpu_podf = 0,
.pu_voltage = 1250000,
.soc_voltage = 1250000,
.cpu_voltage = 1250000,},
{
.pll_rate = 792000000,
.cpu_rate = 792000000,
.cpu_podf = 0,
#ifdef CONFIG_MX6_VPU_352M
/*VPU 352Mhz need voltage 1.25V*/
.pu_voltage = 1250000,
.soc_voltage = 1250000,
#else
.pu_voltage = 1175000,
.soc_voltage = 1175000,
#endif
.cpu_voltage = 1150000,},
#ifdef CONFIG_MX6_VPU_352M
/*pll2_pfd_400M will be fix on 352M,to avoid modify other code
which assume ARM clock sourcing from pll2_pfd_400M, change cpu
freq from 396M to 352M.*/
{
.pll_rate = 352000000,
.cpu_rate = 352000000,
.cpu_podf = 0,
.pu_voltage = 1250000,
.soc_voltage = 1250000,
.cpu_voltage = 950000,},
#else
{
.pll_rate = 396000000,
.cpu_rate = 396000000,
.cpu_podf = 0,
.pu_voltage = 1175000,
.soc_voltage = 1175000,
.cpu_voltage = 950000,},
#endif
};
static struct cpu_op mx6q_cpu_op[] = {
{
.pll_rate = 792000000,
.cpu_rate = 792000000,
.cpu_podf = 0,
#ifdef CONFIG_MX6_VPU_352M
/*VPU 352Mhz need voltage 1.25V*/
.pu_voltage = 1250000,
.soc_voltage = 1250000,
#else
.pu_voltage = 1175000,
.soc_voltage = 1175000,
#endif
.cpu_voltage = 1150000,},
#ifdef CONFIG_MX6_VPU_352M
/*pll2_pfd_400M will be fix on 352M,to avoid modify other code
which assume ARM clock sourcing from pll2_pfd_400M, change cpu
freq from 396M to 352M.*/
{
.pll_rate = 352000000,
.cpu_rate = 352000000,
.cpu_podf = 0,
.pu_voltage = 1250000,
.soc_voltage = 1250000,
.cpu_voltage = 950000,},
#else
{
.pll_rate = 396000000,
.cpu_rate = 396000000,
.cpu_podf = 0,
.pu_voltage = 1175000,
.soc_voltage = 1175000,
.cpu_voltage = 950000,},
#endif
};
/* working point(wp): 0 - 1.2GHz; 1 - 800MHz, 2 - 400MHz, 3 - 200MHz */
static struct cpu_op mx6dl_cpu_op_1_2G[] = {
{
.pll_rate = 1200000000,
.cpu_rate = 1200000000,
.cpu_podf = 0,
.pu_voltage = 1275000,
.soc_voltage = 1275000,
.cpu_voltage = 1275000,},
{
.pll_rate = 792000000,
.cpu_rate = 792000000,
.cpu_podf = 0,
.pu_voltage = 1175000,
.soc_voltage = 1175000,
.cpu_voltage = 1175000,},
{
.pll_rate = 396000000,
.cpu_rate = 396000000,
.cpu_podf = 0,
.pu_voltage = 1175000,
.soc_voltage = 1175000,
.cpu_voltage = 1075000,},
};
/* working point(wp): 0 - 1GHz; 1 - 800MHz, 2 - 400MHz, 3 - 200MHz */
static struct cpu_op mx6dl_cpu_op_1G[] = {
{
.pll_rate = 996000000,
.cpu_rate = 996000000,
.cpu_podf = 0,
.pu_voltage = 1275000,
.soc_voltage = 1275000,
.cpu_voltage = 1275000,},
{
.pll_rate = 792000000,
.cpu_rate = 792000000,
.cpu_podf = 0,
.pu_voltage = 1175000,
.soc_voltage = 1175000,
.cpu_voltage = 1175000,},
{
.pll_rate = 396000000,
.cpu_rate = 396000000,
.cpu_podf = 0,
.pu_voltage = 1175000,
.soc_voltage = 1175000,
.cpu_voltage = 1075000,},
};
static struct cpu_op mx6dl_cpu_op[] = {
{
.pll_rate = 792000000,
.cpu_rate = 792000000,
.cpu_podf = 0,
.pu_voltage = 1175000,
.soc_voltage = 1175000,
.cpu_voltage = 1175000,},
{
.pll_rate = 396000000,
.cpu_rate = 396000000,
.cpu_podf = 0,
.pu_voltage = 1175000,
.soc_voltage = 1175000,
.cpu_voltage = 1075000,},
};
static struct cpu_op mx6sl_cpu_op_1G[] = {
{
.pll_rate = 996000000,
.cpu_rate = 996000000,
.cpu_podf = 0,
.pu_voltage = 1225000,
.soc_voltage = 1225000,
.cpu_voltage = 1275000,},
{
.pll_rate = 792000000,
.cpu_rate = 792000000,
.cpu_podf = 0,
.pu_voltage = 1150000,
.soc_voltage = 1150000,
.cpu_voltage = 1200000,},
{
.pll_rate = 396000000,
.pll_lpm_rate = 792000000,
.cpu_rate = 396000000,
.cpu_podf = 0,
.pu_voltage = 1050000,
.soc_voltage = 1050000,
.cpu_voltage = 1100000,},
{
.pll_rate = 396000000,
.pll_lpm_rate = 792000000,
.cpu_rate = 198000000,
.cpu_podf = 1,
.pu_voltage = 1050000,
.soc_voltage = 1050000,
.cpu_voltage = 1050000,},
};
static struct cpu_op mx6sl_cpu_op[] = {
{
.pll_rate = 792000000,
.cpu_rate = 792000000,
.cpu_podf = 0,
.pu_voltage = 1150000,
.soc_voltage = 1150000,
.cpu_voltage = 1200000,},
{
.pll_rate = 396000000,
.pll_lpm_rate = 792000000,
.cpu_rate = 396000000,
.cpu_podf = 0,
.pu_voltage = 1050000,
.soc_voltage = 1050000,
.cpu_voltage = 1100000,},
{
.pll_rate = 396000000,
.pll_lpm_rate = 792000000,
.cpu_rate = 198000000,
.cpu_podf = 1,
.pu_voltage = 1050000,
.soc_voltage = 1050000,
.cpu_voltage = 1050000,},
};
static struct dvfs_op dvfs_core_setpoint_1_2G[] = {
{33, 14, 33, 10, 128, 0x10}, /* 1.2GHz*/
{30, 12, 33, 100, 200, 0x10}, /* 800MHz */
{28, 12, 33, 100, 200, 0x10}, /* 672MHz */
{26, 8, 33, 100, 200, 0x10}, /* 400MHz */
{20, 0, 33, 20, 10, 0x10} }; /* 200MHz*/
static struct dvfs_op dvfs_core_setpoint_1G[] = {
{33, 14, 33, 10, 128, 0x10}, /* 1GHz*/
{30, 12, 33, 100, 200, 0x10}, /* 800MHz */
{28, 12, 33, 100, 200, 0x10}, /* 672MHz */
{26, 8, 33, 100, 200, 0x10}, /* 400MHz */
{20, 0, 33, 20, 10, 0x10} }; /* 200MHz*/
static struct dvfs_op dvfs_core_setpoint[] = {
{33, 14, 33, 10, 128, 0x08}, /* 800MHz */
{26, 8, 33, 100, 200, 0x08}, /* 400MHz */
{20, 0, 33, 100, 10, 0x08} }; /* 200MHz*/
static struct dvfs_op *mx6_get_dvfs_core_table(int *wp)
{
if (arm_max_freq == CPU_AT_1_2GHz) {
*wp = ARRAY_SIZE(dvfs_core_setpoint_1_2G);
return dvfs_core_setpoint_1_2G;
} else if (arm_max_freq == CPU_AT_1GHz) {
*wp = ARRAY_SIZE(dvfs_core_setpoint_1G);
return dvfs_core_setpoint_1G;
} else {
*wp = ARRAY_SIZE(dvfs_core_setpoint);
return dvfs_core_setpoint;
}
}
struct cpu_op *mx6_get_cpu_op(int *op)
{
if (cpu_is_mx6dl()) {
if (arm_max_freq == CPU_AT_1_2GHz) {
*op = num_cpu_op = ARRAY_SIZE(mx6dl_cpu_op_1_2G);
return mx6dl_cpu_op_1_2G;
} else if (arm_max_freq == CPU_AT_1GHz) {
*op = num_cpu_op = ARRAY_SIZE(mx6dl_cpu_op_1G);
return mx6dl_cpu_op_1G;
} else {
*op = num_cpu_op = ARRAY_SIZE(mx6dl_cpu_op);
return mx6dl_cpu_op;
}
} else if (cpu_is_mx6q()) {
if (arm_max_freq == CPU_AT_1_2GHz) {
*op = num_cpu_op = ARRAY_SIZE(mx6q_cpu_op_1_2G);
return mx6q_cpu_op_1_2G;
} else if (arm_max_freq == CPU_AT_1GHz) {
*op = num_cpu_op = ARRAY_SIZE(mx6q_cpu_op_1G);
return mx6q_cpu_op_1G;
} else {
*op = num_cpu_op = ARRAY_SIZE(mx6q_cpu_op);
return mx6q_cpu_op;
}
} else {
if (arm_max_freq == CPU_AT_1GHz) {
*op = num_cpu_op = ARRAY_SIZE(mx6sl_cpu_op_1G);
return mx6sl_cpu_op_1G;
} else {
*op = num_cpu_op = ARRAY_SIZE(mx6sl_cpu_op);
return mx6sl_cpu_op;
}
}
}
void mx6_set_num_cpu_op(int num)
{
num_cpu_op = num;
return;
}
void mx6_cpu_op_init(void)
{
get_cpu_op = mx6_get_cpu_op;
set_num_cpu_op = mx6_set_num_cpu_op;
get_dvfs_core_op = mx6_get_dvfs_core_table;
}
|