3 * Texas Instruments Incorporated, <www.ti.com>
5 * Lokesh Vutla <lokeshvutla@ti.com>
7 * Based on previous work by:
8 * Aneesh V <aneesh@ti.com>
9 * Steve Sakoman <steve@sakoman.com>
11 * SPDX-License-Identifier: GPL-2.0+
16 #include <linux/string.h>
19 #include <linux/usb/gadget.h>
20 #include <asm/omap_common.h>
21 #include <asm/omap_sec_common.h>
22 #include <asm/arch/gpio.h>
23 #include <asm/arch/dra7xx_iodelay.h>
25 #include <asm/arch/sys_proto.h>
26 #include <asm/arch/mmc_host_def.h>
27 #include <asm/arch/sata.h>
28 #include <environment.h>
29 #include <dwc3-uboot.h>
30 #include <dwc3-omap-uboot.h>
31 #include <ti-usb-phy-uboot.h>
35 #include "../common/board_detect.h"
37 #define board_is_dra76x_evm() board_ti_is("DRA76/7x")
38 #define board_is_dra74x_evm() board_ti_is("5777xCPU")
39 #define board_is_dra72x_evm() board_ti_is("DRA72x-T")
40 #define board_is_dra71x_evm() board_ti_is("DRA79x,D")
41 #define board_is_dra74x_revh_or_later() (board_is_dra74x_evm() && \
42 (strncmp("H", board_ti_get_rev(), 1) <= 0))
43 #define board_is_dra72x_revc_or_later() (board_is_dra72x_evm() && \
44 (strncmp("C", board_ti_get_rev(), 1) <= 0))
45 #define board_ti_get_emif_size() board_ti_get_emif1_size() + \
46 board_ti_get_emif2_size()
48 #ifdef CONFIG_DRIVER_TI_CPSW
52 DECLARE_GLOBAL_DATA_PTR
;
55 #define GPIO_DDR_VTT_EN 203
57 #define SYSINFO_BOARD_NAME_MAX_LEN 37
59 const struct omap_sysinfo sysinfo
= {
60 "Board: UNKNOWN(DRA7 EVM) REV UNKNOWN\n"
63 static const struct emif_regs emif1_ddr3_532_mhz_1cs
= {
64 .sdram_config_init
= 0x61851ab2,
65 .sdram_config
= 0x61851ab2,
66 .sdram_config2
= 0x08000000,
67 .ref_ctrl
= 0x000040F1,
68 .ref_ctrl_final
= 0x00001035,
69 .sdram_tim1
= 0xCCCF36B3,
70 .sdram_tim2
= 0x308F7FDA,
71 .sdram_tim3
= 0x427F88A8,
72 .read_idle_ctrl
= 0x00050000,
73 .zq_config
= 0x0007190B,
74 .temp_alert_config
= 0x00000000,
75 .emif_ddr_phy_ctlr_1_init
= 0x0024400B,
76 .emif_ddr_phy_ctlr_1
= 0x0E24400B,
77 .emif_ddr_ext_phy_ctrl_1
= 0x10040100,
78 .emif_ddr_ext_phy_ctrl_2
= 0x00910091,
79 .emif_ddr_ext_phy_ctrl_3
= 0x00950095,
80 .emif_ddr_ext_phy_ctrl_4
= 0x009B009B,
81 .emif_ddr_ext_phy_ctrl_5
= 0x009E009E,
82 .emif_rd_wr_lvl_rmp_win
= 0x00000000,
83 .emif_rd_wr_lvl_rmp_ctl
= 0x80000000,
84 .emif_rd_wr_lvl_ctl
= 0x00000000,
85 .emif_rd_wr_exec_thresh
= 0x00000305
88 static const struct emif_regs emif2_ddr3_532_mhz_1cs
= {
89 .sdram_config_init
= 0x61851B32,
90 .sdram_config
= 0x61851B32,
91 .sdram_config2
= 0x08000000,
92 .ref_ctrl
= 0x000040F1,
93 .ref_ctrl_final
= 0x00001035,
94 .sdram_tim1
= 0xCCCF36B3,
95 .sdram_tim2
= 0x308F7FDA,
96 .sdram_tim3
= 0x427F88A8,
97 .read_idle_ctrl
= 0x00050000,
98 .zq_config
= 0x0007190B,
99 .temp_alert_config
= 0x00000000,
100 .emif_ddr_phy_ctlr_1_init
= 0x0024400B,
101 .emif_ddr_phy_ctlr_1
= 0x0E24400B,
102 .emif_ddr_ext_phy_ctrl_1
= 0x10040100,
103 .emif_ddr_ext_phy_ctrl_2
= 0x00910091,
104 .emif_ddr_ext_phy_ctrl_3
= 0x00950095,
105 .emif_ddr_ext_phy_ctrl_4
= 0x009B009B,
106 .emif_ddr_ext_phy_ctrl_5
= 0x009E009E,
107 .emif_rd_wr_lvl_rmp_win
= 0x00000000,
108 .emif_rd_wr_lvl_rmp_ctl
= 0x80000000,
109 .emif_rd_wr_lvl_ctl
= 0x00000000,
110 .emif_rd_wr_exec_thresh
= 0x00000305
113 static const struct emif_regs emif_1_regs_ddr3_666_mhz_1cs_dra_es1
= {
114 .sdram_config_init
= 0x61862B32,
115 .sdram_config
= 0x61862B32,
116 .sdram_config2
= 0x08000000,
117 .ref_ctrl
= 0x0000514C,
118 .ref_ctrl_final
= 0x0000144A,
119 .sdram_tim1
= 0xD113781C,
120 .sdram_tim2
= 0x30717FE3,
121 .sdram_tim3
= 0x409F86A8,
122 .read_idle_ctrl
= 0x00050000,
123 .zq_config
= 0x5007190B,
124 .temp_alert_config
= 0x00000000,
125 .emif_ddr_phy_ctlr_1_init
= 0x0024400D,
126 .emif_ddr_phy_ctlr_1
= 0x0E24400D,
127 .emif_ddr_ext_phy_ctrl_1
= 0x10040100,
128 .emif_ddr_ext_phy_ctrl_2
= 0x00A400A4,
129 .emif_ddr_ext_phy_ctrl_3
= 0x00A900A9,
130 .emif_ddr_ext_phy_ctrl_4
= 0x00B000B0,
131 .emif_ddr_ext_phy_ctrl_5
= 0x00B000B0,
132 .emif_rd_wr_lvl_rmp_win
= 0x00000000,
133 .emif_rd_wr_lvl_rmp_ctl
= 0x80000000,
134 .emif_rd_wr_lvl_ctl
= 0x00000000,
135 .emif_rd_wr_exec_thresh
= 0x00000305
138 const struct emif_regs emif_1_regs_ddr3_666_mhz_1cs_dra_es2
= {
139 .sdram_config_init
= 0x61862BB2,
140 .sdram_config
= 0x61862BB2,
141 .sdram_config2
= 0x00000000,
142 .ref_ctrl
= 0x0000514D,
143 .ref_ctrl_final
= 0x0000144A,
144 .sdram_tim1
= 0xD1137824,
145 .sdram_tim2
= 0x30B37FE3,
146 .sdram_tim3
= 0x409F8AD8,
147 .read_idle_ctrl
= 0x00050000,
148 .zq_config
= 0x5007190B,
149 .temp_alert_config
= 0x00000000,
150 .emif_ddr_phy_ctlr_1_init
= 0x0824400E,
151 .emif_ddr_phy_ctlr_1
= 0x0E24400E,
152 .emif_ddr_ext_phy_ctrl_1
= 0x04040100,
153 .emif_ddr_ext_phy_ctrl_2
= 0x006B009F,
154 .emif_ddr_ext_phy_ctrl_3
= 0x006B00A2,
155 .emif_ddr_ext_phy_ctrl_4
= 0x006B00A8,
156 .emif_ddr_ext_phy_ctrl_5
= 0x006B00A8,
157 .emif_rd_wr_lvl_rmp_win
= 0x00000000,
158 .emif_rd_wr_lvl_rmp_ctl
= 0x80000000,
159 .emif_rd_wr_lvl_ctl
= 0x00000000,
160 .emif_rd_wr_exec_thresh
= 0x00000305
163 const struct emif_regs emif1_ddr3_532_mhz_1cs_2G
= {
164 .sdram_config_init
= 0x61851ab2,
165 .sdram_config
= 0x61851ab2,
166 .sdram_config2
= 0x08000000,
167 .ref_ctrl
= 0x000040F1,
168 .ref_ctrl_final
= 0x00001035,
169 .sdram_tim1
= 0xCCCF36B3,
170 .sdram_tim2
= 0x30BF7FDA,
171 .sdram_tim3
= 0x427F8BA8,
172 .read_idle_ctrl
= 0x00050000,
173 .zq_config
= 0x0007190B,
174 .temp_alert_config
= 0x00000000,
175 .emif_ddr_phy_ctlr_1_init
= 0x0024400B,
176 .emif_ddr_phy_ctlr_1
= 0x0E24400B,
177 .emif_ddr_ext_phy_ctrl_1
= 0x10040100,
178 .emif_ddr_ext_phy_ctrl_2
= 0x00910091,
179 .emif_ddr_ext_phy_ctrl_3
= 0x00950095,
180 .emif_ddr_ext_phy_ctrl_4
= 0x009B009B,
181 .emif_ddr_ext_phy_ctrl_5
= 0x009E009E,
182 .emif_rd_wr_lvl_rmp_win
= 0x00000000,
183 .emif_rd_wr_lvl_rmp_ctl
= 0x80000000,
184 .emif_rd_wr_lvl_ctl
= 0x00000000,
185 .emif_rd_wr_exec_thresh
= 0x00000305
188 const struct emif_regs emif2_ddr3_532_mhz_1cs_2G
= {
189 .sdram_config_init
= 0x61851B32,
190 .sdram_config
= 0x61851B32,
191 .sdram_config2
= 0x08000000,
192 .ref_ctrl
= 0x000040F1,
193 .ref_ctrl_final
= 0x00001035,
194 .sdram_tim1
= 0xCCCF36B3,
195 .sdram_tim2
= 0x308F7FDA,
196 .sdram_tim3
= 0x427F88A8,
197 .read_idle_ctrl
= 0x00050000,
198 .zq_config
= 0x0007190B,
199 .temp_alert_config
= 0x00000000,
200 .emif_ddr_phy_ctlr_1_init
= 0x0024400B,
201 .emif_ddr_phy_ctlr_1
= 0x0E24400B,
202 .emif_ddr_ext_phy_ctrl_1
= 0x10040100,
203 .emif_ddr_ext_phy_ctrl_2
= 0x00910091,
204 .emif_ddr_ext_phy_ctrl_3
= 0x00950095,
205 .emif_ddr_ext_phy_ctrl_4
= 0x009B009B,
206 .emif_ddr_ext_phy_ctrl_5
= 0x009E009E,
207 .emif_rd_wr_lvl_rmp_win
= 0x00000000,
208 .emif_rd_wr_lvl_rmp_ctl
= 0x80000000,
209 .emif_rd_wr_lvl_ctl
= 0x00000000,
210 .emif_rd_wr_exec_thresh
= 0x00000305
213 void emif_get_reg_dump(u32 emif_nr
, const struct emif_regs
**regs
)
217 ram_size
= board_ti_get_emif_size();
219 switch (omap_revision()) {
225 if (ram_size
> CONFIG_MAX_MEM_MAPPED
)
226 *regs
= &emif1_ddr3_532_mhz_1cs_2G
;
228 *regs
= &emif1_ddr3_532_mhz_1cs
;
231 if (ram_size
> CONFIG_MAX_MEM_MAPPED
)
232 *regs
= &emif2_ddr3_532_mhz_1cs_2G
;
234 *regs
= &emif2_ddr3_532_mhz_1cs
;
240 if (ram_size
< CONFIG_MAX_MEM_MAPPED
)
241 *regs
= &emif_1_regs_ddr3_666_mhz_1cs_dra_es1
;
243 *regs
= &emif_1_regs_ddr3_666_mhz_1cs_dra_es2
;
246 *regs
= &emif1_ddr3_532_mhz_1cs
;
250 static const struct dmm_lisa_map_regs lisa_map_dra7_1536MB
= {
251 .dmm_lisa_map_0
= 0x0,
252 .dmm_lisa_map_1
= 0x80640300,
253 .dmm_lisa_map_2
= 0xC0500220,
254 .dmm_lisa_map_3
= 0xFF020100,
258 static const struct dmm_lisa_map_regs lisa_map_2G_x_2
= {
259 .dmm_lisa_map_0
= 0x0,
260 .dmm_lisa_map_1
= 0x0,
261 .dmm_lisa_map_2
= 0x80600100,
262 .dmm_lisa_map_3
= 0xFF020100,
266 const struct dmm_lisa_map_regs lisa_map_dra7_2GB
= {
267 .dmm_lisa_map_0
= 0x0,
268 .dmm_lisa_map_1
= 0x0,
269 .dmm_lisa_map_2
= 0x80740300,
270 .dmm_lisa_map_3
= 0xFF020100,
275 * DRA722 EVM EMIF1 2GB CONFIGURATION
276 * EMIF1 4 devices of 512Mb x 8 Micron
278 const struct dmm_lisa_map_regs lisa_map_2G_x_4
= {
279 .dmm_lisa_map_0
= 0x0,
280 .dmm_lisa_map_1
= 0x0,
281 .dmm_lisa_map_2
= 0x80700100,
282 .dmm_lisa_map_3
= 0xFF020100,
286 void emif_get_dmm_regs(const struct dmm_lisa_map_regs
**dmm_lisa_regs
)
290 ram_size
= board_ti_get_emif_size();
292 switch (omap_revision()) {
296 if (ram_size
> CONFIG_MAX_MEM_MAPPED
)
297 *dmm_lisa_regs
= &lisa_map_dra7_2GB
;
299 *dmm_lisa_regs
= &lisa_map_dra7_1536MB
;
304 if (ram_size
< CONFIG_MAX_MEM_MAPPED
)
305 *dmm_lisa_regs
= &lisa_map_2G_x_2
;
307 *dmm_lisa_regs
= &lisa_map_2G_x_4
;
312 struct vcores_data dra752_volts
= {
313 .mpu
.value
[OPP_NOM
] = VDD_MPU_DRA7_NOM
,
314 .mpu
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_MPU_NOM
,
315 .mpu
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
316 .mpu
.addr
= TPS659038_REG_ADDR_SMPS12
,
317 .mpu
.pmic
= &tps659038
,
318 .mpu
.abb_tx_done_mask
= OMAP_ABB_MPU_TXDONE_MASK
,
320 .eve
.value
[OPP_NOM
] = VDD_EVE_DRA7_NOM
,
321 .eve
.value
[OPP_OD
] = VDD_EVE_DRA7_OD
,
322 .eve
.value
[OPP_HIGH
] = VDD_EVE_DRA7_HIGH
,
323 .eve
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_DSPEVE_NOM
,
324 .eve
.efuse
.reg
[OPP_OD
] = STD_FUSE_OPP_VMIN_DSPEVE_OD
,
325 .eve
.efuse
.reg
[OPP_HIGH
] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH
,
326 .eve
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
327 .eve
.addr
= TPS659038_REG_ADDR_SMPS45
,
328 .eve
.pmic
= &tps659038
,
329 .eve
.abb_tx_done_mask
= OMAP_ABB_EVE_TXDONE_MASK
,
331 .gpu
.value
[OPP_NOM
] = VDD_GPU_DRA7_NOM
,
332 .gpu
.value
[OPP_OD
] = VDD_GPU_DRA7_OD
,
333 .gpu
.value
[OPP_HIGH
] = VDD_GPU_DRA7_HIGH
,
334 .gpu
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_GPU_NOM
,
335 .gpu
.efuse
.reg
[OPP_OD
] = STD_FUSE_OPP_VMIN_GPU_OD
,
336 .gpu
.efuse
.reg
[OPP_HIGH
] = STD_FUSE_OPP_VMIN_GPU_HIGH
,
337 .gpu
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
338 .gpu
.addr
= TPS659038_REG_ADDR_SMPS6
,
339 .gpu
.pmic
= &tps659038
,
340 .gpu
.abb_tx_done_mask
= OMAP_ABB_GPU_TXDONE_MASK
,
342 .core
.value
[OPP_NOM
] = VDD_CORE_DRA7_NOM
,
343 .core
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_CORE_NOM
,
344 .core
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
345 .core
.addr
= TPS659038_REG_ADDR_SMPS7
,
346 .core
.pmic
= &tps659038
,
348 .iva
.value
[OPP_NOM
] = VDD_IVA_DRA7_NOM
,
349 .iva
.value
[OPP_OD
] = VDD_IVA_DRA7_OD
,
350 .iva
.value
[OPP_HIGH
] = VDD_IVA_DRA7_HIGH
,
351 .iva
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_IVA_NOM
,
352 .iva
.efuse
.reg
[OPP_OD
] = STD_FUSE_OPP_VMIN_IVA_OD
,
353 .iva
.efuse
.reg
[OPP_HIGH
] = STD_FUSE_OPP_VMIN_IVA_HIGH
,
354 .iva
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
355 .iva
.addr
= TPS659038_REG_ADDR_SMPS8
,
356 .iva
.pmic
= &tps659038
,
357 .iva
.abb_tx_done_mask
= OMAP_ABB_IVA_TXDONE_MASK
,
360 struct vcores_data dra76x_volts
= {
361 .mpu
.value
[OPP_NOM
] = VDD_MPU_DRA7_NOM
,
362 .mpu
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_MPU_NOM
,
363 .mpu
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
364 .mpu
.addr
= LP87565_REG_ADDR_BUCK01
,
365 .mpu
.pmic
= &lp87565
,
366 .mpu
.abb_tx_done_mask
= OMAP_ABB_MPU_TXDONE_MASK
,
368 .eve
.value
[OPP_NOM
] = VDD_EVE_DRA7_NOM
,
369 .eve
.value
[OPP_OD
] = VDD_EVE_DRA7_OD
,
370 .eve
.value
[OPP_HIGH
] = VDD_EVE_DRA7_HIGH
,
371 .eve
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_DSPEVE_NOM
,
372 .eve
.efuse
.reg
[OPP_OD
] = STD_FUSE_OPP_VMIN_DSPEVE_OD
,
373 .eve
.efuse
.reg
[OPP_HIGH
] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH
,
374 .eve
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
375 .eve
.addr
= TPS65917_REG_ADDR_SMPS1
,
376 .eve
.pmic
= &tps659038
,
377 .eve
.abb_tx_done_mask
= OMAP_ABB_EVE_TXDONE_MASK
,
379 .gpu
.value
[OPP_NOM
] = VDD_GPU_DRA7_NOM
,
380 .gpu
.value
[OPP_OD
] = VDD_GPU_DRA7_OD
,
381 .gpu
.value
[OPP_HIGH
] = VDD_GPU_DRA7_HIGH
,
382 .gpu
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_GPU_NOM
,
383 .gpu
.efuse
.reg
[OPP_OD
] = STD_FUSE_OPP_VMIN_GPU_OD
,
384 .gpu
.efuse
.reg
[OPP_HIGH
] = STD_FUSE_OPP_VMIN_GPU_HIGH
,
385 .gpu
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
386 .gpu
.addr
= LP87565_REG_ADDR_BUCK23
,
387 .gpu
.pmic
= &lp87565
,
388 .gpu
.abb_tx_done_mask
= OMAP_ABB_GPU_TXDONE_MASK
,
390 .core
.value
[OPP_NOM
] = VDD_CORE_DRA7_NOM
,
391 .core
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_CORE_NOM
,
392 .core
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
393 .core
.addr
= TPS65917_REG_ADDR_SMPS3
,
394 .core
.pmic
= &tps659038
,
396 .iva
.value
[OPP_NOM
] = VDD_IVA_DRA7_NOM
,
397 .iva
.value
[OPP_OD
] = VDD_IVA_DRA7_OD
,
398 .iva
.value
[OPP_HIGH
] = VDD_IVA_DRA7_HIGH
,
399 .iva
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_IVA_NOM
,
400 .iva
.efuse
.reg
[OPP_OD
] = STD_FUSE_OPP_VMIN_IVA_OD
,
401 .iva
.efuse
.reg
[OPP_HIGH
] = STD_FUSE_OPP_VMIN_IVA_HIGH
,
402 .iva
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
403 .iva
.addr
= TPS65917_REG_ADDR_SMPS4
,
404 .iva
.pmic
= &tps659038
,
405 .iva
.abb_tx_done_mask
= OMAP_ABB_IVA_TXDONE_MASK
,
408 struct vcores_data dra722_volts
= {
409 .mpu
.value
[OPP_NOM
] = VDD_MPU_DRA7_NOM
,
410 .mpu
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_MPU_NOM
,
411 .mpu
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
412 .mpu
.addr
= TPS65917_REG_ADDR_SMPS1
,
413 .mpu
.pmic
= &tps659038
,
414 .mpu
.abb_tx_done_mask
= OMAP_ABB_MPU_TXDONE_MASK
,
416 .core
.value
[OPP_NOM
] = VDD_CORE_DRA7_NOM
,
417 .core
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_CORE_NOM
,
418 .core
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
419 .core
.addr
= TPS65917_REG_ADDR_SMPS2
,
420 .core
.pmic
= &tps659038
,
423 * The DSPEVE, GPU and IVA rails are usually grouped on DRA72x
424 * designs and powered by TPS65917 SMPS3, as on the J6Eco EVM.
426 .gpu
.value
[OPP_NOM
] = VDD_GPU_DRA7_NOM
,
427 .gpu
.value
[OPP_OD
] = VDD_GPU_DRA7_OD
,
428 .gpu
.value
[OPP_HIGH
] = VDD_GPU_DRA7_HIGH
,
429 .gpu
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_GPU_NOM
,
430 .gpu
.efuse
.reg
[OPP_OD
] = STD_FUSE_OPP_VMIN_GPU_OD
,
431 .gpu
.efuse
.reg
[OPP_HIGH
] = STD_FUSE_OPP_VMIN_GPU_HIGH
,
432 .gpu
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
433 .gpu
.addr
= TPS65917_REG_ADDR_SMPS3
,
434 .gpu
.pmic
= &tps659038
,
435 .gpu
.abb_tx_done_mask
= OMAP_ABB_GPU_TXDONE_MASK
,
437 .eve
.value
[OPP_NOM
] = VDD_EVE_DRA7_NOM
,
438 .eve
.value
[OPP_OD
] = VDD_EVE_DRA7_OD
,
439 .eve
.value
[OPP_HIGH
] = VDD_EVE_DRA7_HIGH
,
440 .eve
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_DSPEVE_NOM
,
441 .eve
.efuse
.reg
[OPP_OD
] = STD_FUSE_OPP_VMIN_DSPEVE_OD
,
442 .eve
.efuse
.reg
[OPP_HIGH
] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH
,
443 .eve
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
444 .eve
.addr
= TPS65917_REG_ADDR_SMPS3
,
445 .eve
.pmic
= &tps659038
,
446 .eve
.abb_tx_done_mask
= OMAP_ABB_EVE_TXDONE_MASK
,
448 .iva
.value
[OPP_NOM
] = VDD_IVA_DRA7_NOM
,
449 .iva
.value
[OPP_OD
] = VDD_IVA_DRA7_OD
,
450 .iva
.value
[OPP_HIGH
] = VDD_IVA_DRA7_HIGH
,
451 .iva
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_IVA_NOM
,
452 .iva
.efuse
.reg
[OPP_OD
] = STD_FUSE_OPP_VMIN_IVA_OD
,
453 .iva
.efuse
.reg
[OPP_HIGH
] = STD_FUSE_OPP_VMIN_IVA_HIGH
,
454 .iva
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
455 .iva
.addr
= TPS65917_REG_ADDR_SMPS3
,
456 .iva
.pmic
= &tps659038
,
457 .iva
.abb_tx_done_mask
= OMAP_ABB_IVA_TXDONE_MASK
,
460 struct vcores_data dra718_volts
= {
462 * In the case of dra71x GPU MPU and CORE
463 * are all powered up by BUCK0 of LP873X PMIC
465 .mpu
.value
[OPP_NOM
] = VDD_MPU_DRA7_NOM
,
466 .mpu
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_MPU_NOM
,
467 .mpu
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
468 .mpu
.addr
= LP873X_REG_ADDR_BUCK0
,
470 .mpu
.abb_tx_done_mask
= OMAP_ABB_MPU_TXDONE_MASK
,
472 .core
.value
[OPP_NOM
] = VDD_CORE_DRA7_NOM
,
473 .core
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_CORE_NOM
,
474 .core
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
475 .core
.addr
= LP873X_REG_ADDR_BUCK0
,
476 .core
.pmic
= &lp8733
,
478 .gpu
.value
[OPP_NOM
] = VDD_GPU_DRA7_NOM
,
479 .gpu
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_GPU_NOM
,
480 .gpu
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
481 .gpu
.addr
= LP873X_REG_ADDR_BUCK0
,
483 .gpu
.abb_tx_done_mask
= OMAP_ABB_GPU_TXDONE_MASK
,
486 * The DSPEVE and IVA rails are grouped on DRA71x-evm
487 * and are powered by BUCK1 of LP873X PMIC
489 .eve
.value
[OPP_NOM
] = VDD_EVE_DRA7_NOM
,
490 .eve
.value
[OPP_HIGH
] = VDD_EVE_DRA7_HIGH
,
491 .eve
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_DSPEVE_NOM
,
492 .eve
.efuse
.reg
[OPP_HIGH
] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH
,
493 .eve
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
494 .eve
.addr
= LP873X_REG_ADDR_BUCK1
,
496 .eve
.abb_tx_done_mask
= OMAP_ABB_EVE_TXDONE_MASK
,
498 .iva
.value
[OPP_NOM
] = VDD_IVA_DRA7_NOM
,
499 .iva
.value
[OPP_HIGH
] = VDD_IVA_DRA7_HIGH
,
500 .iva
.efuse
.reg
[OPP_NOM
] = STD_FUSE_OPP_VMIN_IVA_NOM
,
501 .iva
.efuse
.reg
[OPP_HIGH
] = STD_FUSE_OPP_VMIN_IVA_HIGH
,
502 .iva
.efuse
.reg_bits
= DRA752_EFUSE_REGBITS
,
503 .iva
.addr
= LP873X_REG_ADDR_BUCK1
,
505 .iva
.abb_tx_done_mask
= OMAP_ABB_IVA_TXDONE_MASK
,
508 int get_voltrail_opp(int rail_offset
)
512 switch (rail_offset
) {
515 /* DRA71x supports only OPP_NOM for MPU */
516 if (board_is_dra71x_evm())
521 /* DRA71x supports only OPP_NOM for CORE */
522 if (board_is_dra71x_evm())
527 /* DRA71x supports only OPP_NOM for GPU */
528 if (board_is_dra71x_evm())
532 opp
= DRA7_DSPEVE_OPP
;
534 * DRA71x does not support OPP_OD for EVE.
535 * If OPP_OD is selected by menuconfig, fallback
538 if (board_is_dra71x_evm() && opp
== OPP_OD
)
544 * DRA71x does not support OPP_OD for IVA.
545 * If OPP_OD is selected by menuconfig, fallback
548 if (board_is_dra71x_evm() && opp
== OPP_OD
)
566 gd
->bd
->bi_boot_params
= (0x80000000 + 0x100); /* boot param addr */
571 int dram_init_banksize(void)
575 ram_size
= board_ti_get_emif_size();
577 gd
->bd
->bi_dram
[0].start
= CONFIG_SYS_SDRAM_BASE
;
578 gd
->bd
->bi_dram
[0].size
= get_effective_memsize();
579 if (ram_size
> CONFIG_MAX_MEM_MAPPED
) {
580 gd
->bd
->bi_dram
[1].start
= 0x200000000;
581 gd
->bd
->bi_dram
[1].size
= ram_size
- CONFIG_MAX_MEM_MAPPED
;
587 int board_late_init(void)
589 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
590 char *name
= "unknown";
593 if (board_is_dra72x_revc_or_later())
594 name
= "dra72x-revc";
595 else if (board_is_dra71x_evm())
599 } else if (is_dra76x()) {
605 set_board_info_env(name
);
608 * Default FIT boot on HS devices. Non FIT images are not allowed
611 if (get_device_type() == HS_DEVICE
)
612 env_set("boot_fit", "1");
614 omap_die_id_serial();
615 omap_set_fastboot_vars();
620 #ifdef CONFIG_SPL_BUILD
621 void do_board_detect(void)
625 rc
= ti_i2c_eeprom_dra7_get(CONFIG_EEPROM_BUS_ADDRESS
,
626 CONFIG_EEPROM_CHIP_ADDRESS
);
628 printf("ti_i2c_eeprom_init failed %d\n", rc
);
633 void do_board_detect(void)
638 rc
= ti_i2c_eeprom_dra7_get(CONFIG_EEPROM_BUS_ADDRESS
,
639 CONFIG_EEPROM_CHIP_ADDRESS
);
641 printf("ti_i2c_eeprom_init failed %d\n", rc
);
643 if (board_is_dra74x_evm()) {
644 bname
= "DRA74x EVM";
645 } else if (board_is_dra72x_evm()) {
646 bname
= "DRA72x EVM";
647 } else if (board_is_dra71x_evm()) {
648 bname
= "DRA71x EVM";
649 } else if (board_is_dra76x_evm()) {
650 bname
= "DRA76x EVM";
652 /* If EEPROM is not populated */
654 bname
= "DRA72x EVM";
656 bname
= "DRA74x EVM";
660 snprintf(sysinfo
.board_string
, SYSINFO_BOARD_NAME_MAX_LEN
,
661 "Board: %s REV %s\n", bname
, board_ti_get_rev());
663 #endif /* CONFIG_SPL_BUILD */
665 void vcores_init(void)
667 if (board_is_dra74x_evm()) {
668 *omap_vcores
= &dra752_volts
;
669 } else if (board_is_dra72x_evm()) {
670 *omap_vcores
= &dra722_volts
;
671 } else if (board_is_dra71x_evm()) {
672 *omap_vcores
= &dra718_volts
;
673 } else if (board_is_dra76x_evm()) {
674 *omap_vcores
= &dra76x_volts
;
676 /* If EEPROM is not populated */
678 *omap_vcores
= &dra722_volts
;
680 *omap_vcores
= &dra752_volts
;
684 void set_muxconf_regs(void)
686 do_set_mux32((*ctrl
)->control_padconf_core_base
,
687 early_padconf
, ARRAY_SIZE(early_padconf
));
690 #ifdef CONFIG_IODELAY_RECALIBRATION
691 void recalibrate_iodelay(void)
693 struct pad_conf_entry
const *pads
, *delta_pads
= NULL
;
694 struct iodelay_cfg_entry
const *iodelay
;
695 int npads
, niodelays
, delta_npads
= 0;
698 switch (omap_revision()) {
701 pads
= dra72x_core_padconf_array_common
;
702 npads
= ARRAY_SIZE(dra72x_core_padconf_array_common
);
703 if (board_is_dra71x_evm()) {
704 pads
= dra71x_core_padconf_array
;
705 npads
= ARRAY_SIZE(dra71x_core_padconf_array
);
706 iodelay
= dra71_iodelay_cfg_array
;
707 niodelays
= ARRAY_SIZE(dra71_iodelay_cfg_array
);
708 } else if (board_is_dra72x_revc_or_later()) {
709 delta_pads
= dra72x_rgmii_padconf_array_revc
;
711 ARRAY_SIZE(dra72x_rgmii_padconf_array_revc
);
712 iodelay
= dra72_iodelay_cfg_array_revc
;
713 niodelays
= ARRAY_SIZE(dra72_iodelay_cfg_array_revc
);
715 delta_pads
= dra72x_rgmii_padconf_array_revb
;
717 ARRAY_SIZE(dra72x_rgmii_padconf_array_revb
);
718 iodelay
= dra72_iodelay_cfg_array_revb
;
719 niodelays
= ARRAY_SIZE(dra72_iodelay_cfg_array_revb
);
724 pads
= dra74x_core_padconf_array
;
725 npads
= ARRAY_SIZE(dra74x_core_padconf_array
);
726 iodelay
= dra742_es1_1_iodelay_cfg_array
;
727 niodelays
= ARRAY_SIZE(dra742_es1_1_iodelay_cfg_array
);
731 pads
= dra74x_core_padconf_array
;
732 npads
= ARRAY_SIZE(dra74x_core_padconf_array
);
733 iodelay
= dra742_es2_0_iodelay_cfg_array
;
734 niodelays
= ARRAY_SIZE(dra742_es2_0_iodelay_cfg_array
);
735 /* Setup port1 and port2 for rgmii with 'no-id' mode */
736 clrset_spare_register(1, 0, RGMII2_ID_MODE_N_MASK
|
737 RGMII1_ID_MODE_N_MASK
);
740 /* Setup I/O isolation */
741 ret
= __recalibrate_iodelay_start();
745 /* Do the muxing here */
746 do_set_mux32((*ctrl
)->control_padconf_core_base
, pads
, npads
);
748 /* Now do the weird minor deltas that should be safe */
750 do_set_mux32((*ctrl
)->control_padconf_core_base
,
751 delta_pads
, delta_npads
);
753 /* Setup IOdelay configuration */
754 ret
= do_set_iodelay((*ctrl
)->iodelay_config_base
, iodelay
, niodelays
);
756 /* Closeup.. remove isolation */
757 __recalibrate_iodelay_end(ret
);
761 #if defined(CONFIG_MMC)
762 int board_mmc_init(bd_t
*bis
)
764 omap_mmc_init(0, 0, 0, -1, -1);
765 omap_mmc_init(1, 0, 0, -1, -1);
769 void board_mmc_poweron_ldo(uint voltage
)
771 if (board_is_dra71x_evm()) {
772 if (voltage
== LDO_VOLT_3V0
)
774 else if (voltage
== LDO_VOLT_1V8
)
776 lp873x_mmc1_poweron_ldo(voltage
);
778 palmas_mmc1_poweron_ldo(LDO1_VOLTAGE
, LDO1_CTRL
, voltage
);
783 #ifdef CONFIG_USB_DWC3
784 static struct dwc3_device usb_otg_ss1
= {
785 .maximum_speed
= USB_SPEED_SUPER
,
786 .base
= DRA7_USB_OTG_SS1_BASE
,
787 .tx_fifo_resize
= false,
791 static struct dwc3_omap_device usb_otg_ss1_glue
= {
792 .base
= (void *)DRA7_USB_OTG_SS1_GLUE_BASE
,
793 .utmi_mode
= DWC3_OMAP_UTMI_MODE_SW
,
797 static struct ti_usb_phy_device usb_phy1_device
= {
798 .pll_ctrl_base
= (void *)DRA7_USB3_PHY1_PLL_CTRL
,
799 .usb2_phy_power
= (void *)DRA7_USB2_PHY1_POWER
,
800 .usb3_phy_power
= (void *)DRA7_USB3_PHY1_POWER
,
804 static struct dwc3_device usb_otg_ss2
= {
805 .maximum_speed
= USB_SPEED_SUPER
,
806 .base
= DRA7_USB_OTG_SS2_BASE
,
807 .tx_fifo_resize
= false,
811 static struct dwc3_omap_device usb_otg_ss2_glue
= {
812 .base
= (void *)DRA7_USB_OTG_SS2_GLUE_BASE
,
813 .utmi_mode
= DWC3_OMAP_UTMI_MODE_SW
,
817 static struct ti_usb_phy_device usb_phy2_device
= {
818 .usb2_phy_power
= (void *)DRA7_USB2_PHY2_POWER
,
822 int omap_xhci_board_usb_init(int index
, enum usb_init_type init
)
824 enable_usb_clocks(index
);
827 if (init
== USB_INIT_DEVICE
) {
828 usb_otg_ss1
.dr_mode
= USB_DR_MODE_PERIPHERAL
;
829 usb_otg_ss1_glue
.vbus_id_status
= OMAP_DWC3_VBUS_VALID
;
831 usb_otg_ss1
.dr_mode
= USB_DR_MODE_HOST
;
832 usb_otg_ss1_glue
.vbus_id_status
= OMAP_DWC3_ID_GROUND
;
835 ti_usb_phy_uboot_init(&usb_phy1_device
);
836 dwc3_omap_uboot_init(&usb_otg_ss1_glue
);
837 dwc3_uboot_init(&usb_otg_ss1
);
840 if (init
== USB_INIT_DEVICE
) {
841 usb_otg_ss2
.dr_mode
= USB_DR_MODE_PERIPHERAL
;
842 usb_otg_ss2_glue
.vbus_id_status
= OMAP_DWC3_VBUS_VALID
;
844 usb_otg_ss2
.dr_mode
= USB_DR_MODE_HOST
;
845 usb_otg_ss2_glue
.vbus_id_status
= OMAP_DWC3_ID_GROUND
;
848 ti_usb_phy_uboot_init(&usb_phy2_device
);
849 dwc3_omap_uboot_init(&usb_otg_ss2_glue
);
850 dwc3_uboot_init(&usb_otg_ss2
);
853 printf("Invalid Controller Index\n");
859 int omap_xhci_board_usb_cleanup(int index
, enum usb_init_type init
)
864 ti_usb_phy_uboot_exit(index
);
865 dwc3_uboot_exit(index
);
866 dwc3_omap_uboot_exit(index
);
869 printf("Invalid Controller Index\n");
871 disable_usb_clocks(index
);
875 int usb_gadget_handle_interrupts(int index
)
879 status
= dwc3_omap_uboot_interrupt_status(index
);
881 dwc3_uboot_handle_interrupt(index
);
887 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_OS_BOOT)
888 int spl_start_uboot(void)
890 /* break into full u-boot on 'c' */
891 if (serial_tstc() && serial_getc() == 'c')
894 #ifdef CONFIG_SPL_ENV_SUPPORT
897 if (env_get_yesno("boot_os") != 1)
905 #ifdef CONFIG_DRIVER_TI_CPSW
906 extern u32
*const omap_si_rev
;
908 static void cpsw_control(int enabled
)
910 /* VTP can be added here */
915 static struct cpsw_slave_data cpsw_slaves
[] = {
917 .slave_reg_ofs
= 0x208,
918 .sliver_reg_ofs
= 0xd80,
922 .slave_reg_ofs
= 0x308,
923 .sliver_reg_ofs
= 0xdc0,
928 static struct cpsw_platform_data cpsw_data
= {
929 .mdio_base
= CPSW_MDIO_BASE
,
930 .cpsw_base
= CPSW_BASE
,
933 .cpdma_reg_ofs
= 0x800,
935 .slave_data
= cpsw_slaves
,
936 .ale_reg_ofs
= 0xd00,
938 .host_port_reg_ofs
= 0x108,
939 .hw_stats_reg_ofs
= 0x900,
940 .bd_ram_ofs
= 0x2000,
941 .mac_control
= (1 << 5),
942 .control
= cpsw_control
,
944 .version
= CPSW_CTRL_VERSION_2
,
947 int board_eth_init(bd_t
*bis
)
951 uint32_t mac_hi
, mac_lo
;
954 /* try reading mac address from efuse */
955 mac_lo
= readl((*ctrl
)->control_core_mac_id_0_lo
);
956 mac_hi
= readl((*ctrl
)->control_core_mac_id_0_hi
);
957 mac_addr
[0] = (mac_hi
& 0xFF0000) >> 16;
958 mac_addr
[1] = (mac_hi
& 0xFF00) >> 8;
959 mac_addr
[2] = mac_hi
& 0xFF;
960 mac_addr
[3] = (mac_lo
& 0xFF0000) >> 16;
961 mac_addr
[4] = (mac_lo
& 0xFF00) >> 8;
962 mac_addr
[5] = mac_lo
& 0xFF;
964 if (!env_get("ethaddr")) {
965 printf("<ethaddr> not set. Validating first E-fuse MAC\n");
967 if (is_valid_ethaddr(mac_addr
))
968 eth_env_set_enetaddr("ethaddr", mac_addr
);
971 mac_lo
= readl((*ctrl
)->control_core_mac_id_1_lo
);
972 mac_hi
= readl((*ctrl
)->control_core_mac_id_1_hi
);
973 mac_addr
[0] = (mac_hi
& 0xFF0000) >> 16;
974 mac_addr
[1] = (mac_hi
& 0xFF00) >> 8;
975 mac_addr
[2] = mac_hi
& 0xFF;
976 mac_addr
[3] = (mac_lo
& 0xFF0000) >> 16;
977 mac_addr
[4] = (mac_lo
& 0xFF00) >> 8;
978 mac_addr
[5] = mac_lo
& 0xFF;
980 if (!env_get("eth1addr")) {
981 if (is_valid_ethaddr(mac_addr
))
982 eth_env_set_enetaddr("eth1addr", mac_addr
);
985 ctrl_val
= readl((*ctrl
)->control_core_control_io1
) & (~0x33);
987 writel(ctrl_val
, (*ctrl
)->control_core_control_io1
);
989 if (*omap_si_rev
== DRA722_ES1_0
)
990 cpsw_data
.active_slave
= 1;
992 if (board_is_dra72x_revc_or_later()) {
993 cpsw_slaves
[0].phy_if
= PHY_INTERFACE_MODE_RGMII_ID
;
994 cpsw_slaves
[1].phy_if
= PHY_INTERFACE_MODE_RGMII_ID
;
997 ret
= cpsw_register(&cpsw_data
);
999 printf("Error %d registering CPSW switch\n", ret
);
1005 #ifdef CONFIG_BOARD_EARLY_INIT_F
1006 /* VTT regulator enable */
1007 static inline void vtt_regulator_enable(void)
1009 if (omap_hw_init_context() == OMAP_INIT_CONTEXT_UBOOT_AFTER_SPL
)
1012 /* Do not enable VTT for DRA722 */
1017 * EVM Rev G and later use gpio7_11 for DDR3 termination.
1018 * This is safe enough to do on older revs.
1020 gpio_request(GPIO_DDR_VTT_EN
, "ddr_vtt_en");
1021 gpio_direction_output(GPIO_DDR_VTT_EN
, 1);
1024 int board_early_init_f(void)
1026 vtt_regulator_enable();
1031 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
1032 int ft_board_setup(void *blob
, bd_t
*bd
)
1034 ft_cpu_setup(blob
, bd
);
1040 #ifdef CONFIG_SPL_LOAD_FIT
1041 int board_fit_config_name_match(const char *name
)
1044 if (board_is_dra71x_evm()) {
1045 if (!strcmp(name
, "dra71-evm"))
1047 }else if(board_is_dra72x_revc_or_later()) {
1048 if (!strcmp(name
, "dra72-evm-revc"))
1050 } else if (!strcmp(name
, "dra72-evm")) {
1053 } else if (!is_dra72x() && !strcmp(name
, "dra7-evm")) {
1061 #ifdef CONFIG_TI_SECURE_DEVICE
1062 void board_fit_image_post_process(void **p_image
, size_t *p_size
)
1064 secure_boot_verify_image(p_image
, p_size
);
1067 void board_tee_image_process(ulong tee_image
, size_t tee_size
)
1069 secure_tee_install((u32
)tee_image
);
1072 U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_TEE
, board_tee_image_process
);