183d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
2fbf2728dSLokesh Vutla /*
3fbf2728dSLokesh Vutla * board.c
4fbf2728dSLokesh Vutla *
5fbf2728dSLokesh Vutla * Board functions for TI AM43XX based boards
6fbf2728dSLokesh Vutla *
7fbf2728dSLokesh Vutla * Copyright (C) 2013, Texas Instruments, Incorporated - http://www.ti.com/
8fbf2728dSLokesh Vutla */
9fbf2728dSLokesh Vutla
10fbf2728dSLokesh Vutla #include <common.h>
11*62465631SSimon Glass #include <eeprom.h>
129925f1dbSAlex Kiernan #include <environment.h>
139f1a8cd3SSekhar Nori #include <i2c.h>
141221ce45SMasahiro Yamada #include <linux/errno.h>
15fbf2728dSLokesh Vutla #include <spl.h>
169f81eb77SKishon Vijay Abraham I #include <usb.h>
17e29878fcSMadan Srinivas #include <asm/omap_sec_common.h>
183b34ac13SLokesh Vutla #include <asm/arch/clock.h>
19fbf2728dSLokesh Vutla #include <asm/arch/sys_proto.h>
20fbf2728dSLokesh Vutla #include <asm/arch/mux.h>
21d3daba10SLokesh Vutla #include <asm/arch/ddr_defs.h>
22b5e01eecSLokesh Vutla #include <asm/arch/gpio.h>
23d3daba10SLokesh Vutla #include <asm/emif.h>
2400bbe96eSSemen Protsenko #include <asm/omap_common.h>
255f8bb93bSNishanth Menon #include "../common/board_detect.h"
26fbf2728dSLokesh Vutla #include "board.h"
277aa5598aSTom Rini #include <power/pmic.h>
2883bad102STom Rini #include <power/tps65218.h>
29403d70abSFelipe Balbi #include <power/tps62362.h>
304cdd7fdaSMugunthan V N #include <miiphy.h>
314cdd7fdaSMugunthan V N #include <cpsw.h>
329f81eb77SKishon Vijay Abraham I #include <linux/usb/gadget.h>
339f81eb77SKishon Vijay Abraham I #include <dwc3-uboot.h>
349f81eb77SKishon Vijay Abraham I #include <dwc3-omap-uboot.h>
359f81eb77SKishon Vijay Abraham I #include <ti-usb-phy-uboot.h>
36fbf2728dSLokesh Vutla
37fbf2728dSLokesh Vutla DECLARE_GLOBAL_DATA_PTR;
38fbf2728dSLokesh Vutla
394cdd7fdaSMugunthan V N static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
404cdd7fdaSMugunthan V N
419f1a8cd3SSekhar Nori /*
429f1a8cd3SSekhar Nori * Read header information from EEPROM into global structure.
439f1a8cd3SSekhar Nori */
44140d76a9SLokesh Vutla #ifdef CONFIG_TI_I2C_BOARD_DETECT
do_board_detect(void)45140d76a9SLokesh Vutla void do_board_detect(void)
469f1a8cd3SSekhar Nori {
471514244cSJean-Jacques Hiblot /* Ensure I2C is initialized for EEPROM access*/
481514244cSJean-Jacques Hiblot gpi2c_init();
4964a144dcSSimon Glass if (ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS,
5064a144dcSSimon Glass CONFIG_EEPROM_CHIP_ADDRESS))
51140d76a9SLokesh Vutla printf("ti_i2c_eeprom_init failed\n");
529f1a8cd3SSekhar Nori }
53140d76a9SLokesh Vutla #endif
549f1a8cd3SSekhar Nori
557a5f71bcSSourav Poddar #ifndef CONFIG_SKIP_LOWLEVEL_INIT
56fbf2728dSLokesh Vutla
57cf04d032SLokesh Vutla const struct dpll_params dpll_mpu[NUM_CRYSTAL_FREQ][NUM_OPPS] = {
58cf04d032SLokesh Vutla { /* 19.2 MHz */
59e2a6207bSJames Doublesin {125, 3, 2, -1, -1, -1, -1}, /* OPP 50 */
60cf04d032SLokesh Vutla {-1, -1, -1, -1, -1, -1, -1}, /* OPP RESERVED */
61e2a6207bSJames Doublesin {125, 3, 1, -1, -1, -1, -1}, /* OPP 100 */
62e2a6207bSJames Doublesin {150, 3, 1, -1, -1, -1, -1}, /* OPP 120 */
63e2a6207bSJames Doublesin {125, 2, 1, -1, -1, -1, -1}, /* OPP TB */
64e2a6207bSJames Doublesin {625, 11, 1, -1, -1, -1, -1} /* OPP NT */
65cf04d032SLokesh Vutla },
66cf04d032SLokesh Vutla { /* 24 MHz */
67cf04d032SLokesh Vutla {300, 23, 1, -1, -1, -1, -1}, /* OPP 50 */
68cf04d032SLokesh Vutla {-1, -1, -1, -1, -1, -1, -1}, /* OPP RESERVED */
69cf04d032SLokesh Vutla {600, 23, 1, -1, -1, -1, -1}, /* OPP 100 */
70cf04d032SLokesh Vutla {720, 23, 1, -1, -1, -1, -1}, /* OPP 120 */
71cf04d032SLokesh Vutla {800, 23, 1, -1, -1, -1, -1}, /* OPP TB */
72cf04d032SLokesh Vutla {1000, 23, 1, -1, -1, -1, -1} /* OPP NT */
73cf04d032SLokesh Vutla },
74cf04d032SLokesh Vutla { /* 25 MHz */
75cf04d032SLokesh Vutla {300, 24, 1, -1, -1, -1, -1}, /* OPP 50 */
76cf04d032SLokesh Vutla {-1, -1, -1, -1, -1, -1, -1}, /* OPP RESERVED */
77cf04d032SLokesh Vutla {600, 24, 1, -1, -1, -1, -1}, /* OPP 100 */
78cf04d032SLokesh Vutla {720, 24, 1, -1, -1, -1, -1}, /* OPP 120 */
79cf04d032SLokesh Vutla {800, 24, 1, -1, -1, -1, -1}, /* OPP TB */
80cf04d032SLokesh Vutla {1000, 24, 1, -1, -1, -1, -1} /* OPP NT */
81cf04d032SLokesh Vutla },
82cf04d032SLokesh Vutla { /* 26 MHz */
83cf04d032SLokesh Vutla {300, 25, 1, -1, -1, -1, -1}, /* OPP 50 */
84cf04d032SLokesh Vutla {-1, -1, -1, -1, -1, -1, -1}, /* OPP RESERVED */
85cf04d032SLokesh Vutla {600, 25, 1, -1, -1, -1, -1}, /* OPP 100 */
86cf04d032SLokesh Vutla {720, 25, 1, -1, -1, -1, -1}, /* OPP 120 */
87cf04d032SLokesh Vutla {800, 25, 1, -1, -1, -1, -1}, /* OPP TB */
88cf04d032SLokesh Vutla {1000, 25, 1, -1, -1, -1, -1} /* OPP NT */
89cf04d032SLokesh Vutla },
90cf04d032SLokesh Vutla };
91cf04d032SLokesh Vutla
92cf04d032SLokesh Vutla const struct dpll_params dpll_core[NUM_CRYSTAL_FREQ] = {
93e2a6207bSJames Doublesin {625, 11, -1, -1, 10, 8, 4}, /* 19.2 MHz */
94cf04d032SLokesh Vutla {1000, 23, -1, -1, 10, 8, 4}, /* 24 MHz */
95cf04d032SLokesh Vutla {1000, 24, -1, -1, 10, 8, 4}, /* 25 MHz */
96cf04d032SLokesh Vutla {1000, 25, -1, -1, 10, 8, 4} /* 26 MHz */
97cf04d032SLokesh Vutla };
98cf04d032SLokesh Vutla
99cf04d032SLokesh Vutla const struct dpll_params dpll_per[NUM_CRYSTAL_FREQ] = {
100e2a6207bSJames Doublesin {400, 7, 5, -1, -1, -1, -1}, /* 19.2 MHz */
101e2a6207bSJames Doublesin {400, 9, 5, -1, -1, -1, -1}, /* 24 MHz */
102c87b6a96SJames Doublesin {384, 9, 5, -1, -1, -1, -1}, /* 25 MHz */
103e2a6207bSJames Doublesin {480, 12, 5, -1, -1, -1, -1} /* 26 MHz */
104cf04d032SLokesh Vutla };
105cf04d032SLokesh Vutla
106e2a6207bSJames Doublesin const struct dpll_params epos_evm_dpll_ddr[NUM_CRYSTAL_FREQ] = {
107e2a6207bSJames Doublesin {665, 47, 1, -1, 4, -1, -1}, /*19.2*/
108e2a6207bSJames Doublesin {133, 11, 1, -1, 4, -1, -1}, /* 24 MHz */
109e2a6207bSJames Doublesin {266, 24, 1, -1, 4, -1, -1}, /* 25 MHz */
110e2a6207bSJames Doublesin {133, 12, 1, -1, 4, -1, -1} /* 26 MHz */
111e2a6207bSJames Doublesin };
112cf04d032SLokesh Vutla
113cf04d032SLokesh Vutla const struct dpll_params gp_evm_dpll_ddr = {
114e2a6207bSJames Doublesin 50, 2, 1, -1, 2, -1, -1};
115fbf2728dSLokesh Vutla
116403d70abSFelipe Balbi static const struct dpll_params idk_dpll_ddr = {
117403d70abSFelipe Balbi 400, 23, 1, -1, 2, -1, -1
118403d70abSFelipe Balbi };
119403d70abSFelipe Balbi
1207c352cd3STom Rini static const u32 ext_phy_ctrl_const_base_lpddr2[] = {
1217c352cd3STom Rini 0x00500050,
1227c352cd3STom Rini 0x00350035,
1237c352cd3STom Rini 0x00350035,
1247c352cd3STom Rini 0x00350035,
1257c352cd3STom Rini 0x00350035,
1267c352cd3STom Rini 0x00350035,
1277c352cd3STom Rini 0x00000000,
1287c352cd3STom Rini 0x00000000,
1297c352cd3STom Rini 0x00000000,
1307c352cd3STom Rini 0x00000000,
1317c352cd3STom Rini 0x00000000,
1327c352cd3STom Rini 0x00000000,
1337c352cd3STom Rini 0x00000000,
1347c352cd3STom Rini 0x00000000,
1357c352cd3STom Rini 0x00000000,
1367c352cd3STom Rini 0x00000000,
1377c352cd3STom Rini 0x00000000,
1387c352cd3STom Rini 0x00000000,
1397c352cd3STom Rini 0x40001000,
1407c352cd3STom Rini 0x08102040
1417c352cd3STom Rini };
1427c352cd3STom Rini
143d3daba10SLokesh Vutla const struct ctrl_ioregs ioregs_lpddr2 = {
144d3daba10SLokesh Vutla .cm0ioctl = LPDDR2_ADDRCTRL_IOCTRL_VALUE,
145d3daba10SLokesh Vutla .cm1ioctl = LPDDR2_ADDRCTRL_WD0_IOCTRL_VALUE,
146d3daba10SLokesh Vutla .cm2ioctl = LPDDR2_ADDRCTRL_WD1_IOCTRL_VALUE,
147d3daba10SLokesh Vutla .dt0ioctl = LPDDR2_DATA0_IOCTRL_VALUE,
148d3daba10SLokesh Vutla .dt1ioctl = LPDDR2_DATA0_IOCTRL_VALUE,
149d3daba10SLokesh Vutla .dt2ioctrl = LPDDR2_DATA0_IOCTRL_VALUE,
150d3daba10SLokesh Vutla .dt3ioctrl = LPDDR2_DATA0_IOCTRL_VALUE,
151d3daba10SLokesh Vutla .emif_sdram_config_ext = 0x1,
152d3daba10SLokesh Vutla };
153d3daba10SLokesh Vutla
154d3daba10SLokesh Vutla const struct emif_regs emif_regs_lpddr2 = {
155d3daba10SLokesh Vutla .sdram_config = 0x808012BA,
156d3daba10SLokesh Vutla .ref_ctrl = 0x0000040D,
157d3daba10SLokesh Vutla .sdram_tim1 = 0xEA86B411,
158d3daba10SLokesh Vutla .sdram_tim2 = 0x103A094A,
159d3daba10SLokesh Vutla .sdram_tim3 = 0x0F6BA37F,
160d3daba10SLokesh Vutla .read_idle_ctrl = 0x00050000,
161d3daba10SLokesh Vutla .zq_config = 0x50074BE4,
162d3daba10SLokesh Vutla .temp_alert_config = 0x0,
163d3daba10SLokesh Vutla .emif_rd_wr_lvl_rmp_win = 0x0,
164d3daba10SLokesh Vutla .emif_rd_wr_lvl_rmp_ctl = 0x0,
165d3daba10SLokesh Vutla .emif_rd_wr_lvl_ctl = 0x0,
166e2a6207bSJames Doublesin .emif_ddr_phy_ctlr_1 = 0x0E284006,
1678038b497SCooper Jr., Franklin .emif_rd_wr_exec_thresh = 0x80000405,
168d3daba10SLokesh Vutla .emif_ddr_ext_phy_ctrl_1 = 0x04010040,
169d3daba10SLokesh Vutla .emif_ddr_ext_phy_ctrl_2 = 0x00500050,
170d3daba10SLokesh Vutla .emif_ddr_ext_phy_ctrl_3 = 0x00500050,
171d3daba10SLokesh Vutla .emif_ddr_ext_phy_ctrl_4 = 0x00500050,
1728038b497SCooper Jr., Franklin .emif_ddr_ext_phy_ctrl_5 = 0x00500050,
1738038b497SCooper Jr., Franklin .emif_prio_class_serv_map = 0x80000001,
1748038b497SCooper Jr., Franklin .emif_connect_id_serv_1_map = 0x80000094,
1758038b497SCooper Jr., Franklin .emif_connect_id_serv_2_map = 0x00000000,
1768038b497SCooper Jr., Franklin .emif_cos_config = 0x000FFFFF
177d3daba10SLokesh Vutla };
178d3daba10SLokesh Vutla
179b5e01eecSLokesh Vutla const struct ctrl_ioregs ioregs_ddr3 = {
180b5e01eecSLokesh Vutla .cm0ioctl = DDR3_ADDRCTRL_IOCTRL_VALUE,
181b5e01eecSLokesh Vutla .cm1ioctl = DDR3_ADDRCTRL_WD0_IOCTRL_VALUE,
182b5e01eecSLokesh Vutla .cm2ioctl = DDR3_ADDRCTRL_WD1_IOCTRL_VALUE,
183b5e01eecSLokesh Vutla .dt0ioctl = DDR3_DATA0_IOCTRL_VALUE,
184b5e01eecSLokesh Vutla .dt1ioctl = DDR3_DATA0_IOCTRL_VALUE,
185b5e01eecSLokesh Vutla .dt2ioctrl = DDR3_DATA0_IOCTRL_VALUE,
186b5e01eecSLokesh Vutla .dt3ioctrl = DDR3_DATA0_IOCTRL_VALUE,
187e2a6207bSJames Doublesin .emif_sdram_config_ext = 0xc163,
188b5e01eecSLokesh Vutla };
189b5e01eecSLokesh Vutla
190b5e01eecSLokesh Vutla const struct emif_regs ddr3_emif_regs_400Mhz = {
191b5e01eecSLokesh Vutla .sdram_config = 0x638413B2,
192b5e01eecSLokesh Vutla .ref_ctrl = 0x00000C30,
193b5e01eecSLokesh Vutla .sdram_tim1 = 0xEAAAD4DB,
194b5e01eecSLokesh Vutla .sdram_tim2 = 0x266B7FDA,
195b5e01eecSLokesh Vutla .sdram_tim3 = 0x107F8678,
196b5e01eecSLokesh Vutla .read_idle_ctrl = 0x00050000,
197b5e01eecSLokesh Vutla .zq_config = 0x50074BE4,
198b5e01eecSLokesh Vutla .temp_alert_config = 0x0,
199e27f2dd7SLokesh Vutla .emif_ddr_phy_ctlr_1 = 0x0E004008,
200b5e01eecSLokesh Vutla .emif_ddr_ext_phy_ctrl_1 = 0x08020080,
201b5e01eecSLokesh Vutla .emif_ddr_ext_phy_ctrl_2 = 0x00400040,
202b5e01eecSLokesh Vutla .emif_ddr_ext_phy_ctrl_3 = 0x00400040,
203b5e01eecSLokesh Vutla .emif_ddr_ext_phy_ctrl_4 = 0x00400040,
204b5e01eecSLokesh Vutla .emif_ddr_ext_phy_ctrl_5 = 0x00400040,
205b5e01eecSLokesh Vutla .emif_rd_wr_lvl_rmp_win = 0x0,
206b5e01eecSLokesh Vutla .emif_rd_wr_lvl_rmp_ctl = 0x0,
207b5e01eecSLokesh Vutla .emif_rd_wr_lvl_ctl = 0x0,
2088038b497SCooper Jr., Franklin .emif_rd_wr_exec_thresh = 0x80000405,
2098038b497SCooper Jr., Franklin .emif_prio_class_serv_map = 0x80000001,
2108038b497SCooper Jr., Franklin .emif_connect_id_serv_1_map = 0x80000094,
2118038b497SCooper Jr., Franklin .emif_connect_id_serv_2_map = 0x00000000,
2128038b497SCooper Jr., Franklin .emif_cos_config = 0x000FFFFF
213b5e01eecSLokesh Vutla };
214b5e01eecSLokesh Vutla
2152c952111SFranklin S. Cooper Jr /* EMIF DDR3 Configurations are different for beta AM43X GP EVMs */
2162c952111SFranklin S. Cooper Jr const struct emif_regs ddr3_emif_regs_400Mhz_beta = {
2172c952111SFranklin S. Cooper Jr .sdram_config = 0x638413B2,
2182c952111SFranklin S. Cooper Jr .ref_ctrl = 0x00000C30,
2192c952111SFranklin S. Cooper Jr .sdram_tim1 = 0xEAAAD4DB,
2202c952111SFranklin S. Cooper Jr .sdram_tim2 = 0x266B7FDA,
2212c952111SFranklin S. Cooper Jr .sdram_tim3 = 0x107F8678,
2222c952111SFranklin S. Cooper Jr .read_idle_ctrl = 0x00050000,
2232c952111SFranklin S. Cooper Jr .zq_config = 0x50074BE4,
2242c952111SFranklin S. Cooper Jr .temp_alert_config = 0x0,
2252c952111SFranklin S. Cooper Jr .emif_ddr_phy_ctlr_1 = 0x0E004008,
2262c952111SFranklin S. Cooper Jr .emif_ddr_ext_phy_ctrl_1 = 0x08020080,
2272c952111SFranklin S. Cooper Jr .emif_ddr_ext_phy_ctrl_2 = 0x00000065,
2282c952111SFranklin S. Cooper Jr .emif_ddr_ext_phy_ctrl_3 = 0x00000091,
2292c952111SFranklin S. Cooper Jr .emif_ddr_ext_phy_ctrl_4 = 0x000000B5,
2302c952111SFranklin S. Cooper Jr .emif_ddr_ext_phy_ctrl_5 = 0x000000E5,
2318038b497SCooper Jr., Franklin .emif_rd_wr_exec_thresh = 0x80000405,
2328038b497SCooper Jr., Franklin .emif_prio_class_serv_map = 0x80000001,
2338038b497SCooper Jr., Franklin .emif_connect_id_serv_1_map = 0x80000094,
2348038b497SCooper Jr., Franklin .emif_connect_id_serv_2_map = 0x00000000,
2358038b497SCooper Jr., Franklin .emif_cos_config = 0x000FFFFF
2362c952111SFranklin S. Cooper Jr };
2372c952111SFranklin S. Cooper Jr
2382c952111SFranklin S. Cooper Jr /* EMIF DDR3 Configurations are different for production AM43X GP EVMs */
2392c952111SFranklin S. Cooper Jr const struct emif_regs ddr3_emif_regs_400Mhz_production = {
2402c952111SFranklin S. Cooper Jr .sdram_config = 0x638413B2,
2412c952111SFranklin S. Cooper Jr .ref_ctrl = 0x00000C30,
2422c952111SFranklin S. Cooper Jr .sdram_tim1 = 0xEAAAD4DB,
2432c952111SFranklin S. Cooper Jr .sdram_tim2 = 0x266B7FDA,
2442c952111SFranklin S. Cooper Jr .sdram_tim3 = 0x107F8678,
2452c952111SFranklin S. Cooper Jr .read_idle_ctrl = 0x00050000,
2462c952111SFranklin S. Cooper Jr .zq_config = 0x50074BE4,
2472c952111SFranklin S. Cooper Jr .temp_alert_config = 0x0,
2482c952111SFranklin S. Cooper Jr .emif_ddr_phy_ctlr_1 = 0x0E004008,
2492c952111SFranklin S. Cooper Jr .emif_ddr_ext_phy_ctrl_1 = 0x08020080,
2502c952111SFranklin S. Cooper Jr .emif_ddr_ext_phy_ctrl_2 = 0x00000066,
2512c952111SFranklin S. Cooper Jr .emif_ddr_ext_phy_ctrl_3 = 0x00000091,
2522c952111SFranklin S. Cooper Jr .emif_ddr_ext_phy_ctrl_4 = 0x000000B9,
2532c952111SFranklin S. Cooper Jr .emif_ddr_ext_phy_ctrl_5 = 0x000000E6,
2548038b497SCooper Jr., Franklin .emif_rd_wr_exec_thresh = 0x80000405,
2558038b497SCooper Jr., Franklin .emif_prio_class_serv_map = 0x80000001,
2568038b497SCooper Jr., Franklin .emif_connect_id_serv_1_map = 0x80000094,
2578038b497SCooper Jr., Franklin .emif_connect_id_serv_2_map = 0x00000000,
2588038b497SCooper Jr., Franklin .emif_cos_config = 0x000FFFFF
2592c952111SFranklin S. Cooper Jr };
2602c952111SFranklin S. Cooper Jr
2619cb9f333SFelipe Balbi static const struct emif_regs ddr3_sk_emif_regs_400Mhz = {
2629cb9f333SFelipe Balbi .sdram_config = 0x638413b2,
2639cb9f333SFelipe Balbi .sdram_config2 = 0x00000000,
2649cb9f333SFelipe Balbi .ref_ctrl = 0x00000c30,
2659cb9f333SFelipe Balbi .sdram_tim1 = 0xeaaad4db,
2669cb9f333SFelipe Balbi .sdram_tim2 = 0x266b7fda,
2679cb9f333SFelipe Balbi .sdram_tim3 = 0x107f8678,
2689cb9f333SFelipe Balbi .read_idle_ctrl = 0x00050000,
2699cb9f333SFelipe Balbi .zq_config = 0x50074be4,
2709cb9f333SFelipe Balbi .temp_alert_config = 0x0,
2719cb9f333SFelipe Balbi .emif_ddr_phy_ctlr_1 = 0x0e084008,
2729cb9f333SFelipe Balbi .emif_ddr_ext_phy_ctrl_1 = 0x08020080,
2739cb9f333SFelipe Balbi .emif_ddr_ext_phy_ctrl_2 = 0x89,
2749cb9f333SFelipe Balbi .emif_ddr_ext_phy_ctrl_3 = 0x90,
2759cb9f333SFelipe Balbi .emif_ddr_ext_phy_ctrl_4 = 0x8e,
2769cb9f333SFelipe Balbi .emif_ddr_ext_phy_ctrl_5 = 0x8d,
2779cb9f333SFelipe Balbi .emif_rd_wr_lvl_rmp_win = 0x0,
2789cb9f333SFelipe Balbi .emif_rd_wr_lvl_rmp_ctl = 0x00000000,
2799cb9f333SFelipe Balbi .emif_rd_wr_lvl_ctl = 0x00000000,
2808038b497SCooper Jr., Franklin .emif_rd_wr_exec_thresh = 0x80000000,
2818038b497SCooper Jr., Franklin .emif_prio_class_serv_map = 0x80000001,
2828038b497SCooper Jr., Franklin .emif_connect_id_serv_1_map = 0x80000094,
2838038b497SCooper Jr., Franklin .emif_connect_id_serv_2_map = 0x00000000,
2848038b497SCooper Jr., Franklin .emif_cos_config = 0x000FFFFF
2859cb9f333SFelipe Balbi };
2869cb9f333SFelipe Balbi
287403d70abSFelipe Balbi static const struct emif_regs ddr3_idk_emif_regs_400Mhz = {
288403d70abSFelipe Balbi .sdram_config = 0x61a11b32,
289403d70abSFelipe Balbi .sdram_config2 = 0x00000000,
290403d70abSFelipe Balbi .ref_ctrl = 0x00000c30,
291403d70abSFelipe Balbi .sdram_tim1 = 0xeaaad4db,
292403d70abSFelipe Balbi .sdram_tim2 = 0x266b7fda,
293403d70abSFelipe Balbi .sdram_tim3 = 0x107f8678,
294403d70abSFelipe Balbi .read_idle_ctrl = 0x00050000,
295403d70abSFelipe Balbi .zq_config = 0x50074be4,
296403d70abSFelipe Balbi .temp_alert_config = 0x00000000,
297403d70abSFelipe Balbi .emif_ddr_phy_ctlr_1 = 0x00008009,
298403d70abSFelipe Balbi .emif_ddr_ext_phy_ctrl_1 = 0x08020080,
299403d70abSFelipe Balbi .emif_ddr_ext_phy_ctrl_2 = 0x00000040,
300403d70abSFelipe Balbi .emif_ddr_ext_phy_ctrl_3 = 0x0000003e,
301403d70abSFelipe Balbi .emif_ddr_ext_phy_ctrl_4 = 0x00000051,
302403d70abSFelipe Balbi .emif_ddr_ext_phy_ctrl_5 = 0x00000051,
303403d70abSFelipe Balbi .emif_rd_wr_lvl_rmp_win = 0x00000000,
304403d70abSFelipe Balbi .emif_rd_wr_lvl_rmp_ctl = 0x00000000,
305403d70abSFelipe Balbi .emif_rd_wr_lvl_ctl = 0x00000000,
306403d70abSFelipe Balbi .emif_rd_wr_exec_thresh = 0x00000405,
307403d70abSFelipe Balbi .emif_prio_class_serv_map = 0x00000000,
308403d70abSFelipe Balbi .emif_connect_id_serv_1_map = 0x00000000,
309403d70abSFelipe Balbi .emif_connect_id_serv_2_map = 0x00000000,
310403d70abSFelipe Balbi .emif_cos_config = 0x00ffffff
311403d70abSFelipe Balbi };
312403d70abSFelipe Balbi
emif_get_ext_phy_ctrl_const_regs(const u32 ** regs,u32 * size)3137c352cd3STom Rini void emif_get_ext_phy_ctrl_const_regs(const u32 **regs, u32 *size)
3147c352cd3STom Rini {
3157c352cd3STom Rini if (board_is_eposevm()) {
3167c352cd3STom Rini *regs = ext_phy_ctrl_const_base_lpddr2;
3177c352cd3STom Rini *size = ARRAY_SIZE(ext_phy_ctrl_const_base_lpddr2);
3187c352cd3STom Rini }
3197c352cd3STom Rini
3207c352cd3STom Rini return;
3217c352cd3STom Rini }
3227c352cd3STom Rini
get_dpll_ddr_params(void)323e2a6207bSJames Doublesin const struct dpll_params *get_dpll_ddr_params(void)
324e2a6207bSJames Doublesin {
325e2a6207bSJames Doublesin int ind = get_sys_clk_index();
326e2a6207bSJames Doublesin
327e2a6207bSJames Doublesin if (board_is_eposevm())
328e2a6207bSJames Doublesin return &epos_evm_dpll_ddr[ind];
329a5051b72SMadan Srinivas else if (board_is_evm() || board_is_sk())
330e2a6207bSJames Doublesin return &gp_evm_dpll_ddr;
331403d70abSFelipe Balbi else if (board_is_idk())
332403d70abSFelipe Balbi return &idk_dpll_ddr;
333e2a6207bSJames Doublesin
3345f8bb93bSNishanth Menon printf(" Board '%s' not supported\n", board_ti_get_name());
335e2a6207bSJames Doublesin return NULL;
336e2a6207bSJames Doublesin }
337e2a6207bSJames Doublesin
338e2a6207bSJames Doublesin
339cf04d032SLokesh Vutla /*
340cf04d032SLokesh Vutla * get_opp_offset:
341cf04d032SLokesh Vutla * Returns the index for safest OPP of the device to boot.
342cf04d032SLokesh Vutla * max_off: Index of the MAX OPP in DEV ATTRIBUTE register.
343cf04d032SLokesh Vutla * min_off: Index of the MIN OPP in DEV ATTRIBUTE register.
344cf04d032SLokesh Vutla * This data is read from dev_attribute register which is e-fused.
345cf04d032SLokesh Vutla * A'1' in bit indicates OPP disabled and not available, a '0' indicates
346cf04d032SLokesh Vutla * OPP available. Lowest OPP starts with min_off. So returning the
347cf04d032SLokesh Vutla * bit with rightmost '0'.
348cf04d032SLokesh Vutla */
get_opp_offset(int max_off,int min_off)349cf04d032SLokesh Vutla static int get_opp_offset(int max_off, int min_off)
350cf04d032SLokesh Vutla {
351cf04d032SLokesh Vutla struct ctrl_stat *ctrl = (struct ctrl_stat *)CTRL_BASE;
352feca6e67STom Rini int opp, offset, i;
353feca6e67STom Rini
354feca6e67STom Rini /* Bits 0:11 are defined to be the MPU_MAX_FREQ */
355feca6e67STom Rini opp = readl(&ctrl->dev_attr) & ~0xFFFFF000;
356cf04d032SLokesh Vutla
357cf04d032SLokesh Vutla for (i = max_off; i >= min_off; i--) {
358cf04d032SLokesh Vutla offset = opp & (1 << i);
359cf04d032SLokesh Vutla if (!offset)
360cf04d032SLokesh Vutla return i;
361cf04d032SLokesh Vutla }
362cf04d032SLokesh Vutla
363cf04d032SLokesh Vutla return min_off;
364cf04d032SLokesh Vutla }
365cf04d032SLokesh Vutla
get_dpll_mpu_params(void)366cf04d032SLokesh Vutla const struct dpll_params *get_dpll_mpu_params(void)
367cf04d032SLokesh Vutla {
368cf04d032SLokesh Vutla int opp = get_opp_offset(DEV_ATTR_MAX_OFFSET, DEV_ATTR_MIN_OFFSET);
369cf04d032SLokesh Vutla u32 ind = get_sys_clk_index();
370cf04d032SLokesh Vutla
371cf04d032SLokesh Vutla return &dpll_mpu[ind][opp];
372cf04d032SLokesh Vutla }
373cf04d032SLokesh Vutla
get_dpll_core_params(void)374cf04d032SLokesh Vutla const struct dpll_params *get_dpll_core_params(void)
375cf04d032SLokesh Vutla {
376cf04d032SLokesh Vutla int ind = get_sys_clk_index();
377cf04d032SLokesh Vutla
378cf04d032SLokesh Vutla return &dpll_core[ind];
379cf04d032SLokesh Vutla }
380cf04d032SLokesh Vutla
get_dpll_per_params(void)381cf04d032SLokesh Vutla const struct dpll_params *get_dpll_per_params(void)
382cf04d032SLokesh Vutla {
383cf04d032SLokesh Vutla int ind = get_sys_clk_index();
384cf04d032SLokesh Vutla
385cf04d032SLokesh Vutla return &dpll_per[ind];
386fbf2728dSLokesh Vutla }
387fbf2728dSLokesh Vutla
scale_vcores_generic(u32 m)388403d70abSFelipe Balbi void scale_vcores_generic(u32 m)
38983bad102STom Rini {
390ebf48500SKeerthy int mpu_vdd, ddr_volt;
39183bad102STom Rini
3921514244cSJean-Jacques Hiblot #ifndef CONFIG_DM_I2C
39383bad102STom Rini if (i2c_probe(TPS65218_CHIP_PM))
39483bad102STom Rini return;
3951514244cSJean-Jacques Hiblot #else
3961514244cSJean-Jacques Hiblot if (power_tps65218_init(0))
3971514244cSJean-Jacques Hiblot return;
3981514244cSJean-Jacques Hiblot #endif
39983bad102STom Rini
400403d70abSFelipe Balbi switch (m) {
401068ea0a8SFelipe Balbi case 1000:
40283bad102STom Rini mpu_vdd = TPS65218_DCDC_VOLT_SEL_1330MV;
403068ea0a8SFelipe Balbi break;
404d5c082a3SFelipe Balbi case 800:
405d5c082a3SFelipe Balbi mpu_vdd = TPS65218_DCDC_VOLT_SEL_1260MV;
406d5c082a3SFelipe Balbi break;
407d5c082a3SFelipe Balbi case 720:
408d5c082a3SFelipe Balbi mpu_vdd = TPS65218_DCDC_VOLT_SEL_1200MV;
409d5c082a3SFelipe Balbi break;
410068ea0a8SFelipe Balbi case 600:
41183bad102STom Rini mpu_vdd = TPS65218_DCDC_VOLT_SEL_1100MV;
412068ea0a8SFelipe Balbi break;
413d5c082a3SFelipe Balbi case 300:
414d5c082a3SFelipe Balbi mpu_vdd = TPS65218_DCDC_VOLT_SEL_0950MV;
415d5c082a3SFelipe Balbi break;
416068ea0a8SFelipe Balbi default:
41783bad102STom Rini puts("Unknown MPU clock, not scaling\n");
41883bad102STom Rini return;
41983bad102STom Rini }
42083bad102STom Rini
42183bad102STom Rini /* Set DCDC1 (CORE) voltage to 1.1V */
42283bad102STom Rini if (tps65218_voltage_update(TPS65218_DCDC1,
42383bad102STom Rini TPS65218_DCDC_VOLT_SEL_1100MV)) {
424403d70abSFelipe Balbi printf("%s failure\n", __func__);
42583bad102STom Rini return;
42683bad102STom Rini }
42783bad102STom Rini
42883bad102STom Rini /* Set DCDC2 (MPU) voltage */
42983bad102STom Rini if (tps65218_voltage_update(TPS65218_DCDC2, mpu_vdd)) {
430403d70abSFelipe Balbi printf("%s failure\n", __func__);
43183bad102STom Rini return;
43283bad102STom Rini }
433fc69d472SKeerthy
434ebf48500SKeerthy if (board_is_eposevm())
435ebf48500SKeerthy ddr_volt = TPS65218_DCDC3_VOLT_SEL_1200MV;
436ebf48500SKeerthy else
437ebf48500SKeerthy ddr_volt = TPS65218_DCDC3_VOLT_SEL_1350MV;
438ebf48500SKeerthy
439fc69d472SKeerthy /* Set DCDC3 (DDR) voltage */
440ebf48500SKeerthy if (tps65218_voltage_update(TPS65218_DCDC3, ddr_volt)) {
441fc69d472SKeerthy printf("%s failure\n", __func__);
442fc69d472SKeerthy return;
443fc69d472SKeerthy }
44483bad102STom Rini }
44583bad102STom Rini
scale_vcores_idk(u32 m)446403d70abSFelipe Balbi void scale_vcores_idk(u32 m)
447403d70abSFelipe Balbi {
448403d70abSFelipe Balbi int mpu_vdd;
449403d70abSFelipe Balbi
4501514244cSJean-Jacques Hiblot #ifndef CONFIG_DM_I2C
451403d70abSFelipe Balbi if (i2c_probe(TPS62362_I2C_ADDR))
452403d70abSFelipe Balbi return;
4531514244cSJean-Jacques Hiblot #else
4541514244cSJean-Jacques Hiblot if (power_tps62362_init(0))
4551514244cSJean-Jacques Hiblot return;
4561514244cSJean-Jacques Hiblot #endif
457403d70abSFelipe Balbi
458403d70abSFelipe Balbi switch (m) {
459403d70abSFelipe Balbi case 1000:
460403d70abSFelipe Balbi mpu_vdd = TPS62362_DCDC_VOLT_SEL_1330MV;
461403d70abSFelipe Balbi break;
462403d70abSFelipe Balbi case 800:
463403d70abSFelipe Balbi mpu_vdd = TPS62362_DCDC_VOLT_SEL_1260MV;
464403d70abSFelipe Balbi break;
465403d70abSFelipe Balbi case 720:
466403d70abSFelipe Balbi mpu_vdd = TPS62362_DCDC_VOLT_SEL_1200MV;
467403d70abSFelipe Balbi break;
468403d70abSFelipe Balbi case 600:
469403d70abSFelipe Balbi mpu_vdd = TPS62362_DCDC_VOLT_SEL_1100MV;
470403d70abSFelipe Balbi break;
471403d70abSFelipe Balbi case 300:
472403d70abSFelipe Balbi mpu_vdd = TPS62362_DCDC_VOLT_SEL_1330MV;
473403d70abSFelipe Balbi break;
474403d70abSFelipe Balbi default:
475403d70abSFelipe Balbi puts("Unknown MPU clock, not scaling\n");
476403d70abSFelipe Balbi return;
477403d70abSFelipe Balbi }
478403d70abSFelipe Balbi /* Set VDD_MPU voltage */
479403d70abSFelipe Balbi if (tps62362_voltage_update(TPS62362_SET3, mpu_vdd)) {
480403d70abSFelipe Balbi printf("%s failure\n", __func__);
481403d70abSFelipe Balbi return;
482403d70abSFelipe Balbi }
483403d70abSFelipe Balbi }
gpi2c_init(void)4845f8bb93bSNishanth Menon void gpi2c_init(void)
4855f8bb93bSNishanth Menon {
4865f8bb93bSNishanth Menon /* When needed to be invoked prior to BSS initialization */
4875f8bb93bSNishanth Menon static bool first_time = true;
4885f8bb93bSNishanth Menon
4895f8bb93bSNishanth Menon if (first_time) {
4905f8bb93bSNishanth Menon enable_i2c0_pin_mux();
4911514244cSJean-Jacques Hiblot #ifndef CONFIG_DM_I2C
4925f8bb93bSNishanth Menon i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED,
4935f8bb93bSNishanth Menon CONFIG_SYS_OMAP24_I2C_SLAVE);
4941514244cSJean-Jacques Hiblot #endif
4955f8bb93bSNishanth Menon first_time = false;
4965f8bb93bSNishanth Menon }
4975f8bb93bSNishanth Menon }
4985f8bb93bSNishanth Menon
scale_vcores(void)499403d70abSFelipe Balbi void scale_vcores(void)
500403d70abSFelipe Balbi {
501403d70abSFelipe Balbi const struct dpll_params *mpu_params;
502403d70abSFelipe Balbi
5035f8bb93bSNishanth Menon /* Ensure I2C is initialized for PMIC configuration */
5045f8bb93bSNishanth Menon gpi2c_init();
5055f8bb93bSNishanth Menon
506403d70abSFelipe Balbi /* Get the frequency */
507403d70abSFelipe Balbi mpu_params = get_dpll_mpu_params();
508403d70abSFelipe Balbi
509403d70abSFelipe Balbi if (board_is_idk())
510403d70abSFelipe Balbi scale_vcores_idk(mpu_params->m);
511403d70abSFelipe Balbi else
512403d70abSFelipe Balbi scale_vcores_generic(mpu_params->m);
513403d70abSFelipe Balbi }
514403d70abSFelipe Balbi
set_uart_mux_conf(void)515fbf2728dSLokesh Vutla void set_uart_mux_conf(void)
516fbf2728dSLokesh Vutla {
517fbf2728dSLokesh Vutla enable_uart0_pin_mux();
518fbf2728dSLokesh Vutla }
519fbf2728dSLokesh Vutla
set_mux_conf_regs(void)520fbf2728dSLokesh Vutla void set_mux_conf_regs(void)
521fbf2728dSLokesh Vutla {
522fbf2728dSLokesh Vutla enable_board_pin_mux();
523fbf2728dSLokesh Vutla }
524fbf2728dSLokesh Vutla
enable_vtt_regulator(void)525b5e01eecSLokesh Vutla static void enable_vtt_regulator(void)
526b5e01eecSLokesh Vutla {
527b5e01eecSLokesh Vutla u32 temp;
528b5e01eecSLokesh Vutla
529b5e01eecSLokesh Vutla /* enable module */
530cd8341b7SDave Gerlach writel(GPIO_CTRL_ENABLEMODULE, AM33XX_GPIO5_BASE + OMAP_GPIO_CTRL);
531b5e01eecSLokesh Vutla
532cd8341b7SDave Gerlach /* enable output for GPIO5_7 */
533cd8341b7SDave Gerlach writel(GPIO_SETDATAOUT(7),
534cd8341b7SDave Gerlach AM33XX_GPIO5_BASE + OMAP_GPIO_SETDATAOUT);
535cd8341b7SDave Gerlach temp = readl(AM33XX_GPIO5_BASE + OMAP_GPIO_OE);
536cd8341b7SDave Gerlach temp = temp & ~(GPIO_OE_ENABLE(7));
537cd8341b7SDave Gerlach writel(temp, AM33XX_GPIO5_BASE + OMAP_GPIO_OE);
538b5e01eecSLokesh Vutla }
539b5e01eecSLokesh Vutla
5407619badbSTero Kristo enum {
5417619badbSTero Kristo RTC_BOARD_EPOS = 1,
5427619badbSTero Kristo RTC_BOARD_EVM14,
5437619badbSTero Kristo RTC_BOARD_EVM12,
5447619badbSTero Kristo RTC_BOARD_GPEVM,
5457619badbSTero Kristo RTC_BOARD_SK,
5467619badbSTero Kristo };
5477619badbSTero Kristo
5487619badbSTero Kristo /*
5497619badbSTero Kristo * In the rtc_only+DRR in self-refresh boot path we have the board type info
5507619badbSTero Kristo * in the rtc scratch pad register hence we bypass the costly i2c reads to
5517619badbSTero Kristo * eeprom and directly programthe board name string
5527619badbSTero Kristo */
rtc_only_update_board_type(u32 btype)5537619badbSTero Kristo void rtc_only_update_board_type(u32 btype)
5547619badbSTero Kristo {
5557619badbSTero Kristo const char *name = "";
5567619badbSTero Kristo const char *rev = "1.0";
5577619badbSTero Kristo
5587619badbSTero Kristo switch (btype) {
5597619badbSTero Kristo case RTC_BOARD_EPOS:
5607619badbSTero Kristo name = "AM43EPOS";
5617619badbSTero Kristo break;
5627619badbSTero Kristo case RTC_BOARD_EVM14:
5637619badbSTero Kristo name = "AM43__GP";
5647619badbSTero Kristo rev = "1.4";
5657619badbSTero Kristo break;
5667619badbSTero Kristo case RTC_BOARD_EVM12:
5677619badbSTero Kristo name = "AM43__GP";
5687619badbSTero Kristo rev = "1.2";
5697619badbSTero Kristo break;
5707619badbSTero Kristo case RTC_BOARD_GPEVM:
5717619badbSTero Kristo name = "AM43__GP";
5727619badbSTero Kristo break;
5737619badbSTero Kristo case RTC_BOARD_SK:
5747619badbSTero Kristo name = "AM43__SK";
5757619badbSTero Kristo break;
5767619badbSTero Kristo }
5777619badbSTero Kristo ti_i2c_eeprom_am_set(name, rev);
5787619badbSTero Kristo }
5797619badbSTero Kristo
rtc_only_get_board_type(void)5807619badbSTero Kristo u32 rtc_only_get_board_type(void)
5817619badbSTero Kristo {
5827619badbSTero Kristo if (board_is_eposevm())
5837619badbSTero Kristo return RTC_BOARD_EPOS;
5847619badbSTero Kristo else if (board_is_evm_14_or_later())
5857619badbSTero Kristo return RTC_BOARD_EVM14;
5867619badbSTero Kristo else if (board_is_evm_12_or_later())
5877619badbSTero Kristo return RTC_BOARD_EVM12;
5887619badbSTero Kristo else if (board_is_gpevm())
5897619badbSTero Kristo return RTC_BOARD_GPEVM;
5907619badbSTero Kristo else if (board_is_sk())
5917619badbSTero Kristo return RTC_BOARD_SK;
5927619badbSTero Kristo
5937619badbSTero Kristo return 0;
5947619badbSTero Kristo }
5957619badbSTero Kristo
sdram_init(void)596fbf2728dSLokesh Vutla void sdram_init(void)
597fbf2728dSLokesh Vutla {
598b5e01eecSLokesh Vutla /*
599b5e01eecSLokesh Vutla * EPOS EVM has 1GB LPDDR2 connected to EMIF.
600b5e01eecSLokesh Vutla * GP EMV has 1GB DDR3 connected to EMIF
601b5e01eecSLokesh Vutla * along with VTT regulator.
602b5e01eecSLokesh Vutla */
603b5e01eecSLokesh Vutla if (board_is_eposevm()) {
604d3daba10SLokesh Vutla config_ddr(0, &ioregs_lpddr2, NULL, NULL, &emif_regs_lpddr2, 0);
6052c952111SFranklin S. Cooper Jr } else if (board_is_evm_14_or_later()) {
6062c952111SFranklin S. Cooper Jr enable_vtt_regulator();
6072c952111SFranklin S. Cooper Jr config_ddr(0, &ioregs_ddr3, NULL, NULL,
6082c952111SFranklin S. Cooper Jr &ddr3_emif_regs_400Mhz_production, 0);
6092c952111SFranklin S. Cooper Jr } else if (board_is_evm_12_or_later()) {
6102c952111SFranklin S. Cooper Jr enable_vtt_regulator();
6112c952111SFranklin S. Cooper Jr config_ddr(0, &ioregs_ddr3, NULL, NULL,
6122c952111SFranklin S. Cooper Jr &ddr3_emif_regs_400Mhz_beta, 0);
613a5051b72SMadan Srinivas } else if (board_is_evm()) {
614b5e01eecSLokesh Vutla enable_vtt_regulator();
615b5e01eecSLokesh Vutla config_ddr(0, &ioregs_ddr3, NULL, NULL,
616b5e01eecSLokesh Vutla &ddr3_emif_regs_400Mhz, 0);
6179cb9f333SFelipe Balbi } else if (board_is_sk()) {
6189cb9f333SFelipe Balbi config_ddr(400, &ioregs_ddr3, NULL, NULL,
6199cb9f333SFelipe Balbi &ddr3_sk_emif_regs_400Mhz, 0);
620403d70abSFelipe Balbi } else if (board_is_idk()) {
621403d70abSFelipe Balbi config_ddr(400, &ioregs_ddr3, NULL, NULL,
622403d70abSFelipe Balbi &ddr3_idk_emif_regs_400Mhz, 0);
623b5e01eecSLokesh Vutla }
624fbf2728dSLokesh Vutla }
625fbf2728dSLokesh Vutla #endif
626fbf2728dSLokesh Vutla
6277aa5598aSTom Rini /* setup board specific PMIC */
power_init_board(void)6287aa5598aSTom Rini int power_init_board(void)
6297aa5598aSTom Rini {
6301514244cSJean-Jacques Hiblot int rc;
6311514244cSJean-Jacques Hiblot #ifndef CONFIG_DM_I2C
6321514244cSJean-Jacques Hiblot struct pmic *p = NULL;
6331514244cSJean-Jacques Hiblot #endif
634403d70abSFelipe Balbi if (board_is_idk()) {
6351514244cSJean-Jacques Hiblot rc = power_tps62362_init(0);
6361514244cSJean-Jacques Hiblot if (rc)
6371514244cSJean-Jacques Hiblot goto done;
6381514244cSJean-Jacques Hiblot #ifndef CONFIG_DM_I2C
639403d70abSFelipe Balbi p = pmic_get("TPS62362");
6401514244cSJean-Jacques Hiblot if (!p || pmic_probe(p))
6411514244cSJean-Jacques Hiblot goto done;
6421514244cSJean-Jacques Hiblot #endif
643403d70abSFelipe Balbi puts("PMIC: TPS62362\n");
644403d70abSFelipe Balbi } else {
6451514244cSJean-Jacques Hiblot rc = power_tps65218_init(0);
6461514244cSJean-Jacques Hiblot if (rc)
6471514244cSJean-Jacques Hiblot goto done;
6481514244cSJean-Jacques Hiblot #ifndef CONFIG_DM_I2C
6497aa5598aSTom Rini p = pmic_get("TPS65218_PMIC");
6501514244cSJean-Jacques Hiblot if (!p || pmic_probe(p))
6511514244cSJean-Jacques Hiblot goto done;
6521514244cSJean-Jacques Hiblot #endif
6537aa5598aSTom Rini puts("PMIC: TPS65218\n");
654403d70abSFelipe Balbi }
6551514244cSJean-Jacques Hiblot done:
6567aa5598aSTom Rini return 0;
6577aa5598aSTom Rini }
6587aa5598aSTom Rini
board_init(void)659fbf2728dSLokesh Vutla int board_init(void)
660fbf2728dSLokesh Vutla {
6618038b497SCooper Jr., Franklin struct l3f_cfg_bwlimiter *bwlimiter = (struct l3f_cfg_bwlimiter *)L3F_CFG_BWLIMITER;
6628038b497SCooper Jr., Franklin u32 mreqprio_0, mreqprio_1, modena_init0_bw_fractional,
6638038b497SCooper Jr., Franklin modena_init0_bw_integer, modena_init0_watermark_0;
6648038b497SCooper Jr., Franklin
665369cbe1eSLokesh Vutla gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
666e53ad4b4Spekon gupta gpmc_init();
667fbf2728dSLokesh Vutla
668a93feb2eSFaiz Abbas /*
669a93feb2eSFaiz Abbas * Call this to initialize *ctrl again
670a93feb2eSFaiz Abbas */
671a93feb2eSFaiz Abbas hw_data_init();
672a93feb2eSFaiz Abbas
6738038b497SCooper Jr., Franklin /* Clear all important bits for DSS errata that may need to be tweaked*/
6748038b497SCooper Jr., Franklin mreqprio_0 = readl(&cdev->mreqprio_0) & MREQPRIO_0_SAB_INIT1_MASK &
6758038b497SCooper Jr., Franklin MREQPRIO_0_SAB_INIT0_MASK;
6768038b497SCooper Jr., Franklin
6778038b497SCooper Jr., Franklin mreqprio_1 = readl(&cdev->mreqprio_1) & MREQPRIO_1_DSS_MASK;
6788038b497SCooper Jr., Franklin
6798038b497SCooper Jr., Franklin modena_init0_bw_fractional = readl(&bwlimiter->modena_init0_bw_fractional) &
6808038b497SCooper Jr., Franklin BW_LIMITER_BW_FRAC_MASK;
6818038b497SCooper Jr., Franklin
6828038b497SCooper Jr., Franklin modena_init0_bw_integer = readl(&bwlimiter->modena_init0_bw_integer) &
6838038b497SCooper Jr., Franklin BW_LIMITER_BW_INT_MASK;
6848038b497SCooper Jr., Franklin
6858038b497SCooper Jr., Franklin modena_init0_watermark_0 = readl(&bwlimiter->modena_init0_watermark_0) &
6868038b497SCooper Jr., Franklin BW_LIMITER_BW_WATERMARK_MASK;
6878038b497SCooper Jr., Franklin
6888038b497SCooper Jr., Franklin /* Setting MReq Priority of the DSS*/
6898038b497SCooper Jr., Franklin mreqprio_0 |= 0x77;
6908038b497SCooper Jr., Franklin
6918038b497SCooper Jr., Franklin /*
6928038b497SCooper Jr., Franklin * Set L3 Fast Configuration Register
6938038b497SCooper Jr., Franklin * Limiting bandwith for ARM core to 700 MBPS
6948038b497SCooper Jr., Franklin */
6958038b497SCooper Jr., Franklin modena_init0_bw_fractional |= 0x10;
6968038b497SCooper Jr., Franklin modena_init0_bw_integer |= 0x3;
6978038b497SCooper Jr., Franklin
6988038b497SCooper Jr., Franklin writel(mreqprio_0, &cdev->mreqprio_0);
6998038b497SCooper Jr., Franklin writel(mreqprio_1, &cdev->mreqprio_1);
7008038b497SCooper Jr., Franklin
7018038b497SCooper Jr., Franklin writel(modena_init0_bw_fractional, &bwlimiter->modena_init0_bw_fractional);
7028038b497SCooper Jr., Franklin writel(modena_init0_bw_integer, &bwlimiter->modena_init0_bw_integer);
7038038b497SCooper Jr., Franklin writel(modena_init0_watermark_0, &bwlimiter->modena_init0_watermark_0);
7048038b497SCooper Jr., Franklin
705fbf2728dSLokesh Vutla return 0;
706fbf2728dSLokesh Vutla }
707fbf2728dSLokesh Vutla
708fbf2728dSLokesh Vutla #ifdef CONFIG_BOARD_LATE_INIT
709347631bcSJean-Jacques Hiblot #if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
device_okay(const char * path)710347631bcSJean-Jacques Hiblot static int device_okay(const char *path)
711347631bcSJean-Jacques Hiblot {
712347631bcSJean-Jacques Hiblot int node;
713347631bcSJean-Jacques Hiblot
714347631bcSJean-Jacques Hiblot node = fdt_path_offset(gd->fdt_blob, path);
715347631bcSJean-Jacques Hiblot if (node < 0)
716347631bcSJean-Jacques Hiblot return 0;
717347631bcSJean-Jacques Hiblot
718347631bcSJean-Jacques Hiblot return fdtdec_get_is_enabled(gd->fdt_blob, node);
719347631bcSJean-Jacques Hiblot }
720347631bcSJean-Jacques Hiblot #endif
721347631bcSJean-Jacques Hiblot
board_late_init(void)722fbf2728dSLokesh Vutla int board_late_init(void)
723fbf2728dSLokesh Vutla {
724f4af163eSSekhar Nori #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
7255f8bb93bSNishanth Menon set_board_info_env(NULL);
7265d4d436cSLokesh Vutla
7275d4d436cSLokesh Vutla /*
7285d4d436cSLokesh Vutla * Default FIT boot on HS devices. Non FIT images are not allowed
7295d4d436cSLokesh Vutla * on HS devices.
7305d4d436cSLokesh Vutla */
7315d4d436cSLokesh Vutla if (get_device_type() == HS_DEVICE)
732382bee57SSimon Glass env_set("boot_fit", "1");
733f4af163eSSekhar Nori #endif
734347631bcSJean-Jacques Hiblot
735347631bcSJean-Jacques Hiblot #if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
736347631bcSJean-Jacques Hiblot if (device_okay("/ocp/omap_dwc3@48380000"))
737347631bcSJean-Jacques Hiblot enable_usb_clocks(0);
738347631bcSJean-Jacques Hiblot if (device_okay("/ocp/omap_dwc3@483c0000"))
739347631bcSJean-Jacques Hiblot enable_usb_clocks(1);
740347631bcSJean-Jacques Hiblot #endif
741fbf2728dSLokesh Vutla return 0;
742fbf2728dSLokesh Vutla }
743fbf2728dSLokesh Vutla #endif
7444cdd7fdaSMugunthan V N
745347631bcSJean-Jacques Hiblot #if !CONFIG_IS_ENABLED(DM_USB_GADGET)
7469f81eb77SKishon Vijay Abraham I #ifdef CONFIG_USB_DWC3
7479f81eb77SKishon Vijay Abraham I static struct dwc3_device usb_otg_ss1 = {
7489f81eb77SKishon Vijay Abraham I .maximum_speed = USB_SPEED_HIGH,
7499f81eb77SKishon Vijay Abraham I .base = USB_OTG_SS1_BASE,
7509f81eb77SKishon Vijay Abraham I .tx_fifo_resize = false,
7519f81eb77SKishon Vijay Abraham I .index = 0,
7529f81eb77SKishon Vijay Abraham I };
7539f81eb77SKishon Vijay Abraham I
7549f81eb77SKishon Vijay Abraham I static struct dwc3_omap_device usb_otg_ss1_glue = {
7559f81eb77SKishon Vijay Abraham I .base = (void *)USB_OTG_SS1_GLUE_BASE,
7569f81eb77SKishon Vijay Abraham I .utmi_mode = DWC3_OMAP_UTMI_MODE_SW,
7579f81eb77SKishon Vijay Abraham I .index = 0,
7589f81eb77SKishon Vijay Abraham I };
7599f81eb77SKishon Vijay Abraham I
7609f81eb77SKishon Vijay Abraham I static struct ti_usb_phy_device usb_phy1_device = {
7619f81eb77SKishon Vijay Abraham I .usb2_phy_power = (void *)USB2_PHY1_POWER,
7629f81eb77SKishon Vijay Abraham I .index = 0,
7639f81eb77SKishon Vijay Abraham I };
7649f81eb77SKishon Vijay Abraham I
7659f81eb77SKishon Vijay Abraham I static struct dwc3_device usb_otg_ss2 = {
7669f81eb77SKishon Vijay Abraham I .maximum_speed = USB_SPEED_HIGH,
7679f81eb77SKishon Vijay Abraham I .base = USB_OTG_SS2_BASE,
7689f81eb77SKishon Vijay Abraham I .tx_fifo_resize = false,
7699f81eb77SKishon Vijay Abraham I .index = 1,
7709f81eb77SKishon Vijay Abraham I };
7719f81eb77SKishon Vijay Abraham I
7729f81eb77SKishon Vijay Abraham I static struct dwc3_omap_device usb_otg_ss2_glue = {
7739f81eb77SKishon Vijay Abraham I .base = (void *)USB_OTG_SS2_GLUE_BASE,
7749f81eb77SKishon Vijay Abraham I .utmi_mode = DWC3_OMAP_UTMI_MODE_SW,
7759f81eb77SKishon Vijay Abraham I .index = 1,
7769f81eb77SKishon Vijay Abraham I };
7779f81eb77SKishon Vijay Abraham I
7789f81eb77SKishon Vijay Abraham I static struct ti_usb_phy_device usb_phy2_device = {
7799f81eb77SKishon Vijay Abraham I .usb2_phy_power = (void *)USB2_PHY2_POWER,
7809f81eb77SKishon Vijay Abraham I .index = 1,
7819f81eb77SKishon Vijay Abraham I };
7829f81eb77SKishon Vijay Abraham I
usb_gadget_handle_interrupts(int index)7832d48aa69SKishon Vijay Abraham I int usb_gadget_handle_interrupts(int index)
7849f81eb77SKishon Vijay Abraham I {
7859f81eb77SKishon Vijay Abraham I u32 status;
7869f81eb77SKishon Vijay Abraham I
7872d48aa69SKishon Vijay Abraham I status = dwc3_omap_uboot_interrupt_status(index);
7889f81eb77SKishon Vijay Abraham I if (status)
7892d48aa69SKishon Vijay Abraham I dwc3_uboot_handle_interrupt(index);
7909f81eb77SKishon Vijay Abraham I
7919f81eb77SKishon Vijay Abraham I return 0;
7929f81eb77SKishon Vijay Abraham I }
79355efaddeSRoger Quadros #endif /* CONFIG_USB_DWC3 */
79455efaddeSRoger Quadros
79555efaddeSRoger Quadros #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
board_usb_init(int index,enum usb_init_type init)796b16c129cSFaiz Abbas int board_usb_init(int index, enum usb_init_type init)
79755efaddeSRoger Quadros {
79855efaddeSRoger Quadros enable_usb_clocks(index);
79955efaddeSRoger Quadros #ifdef CONFIG_USB_DWC3
80055efaddeSRoger Quadros switch (index) {
80155efaddeSRoger Quadros case 0:
80255efaddeSRoger Quadros if (init == USB_INIT_DEVICE) {
80355efaddeSRoger Quadros usb_otg_ss1.dr_mode = USB_DR_MODE_PERIPHERAL;
80455efaddeSRoger Quadros usb_otg_ss1_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
80555efaddeSRoger Quadros dwc3_omap_uboot_init(&usb_otg_ss1_glue);
80655efaddeSRoger Quadros ti_usb_phy_uboot_init(&usb_phy1_device);
80755efaddeSRoger Quadros dwc3_uboot_init(&usb_otg_ss1);
80855efaddeSRoger Quadros }
80955efaddeSRoger Quadros break;
81055efaddeSRoger Quadros case 1:
81155efaddeSRoger Quadros if (init == USB_INIT_DEVICE) {
81255efaddeSRoger Quadros usb_otg_ss2.dr_mode = USB_DR_MODE_PERIPHERAL;
81355efaddeSRoger Quadros usb_otg_ss2_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
81455efaddeSRoger Quadros ti_usb_phy_uboot_init(&usb_phy2_device);
81555efaddeSRoger Quadros dwc3_omap_uboot_init(&usb_otg_ss2_glue);
81655efaddeSRoger Quadros dwc3_uboot_init(&usb_otg_ss2);
81755efaddeSRoger Quadros }
81855efaddeSRoger Quadros break;
81955efaddeSRoger Quadros default:
82055efaddeSRoger Quadros printf("Invalid Controller Index\n");
82155efaddeSRoger Quadros }
8229f81eb77SKishon Vijay Abraham I #endif
8239f81eb77SKishon Vijay Abraham I
82455efaddeSRoger Quadros return 0;
82555efaddeSRoger Quadros }
82655efaddeSRoger Quadros
board_usb_cleanup(int index,enum usb_init_type init)827b16c129cSFaiz Abbas int board_usb_cleanup(int index, enum usb_init_type init)
82855efaddeSRoger Quadros {
82955efaddeSRoger Quadros #ifdef CONFIG_USB_DWC3
83055efaddeSRoger Quadros switch (index) {
83155efaddeSRoger Quadros case 0:
83255efaddeSRoger Quadros case 1:
83355efaddeSRoger Quadros if (init == USB_INIT_DEVICE) {
83455efaddeSRoger Quadros ti_usb_phy_uboot_exit(index);
83555efaddeSRoger Quadros dwc3_uboot_exit(index);
83655efaddeSRoger Quadros dwc3_omap_uboot_exit(index);
83755efaddeSRoger Quadros }
83855efaddeSRoger Quadros break;
83955efaddeSRoger Quadros default:
84055efaddeSRoger Quadros printf("Invalid Controller Index\n");
84155efaddeSRoger Quadros }
84255efaddeSRoger Quadros #endif
84355efaddeSRoger Quadros disable_usb_clocks(index);
84455efaddeSRoger Quadros
84555efaddeSRoger Quadros return 0;
84655efaddeSRoger Quadros }
84755efaddeSRoger Quadros #endif /* defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP) */
848347631bcSJean-Jacques Hiblot #endif /* !CONFIG_IS_ENABLED(DM_USB_GADGET) */
84955efaddeSRoger Quadros
8504cdd7fdaSMugunthan V N #ifdef CONFIG_DRIVER_TI_CPSW
8514cdd7fdaSMugunthan V N
cpsw_control(int enabled)8524cdd7fdaSMugunthan V N static void cpsw_control(int enabled)
8534cdd7fdaSMugunthan V N {
8544cdd7fdaSMugunthan V N /* Additional controls can be added here */
8554cdd7fdaSMugunthan V N return;
8564cdd7fdaSMugunthan V N }
8574cdd7fdaSMugunthan V N
8584cdd7fdaSMugunthan V N static struct cpsw_slave_data cpsw_slaves[] = {
8594cdd7fdaSMugunthan V N {
8604cdd7fdaSMugunthan V N .slave_reg_ofs = 0x208,
8614cdd7fdaSMugunthan V N .sliver_reg_ofs = 0xd80,
8624cdd7fdaSMugunthan V N .phy_addr = 16,
8634cdd7fdaSMugunthan V N },
8644cdd7fdaSMugunthan V N {
8654cdd7fdaSMugunthan V N .slave_reg_ofs = 0x308,
8664cdd7fdaSMugunthan V N .sliver_reg_ofs = 0xdc0,
8674cdd7fdaSMugunthan V N .phy_addr = 1,
8684cdd7fdaSMugunthan V N },
8694cdd7fdaSMugunthan V N };
8704cdd7fdaSMugunthan V N
8714cdd7fdaSMugunthan V N static struct cpsw_platform_data cpsw_data = {
8724cdd7fdaSMugunthan V N .mdio_base = CPSW_MDIO_BASE,
8734cdd7fdaSMugunthan V N .cpsw_base = CPSW_BASE,
8744cdd7fdaSMugunthan V N .mdio_div = 0xff,
8754cdd7fdaSMugunthan V N .channels = 8,
8764cdd7fdaSMugunthan V N .cpdma_reg_ofs = 0x800,
8774cdd7fdaSMugunthan V N .slaves = 1,
8784cdd7fdaSMugunthan V N .slave_data = cpsw_slaves,
8794cdd7fdaSMugunthan V N .ale_reg_ofs = 0xd00,
8804cdd7fdaSMugunthan V N .ale_entries = 1024,
8814cdd7fdaSMugunthan V N .host_port_reg_ofs = 0x108,
8824cdd7fdaSMugunthan V N .hw_stats_reg_ofs = 0x900,
8834cdd7fdaSMugunthan V N .bd_ram_ofs = 0x2000,
8844cdd7fdaSMugunthan V N .mac_control = (1 << 5),
8854cdd7fdaSMugunthan V N .control = cpsw_control,
8864cdd7fdaSMugunthan V N .host_port_num = 0,
8874cdd7fdaSMugunthan V N .version = CPSW_CTRL_VERSION_2,
8884cdd7fdaSMugunthan V N };
8894cdd7fdaSMugunthan V N
board_eth_init(bd_t * bis)8904cdd7fdaSMugunthan V N int board_eth_init(bd_t *bis)
8914cdd7fdaSMugunthan V N {
8924cdd7fdaSMugunthan V N int rv;
8934cdd7fdaSMugunthan V N uint8_t mac_addr[6];
8944cdd7fdaSMugunthan V N uint32_t mac_hi, mac_lo;
8954cdd7fdaSMugunthan V N
8964cdd7fdaSMugunthan V N /* try reading mac address from efuse */
8974cdd7fdaSMugunthan V N mac_lo = readl(&cdev->macid0l);
8984cdd7fdaSMugunthan V N mac_hi = readl(&cdev->macid0h);
8994cdd7fdaSMugunthan V N mac_addr[0] = mac_hi & 0xFF;
9004cdd7fdaSMugunthan V N mac_addr[1] = (mac_hi & 0xFF00) >> 8;
9014cdd7fdaSMugunthan V N mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
9024cdd7fdaSMugunthan V N mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
9034cdd7fdaSMugunthan V N mac_addr[4] = mac_lo & 0xFF;
9044cdd7fdaSMugunthan V N mac_addr[5] = (mac_lo & 0xFF00) >> 8;
9054cdd7fdaSMugunthan V N
90600caae6dSSimon Glass if (!env_get("ethaddr")) {
9074cdd7fdaSMugunthan V N puts("<ethaddr> not set. Validating first E-fuse MAC\n");
9080adb5b76SJoe Hershberger if (is_valid_ethaddr(mac_addr))
909fd1e959eSSimon Glass eth_env_set_enetaddr("ethaddr", mac_addr);
9104cdd7fdaSMugunthan V N }
9114cdd7fdaSMugunthan V N
9124cdd7fdaSMugunthan V N mac_lo = readl(&cdev->macid1l);
9134cdd7fdaSMugunthan V N mac_hi = readl(&cdev->macid1h);
9144cdd7fdaSMugunthan V N mac_addr[0] = mac_hi & 0xFF;
9154cdd7fdaSMugunthan V N mac_addr[1] = (mac_hi & 0xFF00) >> 8;
9164cdd7fdaSMugunthan V N mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
9174cdd7fdaSMugunthan V N mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
9184cdd7fdaSMugunthan V N mac_addr[4] = mac_lo & 0xFF;
9194cdd7fdaSMugunthan V N mac_addr[5] = (mac_lo & 0xFF00) >> 8;
9204cdd7fdaSMugunthan V N
92100caae6dSSimon Glass if (!env_get("eth1addr")) {
9220adb5b76SJoe Hershberger if (is_valid_ethaddr(mac_addr))
923fd1e959eSSimon Glass eth_env_set_enetaddr("eth1addr", mac_addr);
9244cdd7fdaSMugunthan V N }
9254cdd7fdaSMugunthan V N
9264cdd7fdaSMugunthan V N if (board_is_eposevm()) {
9274cdd7fdaSMugunthan V N writel(RMII_MODE_ENABLE | RMII_CHIPCKL_ENABLE, &cdev->miisel);
9284cdd7fdaSMugunthan V N cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RMII;
9294cdd7fdaSMugunthan V N cpsw_slaves[0].phy_addr = 16;
930619ce62dSFelipe Balbi } else if (board_is_sk()) {
931619ce62dSFelipe Balbi writel(RGMII_MODE_ENABLE, &cdev->miisel);
932619ce62dSFelipe Balbi cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RGMII;
933619ce62dSFelipe Balbi cpsw_slaves[0].phy_addr = 4;
934619ce62dSFelipe Balbi cpsw_slaves[1].phy_addr = 5;
935403d70abSFelipe Balbi } else if (board_is_idk()) {
936403d70abSFelipe Balbi writel(RGMII_MODE_ENABLE, &cdev->miisel);
937403d70abSFelipe Balbi cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RGMII;
938403d70abSFelipe Balbi cpsw_slaves[0].phy_addr = 0;
9394cdd7fdaSMugunthan V N } else {
9404cdd7fdaSMugunthan V N writel(RGMII_MODE_ENABLE, &cdev->miisel);
9414cdd7fdaSMugunthan V N cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RGMII;
9424cdd7fdaSMugunthan V N cpsw_slaves[0].phy_addr = 0;
9434cdd7fdaSMugunthan V N }
9444cdd7fdaSMugunthan V N
9454cdd7fdaSMugunthan V N rv = cpsw_register(&cpsw_data);
9464cdd7fdaSMugunthan V N if (rv < 0)
9474cdd7fdaSMugunthan V N printf("Error %d registering CPSW switch\n", rv);
9484cdd7fdaSMugunthan V N
9494cdd7fdaSMugunthan V N return rv;
9504cdd7fdaSMugunthan V N }
9514cdd7fdaSMugunthan V N #endif
9525a3775a4SLokesh Vutla
9537fe463f5SAndrew F. Davis #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
ft_board_setup(void * blob,bd_t * bd)9547fe463f5SAndrew F. Davis int ft_board_setup(void *blob, bd_t *bd)
9557fe463f5SAndrew F. Davis {
9567fe463f5SAndrew F. Davis ft_cpu_setup(blob, bd);
9577fe463f5SAndrew F. Davis
9587fe463f5SAndrew F. Davis return 0;
9597fe463f5SAndrew F. Davis }
9607fe463f5SAndrew F. Davis #endif
9617fe463f5SAndrew F. Davis
9625375a9b5SVignesh R #if defined(CONFIG_SPL_LOAD_FIT) || defined(CONFIG_DTB_RESELECT)
board_fit_config_name_match(const char * name)9635a3775a4SLokesh Vutla int board_fit_config_name_match(const char *name)
9645a3775a4SLokesh Vutla {
9655375a9b5SVignesh R bool eeprom_read = board_ti_was_eeprom_read();
9665375a9b5SVignesh R
9675375a9b5SVignesh R if (!strcmp(name, "am4372-generic") && !eeprom_read)
9685375a9b5SVignesh R return 0;
9695375a9b5SVignesh R else if (board_is_evm() && !strcmp(name, "am437x-gp-evm"))
9705a3775a4SLokesh Vutla return 0;
9715a3775a4SLokesh Vutla else if (board_is_sk() && !strcmp(name, "am437x-sk-evm"))
9725a3775a4SLokesh Vutla return 0;
9737dd12830SLokesh Vutla else if (board_is_eposevm() && !strcmp(name, "am43x-epos-evm"))
9747dd12830SLokesh Vutla return 0;
97554a92e1aSLokesh Vutla else if (board_is_idk() && !strcmp(name, "am437x-idk-evm"))
97654a92e1aSLokesh Vutla return 0;
9775a3775a4SLokesh Vutla else
9785a3775a4SLokesh Vutla return -1;
9795a3775a4SLokesh Vutla }
9805a3775a4SLokesh Vutla #endif
981e29878fcSMadan Srinivas
9825375a9b5SVignesh R #ifdef CONFIG_DTB_RESELECT
embedded_dtb_select(void)9835375a9b5SVignesh R int embedded_dtb_select(void)
9845375a9b5SVignesh R {
9855375a9b5SVignesh R do_board_detect();
9865375a9b5SVignesh R fdtdec_setup();
9875375a9b5SVignesh R
9885375a9b5SVignesh R return 0;
9895375a9b5SVignesh R }
9905375a9b5SVignesh R #endif
9915375a9b5SVignesh R
992e29878fcSMadan Srinivas #ifdef CONFIG_TI_SECURE_DEVICE
board_fit_image_post_process(const void * fit,int node,void ** p_image,size_t * p_size)993b7d9107fSChia-Wei Wang void board_fit_image_post_process(const void *fit, int node, void **p_image, size_t *p_size)
994e29878fcSMadan Srinivas {
995e29878fcSMadan Srinivas secure_boot_verify_image(p_image, p_size);
996e29878fcSMadan Srinivas }
9973630094cSAndrew F. Davis
board_tee_image_process(ulong tee_image,size_t tee_size)9983630094cSAndrew F. Davis void board_tee_image_process(ulong tee_image, size_t tee_size)
9993630094cSAndrew F. Davis {
10003630094cSAndrew F. Davis secure_tee_install((u32)tee_image);
10013630094cSAndrew F. Davis }
10023630094cSAndrew F. Davis
10033630094cSAndrew F. Davis U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_TEE, board_tee_image_process);
1004e29878fcSMadan Srinivas #endif
1005