blob: d28a8bf7bc4dd692cb5683c287aee492584467d0 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/io.h>
16#include <linux/delay.h>
17#include <linux/mutex.h>
18#include <linux/spinlock.h>
19#include <linux/errno.h>
20#include <linux/cpufreq.h>
21#include <linux/cpu.h>
22#include <linux/regulator/consumer.h>
23
24#include <asm/cpu.h>
25
26#include <mach/board.h>
27#include <mach/msm_iomap.h>
28#include <mach/msm_bus.h>
29#include <mach/msm_bus_board.h>
30#include <mach/socinfo.h>
31#include <mach/rpm-regulator.h>
32
33#include "acpuclock.h"
34#include "avs.h"
35
36/* Frequency switch modes. */
37#define SHOT_SWITCH 4
38#define HOP_SWITCH 5
39#define SIMPLE_SLEW 6
40#define COMPLEX_SLEW 7
41
42/* PLL calibration limits.
43 * The PLL hardware is capable of 384MHz to 1536MHz. The L_VALs
44 * used for calibration should respect these limits. */
45#define L_VAL_SCPLL_CAL_MIN 0x08 /* = 432 MHz with 27MHz source */
46#define L_VAL_SCPLL_CAL_MAX 0x1C /* = 1512 MHz with 27MHz source */
47
48#define MAX_VDD_SC 1250000 /* uV */
49#define MAX_VDD_MEM 1250000 /* uV */
50#define MAX_VDD_DIG 1200000 /* uV */
51#define MAX_AXI 310500 /* KHz */
52#define SCPLL_LOW_VDD_FMAX 594000 /* KHz */
53#define SCPLL_LOW_VDD 1000000 /* uV */
54#define SCPLL_NOMINAL_VDD 1100000 /* uV */
55
56/* SCPLL Modes. */
57#define SCPLL_POWER_DOWN 0
58#define SCPLL_BYPASS 1
59#define SCPLL_STANDBY 2
60#define SCPLL_FULL_CAL 4
61#define SCPLL_HALF_CAL 5
62#define SCPLL_STEP_CAL 6
63#define SCPLL_NORMAL 7
64
65#define SCPLL_DEBUG_NONE 0
66#define SCPLL_DEBUG_FULL 3
67
68/* SCPLL registers offsets. */
69#define SCPLL_DEBUG_OFFSET 0x0
70#define SCPLL_CTL_OFFSET 0x4
71#define SCPLL_CAL_OFFSET 0x8
72#define SCPLL_STATUS_OFFSET 0x10
73#define SCPLL_CFG_OFFSET 0x1C
74#define SCPLL_FSM_CTL_EXT_OFFSET 0x24
75#define SCPLL_LUT_A_HW_MAX (0x38 + ((L_VAL_SCPLL_CAL_MAX / 4) * 4))
76
77/* Clock registers. */
78#define SPSS0_CLK_CTL_ADDR (MSM_ACC0_BASE + 0x04)
79#define SPSS0_CLK_SEL_ADDR (MSM_ACC0_BASE + 0x08)
80#define SPSS1_CLK_CTL_ADDR (MSM_ACC1_BASE + 0x04)
81#define SPSS1_CLK_SEL_ADDR (MSM_ACC1_BASE + 0x08)
82#define SPSS_L2_CLK_SEL_ADDR (MSM_GCC_BASE + 0x38)
83
84/* PTE EFUSE register. */
85#define QFPROM_PTE_EFUSE_ADDR (MSM_QFPROM_BASE + 0x00C0)
86
87static const void * const clk_ctl_addr[] = {SPSS0_CLK_CTL_ADDR,
88 SPSS1_CLK_CTL_ADDR};
89static const void * const clk_sel_addr[] = {SPSS0_CLK_SEL_ADDR,
90 SPSS1_CLK_SEL_ADDR, SPSS_L2_CLK_SEL_ADDR};
91
92static const int rpm_vreg_voter[] = { RPM_VREG_VOTER1, RPM_VREG_VOTER2 };
93static struct regulator *regulator_sc[NR_CPUS];
94
95enum scplls {
96 CPU0 = 0,
97 CPU1,
98 L2,
99};
100
101static const void * const sc_pll_base[] = {
102 [CPU0] = MSM_SCPLL_BASE + 0x200,
103 [CPU1] = MSM_SCPLL_BASE + 0x300,
104 [L2] = MSM_SCPLL_BASE + 0x400,
105};
106
107enum sc_src {
108 ACPU_AFAB,
109 ACPU_PLL_8,
110 ACPU_SCPLL,
111};
112
113static struct clock_state {
114 struct clkctl_acpu_speed *current_speed[NR_CPUS];
115 struct clkctl_l2_speed *current_l2_speed;
116 spinlock_t l2_lock;
117 struct mutex lock;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700118} drv_state;
119
120struct clkctl_l2_speed {
121 unsigned int khz;
122 unsigned int src_sel;
123 unsigned int l_val;
124 unsigned int vdd_dig;
125 unsigned int vdd_mem;
126 unsigned int bw_level;
127};
128
129static struct clkctl_l2_speed *l2_vote[NR_CPUS];
130
131struct clkctl_acpu_speed {
132 unsigned int use_for_scaling[2]; /* One for each CPU. */
133 unsigned int acpuclk_khz;
134 int pll;
135 unsigned int acpuclk_src_sel;
136 unsigned int acpuclk_src_div;
137 unsigned int core_src_sel;
138 unsigned int l_val;
139 struct clkctl_l2_speed *l2_level;
140 unsigned int vdd_sc;
141 unsigned int avsdscr_setting;
142};
143
144/* Instantaneous bandwidth requests in MB/s. */
145#define BW_MBPS(_bw) \
146 { \
147 .vectors = &(struct msm_bus_vectors){ \
148 .src = MSM_BUS_MASTER_AMPSS_M0, \
149 .dst = MSM_BUS_SLAVE_EBI_CH0, \
150 .ib = (_bw) * 1000000UL, \
151 .ab = 0, \
152 }, \
153 .num_paths = 1, \
154 }
155static struct msm_bus_paths bw_level_tbl[] = {
156 [0] = BW_MBPS(824), /* At least 103 MHz on bus. */
157 [1] = BW_MBPS(1336), /* At least 167 MHz on bus. */
158 [2] = BW_MBPS(2008), /* At least 251 MHz on bus. */
159 [3] = BW_MBPS(2480), /* At least 310 MHz on bus. */
160};
161
162static struct msm_bus_scale_pdata bus_client_pdata = {
163 .usecase = bw_level_tbl,
164 .num_usecases = ARRAY_SIZE(bw_level_tbl),
165 .active_only = 1,
166 .name = "acpuclock",
167};
168
169static uint32_t bus_perf_client;
170
171/* L2 frequencies = 2 * 27 MHz * L_VAL */
172static struct clkctl_l2_speed l2_freq_tbl_v2[] = {
173 [0] = { MAX_AXI, 0, 0, 1000000, 1100000, 0},
174 [1] = { 432000, 1, 0x08, 1000000, 1100000, 0},
175 [2] = { 486000, 1, 0x09, 1000000, 1100000, 0},
176 [3] = { 540000, 1, 0x0A, 1000000, 1100000, 0},
177 [4] = { 594000, 1, 0x0B, 1000000, 1100000, 0},
178 [5] = { 648000, 1, 0x0C, 1000000, 1100000, 1},
179 [6] = { 702000, 1, 0x0D, 1100000, 1100000, 1},
180 [7] = { 756000, 1, 0x0E, 1100000, 1100000, 1},
181 [8] = { 810000, 1, 0x0F, 1100000, 1100000, 1},
182 [9] = { 864000, 1, 0x10, 1100000, 1100000, 1},
183 [10] = { 918000, 1, 0x11, 1100000, 1100000, 2},
184 [11] = { 972000, 1, 0x12, 1100000, 1100000, 2},
185 [12] = {1026000, 1, 0x13, 1100000, 1100000, 2},
186 [13] = {1080000, 1, 0x14, 1100000, 1200000, 2},
187 [14] = {1134000, 1, 0x15, 1100000, 1200000, 2},
188 [15] = {1188000, 1, 0x16, 1200000, 1200000, 3},
189 [16] = {1242000, 1, 0x17, 1200000, 1212500, 3},
190 [17] = {1296000, 1, 0x18, 1200000, 1225000, 3},
191 [18] = {1350000, 1, 0x19, 1200000, 1225000, 3},
192 [19] = {1404000, 1, 0x1A, 1200000, 1250000, 3},
193};
194
195#define L2(x) (&l2_freq_tbl_v2[(x)])
196/* SCPLL frequencies = 2 * 27 MHz * L_VAL */
197static struct clkctl_acpu_speed acpu_freq_tbl_1188mhz[] = {
198 { {1, 1}, 192000, ACPU_PLL_8, 3, 1, 0, 0, L2(1), 812500, 0x03006000},
199 /* MAX_AXI row is used to source CPU cores and L2 from the AFAB clock. */
200 { {0, 0}, MAX_AXI, ACPU_AFAB, 1, 0, 0, 0, L2(0), 875000, 0x03006000},
201 { {1, 1}, 384000, ACPU_PLL_8, 3, 0, 0, 0, L2(1), 875000, 0x03006000},
202 { {1, 1}, 432000, ACPU_SCPLL, 0, 0, 1, 0x08, L2(1), 887500, 0x03006000},
203 { {1, 1}, 486000, ACPU_SCPLL, 0, 0, 1, 0x09, L2(2), 912500, 0x03006000},
204 { {1, 1}, 540000, ACPU_SCPLL, 0, 0, 1, 0x0A, L2(3), 925000, 0x03006000},
205 { {1, 1}, 594000, ACPU_SCPLL, 0, 0, 1, 0x0B, L2(4), 937500, 0x03006000},
206 { {1, 1}, 648000, ACPU_SCPLL, 0, 0, 1, 0x0C, L2(5), 950000, 0x03006000},
207 { {1, 1}, 702000, ACPU_SCPLL, 0, 0, 1, 0x0D, L2(6), 975000, 0x03006000},
208 { {1, 1}, 756000, ACPU_SCPLL, 0, 0, 1, 0x0E, L2(7), 1000000, 0x03006000},
209 { {1, 1}, 810000, ACPU_SCPLL, 0, 0, 1, 0x0F, L2(8), 1012500, 0x03006000},
210 { {1, 1}, 864000, ACPU_SCPLL, 0, 0, 1, 0x10, L2(9), 1037500, 0x03006000},
211 { {1, 1}, 918000, ACPU_SCPLL, 0, 0, 1, 0x11, L2(10), 1062500, 0x03006000},
212 { {1, 1}, 972000, ACPU_SCPLL, 0, 0, 1, 0x12, L2(11), 1087500, 0x03006000},
213 { {1, 1}, 1026000, ACPU_SCPLL, 0, 0, 1, 0x13, L2(12), 1125000, 0x03006000},
214 { {1, 1}, 1080000, ACPU_SCPLL, 0, 0, 1, 0x14, L2(13), 1137500, 0x03006000},
215 { {1, 1}, 1134000, ACPU_SCPLL, 0, 0, 1, 0x15, L2(14), 1162500, 0x03006000},
216 { {1, 1}, 1188000, ACPU_SCPLL, 0, 0, 1, 0x16, L2(15), 1187500, 0x03006000},
217 { {0, 0}, 0 },
218};
219
220/* SCPLL frequencies = 2 * 27 MHz * L_VAL */
221static struct clkctl_acpu_speed acpu_freq_tbl_slow[] = {
222 { {1, 1}, 192000, ACPU_PLL_8, 3, 1, 0, 0, L2(1), 812500, 0x03006000},
223 /* MAX_AXI row is used to source CPU cores and L2 from the AFAB clock. */
224 { {0, 0}, MAX_AXI, ACPU_AFAB, 1, 0, 0, 0, L2(0), 875000, 0x03006000},
225 { {1, 1}, 384000, ACPU_PLL_8, 3, 0, 0, 0, L2(1), 875000, 0x03006000},
226 { {1, 1}, 432000, ACPU_SCPLL, 0, 0, 1, 0x08, L2(1), 887500, 0x03006000},
227 { {1, 1}, 486000, ACPU_SCPLL, 0, 0, 1, 0x09, L2(2), 912500, 0x03006000},
228 { {1, 1}, 540000, ACPU_SCPLL, 0, 0, 1, 0x0A, L2(3), 925000, 0x03006000},
229 { {1, 1}, 594000, ACPU_SCPLL, 0, 0, 1, 0x0B, L2(4), 937500, 0x03006000},
230 { {1, 1}, 648000, ACPU_SCPLL, 0, 0, 1, 0x0C, L2(5), 950000, 0x03006000},
231 { {1, 1}, 702000, ACPU_SCPLL, 0, 0, 1, 0x0D, L2(6), 975000, 0x03006000},
232 { {1, 1}, 756000, ACPU_SCPLL, 0, 0, 1, 0x0E, L2(7), 1000000, 0x03006000},
233 { {1, 1}, 810000, ACPU_SCPLL, 0, 0, 1, 0x0F, L2(8), 1012500, 0x03006000},
234 { {1, 1}, 864000, ACPU_SCPLL, 0, 0, 1, 0x10, L2(9), 1037500, 0x03006000},
235 { {1, 1}, 918000, ACPU_SCPLL, 0, 0, 1, 0x11, L2(10), 1062500, 0x03006000},
236 { {1, 1}, 972000, ACPU_SCPLL, 0, 0, 1, 0x12, L2(11), 1087500, 0x03006000},
237 { {1, 1}, 1026000, ACPU_SCPLL, 0, 0, 1, 0x13, L2(12), 1100000, 0x03006000},
238 { {1, 1}, 1080000, ACPU_SCPLL, 0, 0, 1, 0x14, L2(13), 1112500, 0x03006000},
239 { {1, 1}, 1134000, ACPU_SCPLL, 0, 0, 1, 0x15, L2(14), 1125000, 0x03006000},
240 { {1, 1}, 1188000, ACPU_SCPLL, 0, 0, 1, 0x16, L2(15), 1137500, 0x03006000},
241 { {1, 1}, 1242000, ACPU_SCPLL, 0, 0, 1, 0x17, L2(16), 1150000, 0x03006000},
242 { {1, 1}, 1296000, ACPU_SCPLL, 0, 0, 1, 0x18, L2(17), 1175000, 0x03006000},
243 { {1, 1}, 1350000, ACPU_SCPLL, 0, 0, 1, 0x19, L2(18), 1200000, 0x03006000},
244 { {1, 1}, 1404000, ACPU_SCPLL, 0, 0, 1, 0x1A, L2(19), 1225000, 0x03006000},
245 { {1, 1}, 1458000, ACPU_SCPLL, 0, 0, 1, 0x1B, L2(19), 1237500, 0x03006000},
246 { {1, 1}, 1512000, ACPU_SCPLL, 0, 0, 1, 0x1C, L2(19), 1250000, 0x03006000},
247 { {0, 0}, 0 },
248};
249
250/* SCPLL frequencies = 2 * 27 MHz * L_VAL */
251static struct clkctl_acpu_speed acpu_freq_tbl_nom[] = {
252 { {1, 1}, 192000, ACPU_PLL_8, 3, 1, 0, 0, L2(1), 812500, 0x03006000},
253 /* MAX_AXI row is used to source CPU cores and L2 from the AFAB clock. */
254 { {0, 0}, MAX_AXI, ACPU_AFAB, 1, 0, 0, 0, L2(0), 875000, 0x03006000},
255 { {1, 1}, 384000, ACPU_PLL_8, 3, 0, 0, 0, L2(1), 875000, 0x03006000},
256 { {1, 1}, 432000, ACPU_SCPLL, 0, 0, 1, 0x08, L2(1), 887500, 0x03006000},
257 { {1, 1}, 486000, ACPU_SCPLL, 0, 0, 1, 0x09, L2(2), 912500, 0x03006000},
258 { {1, 1}, 540000, ACPU_SCPLL, 0, 0, 1, 0x0A, L2(3), 925000, 0x03006000},
259 { {1, 1}, 594000, ACPU_SCPLL, 0, 0, 1, 0x0B, L2(4), 937500, 0x03006000},
260 { {1, 1}, 648000, ACPU_SCPLL, 0, 0, 1, 0x0C, L2(5), 950000, 0x03006000},
261 { {1, 1}, 702000, ACPU_SCPLL, 0, 0, 1, 0x0D, L2(6), 975000, 0x03006000},
262 { {1, 1}, 756000, ACPU_SCPLL, 0, 0, 1, 0x0E, L2(7), 1000000, 0x03006000},
263 { {1, 1}, 810000, ACPU_SCPLL, 0, 0, 1, 0x0F, L2(8), 1012500, 0x03006000},
264 { {1, 1}, 864000, ACPU_SCPLL, 0, 0, 1, 0x10, L2(9), 1037500, 0x03006000},
265 { {1, 1}, 918000, ACPU_SCPLL, 0, 0, 1, 0x11, L2(10), 1062500, 0x03006000},
266 { {1, 1}, 972000, ACPU_SCPLL, 0, 0, 1, 0x12, L2(11), 1062500, 0x03006000},
267 { {1, 1}, 1026000, ACPU_SCPLL, 0, 0, 1, 0x13, L2(12), 1075000, 0x03006000},
268 { {1, 1}, 1080000, ACPU_SCPLL, 0, 0, 1, 0x14, L2(13), 1087500, 0x03006000},
269 { {1, 1}, 1134000, ACPU_SCPLL, 0, 0, 1, 0x15, L2(14), 1100000, 0x03006000},
270 { {1, 1}, 1188000, ACPU_SCPLL, 0, 0, 1, 0x16, L2(15), 1112500, 0x03006000},
271 { {1, 1}, 1242000, ACPU_SCPLL, 0, 0, 1, 0x17, L2(16), 1125000, 0x03006000},
272 { {1, 1}, 1296000, ACPU_SCPLL, 0, 0, 1, 0x18, L2(17), 1150000, 0x03006000},
273 { {1, 1}, 1350000, ACPU_SCPLL, 0, 0, 1, 0x19, L2(18), 1175000, 0x03006000},
274 { {1, 1}, 1404000, ACPU_SCPLL, 0, 0, 1, 0x1A, L2(19), 1200000, 0x03006000},
275 { {1, 1}, 1458000, ACPU_SCPLL, 0, 0, 1, 0x1B, L2(19), 1212500, 0x03006000},
276 { {1, 1}, 1512000, ACPU_SCPLL, 0, 0, 1, 0x1C, L2(19), 1225000, 0x03006000},
277 { {0, 0}, 0 },
278};
279
280/* SCPLL frequencies = 2 * 27 MHz * L_VAL */
281static struct clkctl_acpu_speed acpu_freq_tbl_fast[] = {
282 { {1, 1}, 192000, ACPU_PLL_8, 3, 1, 0, 0, L2(1), 812500, 0x03006000},
283 /* MAX_AXI row is used to source CPU cores and L2 from the AFAB clock. */
284 { {0, 0}, MAX_AXI, ACPU_AFAB, 1, 0, 0, 0, L2(0), 875000, 0x03006000},
285 { {1, 1}, 384000, ACPU_PLL_8, 3, 0, 0, 0, L2(1), 875000, 0x03006000},
286 { {1, 1}, 432000, ACPU_SCPLL, 0, 0, 1, 0x08, L2(1), 887500, 0x03006000},
287 { {1, 1}, 486000, ACPU_SCPLL, 0, 0, 1, 0x09, L2(2), 912500, 0x03006000},
288 { {1, 1}, 540000, ACPU_SCPLL, 0, 0, 1, 0x0A, L2(3), 925000, 0x03006000},
289 { {1, 1}, 594000, ACPU_SCPLL, 0, 0, 1, 0x0B, L2(4), 937500, 0x03006000},
290 { {1, 1}, 648000, ACPU_SCPLL, 0, 0, 1, 0x0C, L2(5), 950000, 0x03006000},
291 { {1, 1}, 702000, ACPU_SCPLL, 0, 0, 1, 0x0D, L2(6), 975000, 0x03006000},
292 { {1, 1}, 756000, ACPU_SCPLL, 0, 0, 1, 0x0E, L2(7), 1000000, 0x03006000},
293 { {1, 1}, 810000, ACPU_SCPLL, 0, 0, 1, 0x0F, L2(8), 1012500, 0x03006000},
294 { {1, 1}, 864000, ACPU_SCPLL, 0, 0, 1, 0x10, L2(9), 1037500, 0x03006000},
295 { {1, 1}, 918000, ACPU_SCPLL, 0, 0, 1, 0x11, L2(10), 1037500, 0x03006000},
296 { {1, 1}, 972000, ACPU_SCPLL, 0, 0, 1, 0x12, L2(11), 1037500, 0x03006000},
297 { {1, 1}, 1026000, ACPU_SCPLL, 0, 0, 1, 0x13, L2(12), 1050000, 0x03006000},
298 { {1, 1}, 1080000, ACPU_SCPLL, 0, 0, 1, 0x14, L2(13), 1062500, 0x03006000},
299 { {1, 1}, 1134000, ACPU_SCPLL, 0, 0, 1, 0x15, L2(14), 1075000, 0x03006000},
300 { {1, 1}, 1188000, ACPU_SCPLL, 0, 0, 1, 0x16, L2(15), 1087500, 0x03006000},
301 { {1, 1}, 1242000, ACPU_SCPLL, 0, 0, 1, 0x17, L2(16), 1100000, 0x03006000},
302 { {1, 1}, 1296000, ACPU_SCPLL, 0, 0, 1, 0x18, L2(17), 1125000, 0x03006000},
303 { {1, 1}, 1350000, ACPU_SCPLL, 0, 0, 1, 0x19, L2(18), 1150000, 0x03006000},
304 { {1, 1}, 1404000, ACPU_SCPLL, 0, 0, 1, 0x1A, L2(19), 1175000, 0x03006000},
305 { {1, 1}, 1458000, ACPU_SCPLL, 0, 0, 1, 0x1B, L2(19), 1187500, 0x03006000},
306 { {1, 1}, 1512000, ACPU_SCPLL, 0, 0, 1, 0x1C, L2(19), 1200000, 0x03006000},
307 { {0, 0}, 0 },
308};
309
310
311/* acpu_freq_tbl row to use when reconfiguring SC/L2 PLLs. */
312#define CAL_IDX 1
313
314static struct clkctl_acpu_speed *acpu_freq_tbl;
315static struct clkctl_l2_speed *l2_freq_tbl = l2_freq_tbl_v2;
316static unsigned int l2_freq_tbl_size = ARRAY_SIZE(l2_freq_tbl_v2);
317
Matt Wagantall6d9ebee2011-08-26 12:15:24 -0700318static unsigned long acpuclk_8x60_get_rate(int cpu)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700319{
320 return drv_state.current_speed[cpu]->acpuclk_khz;
321}
322
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323static void select_core_source(unsigned int id, unsigned int src)
324{
325 uint32_t regval;
326 int shift;
327
328 shift = (id == L2) ? 0 : 1;
329 regval = readl_relaxed(clk_sel_addr[id]);
330 regval &= ~(0x3 << shift);
331 regval |= (src << shift);
332 writel_relaxed(regval, clk_sel_addr[id]);
333}
334
335static void select_clk_source_div(unsigned int id, struct clkctl_acpu_speed *s)
336{
337 uint32_t reg_clksel, reg_clkctl, src_sel;
338
339 /* Configure the PLL divider mux if we plan to use it. */
340 if (s->core_src_sel == 0) {
341
342 reg_clksel = readl_relaxed(clk_sel_addr[id]);
343
344 /* CLK_SEL_SRC1N0 (bank) bit. */
345 src_sel = reg_clksel & 1;
346
347 /* Program clock source and divider. */
348 reg_clkctl = readl_relaxed(clk_ctl_addr[id]);
349 reg_clkctl &= ~(0xFF << (8 * src_sel));
350 reg_clkctl |= s->acpuclk_src_sel << (4 + 8 * src_sel);
351 reg_clkctl |= s->acpuclk_src_div << (0 + 8 * src_sel);
352 writel_relaxed(reg_clkctl, clk_ctl_addr[id]);
353
354 /* Toggle clock source. */
355 reg_clksel ^= 1;
356
357 /* Program clock source selection. */
358 writel_relaxed(reg_clksel, clk_sel_addr[id]);
359 }
360}
361
362static void scpll_enable(int sc_pll, uint32_t l_val)
363{
364 uint32_t regval;
365
366 /* Power-up SCPLL into standby mode. */
367 writel_relaxed(SCPLL_STANDBY, sc_pll_base[sc_pll] + SCPLL_CTL_OFFSET);
368 mb();
369 udelay(10);
370
371 /* Shot-switch to target frequency. */
372 regval = (l_val << 3) | SHOT_SWITCH;
373 writel_relaxed(regval, sc_pll_base[sc_pll] + SCPLL_FSM_CTL_EXT_OFFSET);
374 writel_relaxed(SCPLL_NORMAL, sc_pll_base[sc_pll] + SCPLL_CTL_OFFSET);
375 mb();
376 udelay(20);
377}
378
379static void scpll_disable(int sc_pll)
380{
381 /* Power down SCPLL. */
382 writel_relaxed(SCPLL_POWER_DOWN,
383 sc_pll_base[sc_pll] + SCPLL_CTL_OFFSET);
384}
385
386static void scpll_change_freq(int sc_pll, uint32_t l_val)
387{
388 uint32_t regval;
389 const void *base_addr = sc_pll_base[sc_pll];
390
391 /* Complex-slew switch to target frequency. */
392 regval = (l_val << 3) | COMPLEX_SLEW;
393 writel_relaxed(regval, base_addr + SCPLL_FSM_CTL_EXT_OFFSET);
394 writel_relaxed(SCPLL_NORMAL, base_addr + SCPLL_CTL_OFFSET);
395
396 /* Wait for frequency switch to start. */
397 while (((readl_relaxed(base_addr + SCPLL_CTL_OFFSET) >> 3) & 0x3F)
398 != l_val)
399 cpu_relax();
400 /* Wait for frequency switch to finish. */
401 while (readl_relaxed(base_addr + SCPLL_STATUS_OFFSET) & 0x1)
402 cpu_relax();
403}
404
405/* Vote for the L2 speed and return the speed that should be applied. */
406static struct clkctl_l2_speed *compute_l2_speed(unsigned int voting_cpu,
407 struct clkctl_l2_speed *tgt_s)
408{
409 struct clkctl_l2_speed *new_s;
410 int cpu;
411
412 /* Bounds check. */
413 BUG_ON(tgt_s >= (l2_freq_tbl + l2_freq_tbl_size));
414
415 /* Find max L2 speed vote. */
416 l2_vote[voting_cpu] = tgt_s;
417 new_s = l2_freq_tbl;
418 for_each_present_cpu(cpu)
419 new_s = max(new_s, l2_vote[cpu]);
420
421 return new_s;
422}
423
424/* Set the L2's clock speed. */
425static void set_l2_speed(struct clkctl_l2_speed *tgt_s)
426{
427 if (tgt_s == drv_state.current_l2_speed)
428 return;
429
430 if (drv_state.current_l2_speed->src_sel == 1
431 && tgt_s->src_sel == 1)
432 scpll_change_freq(L2, tgt_s->l_val);
433 else {
434 if (tgt_s->src_sel == 1) {
435 scpll_enable(L2, tgt_s->l_val);
436 mb();
437 select_core_source(L2, tgt_s->src_sel);
438 } else {
439 select_core_source(L2, tgt_s->src_sel);
440 mb();
441 scpll_disable(L2);
442 }
443 }
444 drv_state.current_l2_speed = tgt_s;
445}
446
447/* Update the bus bandwidth request. */
448static void set_bus_bw(unsigned int bw)
449{
450 int ret;
451
452 /* Bounds check. */
453 if (bw >= ARRAY_SIZE(bw_level_tbl)) {
454 pr_err("%s: invalid bandwidth request (%d)\n", __func__, bw);
455 return;
456 }
457
458 /* Update bandwidth if requst has changed. This may sleep. */
459 ret = msm_bus_scale_client_update_request(bus_perf_client, bw);
460 if (ret)
461 pr_err("%s: bandwidth request failed (%d)\n", __func__, ret);
462
463 return;
464}
465
466/* Apply any per-cpu voltage increases. */
467static int increase_vdd(int cpu, unsigned int vdd_sc, unsigned int vdd_mem,
468 unsigned int vdd_dig, enum setrate_reason reason)
469{
470 int rc = 0;
471
472 /* Increase vdd_mem active-set before vdd_dig and vdd_sc.
473 * vdd_mem should be >= both vdd_sc and vdd_dig. */
474 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8058_S0, rpm_vreg_voter[cpu],
475 vdd_mem, MAX_VDD_MEM, 0);
476 if (rc) {
477 pr_err("%s: vdd_mem (cpu%d) increase failed (%d)\n",
478 __func__, cpu, rc);
479 return rc;
480 }
481
482 /* Increase vdd_dig active-set vote. */
483 rc = rpm_vreg_set_voltage(RPM_VREG_ID_PM8058_S1, rpm_vreg_voter[cpu],
484 vdd_dig, MAX_VDD_DIG, 0);
485 if (rc) {
486 pr_err("%s: vdd_dig (cpu%d) increase failed (%d)\n",
487 __func__, cpu, rc);
488 return rc;
489 }
490
491 /* Don't update the Scorpion voltage in the hotplug path. It should
492 * already be correct. Attempting to set it is bad because we don't
493 * know what CPU we are running on at this point, but the Scorpion
494 * regulator API requires we call it from the affected CPU. */
495 if (reason == SETRATE_HOTPLUG)
496 return rc;
497
498 /* Update per-core Scorpion voltage. */
499 rc = regulator_set_voltage(regulator_sc[cpu], vdd_sc, MAX_VDD_SC);
500 if (rc) {
501 pr_err("%s: vdd_sc (cpu%d) increase failed (%d)\n",
502 __func__, cpu, rc);
503 return rc;
504 }
505
506 return rc;
507}
508
509/* Apply any per-cpu voltage decreases. */
510static void decrease_vdd(int cpu, unsigned int vdd_sc, unsigned int vdd_mem,
511 unsigned int vdd_dig, enum setrate_reason reason)
512{
513 int ret;
514
515 /* Update per-core Scorpion voltage. This must be called on the CPU
516 * that's being affected. Don't do this in the hotplug remove path,
517 * where the rail is off and we're executing on the other CPU. */
518 if (reason != SETRATE_HOTPLUG) {
519 ret = regulator_set_voltage(regulator_sc[cpu], vdd_sc,
520 MAX_VDD_SC);
521 if (ret) {
522 pr_err("%s: vdd_sc (cpu%d) decrease failed (%d)\n",
523 __func__, cpu, ret);
524 return;
525 }
526 }
527
528 /* Decrease vdd_dig active-set vote. */
529 ret = rpm_vreg_set_voltage(RPM_VREG_ID_PM8058_S1, rpm_vreg_voter[cpu],
530 vdd_dig, MAX_VDD_DIG, 0);
531 if (ret) {
532 pr_err("%s: vdd_dig (cpu%d) decrease failed (%d)\n",
533 __func__, cpu, ret);
534 return;
535 }
536
537 /* Decrease vdd_mem active-set after vdd_dig and vdd_sc.
538 * vdd_mem should be >= both vdd_sc and vdd_dig. */
539 ret = rpm_vreg_set_voltage(RPM_VREG_ID_PM8058_S0, rpm_vreg_voter[cpu],
540 vdd_mem, MAX_VDD_MEM, 0);
541 if (ret) {
542 pr_err("%s: vdd_mem (cpu%d) decrease failed (%d)\n",
543 __func__, cpu, ret);
544 return;
545 }
546}
547
548static void switch_sc_speed(int cpu, struct clkctl_acpu_speed *tgt_s)
549{
550 struct clkctl_acpu_speed *strt_s = drv_state.current_speed[cpu];
551
552 if (strt_s->pll != ACPU_SCPLL && tgt_s->pll != ACPU_SCPLL) {
553 select_clk_source_div(cpu, tgt_s);
554 /* Select core source because target may be AFAB. */
555 select_core_source(cpu, tgt_s->core_src_sel);
556 } else if (strt_s->pll != ACPU_SCPLL && tgt_s->pll == ACPU_SCPLL) {
557 scpll_enable(cpu, tgt_s->l_val);
558 mb();
559 select_core_source(cpu, tgt_s->core_src_sel);
560 } else if (strt_s->pll == ACPU_SCPLL && tgt_s->pll != ACPU_SCPLL) {
561 select_clk_source_div(cpu, tgt_s);
562 select_core_source(cpu, tgt_s->core_src_sel);
563 /* Core source switch must complete before disabling SCPLL. */
564 mb();
565 udelay(1);
566 scpll_disable(cpu);
567 } else
568 scpll_change_freq(cpu, tgt_s->l_val);
569
570 /* Update the driver state with the new clock freq */
571 drv_state.current_speed[cpu] = tgt_s;
572}
573
Matt Wagantall6d9ebee2011-08-26 12:15:24 -0700574static int acpuclk_8x60_set_rate(int cpu, unsigned long rate,
575 enum setrate_reason reason)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700576{
577 struct clkctl_acpu_speed *tgt_s, *strt_s;
578 struct clkctl_l2_speed *tgt_l2;
579 unsigned int vdd_mem, vdd_dig, pll_vdd_dig;
580 unsigned long flags;
581 int rc = 0;
582
583 if (cpu > num_possible_cpus()) {
584 rc = -EINVAL;
585 goto out;
586 }
587
588 if (reason == SETRATE_CPUFREQ || reason == SETRATE_HOTPLUG)
589 mutex_lock(&drv_state.lock);
590
591 strt_s = drv_state.current_speed[cpu];
592
593 /* Return early if rate didn't change. */
594 if (rate == strt_s->acpuclk_khz)
595 goto out;
596
597 /* Find target frequency. */
598 for (tgt_s = acpu_freq_tbl; tgt_s->acpuclk_khz != 0; tgt_s++)
599 if (tgt_s->acpuclk_khz == rate)
600 break;
601 if (tgt_s->acpuclk_khz == 0) {
602 rc = -EINVAL;
603 goto out;
604 }
605
606 /* AVS needs SAW_VCTL to be intitialized correctly, before enable,
607 * and is not initialized at acpuclk_init().
608 */
609 if (reason == SETRATE_CPUFREQ)
610 AVS_DISABLE(cpu);
611
612 /* Calculate vdd_mem and vdd_dig requirements.
613 * vdd_mem must be >= vdd_sc */
614 vdd_mem = max(tgt_s->vdd_sc, tgt_s->l2_level->vdd_mem);
615 /* Factor-in PLL vdd_dig requirements. */
616 if ((tgt_s->l2_level->khz > SCPLL_LOW_VDD_FMAX) ||
617 (tgt_s->pll == ACPU_SCPLL
618 && tgt_s->acpuclk_khz > SCPLL_LOW_VDD_FMAX))
619 pll_vdd_dig = SCPLL_NOMINAL_VDD;
620 else
621 pll_vdd_dig = SCPLL_LOW_VDD;
622 vdd_dig = max(tgt_s->l2_level->vdd_dig, pll_vdd_dig);
623
624 /* Increase VDD levels if needed. */
625 if ((reason == SETRATE_CPUFREQ || reason == SETRATE_HOTPLUG
626 || reason == SETRATE_INIT)
627 && (tgt_s->acpuclk_khz > strt_s->acpuclk_khz)) {
628 rc = increase_vdd(cpu, tgt_s->vdd_sc, vdd_mem, vdd_dig, reason);
629 if (rc)
630 goto out;
631 }
632
633 pr_debug("Switching from ACPU%d rate %u KHz -> %u KHz\n",
634 cpu, strt_s->acpuclk_khz, tgt_s->acpuclk_khz);
635
636 /* Switch CPU speed. */
637 switch_sc_speed(cpu, tgt_s);
638
639 /* Update the L2 vote and apply the rate change. */
640 spin_lock_irqsave(&drv_state.l2_lock, flags);
641 tgt_l2 = compute_l2_speed(cpu, tgt_s->l2_level);
642 set_l2_speed(tgt_l2);
643 spin_unlock_irqrestore(&drv_state.l2_lock, flags);
644
645 /* Nothing else to do for SWFI. */
646 if (reason == SETRATE_SWFI)
647 goto out;
648
649 /* Nothing else to do for power collapse. */
650 if (reason == SETRATE_PC)
651 goto out;
652
653 /* Update bus bandwith request. */
654 set_bus_bw(tgt_l2->bw_level);
655
656 /* Drop VDD levels if we can. */
657 if (tgt_s->acpuclk_khz < strt_s->acpuclk_khz)
658 decrease_vdd(cpu, tgt_s->vdd_sc, vdd_mem, vdd_dig, reason);
659
660 pr_debug("ACPU%d speed change complete\n", cpu);
661
662 /* Re-enable AVS */
663 if (reason == SETRATE_CPUFREQ)
664 AVS_ENABLE(cpu, tgt_s->avsdscr_setting);
665
666out:
667 if (reason == SETRATE_CPUFREQ || reason == SETRATE_HOTPLUG)
668 mutex_unlock(&drv_state.lock);
669 return rc;
670}
671
672static void __init scpll_init(int sc_pll)
673{
674 uint32_t regval;
675
676 pr_debug("Initializing SCPLL%d\n", sc_pll);
677
678 /* Clear calibration LUT registers containing max frequency entry.
679 * LUT registers are only writeable in debug mode. */
680 writel_relaxed(SCPLL_DEBUG_FULL,
681 sc_pll_base[sc_pll] + SCPLL_DEBUG_OFFSET);
682 writel_relaxed(0x0, sc_pll_base[sc_pll] + SCPLL_LUT_A_HW_MAX);
683 writel_relaxed(SCPLL_DEBUG_NONE,
684 sc_pll_base[sc_pll] + SCPLL_DEBUG_OFFSET);
685
686 /* Power-up SCPLL into standby mode. */
687 writel_relaxed(SCPLL_STANDBY, sc_pll_base[sc_pll] + SCPLL_CTL_OFFSET);
688 mb();
689 udelay(10);
690
691 /* Calibrate the SCPLL to the maximum range supported by the h/w. We
692 * might not use the full range of calibrated frequencies, but this
693 * simplifies changes required for future increases in max CPU freq.
694 */
695 regval = (L_VAL_SCPLL_CAL_MAX << 24) | (L_VAL_SCPLL_CAL_MIN << 16);
696 writel_relaxed(regval, sc_pll_base[sc_pll] + SCPLL_CAL_OFFSET);
697
698 /* Start calibration */
699 writel_relaxed(SCPLL_FULL_CAL, sc_pll_base[sc_pll] + SCPLL_CTL_OFFSET);
700
701 /* Wait for proof that calibration has started before checking the
702 * 'calibration done' bit in the status register. Waiting for the
703 * LUT register we cleared to contain data accomplishes this.
704 * This is required since the 'calibration done' bit takes time to
705 * transition from 'done' to 'not done' when starting a calibration.
706 */
707 while (readl_relaxed(sc_pll_base[sc_pll] + SCPLL_LUT_A_HW_MAX) == 0)
708 cpu_relax();
709
710 /* Wait for calibration to complete. */
711 while (readl_relaxed(sc_pll_base[sc_pll] + SCPLL_STATUS_OFFSET) & 0x2)
712 cpu_relax();
713
714 /* Power-down SCPLL. */
715 scpll_disable(sc_pll);
716}
717
718/* Force ACPU core and L2 cache clocks to rates that don't require SCPLLs. */
719static void __init unselect_scplls(void)
720{
721 int cpu;
722
723 /* Ensure CAL_IDX frequency uses AFAB sources for CPU cores and L2. */
724 BUG_ON(acpu_freq_tbl[CAL_IDX].core_src_sel != 0);
725 BUG_ON(acpu_freq_tbl[CAL_IDX].l2_level->src_sel != 0);
726
727 for_each_possible_cpu(cpu) {
728 select_clk_source_div(cpu, &acpu_freq_tbl[CAL_IDX]);
729 select_core_source(cpu, acpu_freq_tbl[CAL_IDX].core_src_sel);
730 drv_state.current_speed[cpu] = &acpu_freq_tbl[CAL_IDX];
731 l2_vote[cpu] = acpu_freq_tbl[CAL_IDX].l2_level;
732 }
733
734 select_core_source(L2, acpu_freq_tbl[CAL_IDX].l2_level->src_sel);
735 drv_state.current_l2_speed = acpu_freq_tbl[CAL_IDX].l2_level;
736}
737
738/* Ensure SCPLLs use the 27MHz PXO. */
739static void __init scpll_set_refs(void)
740{
741 int cpu;
742 uint32_t regval;
743
744 /* Bit 4 = 0:PXO, 1:MXO. */
745 for_each_possible_cpu(cpu) {
746 regval = readl_relaxed(sc_pll_base[cpu] + SCPLL_CFG_OFFSET);
747 regval &= ~BIT(4);
748 writel_relaxed(regval, sc_pll_base[cpu] + SCPLL_CFG_OFFSET);
749 }
750 regval = readl_relaxed(sc_pll_base[L2] + SCPLL_CFG_OFFSET);
751 regval &= ~BIT(4);
752 writel_relaxed(regval, sc_pll_base[L2] + SCPLL_CFG_OFFSET);
753}
754
755/* Voltage regulator initialization. */
756static void __init regulator_init(void)
757{
758 struct clkctl_acpu_speed **freq = drv_state.current_speed;
759 const char *regulator_sc_name[] = {"8901_s0", "8901_s1"};
760 int cpu, ret;
761
762 for_each_possible_cpu(cpu) {
763 /* VDD_SC0, VDD_SC1 */
764 regulator_sc[cpu] = regulator_get(NULL, regulator_sc_name[cpu]);
765 if (IS_ERR(regulator_sc[cpu]))
766 goto err;
767 ret = regulator_set_voltage(regulator_sc[cpu],
768 freq[cpu]->vdd_sc, MAX_VDD_SC);
769 if (ret)
770 goto err;
771 ret = regulator_enable(regulator_sc[cpu]);
772 if (ret)
773 goto err;
774 }
775
776 return;
777
778err:
779 pr_err("%s: Failed to initialize voltage regulators\n", __func__);
780 BUG();
781}
782
783/* Register with bus driver. */
784static void __init bus_init(void)
785{
786 bus_perf_client = msm_bus_scale_register_client(&bus_client_pdata);
787 if (!bus_perf_client) {
788 pr_err("%s: unable register bus client\n", __func__);
789 BUG();
790 }
791}
792
793#ifdef CONFIG_CPU_FREQ_MSM
794static struct cpufreq_frequency_table freq_table[NR_CPUS][30];
795
796static void __init cpufreq_table_init(void)
797{
798 int cpu;
799
800 for_each_possible_cpu(cpu) {
801 int i, freq_cnt = 0;
802 /* Construct the freq_table tables from acpu_freq_tbl. */
803 for (i = 0; acpu_freq_tbl[i].acpuclk_khz != 0
804 && freq_cnt < ARRAY_SIZE(*freq_table); i++) {
805 if (acpu_freq_tbl[i].use_for_scaling[cpu]) {
806 freq_table[cpu][freq_cnt].index = freq_cnt;
807 freq_table[cpu][freq_cnt].frequency
808 = acpu_freq_tbl[i].acpuclk_khz;
809 freq_cnt++;
810 }
811 }
812 /* freq_table not big enough to store all usable freqs. */
813 BUG_ON(acpu_freq_tbl[i].acpuclk_khz != 0);
814
815 freq_table[cpu][freq_cnt].index = freq_cnt;
816 freq_table[cpu][freq_cnt].frequency = CPUFREQ_TABLE_END;
817
818 pr_info("CPU%d: %d scaling frequencies supported.\n",
819 cpu, freq_cnt);
820
821 /* Register table with CPUFreq. */
822 cpufreq_frequency_table_get_attr(freq_table[cpu], cpu);
823 }
824}
825#else
826static void __init cpufreq_table_init(void) {}
827#endif
828
829#define HOT_UNPLUG_KHZ MAX_AXI
830static int __cpuinit acpuclock_cpu_callback(struct notifier_block *nfb,
831 unsigned long action, void *hcpu)
832{
833 static int prev_khz[NR_CPUS];
834 int cpu = (int)hcpu;
835
836 switch (action) {
837 case CPU_DEAD:
838 case CPU_DEAD_FROZEN:
Matt Wagantall6d9ebee2011-08-26 12:15:24 -0700839 prev_khz[cpu] = acpuclk_8x60_get_rate(cpu);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700840 /* Fall through. */
841 case CPU_UP_CANCELED:
842 case CPU_UP_CANCELED_FROZEN:
Matt Wagantall6d9ebee2011-08-26 12:15:24 -0700843 acpuclk_8x60_set_rate(cpu, HOT_UNPLUG_KHZ, SETRATE_HOTPLUG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700844 break;
845 case CPU_UP_PREPARE:
846 case CPU_UP_PREPARE_FROZEN:
847 if (WARN_ON(!prev_khz[cpu]))
848 prev_khz[cpu] = acpu_freq_tbl->acpuclk_khz;
Matt Wagantall6d9ebee2011-08-26 12:15:24 -0700849 acpuclk_8x60_set_rate(cpu, prev_khz[cpu], SETRATE_HOTPLUG);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700850 break;
851 default:
852 break;
853 }
854
855 return NOTIFY_OK;
856}
857
858static struct notifier_block __cpuinitdata acpuclock_cpu_notifier = {
859 .notifier_call = acpuclock_cpu_callback,
860};
861
862static unsigned int __init select_freq_plan(void)
863{
864 uint32_t pte_efuse, speed_bin, pvs, max_khz;
865 struct clkctl_acpu_speed *f;
866
867 pte_efuse = readl_relaxed(QFPROM_PTE_EFUSE_ADDR);
868
869 speed_bin = pte_efuse & 0xF;
870 if (speed_bin == 0xF)
871 speed_bin = (pte_efuse >> 4) & 0xF;
872
873 if (speed_bin == 0x1) {
874 max_khz = 1512000;
875 pvs = (pte_efuse >> 10) & 0x7;
876 if (pvs == 0x7)
877 pvs = (pte_efuse >> 13) & 0x7;
878
879 switch (pvs) {
880 case 0x0:
881 case 0x7:
882 acpu_freq_tbl = acpu_freq_tbl_slow;
883 pr_info("ACPU PVS: Slow\n");
884 break;
885 case 0x1:
886 acpu_freq_tbl = acpu_freq_tbl_nom;
887 pr_info("ACPU PVS: Nominal\n");
888 break;
889 case 0x3:
890 acpu_freq_tbl = acpu_freq_tbl_fast;
891 pr_info("ACPU PVS: Fast\n");
892 break;
893 default:
894 acpu_freq_tbl = acpu_freq_tbl_slow;
895 pr_warn("ACPU PVS: Unknown. Defaulting to slow.\n");
896 break;
897 }
898 } else {
899 max_khz = 1188000;
900 acpu_freq_tbl = acpu_freq_tbl_1188mhz;
901 }
902
903 /* Truncate the table based to max_khz. */
904 for (f = acpu_freq_tbl; f->acpuclk_khz != 0; f++) {
905 if (f->acpuclk_khz > max_khz) {
906 f->acpuclk_khz = 0;
907 break;
908 }
909 }
910 f--;
911 pr_info("Max ACPU freq: %u KHz\n", f->acpuclk_khz);
912
913 return f->acpuclk_khz;
914}
915
Matt Wagantall6d9ebee2011-08-26 12:15:24 -0700916static struct acpuclk_data acpuclk_8x60_data = {
917 .set_rate = acpuclk_8x60_set_rate,
918 .get_rate = acpuclk_8x60_get_rate,
919 .power_collapse_khz = MAX_AXI,
920 .wait_for_irq_khz = MAX_AXI,
921};
922
Matt Wagantallec57f062011-08-16 23:54:46 -0700923static int __init acpuclk_8x60_init(struct acpuclk_soc_data *soc_data)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700924{
925 unsigned int max_cpu_khz;
926 int cpu;
927
928 mutex_init(&drv_state.lock);
929 spin_lock_init(&drv_state.l2_lock);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700930
931 /* Configure hardware. */
932 max_cpu_khz = select_freq_plan();
933 unselect_scplls();
934 scpll_set_refs();
935 for_each_possible_cpu(cpu)
936 scpll_init(cpu);
937 scpll_init(L2);
938 regulator_init();
939 bus_init();
940
941 /* Improve boot time by ramping up CPUs immediately. */
942 for_each_online_cpu(cpu)
Matt Wagantall6d9ebee2011-08-26 12:15:24 -0700943 acpuclk_8x60_set_rate(cpu, max_cpu_khz, SETRATE_INIT);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700944
Matt Wagantall6d9ebee2011-08-26 12:15:24 -0700945 acpuclk_register(&acpuclk_8x60_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700946 cpufreq_table_init();
947 register_hotcpu_notifier(&acpuclock_cpu_notifier);
Matt Wagantall6d9ebee2011-08-26 12:15:24 -0700948
949 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700950}
Matt Wagantallec57f062011-08-16 23:54:46 -0700951
952struct acpuclk_soc_data acpuclk_8x60_soc_data __initdata = {
953 .init = acpuclk_8x60_init,
954};