1 // SPDX-License-Identifier: GPL-2.0+
4 * Texas Instruments Incorporated, <www.ti.com>
6 * Lokesh Vutla <lokeshvutla@ti.com>
8 * Based on previous work by:
9 * Aneesh V <aneesh@ti.com>
10 * Steve Sakoman <steve@sakoman.com>
14 #include <fdt_support.h>
22 #include <asm/global_data.h>
23 #include <linux/string.h>
26 #include <linux/usb/gadget.h>
27 #include <asm/omap_common.h>
28 #include <asm/arch/gpio.h>
29 #include <asm/arch/dra7xx_iodelay.h>
31 #include <asm/arch/sys_proto.h>
32 #include <asm/arch/mmc_host_def.h>
33 #include <asm/arch/sata.h>
34 #include <dwc3-uboot.h>
35 #include <dwc3-omap-uboot.h>
37 #include <ti-usb-phy-uboot.h>
40 #include "../common/board_detect.h"
42 #define board_is_dra76x_evm() board_ti_is("DRA76/7x")
43 #define board_is_dra74x_evm() board_ti_is("5777xCPU")
44 #define board_is_dra72x_evm() board_ti_is("DRA72x-T")
45 #define board_is_dra71x_evm() board_ti_is("DRA79x,D")
46 #define board_is_dra74x_revh_or_later() (board_is_dra74x_evm() && \
47 (strncmp("H", board_ti_get_rev(), 1) <= 0))
48 #define board_is_dra72x_revc_or_later() (board_is_dra72x_evm() && \
49 (strncmp("C", board_ti_get_rev(), 1) <= 0))
50 #define board_ti_get_emif_size() board_ti_get_emif1_size() + \
51 board_ti_get_emif2_size()
53 DECLARE_GLOBAL_DATA_PTR;
56 #define GPIO_DDR_VTT_EN 203
58 #define SYSINFO_BOARD_NAME_MAX_LEN 37
60 /* I2C I/O Expander */
61 #define NAND_PCF8575_ADDR 0x21
62 #define NAND_PCF8575_I2C_BUS_NUM 0
64 const struct omap_sysinfo sysinfo = {
65 "Board: UNKNOWN(DRA7 EVM) REV UNKNOWN\n"
68 static const struct emif_regs emif1_ddr3_532_mhz_1cs = {
69 .sdram_config_init = 0x61851ab2,
70 .sdram_config = 0x61851ab2,
71 .sdram_config2 = 0x08000000,
72 .ref_ctrl = 0x000040F1,
73 .ref_ctrl_final = 0x00001035,
74 .sdram_tim1 = 0xCCCF36B3,
75 .sdram_tim2 = 0x308F7FDA,
76 .sdram_tim3 = 0x427F88A8,
77 .read_idle_ctrl = 0x00050000,
78 .zq_config = 0x0007190B,
79 .temp_alert_config = 0x00000000,
80 .emif_ddr_phy_ctlr_1_init = 0x0024400B,
81 .emif_ddr_phy_ctlr_1 = 0x0E24400B,
82 .emif_ddr_ext_phy_ctrl_1 = 0x10040100,
83 .emif_ddr_ext_phy_ctrl_2 = 0x00910091,
84 .emif_ddr_ext_phy_ctrl_3 = 0x00950095,
85 .emif_ddr_ext_phy_ctrl_4 = 0x009B009B,
86 .emif_ddr_ext_phy_ctrl_5 = 0x009E009E,
87 .emif_rd_wr_lvl_rmp_win = 0x00000000,
88 .emif_rd_wr_lvl_rmp_ctl = 0x80000000,
89 .emif_rd_wr_lvl_ctl = 0x00000000,
90 .emif_rd_wr_exec_thresh = 0x00000305
93 static const struct emif_regs emif2_ddr3_532_mhz_1cs = {
94 .sdram_config_init = 0x61851B32,
95 .sdram_config = 0x61851B32,
96 .sdram_config2 = 0x08000000,
97 .ref_ctrl = 0x000040F1,
98 .ref_ctrl_final = 0x00001035,
99 .sdram_tim1 = 0xCCCF36B3,
100 .sdram_tim2 = 0x308F7FDA,
101 .sdram_tim3 = 0x427F88A8,
102 .read_idle_ctrl = 0x00050000,
103 .zq_config = 0x0007190B,
104 .temp_alert_config = 0x00000000,
105 .emif_ddr_phy_ctlr_1_init = 0x0024400B,
106 .emif_ddr_phy_ctlr_1 = 0x0E24400B,
107 .emif_ddr_ext_phy_ctrl_1 = 0x10040100,
108 .emif_ddr_ext_phy_ctrl_2 = 0x00910091,
109 .emif_ddr_ext_phy_ctrl_3 = 0x00950095,
110 .emif_ddr_ext_phy_ctrl_4 = 0x009B009B,
111 .emif_ddr_ext_phy_ctrl_5 = 0x009E009E,
112 .emif_rd_wr_lvl_rmp_win = 0x00000000,
113 .emif_rd_wr_lvl_rmp_ctl = 0x80000000,
114 .emif_rd_wr_lvl_ctl = 0x00000000,
115 .emif_rd_wr_exec_thresh = 0x00000305
118 static const struct emif_regs emif_1_regs_ddr3_666_mhz_1cs_dra_es1 = {
119 .sdram_config_init = 0x61862B32,
120 .sdram_config = 0x61862B32,
121 .sdram_config2 = 0x08000000,
122 .ref_ctrl = 0x0000514C,
123 .ref_ctrl_final = 0x0000144A,
124 .sdram_tim1 = 0xD113781C,
125 .sdram_tim2 = 0x30717FE3,
126 .sdram_tim3 = 0x409F86A8,
127 .read_idle_ctrl = 0x00050000,
128 .zq_config = 0x5007190B,
129 .temp_alert_config = 0x00000000,
130 .emif_ddr_phy_ctlr_1_init = 0x0024400D,
131 .emif_ddr_phy_ctlr_1 = 0x0E24400D,
132 .emif_ddr_ext_phy_ctrl_1 = 0x10040100,
133 .emif_ddr_ext_phy_ctrl_2 = 0x00A400A4,
134 .emif_ddr_ext_phy_ctrl_3 = 0x00A900A9,
135 .emif_ddr_ext_phy_ctrl_4 = 0x00B000B0,
136 .emif_ddr_ext_phy_ctrl_5 = 0x00B000B0,
137 .emif_rd_wr_lvl_rmp_win = 0x00000000,
138 .emif_rd_wr_lvl_rmp_ctl = 0x80000000,
139 .emif_rd_wr_lvl_ctl = 0x00000000,
140 .emif_rd_wr_exec_thresh = 0x00000305
143 const struct emif_regs emif_1_regs_ddr3_666_mhz_1cs_dra_es2 = {
144 .sdram_config_init = 0x61862BB2,
145 .sdram_config = 0x61862BB2,
146 .sdram_config2 = 0x00000000,
147 .ref_ctrl = 0x0000514D,
148 .ref_ctrl_final = 0x0000144A,
149 .sdram_tim1 = 0xD1137824,
150 .sdram_tim2 = 0x30B37FE3,
151 .sdram_tim3 = 0x409F8AD8,
152 .read_idle_ctrl = 0x00050000,
153 .zq_config = 0x5007190B,
154 .temp_alert_config = 0x00000000,
155 .emif_ddr_phy_ctlr_1_init = 0x0824400E,
156 .emif_ddr_phy_ctlr_1 = 0x0E24400E,
157 .emif_ddr_ext_phy_ctrl_1 = 0x04040100,
158 .emif_ddr_ext_phy_ctrl_2 = 0x006B009F,
159 .emif_ddr_ext_phy_ctrl_3 = 0x006B00A2,
160 .emif_ddr_ext_phy_ctrl_4 = 0x006B00A8,
161 .emif_ddr_ext_phy_ctrl_5 = 0x006B00A8,
162 .emif_rd_wr_lvl_rmp_win = 0x00000000,
163 .emif_rd_wr_lvl_rmp_ctl = 0x80000000,
164 .emif_rd_wr_lvl_ctl = 0x00000000,
165 .emif_rd_wr_exec_thresh = 0x00000305
168 const struct emif_regs emif1_ddr3_532_mhz_1cs_2G = {
169 .sdram_config_init = 0x61851ab2,
170 .sdram_config = 0x61851ab2,
171 .sdram_config2 = 0x08000000,
172 .ref_ctrl = 0x000040F1,
173 .ref_ctrl_final = 0x00001035,
174 .sdram_tim1 = 0xCCCF36B3,
175 .sdram_tim2 = 0x30BF7FDA,
176 .sdram_tim3 = 0x427F8BA8,
177 .read_idle_ctrl = 0x00050000,
178 .zq_config = 0x0007190B,
179 .temp_alert_config = 0x00000000,
180 .emif_ddr_phy_ctlr_1_init = 0x0024400B,
181 .emif_ddr_phy_ctlr_1 = 0x0E24400B,
182 .emif_ddr_ext_phy_ctrl_1 = 0x10040100,
183 .emif_ddr_ext_phy_ctrl_2 = 0x00910091,
184 .emif_ddr_ext_phy_ctrl_3 = 0x00950095,
185 .emif_ddr_ext_phy_ctrl_4 = 0x009B009B,
186 .emif_ddr_ext_phy_ctrl_5 = 0x009E009E,
187 .emif_rd_wr_lvl_rmp_win = 0x00000000,
188 .emif_rd_wr_lvl_rmp_ctl = 0x80000000,
189 .emif_rd_wr_lvl_ctl = 0x00000000,
190 .emif_rd_wr_exec_thresh = 0x00000305
193 const struct emif_regs emif2_ddr3_532_mhz_1cs_2G = {
194 .sdram_config_init = 0x61851B32,
195 .sdram_config = 0x61851B32,
196 .sdram_config2 = 0x08000000,
197 .ref_ctrl = 0x000040F1,
198 .ref_ctrl_final = 0x00001035,
199 .sdram_tim1 = 0xCCCF36B3,
200 .sdram_tim2 = 0x308F7FDA,
201 .sdram_tim3 = 0x427F88A8,
202 .read_idle_ctrl = 0x00050000,
203 .zq_config = 0x0007190B,
204 .temp_alert_config = 0x00000000,
205 .emif_ddr_phy_ctlr_1_init = 0x0024400B,
206 .emif_ddr_phy_ctlr_1 = 0x0E24400B,
207 .emif_ddr_ext_phy_ctrl_1 = 0x10040100,
208 .emif_ddr_ext_phy_ctrl_2 = 0x00910091,
209 .emif_ddr_ext_phy_ctrl_3 = 0x00950095,
210 .emif_ddr_ext_phy_ctrl_4 = 0x009B009B,
211 .emif_ddr_ext_phy_ctrl_5 = 0x009E009E,
212 .emif_rd_wr_lvl_rmp_win = 0x00000000,
213 .emif_rd_wr_lvl_rmp_ctl = 0x80000000,
214 .emif_rd_wr_lvl_ctl = 0x00000000,
215 .emif_rd_wr_exec_thresh = 0x00000305
218 const struct emif_regs emif_1_regs_ddr3_666_mhz_1cs_dra76 = {
219 .sdram_config_init = 0x61862B32,
220 .sdram_config = 0x61862B32,
221 .sdram_config2 = 0x00000000,
222 .ref_ctrl = 0x0000514C,
223 .ref_ctrl_final = 0x0000144A,
224 .sdram_tim1 = 0xD113783C,
225 .sdram_tim2 = 0x30B47FE3,
226 .sdram_tim3 = 0x409F8AD8,
227 .read_idle_ctrl = 0x00050000,
228 .zq_config = 0x5007190B,
229 .temp_alert_config = 0x00000000,
230 .emif_ddr_phy_ctlr_1_init = 0x0824400D,
231 .emif_ddr_phy_ctlr_1 = 0x0E24400D,
232 .emif_ddr_ext_phy_ctrl_1 = 0x04040100,
233 .emif_ddr_ext_phy_ctrl_2 = 0x006B009F,
234 .emif_ddr_ext_phy_ctrl_3 = 0x006B00A2,
235 .emif_ddr_ext_phy_ctrl_4 = 0x006B00A8,
236 .emif_ddr_ext_phy_ctrl_5 = 0x006B00A8,
237 .emif_rd_wr_lvl_rmp_win = 0x00000000,
238 .emif_rd_wr_lvl_rmp_ctl = 0x80000000,
239 .emif_rd_wr_lvl_ctl = 0x00000000,
240 .emif_rd_wr_exec_thresh = 0x00000305
243 const struct emif_regs emif_2_regs_ddr3_666_mhz_1cs_dra76 = {
244 .sdram_config_init = 0x61862B32,
245 .sdram_config = 0x61862B32,
246 .sdram_config2 = 0x00000000,
247 .ref_ctrl = 0x0000514C,
248 .ref_ctrl_final = 0x0000144A,
249 .sdram_tim1 = 0xD113781C,
250 .sdram_tim2 = 0x30B47FE3,
251 .sdram_tim3 = 0x409F8AD8,
252 .read_idle_ctrl = 0x00050000,
253 .zq_config = 0x5007190B,
254 .temp_alert_config = 0x00000000,
255 .emif_ddr_phy_ctlr_1_init = 0x0824400D,
256 .emif_ddr_phy_ctlr_1 = 0x0E24400D,
257 .emif_ddr_ext_phy_ctrl_1 = 0x04040100,
258 .emif_ddr_ext_phy_ctrl_2 = 0x006B009F,
259 .emif_ddr_ext_phy_ctrl_3 = 0x006B00A2,
260 .emif_ddr_ext_phy_ctrl_4 = 0x006B00A8,
261 .emif_ddr_ext_phy_ctrl_5 = 0x006B00A8,
262 .emif_rd_wr_lvl_rmp_win = 0x00000000,
263 .emif_rd_wr_lvl_rmp_ctl = 0x80000000,
264 .emif_rd_wr_lvl_ctl = 0x00000000,
265 .emif_rd_wr_exec_thresh = 0x00000305
268 void emif_get_reg_dump(u32 emif_nr, const struct emif_regs **regs)
272 ram_size = board_ti_get_emif_size();
274 switch (omap_revision()) {
280 if (ram_size > CFG_MAX_MEM_MAPPED)
281 *regs = &emif1_ddr3_532_mhz_1cs_2G;
283 *regs = &emif1_ddr3_532_mhz_1cs;
286 if (ram_size > CFG_MAX_MEM_MAPPED)
287 *regs = &emif2_ddr3_532_mhz_1cs_2G;
289 *regs = &emif2_ddr3_532_mhz_1cs;
293 case DRA762_ABZ_ES1_0:
294 case DRA762_ACD_ES1_0:
297 *regs = &emif_1_regs_ddr3_666_mhz_1cs_dra76;
299 *regs = &emif_2_regs_ddr3_666_mhz_1cs_dra76;
304 if (ram_size < CFG_MAX_MEM_MAPPED)
305 *regs = &emif_1_regs_ddr3_666_mhz_1cs_dra_es1;
307 *regs = &emif_1_regs_ddr3_666_mhz_1cs_dra_es2;
310 *regs = &emif1_ddr3_532_mhz_1cs;
314 static const struct dmm_lisa_map_regs lisa_map_dra7_1536MB = {
315 .dmm_lisa_map_0 = 0x0,
316 .dmm_lisa_map_1 = 0x80640300,
317 .dmm_lisa_map_2 = 0xC0500220,
318 .dmm_lisa_map_3 = 0xFF020100,
322 static const struct dmm_lisa_map_regs lisa_map_2G_x_2 = {
323 .dmm_lisa_map_0 = 0x0,
324 .dmm_lisa_map_1 = 0x0,
325 .dmm_lisa_map_2 = 0x80600100,
326 .dmm_lisa_map_3 = 0xFF020100,
330 const struct dmm_lisa_map_regs lisa_map_dra7_2GB = {
331 .dmm_lisa_map_0 = 0x0,
332 .dmm_lisa_map_1 = 0x0,
333 .dmm_lisa_map_2 = 0x80740300,
334 .dmm_lisa_map_3 = 0xFF020100,
339 * DRA722 EVM EMIF1 2GB CONFIGURATION
340 * EMIF1 4 devices of 512Mb x 8 Micron
342 const struct dmm_lisa_map_regs lisa_map_2G_x_4 = {
343 .dmm_lisa_map_0 = 0x0,
344 .dmm_lisa_map_1 = 0x0,
345 .dmm_lisa_map_2 = 0x80700100,
346 .dmm_lisa_map_3 = 0xFF020100,
350 void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs)
354 ram_size = board_ti_get_emif_size();
356 switch (omap_revision()) {
357 case DRA762_ABZ_ES1_0:
358 case DRA762_ACD_ES1_0:
363 if (ram_size > CFG_MAX_MEM_MAPPED)
364 *dmm_lisa_regs = &lisa_map_dra7_2GB;
366 *dmm_lisa_regs = &lisa_map_dra7_1536MB;
372 if (ram_size < CFG_MAX_MEM_MAPPED)
373 *dmm_lisa_regs = &lisa_map_2G_x_2;
375 *dmm_lisa_regs = &lisa_map_2G_x_4;
380 struct vcores_data dra752_volts = {
381 .mpu.value[OPP_NOM] = VDD_MPU_DRA7_NOM,
382 .mpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_MPU_NOM,
383 .mpu.efuse.reg_bits = DRA752_EFUSE_REGBITS,
384 .mpu.addr = TPS659038_REG_ADDR_SMPS12,
385 .mpu.pmic = &tps659038,
386 .mpu.abb_tx_done_mask = OMAP_ABB_MPU_TXDONE_MASK,
388 .eve.value[OPP_NOM] = VDD_EVE_DRA7_NOM,
389 .eve.value[OPP_OD] = VDD_EVE_DRA7_OD,
390 .eve.value[OPP_HIGH] = VDD_EVE_DRA7_HIGH,
391 .eve.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_DSPEVE_NOM,
392 .eve.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_DSPEVE_OD,
393 .eve.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH,
394 .eve.efuse.reg_bits = DRA752_EFUSE_REGBITS,
395 .eve.addr = TPS659038_REG_ADDR_SMPS45,
396 .eve.pmic = &tps659038,
397 .eve.abb_tx_done_mask = OMAP_ABB_EVE_TXDONE_MASK,
399 .gpu.value[OPP_NOM] = VDD_GPU_DRA7_NOM,
400 .gpu.value[OPP_OD] = VDD_GPU_DRA7_OD,
401 .gpu.value[OPP_HIGH] = VDD_GPU_DRA7_HIGH,
402 .gpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_GPU_NOM,
403 .gpu.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_GPU_OD,
404 .gpu.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_GPU_HIGH,
405 .gpu.efuse.reg_bits = DRA752_EFUSE_REGBITS,
406 .gpu.addr = TPS659038_REG_ADDR_SMPS6,
407 .gpu.pmic = &tps659038,
408 .gpu.abb_tx_done_mask = OMAP_ABB_GPU_TXDONE_MASK,
410 .core.value[OPP_NOM] = VDD_CORE_DRA7_NOM,
411 .core.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_CORE_NOM,
412 .core.efuse.reg_bits = DRA752_EFUSE_REGBITS,
413 .core.addr = TPS659038_REG_ADDR_SMPS7,
414 .core.pmic = &tps659038,
416 .iva.value[OPP_NOM] = VDD_IVA_DRA7_NOM,
417 .iva.value[OPP_OD] = VDD_IVA_DRA7_OD,
418 .iva.value[OPP_HIGH] = VDD_IVA_DRA7_HIGH,
419 .iva.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_IVA_NOM,
420 .iva.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_IVA_OD,
421 .iva.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_IVA_HIGH,
422 .iva.efuse.reg_bits = DRA752_EFUSE_REGBITS,
423 .iva.addr = TPS659038_REG_ADDR_SMPS8,
424 .iva.pmic = &tps659038,
425 .iva.abb_tx_done_mask = OMAP_ABB_IVA_TXDONE_MASK,
428 struct vcores_data dra76x_volts = {
429 .mpu.value[OPP_NOM] = VDD_MPU_DRA7_NOM,
430 .mpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_MPU_NOM,
431 .mpu.efuse.reg_bits = DRA752_EFUSE_REGBITS,
432 .mpu.addr = LP87565_REG_ADDR_BUCK01,
433 .mpu.pmic = &lp87565,
434 .mpu.abb_tx_done_mask = OMAP_ABB_MPU_TXDONE_MASK,
436 .eve.value[OPP_NOM] = VDD_EVE_DRA7_NOM,
437 .eve.value[OPP_OD] = VDD_EVE_DRA7_OD,
438 .eve.value[OPP_HIGH] = VDD_EVE_DRA7_HIGH,
439 .eve.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_DSPEVE_NOM,
440 .eve.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_DSPEVE_OD,
441 .eve.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH,
442 .eve.efuse.reg_bits = DRA752_EFUSE_REGBITS,
443 .eve.addr = TPS65917_REG_ADDR_SMPS1,
444 .eve.pmic = &tps659038,
445 .eve.abb_tx_done_mask = OMAP_ABB_EVE_TXDONE_MASK,
447 .gpu.value[OPP_NOM] = VDD_GPU_DRA7_NOM,
448 .gpu.value[OPP_OD] = VDD_GPU_DRA7_OD,
449 .gpu.value[OPP_HIGH] = VDD_GPU_DRA7_HIGH,
450 .gpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_GPU_NOM,
451 .gpu.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_GPU_OD,
452 .gpu.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_GPU_HIGH,
453 .gpu.efuse.reg_bits = DRA752_EFUSE_REGBITS,
454 .gpu.addr = LP87565_REG_ADDR_BUCK23,
455 .gpu.pmic = &lp87565,
456 .gpu.abb_tx_done_mask = OMAP_ABB_GPU_TXDONE_MASK,
458 .core.value[OPP_NOM] = VDD_CORE_DRA7_NOM,
459 .core.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_CORE_NOM,
460 .core.efuse.reg_bits = DRA752_EFUSE_REGBITS,
461 .core.addr = TPS65917_REG_ADDR_SMPS3,
462 .core.pmic = &tps659038,
464 .iva.value[OPP_NOM] = VDD_IVA_DRA7_NOM,
465 .iva.value[OPP_OD] = VDD_IVA_DRA7_OD,
466 .iva.value[OPP_HIGH] = VDD_IVA_DRA7_HIGH,
467 .iva.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_IVA_NOM,
468 .iva.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_IVA_OD,
469 .iva.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_IVA_HIGH,
470 .iva.efuse.reg_bits = DRA752_EFUSE_REGBITS,
471 .iva.addr = TPS65917_REG_ADDR_SMPS4,
472 .iva.pmic = &tps659038,
473 .iva.abb_tx_done_mask = OMAP_ABB_IVA_TXDONE_MASK,
476 struct vcores_data dra722_volts = {
477 .mpu.value[OPP_NOM] = VDD_MPU_DRA7_NOM,
478 .mpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_MPU_NOM,
479 .mpu.efuse.reg_bits = DRA752_EFUSE_REGBITS,
480 .mpu.addr = TPS65917_REG_ADDR_SMPS1,
481 .mpu.pmic = &tps659038,
482 .mpu.abb_tx_done_mask = OMAP_ABB_MPU_TXDONE_MASK,
484 .core.value[OPP_NOM] = VDD_CORE_DRA7_NOM,
485 .core.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_CORE_NOM,
486 .core.efuse.reg_bits = DRA752_EFUSE_REGBITS,
487 .core.addr = TPS65917_REG_ADDR_SMPS2,
488 .core.pmic = &tps659038,
491 * The DSPEVE, GPU and IVA rails are usually grouped on DRA72x
492 * designs and powered by TPS65917 SMPS3, as on the J6Eco EVM.
494 .gpu.value[OPP_NOM] = VDD_GPU_DRA7_NOM,
495 .gpu.value[OPP_OD] = VDD_GPU_DRA7_OD,
496 .gpu.value[OPP_HIGH] = VDD_GPU_DRA7_HIGH,
497 .gpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_GPU_NOM,
498 .gpu.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_GPU_OD,
499 .gpu.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_GPU_HIGH,
500 .gpu.efuse.reg_bits = DRA752_EFUSE_REGBITS,
501 .gpu.addr = TPS65917_REG_ADDR_SMPS3,
502 .gpu.pmic = &tps659038,
503 .gpu.abb_tx_done_mask = OMAP_ABB_GPU_TXDONE_MASK,
505 .eve.value[OPP_NOM] = VDD_EVE_DRA7_NOM,
506 .eve.value[OPP_OD] = VDD_EVE_DRA7_OD,
507 .eve.value[OPP_HIGH] = VDD_EVE_DRA7_HIGH,
508 .eve.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_DSPEVE_NOM,
509 .eve.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_DSPEVE_OD,
510 .eve.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH,
511 .eve.efuse.reg_bits = DRA752_EFUSE_REGBITS,
512 .eve.addr = TPS65917_REG_ADDR_SMPS3,
513 .eve.pmic = &tps659038,
514 .eve.abb_tx_done_mask = OMAP_ABB_EVE_TXDONE_MASK,
516 .iva.value[OPP_NOM] = VDD_IVA_DRA7_NOM,
517 .iva.value[OPP_OD] = VDD_IVA_DRA7_OD,
518 .iva.value[OPP_HIGH] = VDD_IVA_DRA7_HIGH,
519 .iva.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_IVA_NOM,
520 .iva.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_IVA_OD,
521 .iva.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_IVA_HIGH,
522 .iva.efuse.reg_bits = DRA752_EFUSE_REGBITS,
523 .iva.addr = TPS65917_REG_ADDR_SMPS3,
524 .iva.pmic = &tps659038,
525 .iva.abb_tx_done_mask = OMAP_ABB_IVA_TXDONE_MASK,
528 struct vcores_data dra718_volts = {
530 * In the case of dra71x GPU MPU and CORE
531 * are all powered up by BUCK0 of LP873X PMIC
533 .mpu.value[OPP_NOM] = VDD_MPU_DRA7_NOM,
534 .mpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_MPU_NOM,
535 .mpu.efuse.reg_bits = DRA752_EFUSE_REGBITS,
536 .mpu.addr = LP873X_REG_ADDR_BUCK0,
538 .mpu.abb_tx_done_mask = OMAP_ABB_MPU_TXDONE_MASK,
540 .core.value[OPP_NOM] = VDD_CORE_DRA7_NOM,
541 .core.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_CORE_NOM,
542 .core.efuse.reg_bits = DRA752_EFUSE_REGBITS,
543 .core.addr = LP873X_REG_ADDR_BUCK0,
544 .core.pmic = &lp8733,
546 .gpu.value[OPP_NOM] = VDD_GPU_DRA7_NOM,
547 .gpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_GPU_NOM,
548 .gpu.efuse.reg_bits = DRA752_EFUSE_REGBITS,
549 .gpu.addr = LP873X_REG_ADDR_BUCK0,
551 .gpu.abb_tx_done_mask = OMAP_ABB_GPU_TXDONE_MASK,
554 * The DSPEVE and IVA rails are grouped on DRA71x-evm
555 * and are powered by BUCK1 of LP873X PMIC
557 .eve.value[OPP_NOM] = VDD_EVE_DRA7_NOM,
558 .eve.value[OPP_HIGH] = VDD_EVE_DRA7_HIGH,
559 .eve.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_DSPEVE_NOM,
560 .eve.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH,
561 .eve.efuse.reg_bits = DRA752_EFUSE_REGBITS,
562 .eve.addr = LP873X_REG_ADDR_BUCK1,
564 .eve.abb_tx_done_mask = OMAP_ABB_EVE_TXDONE_MASK,
566 .iva.value[OPP_NOM] = VDD_IVA_DRA7_NOM,
567 .iva.value[OPP_HIGH] = VDD_IVA_DRA7_HIGH,
568 .iva.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_IVA_NOM,
569 .iva.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_IVA_HIGH,
570 .iva.efuse.reg_bits = DRA752_EFUSE_REGBITS,
571 .iva.addr = LP873X_REG_ADDR_BUCK1,
573 .iva.abb_tx_done_mask = OMAP_ABB_IVA_TXDONE_MASK,
576 int get_voltrail_opp(int rail_offset)
580 switch (rail_offset) {
583 /* DRA71x supports only OPP_NOM for MPU */
584 if (board_is_dra71x_evm())
589 /* DRA71x supports only OPP_NOM for CORE */
590 if (board_is_dra71x_evm())
595 /* DRA71x supports only OPP_NOM for GPU */
596 if (board_is_dra71x_evm())
600 opp = DRA7_DSPEVE_OPP;
602 * DRA71x does not support OPP_OD for EVE.
603 * If OPP_OD is selected by menuconfig, fallback
606 if (board_is_dra71x_evm() && opp == OPP_OD)
612 * DRA71x does not support OPP_OD for IVA.
613 * If OPP_OD is selected by menuconfig, fallback
616 if (board_is_dra71x_evm() && opp == OPP_OD)
634 gd->bd->bi_boot_params = (0x80000000 + 0x100); /* boot param addr */
639 int dram_init_banksize(void)
643 ram_size = board_ti_get_emif_size();
645 gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE;
646 gd->bd->bi_dram[0].size = get_effective_memsize();
647 if (ram_size > CFG_MAX_MEM_MAPPED) {
648 gd->bd->bi_dram[1].start = 0x200000000;
649 gd->bd->bi_dram[1].size = ram_size - CFG_MAX_MEM_MAPPED;
655 #if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
656 static int device_okay(const char *path)
660 node = fdt_path_offset(gd->fdt_blob, path);
664 return fdtdec_get_is_enabled(gd->fdt_blob, node);
668 int board_late_init(void)
670 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
671 char *name = "unknown";
674 if (board_is_dra72x_revc_or_later())
675 name = "dra72x-revc";
676 else if (board_is_dra71x_evm())
680 } else if (is_dra76x_abz()) {
682 } else if (is_dra76x_acd()) {
688 set_board_info_env(name);
691 * Default FIT boot on HS devices. Non FIT images are not allowed
694 if (get_device_type() == HS_DEVICE)
695 env_set("boot_fit", "1");
697 omap_die_id_serial();
698 omap_set_fastboot_vars();
701 * Hook the LDO1 regulator to EN pin. This applies only to LP8733
702 * Rest all regulators are hooked to EN Pin at reset.
704 if (board_is_dra71x_evm())
705 palmas_i2c_write_u8(LP873X_I2C_SLAVE_ADDR, 0x9, 0x7);
707 #if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
708 if (device_okay("/ocp/omap_dwc3_1@48880000"))
709 enable_usb_clocks(0);
710 if (device_okay("/ocp/omap_dwc3_2@488c0000"))
711 enable_usb_clocks(1);
716 #ifdef CONFIG_SPL_BUILD
717 void do_board_detect(void)
721 rc = ti_i2c_eeprom_dra7_get(CONFIG_EEPROM_BUS_ADDRESS,
722 CONFIG_EEPROM_CHIP_ADDRESS);
724 printf("ti_i2c_eeprom_init failed %d\n", rc);
729 void do_board_detect(void)
734 rc = ti_i2c_eeprom_dra7_get(CONFIG_EEPROM_BUS_ADDRESS,
735 CONFIG_EEPROM_CHIP_ADDRESS);
737 printf("ti_i2c_eeprom_init failed %d\n", rc);
739 if (board_is_dra74x_evm()) {
740 bname = "DRA74x EVM";
741 } else if (board_is_dra72x_evm()) {
742 bname = "DRA72x EVM";
743 } else if (board_is_dra71x_evm()) {
744 bname = "DRA71x EVM";
745 } else if (board_is_dra76x_evm()) {
746 bname = "DRA76x EVM";
748 /* If EEPROM is not populated */
750 bname = "DRA72x EVM";
752 bname = "DRA74x EVM";
756 snprintf(sysinfo.board_string, SYSINFO_BOARD_NAME_MAX_LEN,
757 "Board: %s REV %s\n", bname, board_ti_get_rev());
759 #endif /* CONFIG_SPL_BUILD */
761 void vcores_init(void)
763 if (board_is_dra74x_evm()) {
764 *omap_vcores = &dra752_volts;
765 } else if (board_is_dra72x_evm()) {
766 *omap_vcores = &dra722_volts;
767 } else if (board_is_dra71x_evm()) {
768 *omap_vcores = &dra718_volts;
769 } else if (board_is_dra76x_evm()) {
770 *omap_vcores = &dra76x_volts;
772 /* If EEPROM is not populated */
774 *omap_vcores = &dra722_volts;
776 *omap_vcores = &dra752_volts;
780 void set_muxconf_regs(void)
782 do_set_mux32((*ctrl)->control_padconf_core_base,
783 early_padconf, ARRAY_SIZE(early_padconf));
786 #if defined(CONFIG_MTD_RAW_NAND)
787 static int nand_sw_detect(void)
793 rc = i2c_get_chip_for_busnum(NAND_PCF8575_I2C_BUS_NUM,
794 NAND_PCF8575_ADDR, 0, &dev);
798 rc = dm_i2c_read(dev, 0, (uint8_t *)&data, sizeof(data));
802 /* We are only interested in P10 and P11 on PCF8575 which is equal to
805 data[1] = data[1] & 0x3;
807 /* Ensure only P11 is set and P10 is cleared. This ensures only
808 * NAND (P10) is configured and not NOR (P11) which are both low
809 * true signals. NAND and NOR settings should not be enabled at
818 int nand_sw_detect(void)
824 #ifdef CONFIG_IODELAY_RECALIBRATION
825 void recalibrate_iodelay(void)
827 struct pad_conf_entry const *pads, *delta_pads = NULL;
828 struct iodelay_cfg_entry const *iodelay;
829 int npads, niodelays, delta_npads = 0;
832 switch (omap_revision()) {
836 pads = dra72x_core_padconf_array_common;
837 npads = ARRAY_SIZE(dra72x_core_padconf_array_common);
838 if (board_is_dra71x_evm()) {
839 pads = dra71x_core_padconf_array;
840 npads = ARRAY_SIZE(dra71x_core_padconf_array);
841 iodelay = dra71_iodelay_cfg_array;
842 niodelays = ARRAY_SIZE(dra71_iodelay_cfg_array);
843 /* If SW8 on the EVM is set to enable NAND then
844 * overwrite the pins used by VOUT3 with NAND.
846 if (!nand_sw_detect()) {
847 delta_pads = dra71x_nand_padconf_array;
849 ARRAY_SIZE(dra71x_nand_padconf_array);
851 delta_pads = dra71x_vout3_padconf_array;
853 ARRAY_SIZE(dra71x_vout3_padconf_array);
856 } else if (board_is_dra72x_revc_or_later()) {
857 delta_pads = dra72x_rgmii_padconf_array_revc;
859 ARRAY_SIZE(dra72x_rgmii_padconf_array_revc);
860 iodelay = dra72_iodelay_cfg_array_revc;
861 niodelays = ARRAY_SIZE(dra72_iodelay_cfg_array_revc);
863 delta_pads = dra72x_rgmii_padconf_array_revb;
865 ARRAY_SIZE(dra72x_rgmii_padconf_array_revb);
866 iodelay = dra72_iodelay_cfg_array_revb;
867 niodelays = ARRAY_SIZE(dra72_iodelay_cfg_array_revb);
872 pads = dra74x_core_padconf_array;
873 npads = ARRAY_SIZE(dra74x_core_padconf_array);
874 iodelay = dra742_es1_1_iodelay_cfg_array;
875 niodelays = ARRAY_SIZE(dra742_es1_1_iodelay_cfg_array);
877 case DRA762_ACD_ES1_0:
879 pads = dra76x_core_padconf_array;
880 npads = ARRAY_SIZE(dra76x_core_padconf_array);
881 iodelay = dra76x_es1_0_iodelay_cfg_array;
882 niodelays = ARRAY_SIZE(dra76x_es1_0_iodelay_cfg_array);
886 case DRA762_ABZ_ES1_0:
887 pads = dra74x_core_padconf_array;
888 npads = ARRAY_SIZE(dra74x_core_padconf_array);
889 iodelay = dra742_es2_0_iodelay_cfg_array;
890 niodelays = ARRAY_SIZE(dra742_es2_0_iodelay_cfg_array);
891 /* Setup port1 and port2 for rgmii with 'no-id' mode */
892 clrset_spare_register(1, 0, RGMII2_ID_MODE_N_MASK |
893 RGMII1_ID_MODE_N_MASK);
896 /* Setup I/O isolation */
897 ret = __recalibrate_iodelay_start();
901 /* Do the muxing here */
902 do_set_mux32((*ctrl)->control_padconf_core_base, pads, npads);
904 /* Now do the weird minor deltas that should be safe */
906 do_set_mux32((*ctrl)->control_padconf_core_base,
907 delta_pads, delta_npads);
910 /* Set mux for MCAN instead of DCAN1 */
911 clrsetbits_le32((*ctrl)->control_core_control_spare_rw,
912 MCAN_SEL_ALT_MASK, MCAN_SEL);
914 /* Setup IOdelay configuration */
915 ret = do_set_iodelay((*ctrl)->iodelay_config_base, iodelay, niodelays);
917 /* Closeup.. remove isolation */
918 __recalibrate_iodelay_end(ret);
922 #if defined(CONFIG_MMC)
923 int board_mmc_init(struct bd_info *bis)
925 omap_mmc_init(0, 0, 0, -1, -1);
926 omap_mmc_init(1, 0, 0, -1, -1);
930 void board_mmc_poweron_ldo(uint voltage)
932 if (board_is_dra71x_evm()) {
933 if (voltage == LDO_VOLT_3V0)
935 else if (voltage == LDO_VOLT_1V8)
937 lp873x_mmc1_poweron_ldo(voltage);
938 } else if (board_is_dra76x_evm()) {
939 palmas_mmc1_poweron_ldo(LDO4_VOLTAGE, LDO4_CTRL, voltage);
941 palmas_mmc1_poweron_ldo(LDO1_VOLTAGE, LDO1_CTRL, voltage);
945 static const struct mmc_platform_fixups dra7x_es1_1_mmc1_fixups = {
947 .unsupported_caps = MMC_CAP(MMC_HS_200) |
949 .max_freq = 96000000,
952 static const struct mmc_platform_fixups dra7x_es1_1_mmc23_fixups = {
954 .unsupported_caps = MMC_CAP(MMC_HS_200) |
955 MMC_CAP(UHS_SDR104) |
957 .max_freq = 48000000,
960 const struct mmc_platform_fixups *platform_fixups_mmc(uint32_t addr)
962 switch (omap_revision()) {
965 if (addr == OMAP_HSMMC1_BASE)
966 return &dra7x_es1_1_mmc1_fixups;
968 return &dra7x_es1_1_mmc23_fixups;
975 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_OS_BOOT)
976 int spl_start_uboot(void)
978 /* break into full u-boot on 'c' */
979 if (serial_tstc() && serial_getc() == 'c')
982 #ifdef CONFIG_SPL_ENV_SUPPORT
985 if (env_get_yesno("boot_os") != 1)
993 #ifdef CONFIG_BOARD_EARLY_INIT_F
994 /* VTT regulator enable */
995 static inline void vtt_regulator_enable(void)
997 if (omap_hw_init_context() == OMAP_INIT_CONTEXT_UBOOT_AFTER_SPL)
1000 /* Do not enable VTT for DRA722 or DRA76x */
1001 if (is_dra72x() || is_dra76x())
1005 * EVM Rev G and later use gpio7_11 for DDR3 termination.
1006 * This is safe enough to do on older revs.
1008 gpio_request(GPIO_DDR_VTT_EN, "ddr_vtt_en");
1009 gpio_direction_output(GPIO_DDR_VTT_EN, 1);
1012 int board_early_init_f(void)
1014 vtt_regulator_enable();
1019 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
1020 int ft_board_setup(void *blob, struct bd_info *bd)
1022 ft_cpu_setup(blob, bd);
1028 #ifdef CONFIG_SPL_LOAD_FIT
1029 int board_fit_config_name_match(const char *name)
1032 if (board_is_dra71x_evm()) {
1033 if (!strcmp(name, "dra71-evm"))
1035 }else if(board_is_dra72x_revc_or_later()) {
1036 if (!strcmp(name, "dra72-evm-revc"))
1038 } else if (!strcmp(name, "dra72-evm")) {
1041 } else if (is_dra76x_acd() && !strcmp(name, "dra76-evm")) {
1043 } else if (!is_dra72x() && !is_dra76x_acd() &&
1044 !strcmp(name, "dra7-evm")) {
1052 #if IS_ENABLED(CONFIG_FASTBOOT) && !CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
1053 int fastboot_set_reboot_flag(enum fastboot_reboot_reason reason)
1055 if (reason != FASTBOOT_REBOOT_REASON_BOOTLOADER)
1058 printf("Setting reboot to fastboot flag ...\n");
1059 env_set("dofastboot", "1");