blob: faf5effd7313a0dd668e7cd81ec9b3b80a23264c [file] [log] [blame]
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +00001/*
2 *
3 * HW data initialization for OMAP5
4 *
5 * (C) Copyright 2013
6 * Texas Instruments, <www.ti.com>
7 *
8 * Sricharan R <r.sricharan@ti.com>
9 *
10 * See file CREDITS for list of people who contributed to this
11 * project.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License as
15 * published by the Free Software Foundation; either version 2 of
16 * the License, or (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 * MA 02111-1307 USA
27 */
28#include <common.h>
29#include <asm/arch/omap.h>
SRICHARAN R1a79cab2013-02-04 04:22:01 +000030#include <asm/arch/sys_proto.h>
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +000031#include <asm/omap_common.h>
SRICHARAN R1a79cab2013-02-04 04:22:01 +000032#include <asm/arch/clocks.h>
SRICHARAN R00d328c2013-02-04 04:22:02 +000033#include <asm/omap_gpio.h>
SRICHARAN R1a79cab2013-02-04 04:22:01 +000034#include <asm/io.h>
Lokesh Vutlad8ac0502013-02-04 04:22:05 +000035#include <asm/emif.h>
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +000036
37struct prcm_regs const **prcm =
38 (struct prcm_regs const **) OMAP_SRAM_SCRATCH_PRCM_PTR;
SRICHARAN R1a79cab2013-02-04 04:22:01 +000039struct dplls const **dplls_data =
40 (struct dplls const **) OMAP_SRAM_SCRATCH_DPLLS_PTR;
SRICHARAN R00d328c2013-02-04 04:22:02 +000041struct vcores_data const **omap_vcores =
42 (struct vcores_data const **) OMAP_SRAM_SCRATCH_VCORES_PTR;
Lokesh Vutla834b6b02013-02-04 04:22:04 +000043struct omap_sys_ctrl_regs const **ctrl =
44 (struct omap_sys_ctrl_regs const **)OMAP5_SRAM_SCRATCH_SYS_CTRL;
SRICHARAN R1a79cab2013-02-04 04:22:01 +000045
SRICHARAN Ra04ed142013-02-12 01:33:43 +000046/* OPP HIGH FREQUENCY for ES2.0 */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000047static const struct dpll_params mpu_dpll_params_1_5ghz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +000048 {125, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
49 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
50 {625, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
51 {625, 7, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
52 {750, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
53 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
54 {625, 15, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000055};
56
SRICHARAN Ra04ed142013-02-12 01:33:43 +000057/* OPP NOM FREQUENCY for ES2.0, OPP HIGH for ES1.0 */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000058static const struct dpll_params mpu_dpll_params_1100mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +000059 {275, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
60 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
61 {1375, 20, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
62 {1375, 23, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
63 {550, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
64 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
65 {1375, 47, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000066};
67
SRICHARAN Ra04ed142013-02-12 01:33:43 +000068/* OPP NOM FREQUENCY for ES1.0 */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000069static const struct dpll_params mpu_dpll_params_800mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +000070 {200, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
71 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
72 {1000, 20, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
73 {375, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
74 {400, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
75 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
76 {375, 17, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000077};
78
SRICHARAN Ra04ed142013-02-12 01:33:43 +000079/* OPP LOW FREQUENCY for ES1.0 */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000080static const struct dpll_params mpu_dpll_params_400mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +000081 {200, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
82 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
83 {1000, 20, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
84 {375, 8, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
85 {400, 12, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
86 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
87 {375, 17, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000088};
89
SRICHARAN Ra04ed142013-02-12 01:33:43 +000090/* OPP LOW FREQUENCY for ES2.0 */
91static const struct dpll_params mpu_dpll_params_499mhz[NUM_SYS_CLKS] = {
92 {499, 11, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
93 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
94 {297, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
95 {493, 18, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
96 {499, 25, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
97 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
98 {493, 37, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000099};
100
101static const struct dpll_params
102 core_dpll_params_2128mhz_ddr532[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000103 {266, 2, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 12 MHz */
104 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
105 {443, 6, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 16.8 MHz */
106 {277, 4, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 19.2 MHz */
107 {368, 8, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 26 MHz */
108 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
109 {277, 9, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000110};
111
112static const struct dpll_params
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000113 core_dpll_params_2128mhz_ddr532_es2[NUM_SYS_CLKS] = {
114 {266, 2, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 12 MHz */
115 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
116 {443, 6, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 16.8 MHz */
117 {277, 4, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 19.2 MHz */
118 {368, 8, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 26 MHz */
119 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
120 {277, 9, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6} /* 38.4 MHz */
121};
122
123static const struct dpll_params
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000124 core_dpll_params_2128mhz_ddr266[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000125 {266, 2, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 12 MHz */
126 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
127 {443, 6, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 16.8 MHz */
128 {277, 4, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 19.2 MHz */
129 {368, 8, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 26 MHz */
130 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
131 {277, 9, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000132};
133
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000134static const struct dpll_params
135 core_dpll_params_2128mhz_ddr266_es2[NUM_SYS_CLKS] = {
136 {266, 2, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 12 MHz */
137 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
138 {443, 6, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 16.8 MHz */
139 {277, 4, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 19.2 MHz */
140 {368, 8, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 26 MHz */
141 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
142 {277, 9, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12} /* 38.4 MHz */
143};
144
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000145static const struct dpll_params per_dpll_params_768mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000146 {32, 0, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 12 MHz */
147 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
148 {160, 6, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 16.8 MHz */
149 {20, 0, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 19.2 MHz */
150 {192, 12, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 26 MHz */
151 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
152 {10, 0, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1} /* 38.4 MHz */
153};
154
155static const struct dpll_params per_dpll_params_768mhz_es2[NUM_SYS_CLKS] = {
156 {32, 0, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 12 MHz */
157 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
158 {160, 6, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 16.8 MHz */
159 {20, 0, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 19.2 MHz */
160 {192, 12, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 26 MHz */
161 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
162 {10, 0, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000163};
164
165static const struct dpll_params iva_dpll_params_2330mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000166 {1165, 11, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
167 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
168 {208, 2, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
169 {182, 2, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
170 {224, 4, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
171 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
172 {91, 2, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000173};
174
175/* ABE M & N values with sys_clk as source */
176static const struct dpll_params
177 abe_dpll_params_sysclk_196608khz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000178 {49, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
179 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
180 {35, 5, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
181 {46, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
182 {34, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
183 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
184 {64, 24, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000185};
186
187/* ABE M & N values with 32K clock as source */
188static const struct dpll_params abe_dpll_params_32k_196608khz = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000189 750, 0, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000190};
191
192static const struct dpll_params usb_dpll_params_1920mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000193 {400, 4, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
194 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
195 {400, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
196 {400, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
197 {480, 12, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
198 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
199 {400, 15, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000200};
201
202struct dplls omap5_dplls_es1 = {
203 .mpu = mpu_dpll_params_800mhz,
204 .core = core_dpll_params_2128mhz_ddr532,
205 .per = per_dpll_params_768mhz,
206 .iva = iva_dpll_params_2330mhz,
207#ifdef CONFIG_SYS_OMAP_ABE_SYSCK
208 .abe = abe_dpll_params_sysclk_196608khz,
209#else
210 .abe = &abe_dpll_params_32k_196608khz,
211#endif
212 .usb = usb_dpll_params_1920mhz
213};
214
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000215struct dplls omap5_dplls_es2 = {
216 .mpu = mpu_dpll_params_1100mhz,
217 .core = core_dpll_params_2128mhz_ddr532_es2,
218 .per = per_dpll_params_768mhz_es2,
219 .iva = iva_dpll_params_2330mhz,
220#ifdef CONFIG_SYS_OMAP_ABE_SYSCK
221 .abe = abe_dpll_params_sysclk_196608khz,
222#else
223 .abe = &abe_dpll_params_32k_196608khz,
224#endif
225 .usb = usb_dpll_params_1920mhz
226};
227
SRICHARAN R00d328c2013-02-04 04:22:02 +0000228struct pmic_data palmas = {
229 .base_offset = PALMAS_SMPS_BASE_VOLT_UV,
230 .step = 10000, /* 10 mV represented in uV */
231 /*
232 * Offset codes 1-6 all give the base voltage in Palmas
233 * Offset code 0 switches OFF the SMPS
234 */
235 .start_code = 6,
236};
237
238struct vcores_data omap5430_volts = {
239 .mpu.value = VDD_MPU,
240 .mpu.addr = SMPS_REG_ADDR_12_MPU,
241 .mpu.pmic = &palmas,
242
243 .core.value = VDD_CORE,
244 .core.addr = SMPS_REG_ADDR_8_CORE,
245 .core.pmic = &palmas,
246
247 .mm.value = VDD_MM,
248 .mm.addr = SMPS_REG_ADDR_45_IVA,
249 .mm.pmic = &palmas,
250};
251
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000252struct vcores_data omap5430_volts_es2 = {
253 .mpu.value = VDD_MPU_ES2,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000254 .mpu.addr = SMPS_REG_ADDR_12_MPU,
255 .mpu.pmic = &palmas,
256
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000257 .core.value = VDD_CORE_ES2,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000258 .core.addr = SMPS_REG_ADDR_8_CORE,
259 .core.pmic = &palmas,
260
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000261 .mm.value = VDD_MM_ES2,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000262 .mm.addr = SMPS_REG_ADDR_45_IVA,
263 .mm.pmic = &palmas,
264};
265
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000266/*
267 * Enable essential clock domains, modules and
268 * do some additional special settings needed
269 */
270void enable_basic_clocks(void)
271{
272 u32 const clk_domains_essential[] = {
273 (*prcm)->cm_l4per_clkstctrl,
274 (*prcm)->cm_l3init_clkstctrl,
275 (*prcm)->cm_memif_clkstctrl,
276 (*prcm)->cm_l4cfg_clkstctrl,
277 0
278 };
279
280 u32 const clk_modules_hw_auto_essential[] = {
281 (*prcm)->cm_l3_2_gpmc_clkctrl,
282 (*prcm)->cm_memif_emif_1_clkctrl,
283 (*prcm)->cm_memif_emif_2_clkctrl,
284 (*prcm)->cm_l4cfg_l4_cfg_clkctrl,
285 (*prcm)->cm_wkup_gpio1_clkctrl,
286 (*prcm)->cm_l4per_gpio2_clkctrl,
287 (*prcm)->cm_l4per_gpio3_clkctrl,
288 (*prcm)->cm_l4per_gpio4_clkctrl,
289 (*prcm)->cm_l4per_gpio5_clkctrl,
290 (*prcm)->cm_l4per_gpio6_clkctrl,
291 0
292 };
293
294 u32 const clk_modules_explicit_en_essential[] = {
295 (*prcm)->cm_wkup_gptimer1_clkctrl,
296 (*prcm)->cm_l3init_hsmmc1_clkctrl,
297 (*prcm)->cm_l3init_hsmmc2_clkctrl,
298 (*prcm)->cm_l4per_gptimer2_clkctrl,
299 (*prcm)->cm_wkup_wdtimer2_clkctrl,
300 (*prcm)->cm_l4per_uart3_clkctrl,
301 (*prcm)->cm_l4per_i2c1_clkctrl,
302 0
303 };
304
305 /* Enable optional additional functional clock for GPIO4 */
306 setbits_le32((*prcm)->cm_l4per_gpio4_clkctrl,
307 GPIO4_CLKCTRL_OPTFCLKEN_MASK);
308
309 /* Enable 96 MHz clock for MMC1 & MMC2 */
310 setbits_le32((*prcm)->cm_l3init_hsmmc1_clkctrl,
311 HSMMC_CLKCTRL_CLKSEL_MASK);
312 setbits_le32((*prcm)->cm_l3init_hsmmc2_clkctrl,
313 HSMMC_CLKCTRL_CLKSEL_MASK);
314
315 /* Set the correct clock dividers for mmc */
316 setbits_le32((*prcm)->cm_l3init_hsmmc1_clkctrl,
317 HSMMC_CLKCTRL_CLKSEL_DIV_MASK);
318 setbits_le32((*prcm)->cm_l3init_hsmmc2_clkctrl,
319 HSMMC_CLKCTRL_CLKSEL_DIV_MASK);
320
321 /* Select 32KHz clock as the source of GPTIMER1 */
322 setbits_le32((*prcm)->cm_wkup_gptimer1_clkctrl,
323 GPTIMER1_CLKCTRL_CLKSEL_MASK);
324
325 do_enable_clocks(clk_domains_essential,
326 clk_modules_hw_auto_essential,
327 clk_modules_explicit_en_essential,
328 1);
329
330 /* Select 384Mhz for GPU as its the POR for ES1.0 */
331 setbits_le32((*prcm)->cm_sgx_sgx_clkctrl,
332 CLKSEL_GPU_HYD_GCLK_MASK);
333 setbits_le32((*prcm)->cm_sgx_sgx_clkctrl,
334 CLKSEL_GPU_CORE_GCLK_MASK);
335
336 /* Enable SCRM OPT clocks for PER and CORE dpll */
337 setbits_le32((*prcm)->cm_wkupaon_scrm_clkctrl,
338 OPTFCLKEN_SCRM_PER_MASK);
339 setbits_le32((*prcm)->cm_wkupaon_scrm_clkctrl,
340 OPTFCLKEN_SCRM_CORE_MASK);
341}
342
343void enable_basic_uboot_clocks(void)
344{
345 u32 const clk_domains_essential[] = {
346 0
347 };
348
349 u32 const clk_modules_hw_auto_essential[] = {
350 0
351 };
352
353 u32 const clk_modules_explicit_en_essential[] = {
354 (*prcm)->cm_l4per_mcspi1_clkctrl,
355 (*prcm)->cm_l4per_i2c2_clkctrl,
356 (*prcm)->cm_l4per_i2c3_clkctrl,
357 (*prcm)->cm_l4per_i2c4_clkctrl,
358 (*prcm)->cm_l3init_hsusbtll_clkctrl,
359 (*prcm)->cm_l3init_hsusbhost_clkctrl,
360 (*prcm)->cm_l3init_fsusb_clkctrl,
361 0
362 };
363
364 do_enable_clocks(clk_domains_essential,
365 clk_modules_hw_auto_essential,
366 clk_modules_explicit_en_essential,
367 1);
368}
369
370/*
371 * Enable non-essential clock domains, modules and
372 * do some additional special settings needed
373 */
374void enable_non_essential_clocks(void)
375{
376 u32 const clk_domains_non_essential[] = {
377 (*prcm)->cm_mpu_m3_clkstctrl,
378 (*prcm)->cm_ivahd_clkstctrl,
379 (*prcm)->cm_dsp_clkstctrl,
380 (*prcm)->cm_dss_clkstctrl,
381 (*prcm)->cm_sgx_clkstctrl,
382 (*prcm)->cm1_abe_clkstctrl,
383 (*prcm)->cm_c2c_clkstctrl,
384 (*prcm)->cm_cam_clkstctrl,
385 (*prcm)->cm_dss_clkstctrl,
386 (*prcm)->cm_sdma_clkstctrl,
387 0
388 };
389
390 u32 const clk_modules_hw_auto_non_essential[] = {
391 (*prcm)->cm_mpu_m3_mpu_m3_clkctrl,
392 (*prcm)->cm_ivahd_ivahd_clkctrl,
393 (*prcm)->cm_ivahd_sl2_clkctrl,
394 (*prcm)->cm_dsp_dsp_clkctrl,
395 (*prcm)->cm_l3instr_l3_3_clkctrl,
396 (*prcm)->cm_l3instr_l3_instr_clkctrl,
397 (*prcm)->cm_l3instr_intrconn_wp1_clkctrl,
398 (*prcm)->cm_l3init_hsi_clkctrl,
399 (*prcm)->cm_l4per_hdq1w_clkctrl,
400 0
401 };
402
403 u32 const clk_modules_explicit_en_non_essential[] = {
404 (*prcm)->cm1_abe_aess_clkctrl,
405 (*prcm)->cm1_abe_pdm_clkctrl,
406 (*prcm)->cm1_abe_dmic_clkctrl,
407 (*prcm)->cm1_abe_mcasp_clkctrl,
408 (*prcm)->cm1_abe_mcbsp1_clkctrl,
409 (*prcm)->cm1_abe_mcbsp2_clkctrl,
410 (*prcm)->cm1_abe_mcbsp3_clkctrl,
411 (*prcm)->cm1_abe_slimbus_clkctrl,
412 (*prcm)->cm1_abe_timer5_clkctrl,
413 (*prcm)->cm1_abe_timer6_clkctrl,
414 (*prcm)->cm1_abe_timer7_clkctrl,
415 (*prcm)->cm1_abe_timer8_clkctrl,
416 (*prcm)->cm1_abe_wdt3_clkctrl,
417 (*prcm)->cm_l4per_gptimer9_clkctrl,
418 (*prcm)->cm_l4per_gptimer10_clkctrl,
419 (*prcm)->cm_l4per_gptimer11_clkctrl,
420 (*prcm)->cm_l4per_gptimer3_clkctrl,
421 (*prcm)->cm_l4per_gptimer4_clkctrl,
422 (*prcm)->cm_l4per_mcspi2_clkctrl,
423 (*prcm)->cm_l4per_mcspi3_clkctrl,
424 (*prcm)->cm_l4per_mcspi4_clkctrl,
425 (*prcm)->cm_l4per_mmcsd3_clkctrl,
426 (*prcm)->cm_l4per_mmcsd4_clkctrl,
427 (*prcm)->cm_l4per_mmcsd5_clkctrl,
428 (*prcm)->cm_l4per_uart1_clkctrl,
429 (*prcm)->cm_l4per_uart2_clkctrl,
430 (*prcm)->cm_l4per_uart4_clkctrl,
431 (*prcm)->cm_wkup_keyboard_clkctrl,
432 (*prcm)->cm_wkup_wdtimer2_clkctrl,
433 (*prcm)->cm_cam_iss_clkctrl,
434 (*prcm)->cm_cam_fdif_clkctrl,
435 (*prcm)->cm_dss_dss_clkctrl,
436 (*prcm)->cm_sgx_sgx_clkctrl,
437 0
438 };
439
440 /* Enable optional functional clock for ISS */
441 setbits_le32((*prcm)->cm_cam_iss_clkctrl, ISS_CLKCTRL_OPTFCLKEN_MASK);
442
443 /* Enable all optional functional clocks of DSS */
444 setbits_le32((*prcm)->cm_dss_dss_clkctrl, DSS_CLKCTRL_OPTFCLKEN_MASK);
445
446 do_enable_clocks(clk_domains_non_essential,
447 clk_modules_hw_auto_non_essential,
448 clk_modules_explicit_en_non_essential,
449 0);
450
451 /* Put camera module in no sleep mode */
452 clrsetbits_le32((*prcm)->cm_cam_clkstctrl,
453 MODULE_CLKCTRL_MODULEMODE_MASK,
454 CD_CLKCTRL_CLKTRCTRL_NO_SLEEP <<
455 MODULE_CLKCTRL_MODULEMODE_SHIFT);
456}
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +0000457
Lokesh Vutlad8ac0502013-02-04 04:22:05 +0000458const struct ctrl_ioregs ioregs_omap5430 = {
459 .ctrl_ddrch = DDR_IO_I_34OHM_SR_FASTEST_WD_DQ_NO_PULL_DQS_PULL_DOWN,
460 .ctrl_lpddr2ch = DDR_IO_I_34OHM_SR_FASTEST_WD_CK_CKE_NCS_CA_PULL_DOWN,
461 .ctrl_ddrio_0 = DDR_IO_0_DDR2_DQ_INT_EN_ALL_DDR3_CA_DIS_ALL,
462 .ctrl_ddrio_1 = DDR_IO_1_DQ_OUT_EN_ALL_DQ_INT_EN_ALL,
463 .ctrl_ddrio_2 = DDR_IO_2_CA_OUT_EN_ALL_CA_INT_EN_ALL,
464};
465
466const struct ctrl_ioregs ioregs_omap5432_es1 = {
467 .ctrl_ddrch = DDR_IO_I_40OHM_SR_FAST_WD_DQ_NO_PULL_DQS_NO_PULL,
468 .ctrl_lpddr2ch = 0x0,
469 .ctrl_ddr3ch = DDR_IO_I_40OHM_SR_SLOWEST_WD_DQ_NO_PULL_DQS_NO_PULL,
470 .ctrl_ddrio_0 = DDR_IO_0_VREF_CELLS_DDR3_VALUE,
471 .ctrl_ddrio_1 = DDR_IO_1_VREF_CELLS_DDR3_VALUE,
472 .ctrl_ddrio_2 = DDR_IO_2_VREF_CELLS_DDR3_VALUE,
473 .ctrl_emif_sdram_config_ext = SDRAM_CONFIG_EXT_RD_LVL_11_SAMPLES,
474};
475
Lokesh Vutla79a9ec72013-02-12 01:33:44 +0000476const struct ctrl_ioregs ioregs_omap5432_es2 = {
477 .ctrl_ddrch = DDR_IO_I_40OHM_SR_FAST_WD_DQ_NO_PULL_DQS_NO_PULL_ES2,
478 .ctrl_lpddr2ch = 0x0,
479 .ctrl_ddr3ch = DDR_IO_I_40OHM_SR_SLOWEST_WD_DQ_NO_PULL_DQS_NO_PULL_ES2,
480 .ctrl_ddrio_0 = DDR_IO_0_VREF_CELLS_DDR3_VALUE_ES2,
481 .ctrl_ddrio_1 = DDR_IO_1_VREF_CELLS_DDR3_VALUE_ES2,
482 .ctrl_ddrio_2 = DDR_IO_2_VREF_CELLS_DDR3_VALUE_ES2,
483 .ctrl_emif_sdram_config_ext = SDRAM_CONFIG_EXT_RD_LVL_11_SAMPLES,
484};
485
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +0000486void hw_data_init(void)
487{
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000488 u32 omap_rev = omap_revision();
489
490 switch (omap_rev) {
491
492 case OMAP5430_ES1_0:
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000493 case OMAP5432_ES1_0:
494 *prcm = &omap5_es1_prcm;
495 *dplls_data = &omap5_dplls_es1;
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000496 *omap_vcores = &omap5430_volts;
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000497 break;
498
SRICHARAN R06ebff42013-02-12 01:33:42 +0000499 case OMAP5430_ES2_0:
500 case OMAP5432_ES2_0:
501 *prcm = &omap5_es2_prcm;
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000502 *dplls_data = &omap5_dplls_es2;
503 *omap_vcores = &omap5430_volts_es2;
SRICHARAN R06ebff42013-02-12 01:33:42 +0000504 break;
505
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000506 default:
507 printf("\n INVALID OMAP REVISION ");
508 }
Lokesh Vutla834b6b02013-02-04 04:22:04 +0000509
510 *ctrl = &omap5_ctrl;
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +0000511}
Lokesh Vutlad8ac0502013-02-04 04:22:05 +0000512
513void get_ioregs(const struct ctrl_ioregs **regs)
514{
515 u32 omap_rev = omap_revision();
516
517 switch (omap_rev) {
518 case OMAP5430_ES1_0:
Lokesh Vutla79a9ec72013-02-12 01:33:44 +0000519 case OMAP5430_ES2_0:
Lokesh Vutlad8ac0502013-02-04 04:22:05 +0000520 *regs = &ioregs_omap5430;
521 break;
522 case OMAP5432_ES1_0:
523 *regs = &ioregs_omap5432_es1;
524 break;
Lokesh Vutla79a9ec72013-02-12 01:33:44 +0000525 case OMAP5432_ES2_0:
526 *regs = &ioregs_omap5432_es2;
527 break;
Lokesh Vutlad8ac0502013-02-04 04:22:05 +0000528
529 default:
530 printf("\n INVALID OMAP REVISION ");
531 }
532}