blob: d587a4d4def02fac763509faaab0ce40d84f977f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +00002/*
3 *
4 * HW data initialization for OMAP4
5 *
6 * (C) Copyright 2013
7 * Texas Instruments, <www.ti.com>
8 *
9 * Sricharan R <r.sricharan@ti.com>
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +000010 */
11#include <common.h>
12#include <asm/arch/omap.h>
SRICHARAN R1a79cab2013-02-04 04:22:01 +000013#include <asm/arch/sys_proto.h>
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +000014#include <asm/omap_common.h>
Lokesh Vutla61c517f2013-05-30 02:54:32 +000015#include <asm/arch/clock.h>
SRICHARAN R00d328c2013-02-04 04:22:02 +000016#include <asm/omap_gpio.h>
SRICHARAN R1a79cab2013-02-04 04:22:01 +000017#include <asm/io.h>
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +000018
19struct prcm_regs const **prcm =
20 (struct prcm_regs const **) OMAP_SRAM_SCRATCH_PRCM_PTR;
SRICHARAN R1a79cab2013-02-04 04:22:01 +000021struct dplls const **dplls_data =
22 (struct dplls const **) OMAP_SRAM_SCRATCH_DPLLS_PTR;
SRICHARAN R00d328c2013-02-04 04:22:02 +000023struct vcores_data const **omap_vcores =
24 (struct vcores_data const **) OMAP_SRAM_SCRATCH_VCORES_PTR;
Lokesh Vutla834b6b02013-02-04 04:22:04 +000025struct omap_sys_ctrl_regs const **ctrl =
SRICHARAN R4b1b61c2013-04-24 00:41:22 +000026 (struct omap_sys_ctrl_regs const **)OMAP_SRAM_SCRATCH_SYS_CTRL;
SRICHARAN R1a79cab2013-02-04 04:22:01 +000027
28/*
29 * The M & N values in the following tables are created using the
30 * following tool:
31 * tools/omap/clocks_get_m_n.c
32 * Please use this tool for creating the table for any new frequency.
33 */
34
SRICHARAN Ra04ed142013-02-12 01:33:43 +000035/*
36 * dpll locked at 1400 MHz MPU clk at 700 MHz(OPP100) - DCC OFF
37 * OMAP4460 OPP_NOM frequency
38 */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000039static const struct dpll_params mpu_dpll_params_1400mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +000040 {175, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
41 {700, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
42 {125, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
43 {401, 10, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
44 {350, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
45 {700, 26, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
46 {638, 34, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000047};
48
SRICHARAN Ra04ed142013-02-12 01:33:43 +000049/*
50 * dpll locked at 1600 MHz - MPU clk at 800 MHz(OPP Turbo 4430)
51 * OMAP4430 OPP_TURBO frequency
Taras Kondratiuk6d2e2612013-08-06 15:18:49 +030052 * OMAP4470 OPP_NOM frequency
SRICHARAN Ra04ed142013-02-12 01:33:43 +000053 */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000054static const struct dpll_params mpu_dpll_params_1600mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +000055 {200, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
56 {800, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
57 {619, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
58 {125, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
59 {400, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
60 {800, 26, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
61 {125, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000062};
63
SRICHARAN Ra04ed142013-02-12 01:33:43 +000064/*
65 * dpll locked at 1200 MHz - MPU clk at 600 MHz
66 * OMAP4430 OPP_NOM frequency
67 */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000068static const struct dpll_params mpu_dpll_params_1200mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +000069 {50, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
70 {600, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
71 {250, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
72 {125, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
73 {300, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
74 {200, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
75 {125, 7, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000076};
77
SRICHARAN Ra04ed142013-02-12 01:33:43 +000078/* OMAP4460 OPP_NOM frequency */
Taras Kondratiuk6d2e2612013-08-06 15:18:49 +030079/* OMAP4470 OPP_NOM (Low Power) frequency */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000080static const struct dpll_params core_dpll_params_1600mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +000081 {200, 2, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 12 MHz */
82 {800, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 13 MHz */
83 {619, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 16.8 MHz */
84 {125, 2, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 19.2 MHz */
85 {400, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 26 MHz */
86 {800, 26, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 27 MHz */
87 {125, 5, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000088};
89
SRICHARAN Ra04ed142013-02-12 01:33:43 +000090/* OMAP4430 ES1 OPP_NOM frequency */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000091static const struct dpll_params core_dpll_params_es1_1524mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +000092 {127, 1, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 12 MHz */
93 {762, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 13 MHz */
94 {635, 13, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 16.8 MHz */
95 {635, 15, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 19.2 MHz */
96 {381, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 26 MHz */
97 {254, 8, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 27 MHz */
98 {496, 24, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +000099};
100
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000101/* OMAP4430 ES2.X OPP_NOM frequency */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000102static const struct dpll_params
103 core_dpll_params_es2_1600mhz_ddr200mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000104 {200, 2, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 12 MHz */
105 {800, 12, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 13 MHz */
106 {619, 12, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 16.8 MHz */
107 {125, 2, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 19.2 MHz */
108 {400, 12, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 26 MHz */
109 {800, 26, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 27 MHz */
110 {125, 5, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000111};
112
113static const struct dpll_params per_dpll_params_1536mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000114 {64, 0, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 12 MHz */
115 {768, 12, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 13 MHz */
116 {320, 6, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 16.8 MHz */
117 {40, 0, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 19.2 MHz */
118 {384, 12, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 26 MHz */
119 {256, 8, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 27 MHz */
120 {20, 0, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000121};
122
123static const struct dpll_params iva_dpll_params_1862mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000124 {931, 11, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
125 {931, 12, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
126 {665, 11, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
127 {727, 14, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
128 {931, 25, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
129 {931, 26, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
130 {291, 11, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000131};
132
133/* ABE M & N values with sys_clk as source */
Lokesh Vutla221db4c2017-01-17 08:52:58 +0530134#ifdef CONFIG_SYS_OMAP_ABE_SYSCK
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000135static const struct dpll_params
136 abe_dpll_params_sysclk_196608khz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000137 {49, 5, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
138 {68, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
139 {35, 5, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
140 {46, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
141 {34, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
142 {29, 7, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
143 {64, 24, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000144};
Lokesh Vutla221db4c2017-01-17 08:52:58 +0530145#else
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000146/* ABE M & N values with 32K clock as source */
147static const struct dpll_params abe_dpll_params_32k_196608khz = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000148 750, 0, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000149};
Lokesh Vutla221db4c2017-01-17 08:52:58 +0530150#endif
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000151
152static const struct dpll_params usb_dpll_params_1920mhz[NUM_SYS_CLKS] = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000153 {80, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
154 {960, 12, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
155 {400, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
156 {50, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
157 {480, 12, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
158 {320, 8, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
159 {25, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000160};
161
162struct dplls omap4430_dplls_es1 = {
163 .mpu = mpu_dpll_params_1200mhz,
164 .core = core_dpll_params_es1_1524mhz,
165 .per = per_dpll_params_1536mhz,
166 .iva = iva_dpll_params_1862mhz,
167#ifdef CONFIG_SYS_OMAP_ABE_SYSCK
168 .abe = abe_dpll_params_sysclk_196608khz,
169#else
170 .abe = &abe_dpll_params_32k_196608khz,
171#endif
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000172 .usb = usb_dpll_params_1920mhz,
173 .ddr = NULL
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000174};
175
Janne Grunaud2b0a892014-02-16 21:57:18 +0100176struct dplls omap4430_dplls_es20 = {
177 .mpu = mpu_dpll_params_1200mhz,
178 .core = core_dpll_params_es2_1600mhz_ddr200mhz,
179 .per = per_dpll_params_1536mhz,
180 .iva = iva_dpll_params_1862mhz,
181#ifdef CONFIG_SYS_OMAP_ABE_SYSCK
182 .abe = abe_dpll_params_sysclk_196608khz,
183#else
184 .abe = &abe_dpll_params_32k_196608khz,
185#endif
186 .usb = usb_dpll_params_1920mhz,
187 .ddr = NULL
188};
189
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000190struct dplls omap4430_dplls = {
SRICHARAN Ra04ed142013-02-12 01:33:43 +0000191 .mpu = mpu_dpll_params_1200mhz,
192 .core = core_dpll_params_1600mhz,
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000193 .per = per_dpll_params_1536mhz,
194 .iva = iva_dpll_params_1862mhz,
195#ifdef CONFIG_SYS_OMAP_ABE_SYSCK
196 .abe = abe_dpll_params_sysclk_196608khz,
197#else
198 .abe = &abe_dpll_params_32k_196608khz,
199#endif
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000200 .usb = usb_dpll_params_1920mhz,
201 .ddr = NULL
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000202};
203
204struct dplls omap4460_dplls = {
205 .mpu = mpu_dpll_params_1400mhz,
206 .core = core_dpll_params_1600mhz,
207 .per = per_dpll_params_1536mhz,
208 .iva = iva_dpll_params_1862mhz,
209#ifdef CONFIG_SYS_OMAP_ABE_SYSCK
210 .abe = abe_dpll_params_sysclk_196608khz,
211#else
212 .abe = &abe_dpll_params_32k_196608khz,
213#endif
Lokesh Vutla5e70e292013-02-12 21:29:05 +0000214 .usb = usb_dpll_params_1920mhz,
215 .ddr = NULL
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000216};
217
Taras Kondratiuk6d2e2612013-08-06 15:18:49 +0300218struct dplls omap4470_dplls = {
219 .mpu = mpu_dpll_params_1600mhz,
220 .core = core_dpll_params_1600mhz,
221 .per = per_dpll_params_1536mhz,
222 .iva = iva_dpll_params_1862mhz,
223#ifdef CONFIG_SYS_OMAP_ABE_SYSCK
224 .abe = abe_dpll_params_sysclk_196608khz,
225#else
226 .abe = &abe_dpll_params_32k_196608khz,
227#endif
228 .usb = usb_dpll_params_1920mhz,
229 .ddr = NULL
230};
231
SRICHARAN R00d328c2013-02-04 04:22:02 +0000232struct pmic_data twl6030_4430es1 = {
233 .base_offset = PHOENIX_SMPS_BASE_VOLT_STD_MODE_UV,
Lubomir Popovc8a3e762013-04-08 22:05:33 +0000234 .step = 12660, /* 12.66 mV represented in uV */
SRICHARAN R00d328c2013-02-04 04:22:02 +0000235 /* The code starts at 1 not 0 */
236 .start_code = 1,
Lokesh Vutlaae49f6d2013-05-30 02:54:33 +0000237 .i2c_slave_addr = SMPS_I2C_SLAVE_ADDR,
238 .pmic_bus_init = sri2c_init,
239 .pmic_write = omap_vc_bypass_send_value,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000240};
241
Taras Kondratiuk6d2e2612013-08-06 15:18:49 +0300242/* twl6030 struct is used for TWL6030 and TWL6032 PMIC */
SRICHARAN R00d328c2013-02-04 04:22:02 +0000243struct pmic_data twl6030 = {
244 .base_offset = PHOENIX_SMPS_BASE_VOLT_STD_MODE_WITH_OFFSET_UV,
Lubomir Popovc8a3e762013-04-08 22:05:33 +0000245 .step = 12660, /* 12.66 mV represented in uV */
SRICHARAN R00d328c2013-02-04 04:22:02 +0000246 /* The code starts at 1 not 0 */
247 .start_code = 1,
Lokesh Vutlaae49f6d2013-05-30 02:54:33 +0000248 .i2c_slave_addr = SMPS_I2C_SLAVE_ADDR,
249 .pmic_bus_init = sri2c_init,
250 .pmic_write = omap_vc_bypass_send_value,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000251};
252
253struct pmic_data tps62361 = {
254 .base_offset = TPS62361_BASE_VOLT_MV,
255 .step = 10000, /* 10 mV represented in uV */
256 .start_code = 0,
257 .gpio = TPS62361_VSEL0_GPIO,
Lokesh Vutlaae49f6d2013-05-30 02:54:33 +0000258 .gpio_en = 1,
259 .i2c_slave_addr = SMPS_I2C_SLAVE_ADDR,
260 .pmic_bus_init = sri2c_init,
261 .pmic_write = omap_vc_bypass_send_value,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000262};
263
264struct vcores_data omap4430_volts_es1 = {
Lokesh Vutla6ede0fd2016-11-23 12:54:39 +0530265 .mpu.value[OPP_NOM] = 1325,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000266 .mpu.addr = SMPS_REG_ADDR_VCORE1,
267 .mpu.pmic = &twl6030_4430es1,
268
Lokesh Vutla6ede0fd2016-11-23 12:54:39 +0530269 .core.value[OPP_NOM] = 1200,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000270 .core.addr = SMPS_REG_ADDR_VCORE3,
271 .core.pmic = &twl6030_4430es1,
272
Lokesh Vutla6ede0fd2016-11-23 12:54:39 +0530273 .mm.value[OPP_NOM] = 1200,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000274 .mm.addr = SMPS_REG_ADDR_VCORE2,
275 .mm.pmic = &twl6030_4430es1,
276};
277
278struct vcores_data omap4430_volts = {
Lokesh Vutla6ede0fd2016-11-23 12:54:39 +0530279 .mpu.value[OPP_NOM] = 1325,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000280 .mpu.addr = SMPS_REG_ADDR_VCORE1,
281 .mpu.pmic = &twl6030,
282
Lokesh Vutla6ede0fd2016-11-23 12:54:39 +0530283 .core.value[OPP_NOM] = 1200,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000284 .core.addr = SMPS_REG_ADDR_VCORE3,
285 .core.pmic = &twl6030,
286
Lokesh Vutla6ede0fd2016-11-23 12:54:39 +0530287 .mm.value[OPP_NOM] = 1200,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000288 .mm.addr = SMPS_REG_ADDR_VCORE2,
289 .mm.pmic = &twl6030,
290};
291
292struct vcores_data omap4460_volts = {
Lokesh Vutla6ede0fd2016-11-23 12:54:39 +0530293 .mpu.value[OPP_NOM] = 1203,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000294 .mpu.addr = TPS62361_REG_ADDR_SET1,
295 .mpu.pmic = &tps62361,
296
Lokesh Vutla6ede0fd2016-11-23 12:54:39 +0530297 .core.value[OPP_NOM] = 1200,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000298 .core.addr = SMPS_REG_ADDR_VCORE1,
Lubomir Popovc8a3e762013-04-08 22:05:33 +0000299 .core.pmic = &twl6030,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000300
Lokesh Vutla6ede0fd2016-11-23 12:54:39 +0530301 .mm.value[OPP_NOM] = 1200,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000302 .mm.addr = SMPS_REG_ADDR_VCORE2,
Lubomir Popovc8a3e762013-04-08 22:05:33 +0000303 .mm.pmic = &twl6030,
SRICHARAN R00d328c2013-02-04 04:22:02 +0000304};
305
Lubomir Popov4ec12e92013-11-20 15:32:17 +0200306/*
307 * Take closest integer part of the mV value corresponding to a TWL6032 SMPS
308 * voltage selection code. Aligned with OMAP4470 ES1.0 OCA V.0.7.
309 */
Taras Kondratiuk6d2e2612013-08-06 15:18:49 +0300310struct vcores_data omap4470_volts = {
Lokesh Vutla6ede0fd2016-11-23 12:54:39 +0530311 .mpu.value[OPP_NOM] = 1202,
Taras Kondratiuk6d2e2612013-08-06 15:18:49 +0300312 .mpu.addr = SMPS_REG_ADDR_SMPS1,
313 .mpu.pmic = &twl6030,
314
Lokesh Vutla6ede0fd2016-11-23 12:54:39 +0530315 .core.value[OPP_NOM] = 1126,
Lubomir Popov4ec12e92013-11-20 15:32:17 +0200316 .core.addr = SMPS_REG_ADDR_SMPS2,
Taras Kondratiuk6d2e2612013-08-06 15:18:49 +0300317 .core.pmic = &twl6030,
318
Lokesh Vutla6ede0fd2016-11-23 12:54:39 +0530319 .mm.value[OPP_NOM] = 1139,
Lubomir Popov4ec12e92013-11-20 15:32:17 +0200320 .mm.addr = SMPS_REG_ADDR_SMPS5,
Taras Kondratiuk6d2e2612013-08-06 15:18:49 +0300321 .mm.pmic = &twl6030,
322};
323
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000324/*
325 * Enable essential clock domains, modules and
326 * do some additional special settings needed
327 */
328void enable_basic_clocks(void)
329{
330 u32 const clk_domains_essential[] = {
331 (*prcm)->cm_l4per_clkstctrl,
332 (*prcm)->cm_l3init_clkstctrl,
333 (*prcm)->cm_memif_clkstctrl,
334 (*prcm)->cm_l4cfg_clkstctrl,
335 0
336 };
337
338 u32 const clk_modules_hw_auto_essential[] = {
Lokesh Vutla15c2c702013-02-17 23:33:37 +0000339 (*prcm)->cm_l3_gpmc_clkctrl,
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000340 (*prcm)->cm_memif_emif_1_clkctrl,
341 (*prcm)->cm_memif_emif_2_clkctrl,
342 (*prcm)->cm_l4cfg_l4_cfg_clkctrl,
343 (*prcm)->cm_wkup_gpio1_clkctrl,
344 (*prcm)->cm_l4per_gpio2_clkctrl,
345 (*prcm)->cm_l4per_gpio3_clkctrl,
346 (*prcm)->cm_l4per_gpio4_clkctrl,
347 (*prcm)->cm_l4per_gpio5_clkctrl,
348 (*prcm)->cm_l4per_gpio6_clkctrl,
349 0
350 };
351
352 u32 const clk_modules_explicit_en_essential[] = {
353 (*prcm)->cm_wkup_gptimer1_clkctrl,
354 (*prcm)->cm_l3init_hsmmc1_clkctrl,
355 (*prcm)->cm_l3init_hsmmc2_clkctrl,
356 (*prcm)->cm_l4per_gptimer2_clkctrl,
357 (*prcm)->cm_wkup_wdtimer2_clkctrl,
358 (*prcm)->cm_l4per_uart3_clkctrl,
Paul Kocialkowski4313fd52016-02-27 19:18:59 +0100359 (*prcm)->cm_l4per_i2c1_clkctrl,
360 (*prcm)->cm_l4per_i2c2_clkctrl,
361 (*prcm)->cm_l4per_i2c3_clkctrl,
362 (*prcm)->cm_l4per_i2c4_clkctrl,
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000363 0
364 };
365
366 /* Enable optional additional functional clock for GPIO4 */
367 setbits_le32((*prcm)->cm_l4per_gpio4_clkctrl,
368 GPIO4_CLKCTRL_OPTFCLKEN_MASK);
369
370 /* Enable 96 MHz clock for MMC1 & MMC2 */
371 setbits_le32((*prcm)->cm_l3init_hsmmc1_clkctrl,
372 HSMMC_CLKCTRL_CLKSEL_MASK);
373 setbits_le32((*prcm)->cm_l3init_hsmmc2_clkctrl,
374 HSMMC_CLKCTRL_CLKSEL_MASK);
375
376 /* Select 32KHz clock as the source of GPTIMER1 */
377 setbits_le32((*prcm)->cm_wkup_gptimer1_clkctrl,
378 GPTIMER1_CLKCTRL_CLKSEL_MASK);
379
Paul Kocialkowskic7f3bb12016-02-27 19:18:58 +0100380 /* Enable optional 48M functional clock for USB PHY */
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000381 setbits_le32((*prcm)->cm_l3init_usbphy_clkctrl,
382 USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK);
383
Paul Kocialkowski913349f2016-02-27 19:19:02 +0100384 /* Enable 32 KHz clock for USB PHY */
385 setbits_le32((*prcm)->cm_coreaon_usb_phy1_core_clkctrl,
386 USBPHY_CORE_CLKCTRL_OPTFCLKEN_CLK32K);
387
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000388 do_enable_clocks(clk_domains_essential,
389 clk_modules_hw_auto_essential,
390 clk_modules_explicit_en_essential,
391 1);
392}
393
394void enable_basic_uboot_clocks(void)
395{
396 u32 const clk_domains_essential[] = {
397 0
398 };
399
400 u32 const clk_modules_hw_auto_essential[] = {
401 (*prcm)->cm_l3init_hsusbotg_clkctrl,
402 (*prcm)->cm_l3init_usbphy_clkctrl,
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000403 (*prcm)->cm_clksel_usb_60mhz,
404 (*prcm)->cm_l3init_hsusbtll_clkctrl,
405 0
406 };
407
408 u32 const clk_modules_explicit_en_essential[] = {
409 (*prcm)->cm_l4per_mcspi1_clkctrl,
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000410 (*prcm)->cm_l3init_hsusbhost_clkctrl,
411 0
412 };
413
414 do_enable_clocks(clk_domains_essential,
415 clk_modules_hw_auto_essential,
416 clk_modules_explicit_en_essential,
417 1);
418}
419
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +0000420void hw_data_init(void)
421{
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000422 u32 omap_rev = omap_revision();
423
424 (*prcm) = &omap4_prcm;
425
426 switch (omap_rev) {
427
428 case OMAP4430_ES1_0:
429 *dplls_data = &omap4430_dplls_es1;
SRICHARAN R00d328c2013-02-04 04:22:02 +0000430 *omap_vcores = &omap4430_volts_es1;
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000431 break;
432
433 case OMAP4430_ES2_0:
Janne Grunaud2b0a892014-02-16 21:57:18 +0100434 *dplls_data = &omap4430_dplls_es20;
435 *omap_vcores = &omap4430_volts;
436 break;
437
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000438 case OMAP4430_ES2_1:
439 case OMAP4430_ES2_2:
440 case OMAP4430_ES2_3:
441 *dplls_data = &omap4430_dplls;
SRICHARAN R00d328c2013-02-04 04:22:02 +0000442 *omap_vcores = &omap4430_volts;
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000443 break;
444
445 case OMAP4460_ES1_0:
446 case OMAP4460_ES1_1:
447 *dplls_data = &omap4460_dplls;
SRICHARAN R00d328c2013-02-04 04:22:02 +0000448 *omap_vcores = &omap4460_volts;
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000449 break;
450
Taras Kondratiuk6d2e2612013-08-06 15:18:49 +0300451 case OMAP4470_ES1_0:
452 *dplls_data = &omap4470_dplls;
453 *omap_vcores = &omap4470_volts;
454 break;
455
SRICHARAN R1a79cab2013-02-04 04:22:01 +0000456 default:
457 printf("\n INVALID OMAP REVISION ");
458 }
459
Lokesh Vutla834b6b02013-02-04 04:22:04 +0000460 *ctrl = &omap4_ctrl;
SRICHARAN Rfb6aa1f2013-02-04 04:22:00 +0000461}