blob: eecfbade3543b67523b5b6d9b205c20a3a4c94c8 [file] [log] [blame]
Sricharan9784f1f2011-11-15 09:49:58 -05001/*
2 *
3 * Clock initialization for OMAP5
4 *
5 * (C) Copyright 2010
6 * Texas Instruments, <www.ti.com>
7 *
8 * Aneesh V <aneesh@ti.com>
9 * Sricharan R <r.sricharan@ti.com>
10 *
11 * Based on previous work by:
12 * Santosh Shilimkar <santosh.shilimkar@ti.com>
13 * Rajendra Nayak <rnayak@ti.com>
14 *
15 * See file CREDITS for list of people who contributed to this
16 * project.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 */
33#include <common.h>
34#include <asm/omap_common.h>
35#include <asm/arch/clocks.h>
36#include <asm/arch/sys_proto.h>
37#include <asm/utils.h>
38#include <asm/omap_gpio.h>
39
40#ifndef CONFIG_SPL_BUILD
41/*
42 * printing to console doesn't work unless
43 * this code is executed from SPL
44 */
45#define printf(fmt, args...)
46#define puts(s)
47#endif
48
49struct omap5_prcm_regs *const prcm = (struct omap5_prcm_regs *)0x4A004100;
50
51const u32 sys_clk_array[8] = {
52 12000000, /* 12 MHz */
53 0, /* NA */
54 16800000, /* 16.8 MHz */
55 19200000, /* 19.2 MHz */
56 26000000, /* 26 MHz */
57 0, /* NA */
58 38400000, /* 38.4 MHz */
59};
60
61static const struct dpll_params mpu_dpll_params_1_5ghz[NUM_SYS_CLKS] = {
62 {125, 0, 1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
63 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
64 {625, 6, 1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
65 {625, 7, 1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
66 {750, 12, 1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
67 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
68 {625, 15, 1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
69};
70
71static const struct dpll_params mpu_dpll_params_2ghz[NUM_SYS_CLKS] = {
72 {500, 2, 1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
73 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
74 {2024, 16, 1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
75 {625, 5, 1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
76 {1000, 12, 1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
77 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
78 {625, 11, 1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
79};
80
81static const struct dpll_params mpu_dpll_params_1100mhz[NUM_SYS_CLKS] = {
82 {275, 2, 1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
83 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
84 {1375, 20, 1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
85 {1375, 23, 1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
86 {550, 12, 1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
87 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
88 {1375, 47, 1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
89};
90
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +000091static const struct dpll_params mpu_dpll_params_800mhz[NUM_SYS_CLKS] = {
92 {200, 2, 1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
93 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
94 {1000, 20, 1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
95 {375, 8, 1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
96 {400, 12, 1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
97 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
98 {375, 17, 1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
99};
100
101static const struct dpll_params mpu_dpll_params_400mhz[NUM_SYS_CLKS] = {
102 {200, 2, 2, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
103 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
104 {1000, 20, 2, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
105 {375, 8, 2, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
106 {400, 12, 2, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
107 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
108 {375, 17, 2, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
109};
110
Sricharan9784f1f2011-11-15 09:49:58 -0500111static const struct dpll_params mpu_dpll_params_550mhz[NUM_SYS_CLKS] = {
112 {275, 2, 2, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
113 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
114 {1375, 20, 2, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
115 {1375, 23, 2, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
116 {550, 12, 2, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
117 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
118 {1375, 47, 2, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
119};
120
121static const struct dpll_params
122 core_dpll_params_2128mhz_ddr532[NUM_SYS_CLKS] = {
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000123 {266, 2, 2, 5, 8, 4, 62, 5, 5, 7}, /* 12 MHz */
Sricharan9784f1f2011-11-15 09:49:58 -0500124 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000125 {570, 8, 2, 5, 8, 4, 62, 5, 5, 7}, /* 16.8 MHz */
126 {665, 11, 2, 5, 8, 4, 62, 5, 5, 7}, /* 19.2 MHz */
127 {532, 12, 2, 5, 8, 4, 62, 5, 5, 7}, /* 26 MHz */
Sricharan9784f1f2011-11-15 09:49:58 -0500128 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000129 {665, 23, 2, 5, 8, 4, 62, 5, 5, 7} /* 38.4 MHz */
Sricharan9784f1f2011-11-15 09:49:58 -0500130};
131
132static const struct dpll_params
133 core_dpll_params_2128mhz_ddr266[NUM_SYS_CLKS] = {
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000134 {266, 2, 4, 5, 8, 8, 62, 10, 10, 14}, /* 12 MHz */
Sricharan9784f1f2011-11-15 09:49:58 -0500135 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000136 {570, 8, 4, 5, 8, 8, 62, 10, 10, 14}, /* 16.8 MHz */
137 {665, 11, 4, 5, 8, 8, 62, 10, 10, 14}, /* 19.2 MHz */
138 {532, 12, 4, 8, 8, 8, 62, 10, 10, 14}, /* 26 MHz */
Sricharan9784f1f2011-11-15 09:49:58 -0500139 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000140 {665, 23, 4, 8, 8, 8, 62, 10, 10, 14} /* 38.4 MHz */
Sricharan9784f1f2011-11-15 09:49:58 -0500141};
142
143static const struct dpll_params per_dpll_params_768mhz[NUM_SYS_CLKS] = {
144 {32, 0, 4, 3, 6, 4, -1, 2, -1, -1}, /* 12 MHz */
145 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
146 {160, 6, 4, 3, 6, 4, -1, 2, -1, -1}, /* 16.8 MHz */
147 {20, 0, 4, 3, 6, 4, -1, 2, -1, -1}, /* 19.2 MHz */
148 {192, 12, 4, 3, 6, 4, -1, 2, -1, -1}, /* 26 MHz */
149 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
150 {10, 0, 4, 3, 6, 4, -1, 2, -1, -1} /* 38.4 MHz */
151};
152
153static const struct dpll_params iva_dpll_params_2330mhz[NUM_SYS_CLKS] = {
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000154 {1165, 11, -1, -1, 5, 6, -1, -1, -1, -1}, /* 12 MHz */
155 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
156 {2011, 28, -1, -1, 5, 6, -1, -1, -1, -1}, /* 16.8 MHz */
157 {1881, 30, -1, -1, 5, 6, -1, -1, -1, -1}, /* 19.2 MHz */
158 {1165, 25, -1, -1, 5, 6, -1, -1, -1, -1}, /* 26 MHz */
159 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
160 {1972, 64, -1, -1, 5, 6, -1, -1, -1, -1} /* 38.4 MHz */
Sricharan9784f1f2011-11-15 09:49:58 -0500161};
162
163/* ABE M & N values with sys_clk as source */
164static const struct dpll_params
165 abe_dpll_params_sysclk_196608khz[NUM_SYS_CLKS] = {
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000166 {49, 5, 1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
167 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
168 {35, 5, 1, 1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
169 {46, 8, 1, 1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
170 {34, 8, 1, 1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
171 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
172 {64, 24, 1, 1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
Sricharan9784f1f2011-11-15 09:49:58 -0500173};
174
175/* ABE M & N values with 32K clock as source */
176static const struct dpll_params abe_dpll_params_32k_196608khz = {
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000177 750, 0, 1, 1, -1, -1, -1, -1, -1, -1
Sricharan9784f1f2011-11-15 09:49:58 -0500178};
179
180static const struct dpll_params usb_dpll_params_1920mhz[NUM_SYS_CLKS] = {
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000181 {400, 4, 2, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
182 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
183 {400, 6, 2, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
184 {400, 7, 2, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
185 {480, 12, 2, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
186 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
187 {400, 15, 2, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
Sricharan9784f1f2011-11-15 09:49:58 -0500188};
189
190void setup_post_dividers(u32 *const base, const struct dpll_params *params)
191{
192 struct dpll_regs *const dpll_regs = (struct dpll_regs *)base;
193
194 /* Setup post-dividers */
195 if (params->m2 >= 0)
196 writel(params->m2, &dpll_regs->cm_div_m2_dpll);
197 if (params->m3 >= 0)
198 writel(params->m3, &dpll_regs->cm_div_m3_dpll);
199 if (params->h11 >= 0)
200 writel(params->h11, &dpll_regs->cm_div_h11_dpll);
201 if (params->h12 >= 0)
202 writel(params->h12, &dpll_regs->cm_div_h12_dpll);
203 if (params->h13 >= 0)
204 writel(params->h13, &dpll_regs->cm_div_h13_dpll);
205 if (params->h14 >= 0)
206 writel(params->h14, &dpll_regs->cm_div_h14_dpll);
207 if (params->h22 >= 0)
208 writel(params->h22, &dpll_regs->cm_div_h22_dpll);
209 if (params->h23 >= 0)
210 writel(params->h23, &dpll_regs->cm_div_h23_dpll);
211}
212
213const struct dpll_params *get_mpu_dpll_params(void)
214{
215 u32 sysclk_ind = get_sys_clk_index();
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000216 return &mpu_dpll_params_800mhz[sysclk_ind];
Sricharan9784f1f2011-11-15 09:49:58 -0500217}
218
219const struct dpll_params *get_core_dpll_params(void)
220{
221 u32 sysclk_ind = get_sys_clk_index();
222
223 /* Configuring the DDR to be at 532mhz */
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000224 return &core_dpll_params_2128mhz_ddr532[sysclk_ind];
Sricharan9784f1f2011-11-15 09:49:58 -0500225}
226
227const struct dpll_params *get_per_dpll_params(void)
228{
229 u32 sysclk_ind = get_sys_clk_index();
230 return &per_dpll_params_768mhz[sysclk_ind];
231}
232
233const struct dpll_params *get_iva_dpll_params(void)
234{
235 u32 sysclk_ind = get_sys_clk_index();
236 return &iva_dpll_params_2330mhz[sysclk_ind];
237}
238
239const struct dpll_params *get_usb_dpll_params(void)
240{
241 u32 sysclk_ind = get_sys_clk_index();
242 return &usb_dpll_params_1920mhz[sysclk_ind];
243}
244
245const struct dpll_params *get_abe_dpll_params(void)
246{
247#ifdef CONFIG_SYS_OMAP_ABE_SYSCK
248 u32 sysclk_ind = get_sys_clk_index();
249 return &abe_dpll_params_sysclk_196608khz[sysclk_ind];
250#else
251 return &abe_dpll_params_32k_196608khz;
252#endif
253}
254
255/*
256 * Setup the voltages for vdd_mpu, vdd_core, and vdd_iva
257 * We set the maximum voltages allowed here because Smart-Reflex is not
258 * enabled in bootloader. Voltage initialization in the kernel will set
259 * these to the nominal values after enabling Smart-Reflex
260 */
261void scale_vcores(void)
262{
Lokesh Vutla4acda712012-05-22 00:03:27 +0000263 u32 volt_core, volt_mpu, volt_mm;
Sricharan9784f1f2011-11-15 09:49:58 -0500264
Nishanth Menon41d7ab12012-03-01 14:17:37 +0000265 omap_vc_init(PRM_VC_I2C_CHANNEL_FREQ_KHZ);
Sricharan9784f1f2011-11-15 09:49:58 -0500266
SRICHARAN R698a1f22012-03-12 02:25:38 +0000267 /* Palmas settings */
Lokesh Vutla4acda712012-05-22 00:03:27 +0000268 if (omap_revision() != OMAP5432_ES1_0) {
269 volt_core = VDD_CORE;
270 volt_mpu = VDD_MPU;
271 volt_mm = VDD_MM;
272 } else {
273 volt_core = VDD_CORE_5432;
274 volt_mpu = VDD_MPU_5432;
275 volt_mm = VDD_MM_5432;
276 }
Sricharan9784f1f2011-11-15 09:49:58 -0500277
Lokesh Vutla4acda712012-05-22 00:03:27 +0000278 do_scale_vcore(SMPS_REG_ADDR_8_CORE, volt_core);
279 do_scale_vcore(SMPS_REG_ADDR_12_MPU, volt_mpu);
280 do_scale_vcore(SMPS_REG_ADDR_45_IVA, volt_mm);
SRICHARAN R698a1f22012-03-12 02:25:38 +0000281
Lokesh Vutla4acda712012-05-22 00:03:27 +0000282 if (omap_revision() == OMAP5432_ES1_0) {
283 /* Configure LDO SRAM "magic" bits */
284 writel(2, &prcm->prm_sldo_core_setup);
285 writel(2, &prcm->prm_sldo_mpu_setup);
286 writel(2, &prcm->prm_sldo_mm_setup);
287 }
SRICHARAN R698a1f22012-03-12 02:25:38 +0000288}
289
290u32 get_offset_code(u32 volt_offset)
291{
292 u32 offset_code, step = 10000; /* 10 mV represented in uV */
293
294 volt_offset -= PALMAS_SMPS_BASE_VOLT_UV;
295
296 offset_code = (volt_offset + step - 1) / step;
Sricharan9784f1f2011-11-15 09:49:58 -0500297
SRICHARAN R698a1f22012-03-12 02:25:38 +0000298 /*
299 * Offset codes 1-6 all give the base voltage in Palmas
300 * Offset code 0 switches OFF the SMPS
301 */
302 return offset_code + 6;
Sricharan9784f1f2011-11-15 09:49:58 -0500303}
304
305/*
306 * Enable essential clock domains, modules and
307 * do some additional special settings needed
308 */
309void enable_basic_clocks(void)
310{
311 u32 *const clk_domains_essential[] = {
312 &prcm->cm_l4per_clkstctrl,
313 &prcm->cm_l3init_clkstctrl,
314 &prcm->cm_memif_clkstctrl,
315 &prcm->cm_l4cfg_clkstctrl,
316 0
317 };
318
319 u32 *const clk_modules_hw_auto_essential[] = {
SRICHARAN R35712ab2012-06-12 19:53:30 +0000320 &prcm->cm_l3_2_gpmc_clkctrl,
Sricharan308fe922011-11-15 09:50:03 -0500321 &prcm->cm_memif_emif_1_clkctrl,
322 &prcm->cm_memif_emif_2_clkctrl,
323 &prcm->cm_l4cfg_l4_cfg_clkctrl,
Sricharan9784f1f2011-11-15 09:49:58 -0500324 &prcm->cm_wkup_gpio1_clkctrl,
325 &prcm->cm_l4per_gpio2_clkctrl,
326 &prcm->cm_l4per_gpio3_clkctrl,
327 &prcm->cm_l4per_gpio4_clkctrl,
328 &prcm->cm_l4per_gpio5_clkctrl,
329 &prcm->cm_l4per_gpio6_clkctrl,
Sricharan9784f1f2011-11-15 09:49:58 -0500330 0
331 };
332
333 u32 *const clk_modules_explicit_en_essential[] = {
Sricharan308fe922011-11-15 09:50:03 -0500334 &prcm->cm_wkup_gptimer1_clkctrl,
Sricharan9784f1f2011-11-15 09:49:58 -0500335 &prcm->cm_l3init_hsmmc1_clkctrl,
336 &prcm->cm_l3init_hsmmc2_clkctrl,
Sricharan308fe922011-11-15 09:50:03 -0500337 &prcm->cm_l4per_gptimer2_clkctrl,
Sricharan9784f1f2011-11-15 09:49:58 -0500338 &prcm->cm_wkup_wdtimer2_clkctrl,
339 &prcm->cm_l4per_uart3_clkctrl,
Sricharan308fe922011-11-15 09:50:03 -0500340 &prcm->cm_l4per_i2c1_clkctrl,
Sricharan9784f1f2011-11-15 09:49:58 -0500341 0
342 };
343
344 /* Enable optional additional functional clock for GPIO4 */
345 setbits_le32(&prcm->cm_l4per_gpio4_clkctrl,
346 GPIO4_CLKCTRL_OPTFCLKEN_MASK);
347
348 /* Enable 96 MHz clock for MMC1 & MMC2 */
349 setbits_le32(&prcm->cm_l3init_hsmmc1_clkctrl,
350 HSMMC_CLKCTRL_CLKSEL_MASK);
351 setbits_le32(&prcm->cm_l3init_hsmmc2_clkctrl,
352 HSMMC_CLKCTRL_CLKSEL_MASK);
353
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000354 /* Set the correct clock dividers for mmc */
355 setbits_le32(&prcm->cm_l3init_hsmmc1_clkctrl,
356 HSMMC_CLKCTRL_CLKSEL_DIV_MASK);
357 setbits_le32(&prcm->cm_l3init_hsmmc2_clkctrl,
358 HSMMC_CLKCTRL_CLKSEL_DIV_MASK);
359
Sricharan9784f1f2011-11-15 09:49:58 -0500360 /* Select 32KHz clock as the source of GPTIMER1 */
361 setbits_le32(&prcm->cm_wkup_gptimer1_clkctrl,
362 GPTIMER1_CLKCTRL_CLKSEL_MASK);
363
364 do_enable_clocks(clk_domains_essential,
365 clk_modules_hw_auto_essential,
366 clk_modules_explicit_en_essential,
367 1);
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000368
369 /* Select 384Mhz for GPU as its the POR for ES1.0 */
370 setbits_le32(&prcm->cm_sgx_sgx_clkctrl,
371 CLKSEL_GPU_HYD_GCLK_MASK);
372 setbits_le32(&prcm->cm_sgx_sgx_clkctrl,
373 CLKSEL_GPU_CORE_GCLK_MASK);
374
375 /* Enable SCRM OPT clocks for PER and CORE dpll */
376 setbits_le32(&prcm->cm_wkupaon_scrm_clkctrl,
377 OPTFCLKEN_SCRM_PER_MASK);
378 setbits_le32(&prcm->cm_wkupaon_scrm_clkctrl,
379 OPTFCLKEN_SCRM_CORE_MASK);
Sricharan9784f1f2011-11-15 09:49:58 -0500380}
381
Sricharan308fe922011-11-15 09:50:03 -0500382void enable_basic_uboot_clocks(void)
383{
384 u32 *const clk_domains_essential[] = {
385 0
386 };
387
388 u32 *const clk_modules_hw_auto_essential[] = {
389 0
390 };
391
392 u32 *const clk_modules_explicit_en_essential[] = {
393 &prcm->cm_l4per_mcspi1_clkctrl,
394 &prcm->cm_l4per_i2c2_clkctrl,
395 &prcm->cm_l4per_i2c3_clkctrl,
396 &prcm->cm_l4per_i2c4_clkctrl,
SRICHARAN R96b80b22012-06-12 19:53:31 +0000397 &prcm->cm_l3init_hsusbtll_clkctrl,
398 &prcm->cm_l3init_hsusbhost_clkctrl,
399 &prcm->cm_l3init_fsusb_clkctrl,
Sricharan308fe922011-11-15 09:50:03 -0500400 0
401 };
402
403 do_enable_clocks(clk_domains_essential,
404 clk_modules_hw_auto_essential,
405 clk_modules_explicit_en_essential,
406 1);
407}
408
Sricharan9784f1f2011-11-15 09:49:58 -0500409/*
410 * Enable non-essential clock domains, modules and
411 * do some additional special settings needed
412 */
413void enable_non_essential_clocks(void)
414{
415 u32 *const clk_domains_non_essential[] = {
416 &prcm->cm_mpu_m3_clkstctrl,
417 &prcm->cm_ivahd_clkstctrl,
418 &prcm->cm_dsp_clkstctrl,
419 &prcm->cm_dss_clkstctrl,
420 &prcm->cm_sgx_clkstctrl,
421 &prcm->cm1_abe_clkstctrl,
422 &prcm->cm_c2c_clkstctrl,
423 &prcm->cm_cam_clkstctrl,
424 &prcm->cm_dss_clkstctrl,
425 &prcm->cm_sdma_clkstctrl,
426 0
427 };
428
429 u32 *const clk_modules_hw_auto_non_essential[] = {
430 &prcm->cm_mpu_m3_mpu_m3_clkctrl,
431 &prcm->cm_ivahd_ivahd_clkctrl,
432 &prcm->cm_ivahd_sl2_clkctrl,
433 &prcm->cm_dsp_dsp_clkctrl,
Sricharan9784f1f2011-11-15 09:49:58 -0500434 &prcm->cm_l3instr_l3_3_clkctrl,
435 &prcm->cm_l3instr_l3_instr_clkctrl,
436 &prcm->cm_l3instr_intrconn_wp1_clkctrl,
437 &prcm->cm_l3init_hsi_clkctrl,
SRICHARAN Rb1ee0bc2012-03-12 02:25:34 +0000438 &prcm->cm_l4per_hdq1w_clkctrl,
Sricharan9784f1f2011-11-15 09:49:58 -0500439 0
440 };
441
442 u32 *const clk_modules_explicit_en_non_essential[] = {
443 &prcm->cm1_abe_aess_clkctrl,
444 &prcm->cm1_abe_pdm_clkctrl,
445 &prcm->cm1_abe_dmic_clkctrl,
446 &prcm->cm1_abe_mcasp_clkctrl,
447 &prcm->cm1_abe_mcbsp1_clkctrl,
448 &prcm->cm1_abe_mcbsp2_clkctrl,
449 &prcm->cm1_abe_mcbsp3_clkctrl,
450 &prcm->cm1_abe_slimbus_clkctrl,
451 &prcm->cm1_abe_timer5_clkctrl,
452 &prcm->cm1_abe_timer6_clkctrl,
453 &prcm->cm1_abe_timer7_clkctrl,
454 &prcm->cm1_abe_timer8_clkctrl,
455 &prcm->cm1_abe_wdt3_clkctrl,
456 &prcm->cm_l4per_gptimer9_clkctrl,
457 &prcm->cm_l4per_gptimer10_clkctrl,
458 &prcm->cm_l4per_gptimer11_clkctrl,
459 &prcm->cm_l4per_gptimer3_clkctrl,
460 &prcm->cm_l4per_gptimer4_clkctrl,
Sricharan9784f1f2011-11-15 09:49:58 -0500461 &prcm->cm_l4per_mcspi2_clkctrl,
462 &prcm->cm_l4per_mcspi3_clkctrl,
463 &prcm->cm_l4per_mcspi4_clkctrl,
464 &prcm->cm_l4per_mmcsd3_clkctrl,
465 &prcm->cm_l4per_mmcsd4_clkctrl,
466 &prcm->cm_l4per_mmcsd5_clkctrl,
467 &prcm->cm_l4per_uart1_clkctrl,
468 &prcm->cm_l4per_uart2_clkctrl,
469 &prcm->cm_l4per_uart4_clkctrl,
470 &prcm->cm_wkup_keyboard_clkctrl,
471 &prcm->cm_wkup_wdtimer2_clkctrl,
472 &prcm->cm_cam_iss_clkctrl,
473 &prcm->cm_cam_fdif_clkctrl,
474 &prcm->cm_dss_dss_clkctrl,
475 &prcm->cm_sgx_sgx_clkctrl,
Sricharan9784f1f2011-11-15 09:49:58 -0500476 0
477 };
478
479 /* Enable optional functional clock for ISS */
480 setbits_le32(&prcm->cm_cam_iss_clkctrl, ISS_CLKCTRL_OPTFCLKEN_MASK);
481
482 /* Enable all optional functional clocks of DSS */
483 setbits_le32(&prcm->cm_dss_dss_clkctrl, DSS_CLKCTRL_OPTFCLKEN_MASK);
484
485 do_enable_clocks(clk_domains_non_essential,
486 clk_modules_hw_auto_non_essential,
487 clk_modules_explicit_en_non_essential,
488 0);
489
490 /* Put camera module in no sleep mode */
491 clrsetbits_le32(&prcm->cm_cam_clkstctrl, MODULE_CLKCTRL_MODULEMODE_MASK,
492 CD_CLKCTRL_CLKTRCTRL_NO_SLEEP <<
493 MODULE_CLKCTRL_MODULEMODE_SHIFT);
494}