blob: 604fa42b1b6a035851a6c4fb0f705cff132d648b [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 =
SRICHARAN R4b1b61c2013-04-24 00:41:22 +000044 (struct omap_sys_ctrl_regs const **)OMAP_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
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000101static const struct dpll_params mpu_dpll_params_1ghz[NUM_SYS_CLKS] = {
102 {250, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
103 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
104 {119, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
105 {625, 11, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
106 {500, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
107 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
108 {625, 23, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 38.4 MHz */
109 {50, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 20 MHz */
110};
111
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000112static const struct dpll_params
113 core_dpll_params_2128mhz_ddr532[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000114 {266, 2, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 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, 5, -1, 5, 7, -1}, /* 16.8 MHz */
117 {277, 4, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 19.2 MHz */
118 {368, 8, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 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, 5, -1, 5, 7, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000121};
122
123static const struct dpll_params
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000124 core_dpll_params_2128mhz_ddr532_es2[NUM_SYS_CLKS] = {
125 {266, 2, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 12 MHz */
126 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
127 {443, 6, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 16.8 MHz */
128 {277, 4, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 19.2 MHz */
129 {368, 8, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 26 MHz */
130 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
131 {277, 9, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6} /* 38.4 MHz */
132};
133
134static const struct dpll_params
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000135 core_dpll_params_2128mhz_ddr532_dra7xx[NUM_SYS_CLKS] = {
136 {266, 2, 2, -1, -1, 4, 62, 5, -1, 5, 7, 6}, /* 12 MHz */
137 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
138 {443, 6, 2, -1, -1, 4, 62, 5, -1, 5, 7, 6}, /* 16.8 MHz */
139 {277, 4, 2, -1, -1, 4, 62, 5, -1, 5, 7, 6}, /* 19.2 MHz */
140 {368, 8, 2, -1, -1, 4, 62, 5, -1, 5, 7, 6}, /* 26 MHz */
141 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
142 {277, 9, 2, -1, -1, 4, 62, 5, -1, 5, 7, 6}, /* 38.4 MHz */
143 {266, 4, 2, -1, -1, 4, 62, 5, -1, 5, 7, 6} /* 20 MHz */
144};
145
146static const struct dpll_params
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000147 core_dpll_params_2128mhz_ddr266[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000148 {266, 2, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 12 MHz */
149 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
150 {443, 6, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 16.8 MHz */
151 {277, 4, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 19.2 MHz */
152 {368, 8, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 26 MHz */
153 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
154 {277, 9, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000155};
156
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000157static const struct dpll_params
158 core_dpll_params_2128mhz_ddr266_es2[NUM_SYS_CLKS] = {
159 {266, 2, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 12 MHz */
160 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
161 {443, 6, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 16.8 MHz */
162 {277, 4, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 19.2 MHz */
163 {368, 8, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 26 MHz */
164 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
165 {277, 9, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12} /* 38.4 MHz */
166};
167
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000168static const struct dpll_params per_dpll_params_768mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000169 {32, 0, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 12 MHz */
170 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
171 {160, 6, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 16.8 MHz */
172 {20, 0, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 19.2 MHz */
173 {192, 12, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 26 MHz */
174 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
175 {10, 0, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1} /* 38.4 MHz */
176};
177
178static const struct dpll_params per_dpll_params_768mhz_es2[NUM_SYS_CLKS] = {
179 {32, 0, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 12 MHz */
180 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
181 {160, 6, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 16.8 MHz */
182 {20, 0, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 19.2 MHz */
183 {192, 12, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 26 MHz */
184 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
185 {10, 0, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000186};
187
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000188static const struct dpll_params per_dpll_params_768mhz_dra7xx[NUM_SYS_CLKS] = {
189 {32, 0, 4, -1, 3, 4, 10, 2, -1, -1, -1, -1}, /* 12 MHz */
190 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
191 {160, 6, 4, -1, 3, 4, 10, 2, -1, -1, -1, -1}, /* 16.8 MHz */
192 {20, 0, 4, -1, 3, 4, 10, 2, -1, -1, -1, -1}, /* 19.2 MHz */
193 {192, 12, 4, -1, 3, 4, 10, 2, -1, -1, -1, -1}, /* 26 MHz */
194 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
195 {10, 0, 4, -1, 3, 4, 10, 2, -1, -1, -1, -1}, /* 38.4 MHz */
196 {96, 4, 4, -1, 3, 4, 10, 2, -1, -1, -1, -1} /* 20 MHz */
197};
198
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000199static const struct dpll_params iva_dpll_params_2330mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000200 {1165, 11, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
201 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
202 {208, 2, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
203 {182, 2, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
204 {224, 4, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
205 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
206 {91, 2, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000207};
208
209/* ABE M & N values with sys_clk as source */
210static const struct dpll_params
211 abe_dpll_params_sysclk_196608khz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000212 {49, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
213 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
214 {35, 5, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
215 {46, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
216 {34, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
217 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
218 {64, 24, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000219};
220
221/* ABE M & N values with 32K clock as source */
222static const struct dpll_params abe_dpll_params_32k_196608khz = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000223 750, 0, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000224};
225
226static const struct dpll_params usb_dpll_params_1920mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000227 {400, 4, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
228 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
229 {400, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
230 {400, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
231 {480, 12, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
232 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000233 {400, 15, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 38.4 MHz */
234 {48, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 20 MHz */
235};
236
237static const struct dpll_params ddr_dpll_params_1066mhz[NUM_SYS_CLKS] = {
238 {533, 11, 1, 1, 4, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
239 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
240 {222, 6, 1, 1, 4, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
241 {111, 3, 1, 1, 4, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
242 {41, 1, 1, 1, 4, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
243 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
244 {347, 24, 1, 1, 4, -1, -1, -1, -1, -1, -1, -1}, /* 38.4 MHz */
245 {533, 19, 1, 1, 4, -1, -1, -1, -1, -1, -1, -1} /* 20 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000246};
247
248struct dplls omap5_dplls_es1 = {
249 .mpu = mpu_dpll_params_800mhz,
250 .core = core_dpll_params_2128mhz_ddr532,
251 .per = per_dpll_params_768mhz,
252 .iva = iva_dpll_params_2330mhz,
253#ifdef CONFIG_SYS_OMAP_ABE_SYSCK
254 .abe = abe_dpll_params_sysclk_196608khz,
255#else
256 .abe = &abe_dpll_params_32k_196608khz,
257#endif
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000258 .usb = usb_dpll_params_1920mhz,
259 .ddr = NULL
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000260};
261
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000262struct dplls omap5_dplls_es2 = {
263 .mpu = mpu_dpll_params_1100mhz,
264 .core = core_dpll_params_2128mhz_ddr532_es2,
265 .per = per_dpll_params_768mhz_es2,
266 .iva = iva_dpll_params_2330mhz,
267#ifdef CONFIG_SYS_OMAP_ABE_SYSCK
268 .abe = abe_dpll_params_sysclk_196608khz,
269#else
270 .abe = &abe_dpll_params_32k_196608khz,
271#endif
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000272 .usb = usb_dpll_params_1920mhz,
273 .ddr = NULL
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000274};
275
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000276struct dplls dra7xx_dplls = {
277 .mpu = mpu_dpll_params_1ghz,
278 .core = core_dpll_params_2128mhz_ddr532_dra7xx,
279 .per = per_dpll_params_768mhz_dra7xx,
280 .usb = usb_dpll_params_1920mhz,
281 .ddr = ddr_dpll_params_1066mhz,
282};
283
SRICHARAN R00d328c2013-02-04 04:22:02 +0000284struct pmic_data palmas = {
285 .base_offset = PALMAS_SMPS_BASE_VOLT_UV,
286 .step = 10000, /* 10 mV represented in uV */
287 /*
288 * Offset codes 1-6 all give the base voltage in Palmas
289 * Offset code 0 switches OFF the SMPS
290 */
291 .start_code = 6,
292};
293
294struct vcores_data omap5430_volts = {
295 .mpu.value = VDD_MPU,
296 .mpu.addr = SMPS_REG_ADDR_12_MPU,
297 .mpu.pmic = &palmas,
298
299 .core.value = VDD_CORE,
300 .core.addr = SMPS_REG_ADDR_8_CORE,
301 .core.pmic = &palmas,
302
303 .mm.value = VDD_MM,
304 .mm.addr = SMPS_REG_ADDR_45_IVA,
305 .mm.pmic = &palmas,
306};
307
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000308struct vcores_data omap5430_volts_es2 = {
309 .mpu.value = VDD_MPU_ES2,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000310 .mpu.addr = SMPS_REG_ADDR_12_MPU,
311 .mpu.pmic = &palmas,
312
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000313 .core.value = VDD_CORE_ES2,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000314 .core.addr = SMPS_REG_ADDR_8_CORE,
315 .core.pmic = &palmas,
316
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000317 .mm.value = VDD_MM_ES2,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000318 .mm.addr = SMPS_REG_ADDR_45_IVA,
319 .mm.pmic = &palmas,
320};
321
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000322/*
323 * Enable essential clock domains, modules and
324 * do some additional special settings needed
325 */
326void enable_basic_clocks(void)
327{
328 u32 const clk_domains_essential[] = {
329 (*prcm)->cm_l4per_clkstctrl,
330 (*prcm)->cm_l3init_clkstctrl,
331 (*prcm)->cm_memif_clkstctrl,
332 (*prcm)->cm_l4cfg_clkstctrl,
333 0
334 };
335
336 u32 const clk_modules_hw_auto_essential[] = {
Lokesh Vutla15c2c702013-02-17 23:33:37 +0000337 (*prcm)->cm_l3_gpmc_clkctrl,
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000338 (*prcm)->cm_memif_emif_1_clkctrl,
339 (*prcm)->cm_memif_emif_2_clkctrl,
340 (*prcm)->cm_l4cfg_l4_cfg_clkctrl,
341 (*prcm)->cm_wkup_gpio1_clkctrl,
342 (*prcm)->cm_l4per_gpio2_clkctrl,
343 (*prcm)->cm_l4per_gpio3_clkctrl,
344 (*prcm)->cm_l4per_gpio4_clkctrl,
345 (*prcm)->cm_l4per_gpio5_clkctrl,
346 (*prcm)->cm_l4per_gpio6_clkctrl,
347 0
348 };
349
350 u32 const clk_modules_explicit_en_essential[] = {
351 (*prcm)->cm_wkup_gptimer1_clkctrl,
352 (*prcm)->cm_l3init_hsmmc1_clkctrl,
353 (*prcm)->cm_l3init_hsmmc2_clkctrl,
354 (*prcm)->cm_l4per_gptimer2_clkctrl,
355 (*prcm)->cm_wkup_wdtimer2_clkctrl,
356 (*prcm)->cm_l4per_uart3_clkctrl,
357 (*prcm)->cm_l4per_i2c1_clkctrl,
358 0
359 };
360
361 /* Enable optional additional functional clock for GPIO4 */
362 setbits_le32((*prcm)->cm_l4per_gpio4_clkctrl,
363 GPIO4_CLKCTRL_OPTFCLKEN_MASK);
364
365 /* Enable 96 MHz clock for MMC1 & MMC2 */
366 setbits_le32((*prcm)->cm_l3init_hsmmc1_clkctrl,
367 HSMMC_CLKCTRL_CLKSEL_MASK);
368 setbits_le32((*prcm)->cm_l3init_hsmmc2_clkctrl,
369 HSMMC_CLKCTRL_CLKSEL_MASK);
370
371 /* Set the correct clock dividers for mmc */
372 setbits_le32((*prcm)->cm_l3init_hsmmc1_clkctrl,
373 HSMMC_CLKCTRL_CLKSEL_DIV_MASK);
374 setbits_le32((*prcm)->cm_l3init_hsmmc2_clkctrl,
375 HSMMC_CLKCTRL_CLKSEL_DIV_MASK);
376
377 /* Select 32KHz clock as the source of GPTIMER1 */
378 setbits_le32((*prcm)->cm_wkup_gptimer1_clkctrl,
379 GPTIMER1_CLKCTRL_CLKSEL_MASK);
380
381 do_enable_clocks(clk_domains_essential,
382 clk_modules_hw_auto_essential,
383 clk_modules_explicit_en_essential,
384 1);
385
386 /* Select 384Mhz for GPU as its the POR for ES1.0 */
387 setbits_le32((*prcm)->cm_sgx_sgx_clkctrl,
388 CLKSEL_GPU_HYD_GCLK_MASK);
389 setbits_le32((*prcm)->cm_sgx_sgx_clkctrl,
390 CLKSEL_GPU_CORE_GCLK_MASK);
391
392 /* Enable SCRM OPT clocks for PER and CORE dpll */
393 setbits_le32((*prcm)->cm_wkupaon_scrm_clkctrl,
394 OPTFCLKEN_SCRM_PER_MASK);
395 setbits_le32((*prcm)->cm_wkupaon_scrm_clkctrl,
396 OPTFCLKEN_SCRM_CORE_MASK);
397}
398
399void enable_basic_uboot_clocks(void)
400{
401 u32 const clk_domains_essential[] = {
402 0
403 };
404
405 u32 const clk_modules_hw_auto_essential[] = {
Lubomir Popov65354032013-04-11 00:08:51 +0000406 (*prcm)->cm_l3init_hsusbtll_clkctrl,
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000407 0
408 };
409
410 u32 const clk_modules_explicit_en_essential[] = {
411 (*prcm)->cm_l4per_mcspi1_clkctrl,
412 (*prcm)->cm_l4per_i2c2_clkctrl,
413 (*prcm)->cm_l4per_i2c3_clkctrl,
414 (*prcm)->cm_l4per_i2c4_clkctrl,
Lubomir Popovb36e6092013-04-08 21:49:37 +0000415 (*prcm)->cm_l4per_i2c5_clkctrl,
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000416 (*prcm)->cm_l3init_hsusbhost_clkctrl,
417 (*prcm)->cm_l3init_fsusb_clkctrl,
418 0
419 };
420
421 do_enable_clocks(clk_domains_essential,
422 clk_modules_hw_auto_essential,
423 clk_modules_explicit_en_essential,
424 1);
425}
426
427/*
428 * Enable non-essential clock domains, modules and
429 * do some additional special settings needed
430 */
431void enable_non_essential_clocks(void)
432{
433 u32 const clk_domains_non_essential[] = {
434 (*prcm)->cm_mpu_m3_clkstctrl,
435 (*prcm)->cm_ivahd_clkstctrl,
436 (*prcm)->cm_dsp_clkstctrl,
437 (*prcm)->cm_dss_clkstctrl,
438 (*prcm)->cm_sgx_clkstctrl,
439 (*prcm)->cm1_abe_clkstctrl,
440 (*prcm)->cm_c2c_clkstctrl,
441 (*prcm)->cm_cam_clkstctrl,
442 (*prcm)->cm_dss_clkstctrl,
443 (*prcm)->cm_sdma_clkstctrl,
444 0
445 };
446
447 u32 const clk_modules_hw_auto_non_essential[] = {
448 (*prcm)->cm_mpu_m3_mpu_m3_clkctrl,
449 (*prcm)->cm_ivahd_ivahd_clkctrl,
450 (*prcm)->cm_ivahd_sl2_clkctrl,
451 (*prcm)->cm_dsp_dsp_clkctrl,
452 (*prcm)->cm_l3instr_l3_3_clkctrl,
453 (*prcm)->cm_l3instr_l3_instr_clkctrl,
454 (*prcm)->cm_l3instr_intrconn_wp1_clkctrl,
455 (*prcm)->cm_l3init_hsi_clkctrl,
456 (*prcm)->cm_l4per_hdq1w_clkctrl,
457 0
458 };
459
460 u32 const clk_modules_explicit_en_non_essential[] = {
461 (*prcm)->cm1_abe_aess_clkctrl,
462 (*prcm)->cm1_abe_pdm_clkctrl,
463 (*prcm)->cm1_abe_dmic_clkctrl,
464 (*prcm)->cm1_abe_mcasp_clkctrl,
465 (*prcm)->cm1_abe_mcbsp1_clkctrl,
466 (*prcm)->cm1_abe_mcbsp2_clkctrl,
467 (*prcm)->cm1_abe_mcbsp3_clkctrl,
468 (*prcm)->cm1_abe_slimbus_clkctrl,
469 (*prcm)->cm1_abe_timer5_clkctrl,
470 (*prcm)->cm1_abe_timer6_clkctrl,
471 (*prcm)->cm1_abe_timer7_clkctrl,
472 (*prcm)->cm1_abe_timer8_clkctrl,
473 (*prcm)->cm1_abe_wdt3_clkctrl,
474 (*prcm)->cm_l4per_gptimer9_clkctrl,
475 (*prcm)->cm_l4per_gptimer10_clkctrl,
476 (*prcm)->cm_l4per_gptimer11_clkctrl,
477 (*prcm)->cm_l4per_gptimer3_clkctrl,
478 (*prcm)->cm_l4per_gptimer4_clkctrl,
479 (*prcm)->cm_l4per_mcspi2_clkctrl,
480 (*prcm)->cm_l4per_mcspi3_clkctrl,
481 (*prcm)->cm_l4per_mcspi4_clkctrl,
482 (*prcm)->cm_l4per_mmcsd3_clkctrl,
483 (*prcm)->cm_l4per_mmcsd4_clkctrl,
484 (*prcm)->cm_l4per_mmcsd5_clkctrl,
485 (*prcm)->cm_l4per_uart1_clkctrl,
486 (*prcm)->cm_l4per_uart2_clkctrl,
487 (*prcm)->cm_l4per_uart4_clkctrl,
488 (*prcm)->cm_wkup_keyboard_clkctrl,
489 (*prcm)->cm_wkup_wdtimer2_clkctrl,
490 (*prcm)->cm_cam_iss_clkctrl,
491 (*prcm)->cm_cam_fdif_clkctrl,
492 (*prcm)->cm_dss_dss_clkctrl,
493 (*prcm)->cm_sgx_sgx_clkctrl,
494 0
495 };
496
497 /* Enable optional functional clock for ISS */
498 setbits_le32((*prcm)->cm_cam_iss_clkctrl, ISS_CLKCTRL_OPTFCLKEN_MASK);
499
500 /* Enable all optional functional clocks of DSS */
501 setbits_le32((*prcm)->cm_dss_dss_clkctrl, DSS_CLKCTRL_OPTFCLKEN_MASK);
502
503 do_enable_clocks(clk_domains_non_essential,
504 clk_modules_hw_auto_non_essential,
505 clk_modules_explicit_en_non_essential,
506 0);
507
508 /* Put camera module in no sleep mode */
509 clrsetbits_le32((*prcm)->cm_cam_clkstctrl,
510 MODULE_CLKCTRL_MODULEMODE_MASK,
511 CD_CLKCTRL_CLKTRCTRL_NO_SLEEP <<
512 MODULE_CLKCTRL_MODULEMODE_SHIFT);
513}
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +0000514
Lokesh Vutlad8ac0502013-02-04 04:22:05 +0000515const struct ctrl_ioregs ioregs_omap5430 = {
516 .ctrl_ddrch = DDR_IO_I_34OHM_SR_FASTEST_WD_DQ_NO_PULL_DQS_PULL_DOWN,
517 .ctrl_lpddr2ch = DDR_IO_I_34OHM_SR_FASTEST_WD_CK_CKE_NCS_CA_PULL_DOWN,
518 .ctrl_ddrio_0 = DDR_IO_0_DDR2_DQ_INT_EN_ALL_DDR3_CA_DIS_ALL,
519 .ctrl_ddrio_1 = DDR_IO_1_DQ_OUT_EN_ALL_DQ_INT_EN_ALL,
520 .ctrl_ddrio_2 = DDR_IO_2_CA_OUT_EN_ALL_CA_INT_EN_ALL,
521};
522
523const struct ctrl_ioregs ioregs_omap5432_es1 = {
524 .ctrl_ddrch = DDR_IO_I_40OHM_SR_FAST_WD_DQ_NO_PULL_DQS_NO_PULL,
525 .ctrl_lpddr2ch = 0x0,
526 .ctrl_ddr3ch = DDR_IO_I_40OHM_SR_SLOWEST_WD_DQ_NO_PULL_DQS_NO_PULL,
527 .ctrl_ddrio_0 = DDR_IO_0_VREF_CELLS_DDR3_VALUE,
528 .ctrl_ddrio_1 = DDR_IO_1_VREF_CELLS_DDR3_VALUE,
529 .ctrl_ddrio_2 = DDR_IO_2_VREF_CELLS_DDR3_VALUE,
530 .ctrl_emif_sdram_config_ext = SDRAM_CONFIG_EXT_RD_LVL_11_SAMPLES,
531};
532
Lokesh Vutla79a9ec72013-02-12 01:33:44 +0000533const struct ctrl_ioregs ioregs_omap5432_es2 = {
534 .ctrl_ddrch = DDR_IO_I_40OHM_SR_FAST_WD_DQ_NO_PULL_DQS_NO_PULL_ES2,
535 .ctrl_lpddr2ch = 0x0,
536 .ctrl_ddr3ch = DDR_IO_I_40OHM_SR_SLOWEST_WD_DQ_NO_PULL_DQS_NO_PULL_ES2,
537 .ctrl_ddrio_0 = DDR_IO_0_VREF_CELLS_DDR3_VALUE_ES2,
538 .ctrl_ddrio_1 = DDR_IO_1_VREF_CELLS_DDR3_VALUE_ES2,
539 .ctrl_ddrio_2 = DDR_IO_2_VREF_CELLS_DDR3_VALUE_ES2,
540 .ctrl_emif_sdram_config_ext = SDRAM_CONFIG_EXT_RD_LVL_11_SAMPLES,
541};
542
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +0000543void hw_data_init(void)
544{
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000545 u32 omap_rev = omap_revision();
546
547 switch (omap_rev) {
548
549 case OMAP5430_ES1_0:
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000550 case OMAP5432_ES1_0:
551 *prcm = &omap5_es1_prcm;
552 *dplls_data = &omap5_dplls_es1;
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000553 *omap_vcores = &omap5430_volts;
Lokesh Vutlaf120cef2013-02-12 21:29:06 +0000554 *ctrl = &omap5_ctrl;
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000555 break;
556
SRICHARAN R06ebff42013-02-12 01:33:42 +0000557 case OMAP5430_ES2_0:
558 case OMAP5432_ES2_0:
559 *prcm = &omap5_es2_prcm;
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000560 *dplls_data = &omap5_dplls_es2;
561 *omap_vcores = &omap5430_volts_es2;
Lokesh Vutlaf120cef2013-02-12 21:29:06 +0000562 *ctrl = &omap5_ctrl;
SRICHARAN R06ebff42013-02-12 01:33:42 +0000563 break;
564
Lokesh Vutla15c2c702013-02-17 23:33:37 +0000565 case DRA752_ES1_0:
566 *prcm = &dra7xx_prcm;
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000567 *dplls_data = &dra7xx_dplls;
568 *omap_vcores = &omap5430_volts_es2;
Lokesh Vutlaf120cef2013-02-12 21:29:06 +0000569 *ctrl = &dra7xx_ctrl;
Lokesh Vutla15c2c702013-02-17 23:33:37 +0000570 break;
571
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000572 default:
573 printf("\n INVALID OMAP REVISION ");
574 }
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +0000575}
Lokesh Vutlad8ac0502013-02-04 04:22:05 +0000576
577void get_ioregs(const struct ctrl_ioregs **regs)
578{
579 u32 omap_rev = omap_revision();
580
581 switch (omap_rev) {
582 case OMAP5430_ES1_0:
Lokesh Vutla79a9ec72013-02-12 01:33:44 +0000583 case OMAP5430_ES2_0:
Lokesh Vutlad8ac0502013-02-04 04:22:05 +0000584 *regs = &ioregs_omap5430;
585 break;
586 case OMAP5432_ES1_0:
587 *regs = &ioregs_omap5432_es1;
588 break;
Lokesh Vutla79a9ec72013-02-12 01:33:44 +0000589 case OMAP5432_ES2_0:
Lokesh Vutla8caa56c2013-02-12 21:29:07 +0000590 case DRA752_ES1_0:
Lokesh Vutla79a9ec72013-02-12 01:33:44 +0000591 *regs = &ioregs_omap5432_es2;
592 break;
Lokesh Vutlad8ac0502013-02-04 04:22:05 +0000593
594 default:
595 printf("\n INVALID OMAP REVISION ");
596 }
597}