blob: 90274a02cfdeeac70af20108ec29bb329216c446 [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>
Lokesh Vutla36852972013-05-30 03:19:29 +000029#include <palmas.h>
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +000030#include <asm/arch/omap.h>
SRICHARAN R1a79cab2013-02-04 04:22:01 +000031#include <asm/arch/sys_proto.h>
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +000032#include <asm/omap_common.h>
Lokesh Vutla61c517f2013-05-30 02:54:32 +000033#include <asm/arch/clock.h>
SRICHARAN R00d328c2013-02-04 04:22:02 +000034#include <asm/omap_gpio.h>
SRICHARAN R1a79cab2013-02-04 04:22:01 +000035#include <asm/io.h>
Lokesh Vutlad8ac0502013-02-04 04:22:05 +000036#include <asm/emif.h>
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +000037
38struct prcm_regs const **prcm =
39 (struct prcm_regs const **) OMAP_SRAM_SCRATCH_PRCM_PTR;
SRICHARAN R1a79cab2013-02-04 04:22:01 +000040struct dplls const **dplls_data =
41 (struct dplls const **) OMAP_SRAM_SCRATCH_DPLLS_PTR;
SRICHARAN R00d328c2013-02-04 04:22:02 +000042struct vcores_data const **omap_vcores =
43 (struct vcores_data const **) OMAP_SRAM_SCRATCH_VCORES_PTR;
Lokesh Vutla834b6b02013-02-04 04:22:04 +000044struct omap_sys_ctrl_regs const **ctrl =
SRICHARAN R4b1b61c2013-04-24 00:41:22 +000045 (struct omap_sys_ctrl_regs const **)OMAP_SRAM_SCRATCH_SYS_CTRL;
SRICHARAN R1a79cab2013-02-04 04:22:01 +000046
SRICHARAN Ra04ed142013-02-12 01:33:43 +000047/* OPP HIGH FREQUENCY for ES2.0 */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000048static const struct dpll_params mpu_dpll_params_1_5ghz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +000049 {125, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
50 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
51 {625, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
52 {625, 7, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
53 {750, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
54 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
55 {625, 15, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000056};
57
SRICHARAN Ra04ed142013-02-12 01:33:43 +000058/* OPP NOM FREQUENCY for ES2.0, OPP HIGH for ES1.0 */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000059static const struct dpll_params mpu_dpll_params_1100mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +000060 {275, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
61 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
62 {1375, 20, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
63 {1375, 23, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
64 {550, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
65 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
66 {1375, 47, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000067};
68
SRICHARAN Ra04ed142013-02-12 01:33:43 +000069/* OPP NOM FREQUENCY for ES1.0 */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000070static const struct dpll_params mpu_dpll_params_800mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +000071 {200, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
72 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
73 {1000, 20, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
74 {375, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
75 {400, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
76 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
77 {375, 17, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000078};
79
SRICHARAN Ra04ed142013-02-12 01:33:43 +000080/* OPP LOW FREQUENCY for ES1.0 */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000081static const struct dpll_params mpu_dpll_params_400mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +000082 {200, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
83 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
84 {1000, 20, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
85 {375, 8, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
86 {400, 12, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
87 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
88 {375, 17, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000089};
90
SRICHARAN Ra04ed142013-02-12 01:33:43 +000091/* OPP LOW FREQUENCY for ES2.0 */
92static const struct dpll_params mpu_dpll_params_499mhz[NUM_SYS_CLKS] = {
93 {499, 11, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
94 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
95 {297, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
96 {493, 18, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
97 {499, 25, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
98 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
99 {493, 37, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000100};
101
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000102static const struct dpll_params mpu_dpll_params_1ghz[NUM_SYS_CLKS] = {
103 {250, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
104 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
105 {119, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
106 {625, 11, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
107 {500, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
108 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
109 {625, 23, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 38.4 MHz */
110 {50, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 20 MHz */
111};
112
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000113static const struct dpll_params
114 core_dpll_params_2128mhz_ddr532[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000115 {266, 2, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 12 MHz */
116 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
117 {443, 6, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 16.8 MHz */
118 {277, 4, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 19.2 MHz */
119 {368, 8, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 26 MHz */
120 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
121 {277, 9, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000122};
123
124static const struct dpll_params
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000125 core_dpll_params_2128mhz_ddr532_es2[NUM_SYS_CLKS] = {
126 {266, 2, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 12 MHz */
127 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
128 {443, 6, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 16.8 MHz */
129 {277, 4, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 19.2 MHz */
130 {368, 8, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 26 MHz */
131 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
132 {277, 9, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6} /* 38.4 MHz */
133};
134
135static const struct dpll_params
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000136 core_dpll_params_2128mhz_ddr532_dra7xx[NUM_SYS_CLKS] = {
137 {266, 2, 2, -1, -1, 4, 62, 5, -1, 5, 7, 6}, /* 12 MHz */
138 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
139 {443, 6, 2, -1, -1, 4, 62, 5, -1, 5, 7, 6}, /* 16.8 MHz */
140 {277, 4, 2, -1, -1, 4, 62, 5, -1, 5, 7, 6}, /* 19.2 MHz */
141 {368, 8, 2, -1, -1, 4, 62, 5, -1, 5, 7, 6}, /* 26 MHz */
142 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
143 {277, 9, 2, -1, -1, 4, 62, 5, -1, 5, 7, 6}, /* 38.4 MHz */
144 {266, 4, 2, -1, -1, 4, 62, 5, -1, 5, 7, 6} /* 20 MHz */
145};
146
147static const struct dpll_params
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000148 core_dpll_params_2128mhz_ddr266[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000149 {266, 2, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 12 MHz */
150 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
151 {443, 6, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 16.8 MHz */
152 {277, 4, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 19.2 MHz */
153 {368, 8, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 26 MHz */
154 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
155 {277, 9, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000156};
157
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000158static const struct dpll_params
159 core_dpll_params_2128mhz_ddr266_es2[NUM_SYS_CLKS] = {
160 {266, 2, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 12 MHz */
161 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
162 {443, 6, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 16.8 MHz */
163 {277, 4, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 19.2 MHz */
164 {368, 8, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 26 MHz */
165 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
166 {277, 9, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12} /* 38.4 MHz */
167};
168
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000169static const struct dpll_params per_dpll_params_768mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000170 {32, 0, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 12 MHz */
171 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
172 {160, 6, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 16.8 MHz */
173 {20, 0, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 19.2 MHz */
174 {192, 12, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 26 MHz */
175 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
176 {10, 0, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1} /* 38.4 MHz */
177};
178
179static const struct dpll_params per_dpll_params_768mhz_es2[NUM_SYS_CLKS] = {
180 {32, 0, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 12 MHz */
181 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
182 {160, 6, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 16.8 MHz */
183 {20, 0, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 19.2 MHz */
184 {192, 12, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 26 MHz */
185 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
186 {10, 0, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000187};
188
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000189static const struct dpll_params per_dpll_params_768mhz_dra7xx[NUM_SYS_CLKS] = {
190 {32, 0, 4, -1, 3, 4, 10, 2, -1, -1, -1, -1}, /* 12 MHz */
191 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
192 {160, 6, 4, -1, 3, 4, 10, 2, -1, -1, -1, -1}, /* 16.8 MHz */
193 {20, 0, 4, -1, 3, 4, 10, 2, -1, -1, -1, -1}, /* 19.2 MHz */
194 {192, 12, 4, -1, 3, 4, 10, 2, -1, -1, -1, -1}, /* 26 MHz */
195 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
196 {10, 0, 4, -1, 3, 4, 10, 2, -1, -1, -1, -1}, /* 38.4 MHz */
197 {96, 4, 4, -1, 3, 4, 10, 2, -1, -1, -1, -1} /* 20 MHz */
198};
199
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000200static const struct dpll_params iva_dpll_params_2330mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000201 {1165, 11, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
202 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
203 {208, 2, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
204 {182, 2, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
205 {224, 4, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
206 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
207 {91, 2, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000208};
209
210/* ABE M & N values with sys_clk as source */
211static const struct dpll_params
212 abe_dpll_params_sysclk_196608khz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000213 {49, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
214 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
215 {35, 5, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
216 {46, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
217 {34, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
218 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
219 {64, 24, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000220};
221
222/* ABE M & N values with 32K clock as source */
223static const struct dpll_params abe_dpll_params_32k_196608khz = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000224 750, 0, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000225};
226
227static const struct dpll_params usb_dpll_params_1920mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000228 {400, 4, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
229 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
230 {400, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
231 {400, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
232 {480, 12, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
233 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000234 {400, 15, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 38.4 MHz */
235 {48, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 20 MHz */
236};
237
238static const struct dpll_params ddr_dpll_params_1066mhz[NUM_SYS_CLKS] = {
239 {533, 11, 1, 1, 4, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
240 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
241 {222, 6, 1, 1, 4, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
242 {111, 3, 1, 1, 4, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
243 {41, 1, 1, 1, 4, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
244 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
245 {347, 24, 1, 1, 4, -1, -1, -1, -1, -1, -1, -1}, /* 38.4 MHz */
246 {533, 19, 1, 1, 4, -1, -1, -1, -1, -1, -1, -1} /* 20 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000247};
248
249struct dplls omap5_dplls_es1 = {
250 .mpu = mpu_dpll_params_800mhz,
251 .core = core_dpll_params_2128mhz_ddr532,
252 .per = per_dpll_params_768mhz,
253 .iva = iva_dpll_params_2330mhz,
254#ifdef CONFIG_SYS_OMAP_ABE_SYSCK
255 .abe = abe_dpll_params_sysclk_196608khz,
256#else
257 .abe = &abe_dpll_params_32k_196608khz,
258#endif
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000259 .usb = usb_dpll_params_1920mhz,
260 .ddr = NULL
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000261};
262
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000263struct dplls omap5_dplls_es2 = {
264 .mpu = mpu_dpll_params_1100mhz,
265 .core = core_dpll_params_2128mhz_ddr532_es2,
266 .per = per_dpll_params_768mhz_es2,
267 .iva = iva_dpll_params_2330mhz,
268#ifdef CONFIG_SYS_OMAP_ABE_SYSCK
269 .abe = abe_dpll_params_sysclk_196608khz,
270#else
271 .abe = &abe_dpll_params_32k_196608khz,
272#endif
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000273 .usb = usb_dpll_params_1920mhz,
274 .ddr = NULL
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000275};
276
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000277struct dplls dra7xx_dplls = {
278 .mpu = mpu_dpll_params_1ghz,
279 .core = core_dpll_params_2128mhz_ddr532_dra7xx,
280 .per = per_dpll_params_768mhz_dra7xx,
281 .usb = usb_dpll_params_1920mhz,
282 .ddr = ddr_dpll_params_1066mhz,
283};
284
SRICHARAN R00d328c2013-02-04 04:22:02 +0000285struct pmic_data palmas = {
286 .base_offset = PALMAS_SMPS_BASE_VOLT_UV,
287 .step = 10000, /* 10 mV represented in uV */
288 /*
289 * Offset codes 1-6 all give the base voltage in Palmas
290 * Offset code 0 switches OFF the SMPS
291 */
292 .start_code = 6,
Lokesh Vutlaae49f6d2013-05-30 02:54:33 +0000293 .i2c_slave_addr = SMPS_I2C_SLAVE_ADDR,
294 .pmic_bus_init = sri2c_init,
295 .pmic_write = omap_vc_bypass_send_value,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000296};
297
Lokesh Vutla36852972013-05-30 03:19:29 +0000298struct pmic_data tps659038 = {
299 .base_offset = PALMAS_SMPS_BASE_VOLT_UV,
300 .step = 10000, /* 10 mV represented in uV */
301 /*
302 * Offset codes 1-6 all give the base voltage in Palmas
303 * Offset code 0 switches OFF the SMPS
304 */
305 .start_code = 6,
306 .i2c_slave_addr = TPS659038_I2C_SLAVE_ADDR,
307 .pmic_bus_init = gpi2c_init,
308 .pmic_write = palmas_i2c_write_u8,
309};
310
SRICHARAN R00d328c2013-02-04 04:22:02 +0000311struct vcores_data omap5430_volts = {
312 .mpu.value = VDD_MPU,
313 .mpu.addr = SMPS_REG_ADDR_12_MPU,
314 .mpu.pmic = &palmas,
315
316 .core.value = VDD_CORE,
317 .core.addr = SMPS_REG_ADDR_8_CORE,
318 .core.pmic = &palmas,
319
320 .mm.value = VDD_MM,
321 .mm.addr = SMPS_REG_ADDR_45_IVA,
322 .mm.pmic = &palmas,
323};
324
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000325struct vcores_data omap5430_volts_es2 = {
326 .mpu.value = VDD_MPU_ES2,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000327 .mpu.addr = SMPS_REG_ADDR_12_MPU,
328 .mpu.pmic = &palmas,
329
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000330 .core.value = VDD_CORE_ES2,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000331 .core.addr = SMPS_REG_ADDR_8_CORE,
332 .core.pmic = &palmas,
333
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000334 .mm.value = VDD_MM_ES2,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000335 .mm.addr = SMPS_REG_ADDR_45_IVA,
336 .mm.pmic = &palmas,
337};
338
Lokesh Vutla36852972013-05-30 03:19:29 +0000339struct vcores_data dra752_volts = {
340 .mpu.value = VDD_MPU_DRA752,
341 .mpu.addr = TPS659038_REG_ADDR_SMPS12_MPU,
342 .mpu.pmic = &tps659038,
343
344 .eve.value = VDD_EVE_DRA752,
345 .eve.addr = TPS659038_REG_ADDR_SMPS45_EVE,
346 .eve.pmic = &tps659038,
347
348 .gpu.value = VDD_GPU_DRA752,
349 .gpu.addr = TPS659038_REG_ADDR_SMPS6_GPU,
350 .gpu.pmic = &tps659038,
351
352 .core.value = VDD_CORE_DRA752,
353 .core.addr = TPS659038_REG_ADDR_SMPS7_CORE,
354 .core.pmic = &tps659038,
355
356 .iva.value = VDD_IVA_DRA752,
357 .iva.addr = TPS659038_REG_ADDR_SMPS8_IVA,
358 .iva.pmic = &tps659038,
359};
360
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000361/*
362 * Enable essential clock domains, modules and
363 * do some additional special settings needed
364 */
365void enable_basic_clocks(void)
366{
367 u32 const clk_domains_essential[] = {
368 (*prcm)->cm_l4per_clkstctrl,
369 (*prcm)->cm_l3init_clkstctrl,
370 (*prcm)->cm_memif_clkstctrl,
371 (*prcm)->cm_l4cfg_clkstctrl,
372 0
373 };
374
375 u32 const clk_modules_hw_auto_essential[] = {
Lokesh Vutla15c2c702013-02-17 23:33:37 +0000376 (*prcm)->cm_l3_gpmc_clkctrl,
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000377 (*prcm)->cm_memif_emif_1_clkctrl,
378 (*prcm)->cm_memif_emif_2_clkctrl,
379 (*prcm)->cm_l4cfg_l4_cfg_clkctrl,
380 (*prcm)->cm_wkup_gpio1_clkctrl,
381 (*prcm)->cm_l4per_gpio2_clkctrl,
382 (*prcm)->cm_l4per_gpio3_clkctrl,
383 (*prcm)->cm_l4per_gpio4_clkctrl,
384 (*prcm)->cm_l4per_gpio5_clkctrl,
385 (*prcm)->cm_l4per_gpio6_clkctrl,
386 0
387 };
388
389 u32 const clk_modules_explicit_en_essential[] = {
390 (*prcm)->cm_wkup_gptimer1_clkctrl,
391 (*prcm)->cm_l3init_hsmmc1_clkctrl,
392 (*prcm)->cm_l3init_hsmmc2_clkctrl,
393 (*prcm)->cm_l4per_gptimer2_clkctrl,
394 (*prcm)->cm_wkup_wdtimer2_clkctrl,
395 (*prcm)->cm_l4per_uart3_clkctrl,
396 (*prcm)->cm_l4per_i2c1_clkctrl,
397 0
398 };
399
400 /* Enable optional additional functional clock for GPIO4 */
401 setbits_le32((*prcm)->cm_l4per_gpio4_clkctrl,
402 GPIO4_CLKCTRL_OPTFCLKEN_MASK);
403
404 /* Enable 96 MHz clock for MMC1 & MMC2 */
405 setbits_le32((*prcm)->cm_l3init_hsmmc1_clkctrl,
406 HSMMC_CLKCTRL_CLKSEL_MASK);
407 setbits_le32((*prcm)->cm_l3init_hsmmc2_clkctrl,
408 HSMMC_CLKCTRL_CLKSEL_MASK);
409
410 /* Set the correct clock dividers for mmc */
411 setbits_le32((*prcm)->cm_l3init_hsmmc1_clkctrl,
412 HSMMC_CLKCTRL_CLKSEL_DIV_MASK);
413 setbits_le32((*prcm)->cm_l3init_hsmmc2_clkctrl,
414 HSMMC_CLKCTRL_CLKSEL_DIV_MASK);
415
416 /* Select 32KHz clock as the source of GPTIMER1 */
417 setbits_le32((*prcm)->cm_wkup_gptimer1_clkctrl,
418 GPTIMER1_CLKCTRL_CLKSEL_MASK);
419
420 do_enable_clocks(clk_domains_essential,
421 clk_modules_hw_auto_essential,
422 clk_modules_explicit_en_essential,
423 1);
424
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000425 /* Enable SCRM OPT clocks for PER and CORE dpll */
426 setbits_le32((*prcm)->cm_wkupaon_scrm_clkctrl,
427 OPTFCLKEN_SCRM_PER_MASK);
428 setbits_le32((*prcm)->cm_wkupaon_scrm_clkctrl,
429 OPTFCLKEN_SCRM_CORE_MASK);
430}
431
432void enable_basic_uboot_clocks(void)
433{
434 u32 const clk_domains_essential[] = {
435 0
436 };
437
438 u32 const clk_modules_hw_auto_essential[] = {
Lubomir Popov65354032013-04-11 00:08:51 +0000439 (*prcm)->cm_l3init_hsusbtll_clkctrl,
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000440 0
441 };
442
443 u32 const clk_modules_explicit_en_essential[] = {
444 (*prcm)->cm_l4per_mcspi1_clkctrl,
445 (*prcm)->cm_l4per_i2c2_clkctrl,
446 (*prcm)->cm_l4per_i2c3_clkctrl,
447 (*prcm)->cm_l4per_i2c4_clkctrl,
Lubomir Popovb36e6092013-04-08 21:49:37 +0000448 (*prcm)->cm_l4per_i2c5_clkctrl,
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000449 (*prcm)->cm_l3init_hsusbhost_clkctrl,
450 (*prcm)->cm_l3init_fsusb_clkctrl,
451 0
452 };
453
454 do_enable_clocks(clk_domains_essential,
455 clk_modules_hw_auto_essential,
456 clk_modules_explicit_en_essential,
457 1);
458}
459
460/*
461 * Enable non-essential clock domains, modules and
462 * do some additional special settings needed
463 */
464void enable_non_essential_clocks(void)
465{
466 u32 const clk_domains_non_essential[] = {
467 (*prcm)->cm_mpu_m3_clkstctrl,
468 (*prcm)->cm_ivahd_clkstctrl,
469 (*prcm)->cm_dsp_clkstctrl,
470 (*prcm)->cm_dss_clkstctrl,
471 (*prcm)->cm_sgx_clkstctrl,
472 (*prcm)->cm1_abe_clkstctrl,
473 (*prcm)->cm_c2c_clkstctrl,
474 (*prcm)->cm_cam_clkstctrl,
475 (*prcm)->cm_dss_clkstctrl,
476 (*prcm)->cm_sdma_clkstctrl,
477 0
478 };
479
480 u32 const clk_modules_hw_auto_non_essential[] = {
481 (*prcm)->cm_mpu_m3_mpu_m3_clkctrl,
482 (*prcm)->cm_ivahd_ivahd_clkctrl,
483 (*prcm)->cm_ivahd_sl2_clkctrl,
484 (*prcm)->cm_dsp_dsp_clkctrl,
485 (*prcm)->cm_l3instr_l3_3_clkctrl,
486 (*prcm)->cm_l3instr_l3_instr_clkctrl,
487 (*prcm)->cm_l3instr_intrconn_wp1_clkctrl,
488 (*prcm)->cm_l3init_hsi_clkctrl,
489 (*prcm)->cm_l4per_hdq1w_clkctrl,
490 0
491 };
492
493 u32 const clk_modules_explicit_en_non_essential[] = {
494 (*prcm)->cm1_abe_aess_clkctrl,
495 (*prcm)->cm1_abe_pdm_clkctrl,
496 (*prcm)->cm1_abe_dmic_clkctrl,
497 (*prcm)->cm1_abe_mcasp_clkctrl,
498 (*prcm)->cm1_abe_mcbsp1_clkctrl,
499 (*prcm)->cm1_abe_mcbsp2_clkctrl,
500 (*prcm)->cm1_abe_mcbsp3_clkctrl,
501 (*prcm)->cm1_abe_slimbus_clkctrl,
502 (*prcm)->cm1_abe_timer5_clkctrl,
503 (*prcm)->cm1_abe_timer6_clkctrl,
504 (*prcm)->cm1_abe_timer7_clkctrl,
505 (*prcm)->cm1_abe_timer8_clkctrl,
506 (*prcm)->cm1_abe_wdt3_clkctrl,
507 (*prcm)->cm_l4per_gptimer9_clkctrl,
508 (*prcm)->cm_l4per_gptimer10_clkctrl,
509 (*prcm)->cm_l4per_gptimer11_clkctrl,
510 (*prcm)->cm_l4per_gptimer3_clkctrl,
511 (*prcm)->cm_l4per_gptimer4_clkctrl,
512 (*prcm)->cm_l4per_mcspi2_clkctrl,
513 (*prcm)->cm_l4per_mcspi3_clkctrl,
514 (*prcm)->cm_l4per_mcspi4_clkctrl,
515 (*prcm)->cm_l4per_mmcsd3_clkctrl,
516 (*prcm)->cm_l4per_mmcsd4_clkctrl,
517 (*prcm)->cm_l4per_mmcsd5_clkctrl,
518 (*prcm)->cm_l4per_uart1_clkctrl,
519 (*prcm)->cm_l4per_uart2_clkctrl,
520 (*prcm)->cm_l4per_uart4_clkctrl,
521 (*prcm)->cm_wkup_keyboard_clkctrl,
522 (*prcm)->cm_wkup_wdtimer2_clkctrl,
523 (*prcm)->cm_cam_iss_clkctrl,
524 (*prcm)->cm_cam_fdif_clkctrl,
525 (*prcm)->cm_dss_dss_clkctrl,
526 (*prcm)->cm_sgx_sgx_clkctrl,
527 0
528 };
529
530 /* Enable optional functional clock for ISS */
531 setbits_le32((*prcm)->cm_cam_iss_clkctrl, ISS_CLKCTRL_OPTFCLKEN_MASK);
532
533 /* Enable all optional functional clocks of DSS */
534 setbits_le32((*prcm)->cm_dss_dss_clkctrl, DSS_CLKCTRL_OPTFCLKEN_MASK);
535
536 do_enable_clocks(clk_domains_non_essential,
537 clk_modules_hw_auto_non_essential,
538 clk_modules_explicit_en_non_essential,
539 0);
540
541 /* Put camera module in no sleep mode */
542 clrsetbits_le32((*prcm)->cm_cam_clkstctrl,
543 MODULE_CLKCTRL_MODULEMODE_MASK,
544 CD_CLKCTRL_CLKTRCTRL_NO_SLEEP <<
545 MODULE_CLKCTRL_MODULEMODE_SHIFT);
546}
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +0000547
Lokesh Vutlad8ac0502013-02-04 04:22:05 +0000548const struct ctrl_ioregs ioregs_omap5430 = {
549 .ctrl_ddrch = DDR_IO_I_34OHM_SR_FASTEST_WD_DQ_NO_PULL_DQS_PULL_DOWN,
550 .ctrl_lpddr2ch = DDR_IO_I_34OHM_SR_FASTEST_WD_CK_CKE_NCS_CA_PULL_DOWN,
551 .ctrl_ddrio_0 = DDR_IO_0_DDR2_DQ_INT_EN_ALL_DDR3_CA_DIS_ALL,
552 .ctrl_ddrio_1 = DDR_IO_1_DQ_OUT_EN_ALL_DQ_INT_EN_ALL,
553 .ctrl_ddrio_2 = DDR_IO_2_CA_OUT_EN_ALL_CA_INT_EN_ALL,
554};
555
556const struct ctrl_ioregs ioregs_omap5432_es1 = {
557 .ctrl_ddrch = DDR_IO_I_40OHM_SR_FAST_WD_DQ_NO_PULL_DQS_NO_PULL,
558 .ctrl_lpddr2ch = 0x0,
559 .ctrl_ddr3ch = DDR_IO_I_40OHM_SR_SLOWEST_WD_DQ_NO_PULL_DQS_NO_PULL,
560 .ctrl_ddrio_0 = DDR_IO_0_VREF_CELLS_DDR3_VALUE,
561 .ctrl_ddrio_1 = DDR_IO_1_VREF_CELLS_DDR3_VALUE,
562 .ctrl_ddrio_2 = DDR_IO_2_VREF_CELLS_DDR3_VALUE,
563 .ctrl_emif_sdram_config_ext = SDRAM_CONFIG_EXT_RD_LVL_11_SAMPLES,
564};
565
Lokesh Vutla79a9ec72013-02-12 01:33:44 +0000566const struct ctrl_ioregs ioregs_omap5432_es2 = {
567 .ctrl_ddrch = DDR_IO_I_40OHM_SR_FAST_WD_DQ_NO_PULL_DQS_NO_PULL_ES2,
568 .ctrl_lpddr2ch = 0x0,
569 .ctrl_ddr3ch = DDR_IO_I_40OHM_SR_SLOWEST_WD_DQ_NO_PULL_DQS_NO_PULL_ES2,
570 .ctrl_ddrio_0 = DDR_IO_0_VREF_CELLS_DDR3_VALUE_ES2,
571 .ctrl_ddrio_1 = DDR_IO_1_VREF_CELLS_DDR3_VALUE_ES2,
572 .ctrl_ddrio_2 = DDR_IO_2_VREF_CELLS_DDR3_VALUE_ES2,
573 .ctrl_emif_sdram_config_ext = SDRAM_CONFIG_EXT_RD_LVL_11_SAMPLES,
574};
575
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +0000576void hw_data_init(void)
577{
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000578 u32 omap_rev = omap_revision();
579
580 switch (omap_rev) {
581
582 case OMAP5430_ES1_0:
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000583 case OMAP5432_ES1_0:
584 *prcm = &omap5_es1_prcm;
585 *dplls_data = &omap5_dplls_es1;
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000586 *omap_vcores = &omap5430_volts;
Lokesh Vutlaf120cef2013-02-12 21:29:06 +0000587 *ctrl = &omap5_ctrl;
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000588 break;
589
SRICHARAN R06ebff42013-02-12 01:33:42 +0000590 case OMAP5430_ES2_0:
591 case OMAP5432_ES2_0:
592 *prcm = &omap5_es2_prcm;
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000593 *dplls_data = &omap5_dplls_es2;
594 *omap_vcores = &omap5430_volts_es2;
Lokesh Vutlaf120cef2013-02-12 21:29:06 +0000595 *ctrl = &omap5_ctrl;
SRICHARAN R06ebff42013-02-12 01:33:42 +0000596 break;
597
Lokesh Vutla15c2c702013-02-17 23:33:37 +0000598 case DRA752_ES1_0:
599 *prcm = &dra7xx_prcm;
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000600 *dplls_data = &dra7xx_dplls;
Lokesh Vutla36852972013-05-30 03:19:29 +0000601 *omap_vcores = &dra752_volts;
Lokesh Vutlaf120cef2013-02-12 21:29:06 +0000602 *ctrl = &dra7xx_ctrl;
Lokesh Vutla15c2c702013-02-17 23:33:37 +0000603 break;
604
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000605 default:
606 printf("\n INVALID OMAP REVISION ");
607 }
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +0000608}
Lokesh Vutlad8ac0502013-02-04 04:22:05 +0000609
610void get_ioregs(const struct ctrl_ioregs **regs)
611{
612 u32 omap_rev = omap_revision();
613
614 switch (omap_rev) {
615 case OMAP5430_ES1_0:
Lokesh Vutla79a9ec72013-02-12 01:33:44 +0000616 case OMAP5430_ES2_0:
Lokesh Vutlad8ac0502013-02-04 04:22:05 +0000617 *regs = &ioregs_omap5430;
618 break;
619 case OMAP5432_ES1_0:
620 *regs = &ioregs_omap5432_es1;
621 break;
Lokesh Vutla79a9ec72013-02-12 01:33:44 +0000622 case OMAP5432_ES2_0:
Lokesh Vutla8caa56c2013-02-12 21:29:07 +0000623 case DRA752_ES1_0:
Lokesh Vutla79a9ec72013-02-12 01:33:44 +0000624 *regs = &ioregs_omap5432_es2;
625 break;
Lokesh Vutlad8ac0502013-02-04 04:22:05 +0000626
627 default:
628 printf("\n INVALID OMAP REVISION ");
629 }
630}