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
|
/*
* 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 - 800MHz, 2 - 624MHz 3 - 400MHz, 4 - 200MHz */
static struct cpu_op mx6_cpu_op_1_2G[] = {
{
.pll_rate = 1200000000,
.cpu_rate = 1200000000,
.cpu_podf = 0,
.cpu_voltage = 1275000,},
{
.pll_rate = 792000000,
.cpu_rate = 792000000,
.cpu_podf = 0,
.cpu_voltage = 1100000,},
{
.pll_rate = 624000000,
.cpu_rate = 624000000,
.cpu_voltage = 1100000,},
{
.pll_rate = 792000000,
.cpu_rate = 396000000,
.cpu_podf = 1,
.cpu_voltage = 950000,},
{
.pll_rate = 792000000,
.cpu_rate = 198000000,
.cpu_podf = 3,
.cpu_voltage = 850000,},
};
/* working point(wp): 0 - 1GHz; 1 - 800MHz, 2 - 624MHz 3 - 400MHz, 4 - 200MHz */
static struct cpu_op mx6_cpu_op_1G[] = {
{
.pll_rate = 996000000,
.cpu_rate = 996000000,
.cpu_podf = 0,
.cpu_voltage = 1225000,},
{
.pll_rate = 792000000,
.cpu_rate = 792000000,
.cpu_podf = 0,
.cpu_voltage = 1100000,},
{
.pll_rate = 624000000,
.cpu_rate = 624000000,
.cpu_voltage = 1100000,},
{
.pll_rate = 792000000,
.cpu_rate = 396000000,
.cpu_podf = 1,
.cpu_voltage = 950000,},
{
.pll_rate = 792000000,
.cpu_rate = 198000000,
.cpu_podf = 3,
.cpu_voltage = 850000,},
};
static struct cpu_op mx6_cpu_op[] = {
{
.pll_rate = 792000000,
.cpu_rate = 792000000,
.cpu_podf = 0,
.cpu_voltage = 1100000,},
{
.pll_rate = 792000000,
.cpu_rate = 396000000,
.cpu_podf = 1,
.cpu_voltage = 950000,},
{
.pll_rate = 792000000,
.cpu_rate = 198000000,
.cpu_podf = 3,
.cpu_voltage = 850000,},
};
/* working point(wp): 0 - 1GHzMHz; 1 - 800MHz, 3 - 400MHz, 4 - 200MHz */
static struct cpu_op mx6dl_cpu_op_1G[] = {
{
.pll_rate = 996000000,
.cpu_rate = 996000000,
.cpu_podf = 0,
.cpu_voltage = 1225000,},
{
.pll_rate = 792000000,
.cpu_rate = 792000000,
.cpu_podf = 0,
.cpu_voltage = 1100000,},
{
.pll_rate = 792000000,
.cpu_rate = 396000000,
.cpu_podf = 1,
.cpu_voltage = 1000000,},
{
.pll_rate = 792000000,
.cpu_rate = 198000000,
.cpu_podf = 3,
.cpu_voltage = 1000000,},
};
static struct cpu_op mx6dl_cpu_op[] = {
{
.pll_rate = 792000000,
.cpu_rate = 792000000,
.cpu_podf = 0,
.cpu_voltage = 1100000,},
{
.pll_rate = 792000000,
.cpu_rate = 396000000,
.cpu_podf = 1,
.cpu_voltage = 1000000,},
{
.pll_rate = 792000000,
.cpu_rate = 198000000,
.cpu_podf = 3,
.cpu_voltage = 1000000,},
};
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}, /* 624MHz */
{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}, /* 624MHz */
{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, 20, 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_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 (arm_max_freq == CPU_AT_1_2GHz) {
*op = num_cpu_op = ARRAY_SIZE(mx6_cpu_op_1_2G);
return mx6_cpu_op_1_2G;
} else if (arm_max_freq == CPU_AT_1GHz) {
*op = num_cpu_op = ARRAY_SIZE(mx6_cpu_op_1G);
return mx6_cpu_op_1G;
} else {
*op = num_cpu_op = ARRAY_SIZE(mx6_cpu_op);
return mx6_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;
}
|