blob: 0ed16ca15ae79d696a49e4e23e3830a3f2a25210 [file] [log] [blame]
Peter Korsgaard85ec2db2012-10-18 01:21:09 +00001/*
2 * board.c
3 *
4 * Board functions for TI AM335X based boards
5 *
6 * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
7 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02008 * SPDX-License-Identifier: GPL-2.0+
Peter Korsgaard85ec2db2012-10-18 01:21:09 +00009 */
10
11#include <common.h>
12#include <errno.h>
13#include <spl.h>
Lokesh Vutlaabb44e62016-05-16 11:47:29 +053014#include <serial.h>
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000015#include <asm/arch/cpu.h>
16#include <asm/arch/hardware.h>
17#include <asm/arch/omap.h>
18#include <asm/arch/ddr_defs.h>
19#include <asm/arch/clock.h>
Lokesh Vutla0d144f52016-05-16 11:47:26 +053020#include <asm/arch/clk_synthesizer.h>
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000021#include <asm/arch/gpio.h>
22#include <asm/arch/mmc_host_def.h>
23#include <asm/arch/sys_proto.h>
Steve Kipiszbe9b6f82013-07-18 15:13:03 -040024#include <asm/arch/mem.h>
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000025#include <asm/io.h>
26#include <asm/emif.h>
27#include <asm/gpio.h>
Andrew F. Davisbd249152016-08-30 14:06:24 -050028#include <asm/omap_sec_common.h>
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000029#include <i2c.h>
30#include <miiphy.h>
31#include <cpsw.h>
Tom Rini52437072013-08-30 16:28:46 -040032#include <power/tps65217.h>
33#include <power/tps65910.h>
Tom Rini303bfe82013-10-01 12:32:04 -040034#include <environment.h>
35#include <watchdog.h>
Tom Rini810b5812014-03-28 12:03:38 -040036#include <environment.h>
Nishanth Menon2afa70d2016-02-24 12:30:55 -060037#include "../common/board_detect.h"
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000038#include "board.h"
39
40DECLARE_GLOBAL_DATA_PTR;
41
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000042/* GPIO that controls power to DDR on EVM-SK */
Lokesh Vutla0d144f52016-05-16 11:47:26 +053043#define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio))
44#define GPIO_DDR_VTT_EN GPIO_TO_PIN(0, 7)
45#define ICE_GPIO_DDR_VTT_EN GPIO_TO_PIN(0, 18)
46#define GPIO_PR1_MII_CTRL GPIO_TO_PIN(3, 4)
47#define GPIO_MUX_MII_CTRL GPIO_TO_PIN(3, 10)
48#define GPIO_FET_SWITCH_CTRL GPIO_TO_PIN(0, 7)
49#define GPIO_PHY_RESET GPIO_TO_PIN(2, 5)
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000050
Mugunthan V Ndf7a99f2015-09-07 14:22:18 +053051#if defined(CONFIG_SPL_BUILD) || \
52 (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_DM_ETH))
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000053static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
Mugunthan V Ndf7a99f2015-09-07 14:22:18 +053054#endif
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000055
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000056/*
57 * Read header information from EEPROM into global structure.
58 */
Nishanth Menon2afa70d2016-02-24 12:30:55 -060059static inline int __maybe_unused read_eeprom(void)
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000060{
Nishanth Menon2afa70d2016-02-24 12:30:55 -060061 return ti_i2c_eeprom_am_get(-1, CONFIG_SYS_I2C_EEPROM_ADDR);
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000062}
63
Lokesh Vutlaabb44e62016-05-16 11:47:29 +053064#ifndef CONFIG_DM_SERIAL
65struct serial_device *default_serial_console(void)
66{
67 if (board_is_icev2())
68 return &eserial4_device;
69 else
70 return &eserial1_device;
71}
72#endif
73
Tom Rini8de09df2014-04-09 08:25:57 -040074#ifndef CONFIG_SKIP_LOWLEVEL_INIT
Peter Korsgaardeb6cf7b2012-10-18 01:21:12 +000075static const struct ddr_data ddr2_data = {
Tom Rini7f50a572014-07-07 21:40:16 -040076 .datardsratio0 = MT47H128M16RT25E_RD_DQS,
77 .datafwsratio0 = MT47H128M16RT25E_PHY_FIFO_WE,
78 .datawrsratio0 = MT47H128M16RT25E_PHY_WR_DATA,
Peter Korsgaardeb6cf7b2012-10-18 01:21:12 +000079};
80
81static const struct cmd_control ddr2_cmd_ctrl_data = {
Peter Korsgaard3adb8272012-10-18 01:21:13 +000082 .cmd0csratio = MT47H128M16RT25E_RATIO,
Peter Korsgaard85ec2db2012-10-18 01:21:09 +000083
Peter Korsgaard3adb8272012-10-18 01:21:13 +000084 .cmd1csratio = MT47H128M16RT25E_RATIO,
Peter Korsgaardeb6cf7b2012-10-18 01:21:12 +000085
Peter Korsgaard3adb8272012-10-18 01:21:13 +000086 .cmd2csratio = MT47H128M16RT25E_RATIO,
Peter Korsgaardeb6cf7b2012-10-18 01:21:12 +000087};
88
89static const struct emif_regs ddr2_emif_reg_data = {
Peter Korsgaard3adb8272012-10-18 01:21:13 +000090 .sdram_config = MT47H128M16RT25E_EMIF_SDCFG,
91 .ref_ctrl = MT47H128M16RT25E_EMIF_SDREF,
92 .sdram_tim1 = MT47H128M16RT25E_EMIF_TIM1,
93 .sdram_tim2 = MT47H128M16RT25E_EMIF_TIM2,
94 .sdram_tim3 = MT47H128M16RT25E_EMIF_TIM3,
95 .emif_ddr_phy_ctlr_1 = MT47H128M16RT25E_EMIF_READ_LATENCY,
Peter Korsgaardeb6cf7b2012-10-18 01:21:12 +000096};
97
98static const struct ddr_data ddr3_data = {
Peter Korsgaard3adb8272012-10-18 01:21:13 +000099 .datardsratio0 = MT41J128MJT125_RD_DQS,
100 .datawdsratio0 = MT41J128MJT125_WR_DQS,
101 .datafwsratio0 = MT41J128MJT125_PHY_FIFO_WE,
102 .datawrsratio0 = MT41J128MJT125_PHY_WR_DATA,
Peter Korsgaardeb6cf7b2012-10-18 01:21:12 +0000103};
104
Tom Rini385bc752013-03-21 04:30:02 +0000105static const struct ddr_data ddr3_beagleblack_data = {
106 .datardsratio0 = MT41K256M16HA125E_RD_DQS,
107 .datawdsratio0 = MT41K256M16HA125E_WR_DQS,
108 .datafwsratio0 = MT41K256M16HA125E_PHY_FIFO_WE,
109 .datawrsratio0 = MT41K256M16HA125E_PHY_WR_DATA,
Tom Rini385bc752013-03-21 04:30:02 +0000110};
111
Jeff Lance7c03a222013-01-14 05:32:20 +0000112static const struct ddr_data ddr3_evm_data = {
113 .datardsratio0 = MT41J512M8RH125_RD_DQS,
114 .datawdsratio0 = MT41J512M8RH125_WR_DQS,
115 .datafwsratio0 = MT41J512M8RH125_PHY_FIFO_WE,
116 .datawrsratio0 = MT41J512M8RH125_PHY_WR_DATA,
Jeff Lance7c03a222013-01-14 05:32:20 +0000117};
118
Lokesh Vutla5837b902016-05-16 11:47:24 +0530119static const struct ddr_data ddr3_icev2_data = {
120 .datardsratio0 = MT41J128MJT125_RD_DQS_400MHz,
121 .datawdsratio0 = MT41J128MJT125_WR_DQS_400MHz,
122 .datafwsratio0 = MT41J128MJT125_PHY_FIFO_WE_400MHz,
123 .datawrsratio0 = MT41J128MJT125_PHY_WR_DATA_400MHz,
124};
125
Peter Korsgaardeb6cf7b2012-10-18 01:21:12 +0000126static const struct cmd_control ddr3_cmd_ctrl_data = {
Peter Korsgaard3adb8272012-10-18 01:21:13 +0000127 .cmd0csratio = MT41J128MJT125_RATIO,
Peter Korsgaard3adb8272012-10-18 01:21:13 +0000128 .cmd0iclkout = MT41J128MJT125_INVERT_CLKOUT,
Peter Korsgaardeb6cf7b2012-10-18 01:21:12 +0000129
Peter Korsgaard3adb8272012-10-18 01:21:13 +0000130 .cmd1csratio = MT41J128MJT125_RATIO,
Peter Korsgaard3adb8272012-10-18 01:21:13 +0000131 .cmd1iclkout = MT41J128MJT125_INVERT_CLKOUT,
Peter Korsgaardeb6cf7b2012-10-18 01:21:12 +0000132
Peter Korsgaard3adb8272012-10-18 01:21:13 +0000133 .cmd2csratio = MT41J128MJT125_RATIO,
Peter Korsgaard3adb8272012-10-18 01:21:13 +0000134 .cmd2iclkout = MT41J128MJT125_INVERT_CLKOUT,
Peter Korsgaardeb6cf7b2012-10-18 01:21:12 +0000135};
136
Tom Rini385bc752013-03-21 04:30:02 +0000137static const struct cmd_control ddr3_beagleblack_cmd_ctrl_data = {
138 .cmd0csratio = MT41K256M16HA125E_RATIO,
Tom Rini385bc752013-03-21 04:30:02 +0000139 .cmd0iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
140
141 .cmd1csratio = MT41K256M16HA125E_RATIO,
Tom Rini385bc752013-03-21 04:30:02 +0000142 .cmd1iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
143
144 .cmd2csratio = MT41K256M16HA125E_RATIO,
Tom Rini385bc752013-03-21 04:30:02 +0000145 .cmd2iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
146};
147
Jeff Lance7c03a222013-01-14 05:32:20 +0000148static const struct cmd_control ddr3_evm_cmd_ctrl_data = {
149 .cmd0csratio = MT41J512M8RH125_RATIO,
Jeff Lance7c03a222013-01-14 05:32:20 +0000150 .cmd0iclkout = MT41J512M8RH125_INVERT_CLKOUT,
151
152 .cmd1csratio = MT41J512M8RH125_RATIO,
Jeff Lance7c03a222013-01-14 05:32:20 +0000153 .cmd1iclkout = MT41J512M8RH125_INVERT_CLKOUT,
154
155 .cmd2csratio = MT41J512M8RH125_RATIO,
Jeff Lance7c03a222013-01-14 05:32:20 +0000156 .cmd2iclkout = MT41J512M8RH125_INVERT_CLKOUT,
157};
158
Lokesh Vutla5837b902016-05-16 11:47:24 +0530159static const struct cmd_control ddr3_icev2_cmd_ctrl_data = {
160 .cmd0csratio = MT41J128MJT125_RATIO_400MHz,
161 .cmd0iclkout = MT41J128MJT125_INVERT_CLKOUT_400MHz,
162
163 .cmd1csratio = MT41J128MJT125_RATIO_400MHz,
164 .cmd1iclkout = MT41J128MJT125_INVERT_CLKOUT_400MHz,
165
166 .cmd2csratio = MT41J128MJT125_RATIO_400MHz,
167 .cmd2iclkout = MT41J128MJT125_INVERT_CLKOUT_400MHz,
168};
169
Peter Korsgaardeb6cf7b2012-10-18 01:21:12 +0000170static struct emif_regs ddr3_emif_reg_data = {
Peter Korsgaard3adb8272012-10-18 01:21:13 +0000171 .sdram_config = MT41J128MJT125_EMIF_SDCFG,
172 .ref_ctrl = MT41J128MJT125_EMIF_SDREF,
173 .sdram_tim1 = MT41J128MJT125_EMIF_TIM1,
174 .sdram_tim2 = MT41J128MJT125_EMIF_TIM2,
175 .sdram_tim3 = MT41J128MJT125_EMIF_TIM3,
176 .zq_config = MT41J128MJT125_ZQ_CFG,
Vaibhav Hiremathc30d57b2013-03-14 21:11:16 +0000177 .emif_ddr_phy_ctlr_1 = MT41J128MJT125_EMIF_READ_LATENCY |
178 PHY_EN_DYN_PWRDN,
Peter Korsgaardeb6cf7b2012-10-18 01:21:12 +0000179};
Jeff Lance7c03a222013-01-14 05:32:20 +0000180
Tom Rini385bc752013-03-21 04:30:02 +0000181static struct emif_regs ddr3_beagleblack_emif_reg_data = {
182 .sdram_config = MT41K256M16HA125E_EMIF_SDCFG,
183 .ref_ctrl = MT41K256M16HA125E_EMIF_SDREF,
184 .sdram_tim1 = MT41K256M16HA125E_EMIF_TIM1,
185 .sdram_tim2 = MT41K256M16HA125E_EMIF_TIM2,
186 .sdram_tim3 = MT41K256M16HA125E_EMIF_TIM3,
187 .zq_config = MT41K256M16HA125E_ZQ_CFG,
188 .emif_ddr_phy_ctlr_1 = MT41K256M16HA125E_EMIF_READ_LATENCY,
189};
190
Jeff Lance7c03a222013-01-14 05:32:20 +0000191static struct emif_regs ddr3_evm_emif_reg_data = {
192 .sdram_config = MT41J512M8RH125_EMIF_SDCFG,
193 .ref_ctrl = MT41J512M8RH125_EMIF_SDREF,
194 .sdram_tim1 = MT41J512M8RH125_EMIF_TIM1,
195 .sdram_tim2 = MT41J512M8RH125_EMIF_TIM2,
196 .sdram_tim3 = MT41J512M8RH125_EMIF_TIM3,
197 .zq_config = MT41J512M8RH125_ZQ_CFG,
Vaibhav Hiremathc30d57b2013-03-14 21:11:16 +0000198 .emif_ddr_phy_ctlr_1 = MT41J512M8RH125_EMIF_READ_LATENCY |
199 PHY_EN_DYN_PWRDN,
Jeff Lance7c03a222013-01-14 05:32:20 +0000200};
Peter Korsgaardeb204db2013-05-13 08:36:30 +0000201
Lokesh Vutla5837b902016-05-16 11:47:24 +0530202static struct emif_regs ddr3_icev2_emif_reg_data = {
203 .sdram_config = MT41J128MJT125_EMIF_SDCFG_400MHz,
204 .ref_ctrl = MT41J128MJT125_EMIF_SDREF_400MHz,
205 .sdram_tim1 = MT41J128MJT125_EMIF_TIM1_400MHz,
206 .sdram_tim2 = MT41J128MJT125_EMIF_TIM2_400MHz,
207 .sdram_tim3 = MT41J128MJT125_EMIF_TIM3_400MHz,
208 .zq_config = MT41J128MJT125_ZQ_CFG_400MHz,
209 .emif_ddr_phy_ctlr_1 = MT41J128MJT125_EMIF_READ_LATENCY_400MHz |
210 PHY_EN_DYN_PWRDN,
211};
212
Peter Korsgaardeb204db2013-05-13 08:36:30 +0000213#ifdef CONFIG_SPL_OS_BOOT
214int spl_start_uboot(void)
215{
216 /* break into full u-boot on 'c' */
Tom Rini810b5812014-03-28 12:03:38 -0400217 if (serial_tstc() && serial_getc() == 'c')
218 return 1;
219
220#ifdef CONFIG_SPL_ENV_SUPPORT
221 env_init();
222 env_relocate_spec();
223 if (getenv_yesno("boot_os") != 1)
224 return 1;
225#endif
226
227 return 0;
Peter Korsgaardeb204db2013-05-13 08:36:30 +0000228}
229#endif
230
Lokesh Vutla89a83bf2013-07-30 10:48:52 +0530231#define OSC (V_OSCK/1000000)
232const struct dpll_params dpll_ddr = {
233 266, OSC-1, 1, -1, -1, -1, -1};
234const struct dpll_params dpll_ddr_evm_sk = {
235 303, OSC-1, 1, -1, -1, -1, -1};
236const struct dpll_params dpll_ddr_bone_black = {
237 400, OSC-1, 1, -1, -1, -1, -1};
238
Tom Rini52437072013-08-30 16:28:46 -0400239void am33xx_spl_board_init(void)
240{
Tom Rini52437072013-08-30 16:28:46 -0400241 int mpu_vdd;
242
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600243 if (read_eeprom() < 0)
Tom Rini52437072013-08-30 16:28:46 -0400244 puts("Could not get board ID.\n");
245
246 /* Get the frequency */
Steve Kipisz5adac352013-08-14 10:51:31 -0400247 dpll_mpu_opp100.m = am335x_get_efuse_mpu_max_freq(cdev);
Tom Rini52437072013-08-30 16:28:46 -0400248
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600249 if (board_is_bone() || board_is_bone_lt()) {
Tom Rini52437072013-08-30 16:28:46 -0400250 /* BeagleBone PMIC Code */
251 int usb_cur_lim;
252
253 /*
254 * Only perform PMIC configurations if board rev > A1
255 * on Beaglebone White
256 */
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600257 if (board_is_bone() && !strncmp(board_ti_get_rev(), "00A1", 4))
Tom Rini52437072013-08-30 16:28:46 -0400258 return;
259
260 if (i2c_probe(TPS65217_CHIP_PM))
261 return;
262
263 /*
264 * On Beaglebone White we need to ensure we have AC power
265 * before increasing the frequency.
266 */
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600267 if (board_is_bone()) {
Tom Rini52437072013-08-30 16:28:46 -0400268 uchar pmic_status_reg;
269 if (tps65217_reg_read(TPS65217_STATUS,
270 &pmic_status_reg))
271 return;
272 if (!(pmic_status_reg & TPS65217_PWR_SRC_AC_BITMASK)) {
273 puts("No AC power, disabling frequency switch\n");
274 return;
275 }
276 }
277
278 /*
279 * Override what we have detected since we know if we have
280 * a Beaglebone Black it supports 1GHz.
281 */
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600282 if (board_is_bone_lt())
Steve Kipisz5adac352013-08-14 10:51:31 -0400283 dpll_mpu_opp100.m = MPUPLL_M_1000;
Tom Rini52437072013-08-30 16:28:46 -0400284
285 /*
286 * Increase USB current limit to 1300mA or 1800mA and set
287 * the MPU voltage controller as needed.
288 */
Steve Kipisz5adac352013-08-14 10:51:31 -0400289 if (dpll_mpu_opp100.m == MPUPLL_M_1000) {
Tom Rini52437072013-08-30 16:28:46 -0400290 usb_cur_lim = TPS65217_USB_INPUT_CUR_LIMIT_1800MA;
291 mpu_vdd = TPS65217_DCDC_VOLT_SEL_1325MV;
292 } else {
293 usb_cur_lim = TPS65217_USB_INPUT_CUR_LIMIT_1300MA;
294 mpu_vdd = TPS65217_DCDC_VOLT_SEL_1275MV;
295 }
296
297 if (tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
298 TPS65217_POWER_PATH,
299 usb_cur_lim,
300 TPS65217_USB_INPUT_CUR_LIMIT_MASK))
301 puts("tps65217_reg_write failure\n");
302
Steve Kipisz5adac352013-08-14 10:51:31 -0400303 /* Set DCDC3 (CORE) voltage to 1.125V */
304 if (tps65217_voltage_update(TPS65217_DEFDCDC3,
305 TPS65217_DCDC_VOLT_SEL_1125MV)) {
306 puts("tps65217_voltage_update failure\n");
307 return;
308 }
309
310 /* Set CORE Frequencies to OPP100 */
311 do_setup_dpll(&dpll_core_regs, &dpll_core_opp100);
Tom Rini52437072013-08-30 16:28:46 -0400312
313 /* Set DCDC2 (MPU) voltage */
314 if (tps65217_voltage_update(TPS65217_DEFDCDC2, mpu_vdd)) {
315 puts("tps65217_voltage_update failure\n");
316 return;
317 }
318
319 /*
320 * Set LDO3, LDO4 output voltage to 3.3V for Beaglebone.
321 * Set LDO3 to 1.8V and LDO4 to 3.3V for Beaglebone Black.
322 */
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600323 if (board_is_bone()) {
Tom Rini52437072013-08-30 16:28:46 -0400324 if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
325 TPS65217_DEFLS1,
326 TPS65217_LDO_VOLTAGE_OUT_3_3,
327 TPS65217_LDO_MASK))
328 puts("tps65217_reg_write failure\n");
329 } else {
330 if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
331 TPS65217_DEFLS1,
332 TPS65217_LDO_VOLTAGE_OUT_1_8,
333 TPS65217_LDO_MASK))
334 puts("tps65217_reg_write failure\n");
335 }
336
337 if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
338 TPS65217_DEFLS2,
339 TPS65217_LDO_VOLTAGE_OUT_3_3,
340 TPS65217_LDO_MASK))
341 puts("tps65217_reg_write failure\n");
342 } else {
343 int sil_rev;
344
345 /*
346 * The GP EVM, IDK and EVM SK use a TPS65910 PMIC. For all
347 * MPU frequencies we support we use a CORE voltage of
348 * 1.1375V. For MPU voltage we need to switch based on
349 * the frequency we are running at.
350 */
351 if (i2c_probe(TPS65910_CTRL_I2C_ADDR))
352 return;
353
354 /*
355 * Depending on MPU clock and PG we will need a different
356 * VDD to drive at that speed.
357 */
358 sil_rev = readl(&cdev->deviceid) >> 28;
Steve Kipisz5adac352013-08-14 10:51:31 -0400359 mpu_vdd = am335x_get_tps65910_mpu_vdd(sil_rev,
360 dpll_mpu_opp100.m);
Tom Rini52437072013-08-30 16:28:46 -0400361
362 /* Tell the TPS65910 to use i2c */
363 tps65910_set_i2c_control();
364
365 /* First update MPU voltage. */
366 if (tps65910_voltage_update(MPU, mpu_vdd))
367 return;
368
369 /* Second, update the CORE voltage. */
370 if (tps65910_voltage_update(CORE, TPS65910_OP_REG_SEL_1_1_3))
371 return;
Steve Kipisz5adac352013-08-14 10:51:31 -0400372
373 /* Set CORE Frequencies to OPP100 */
374 do_setup_dpll(&dpll_core_regs, &dpll_core_opp100);
Tom Rini52437072013-08-30 16:28:46 -0400375 }
376
377 /* Set MPU Frequency to what we detected now that voltages are set */
Steve Kipisz5adac352013-08-14 10:51:31 -0400378 do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
Tom Rini52437072013-08-30 16:28:46 -0400379}
380
Lokesh Vutla89a83bf2013-07-30 10:48:52 +0530381const struct dpll_params *get_dpll_ddr_params(void)
382{
Lokesh Vutla89a83bf2013-07-30 10:48:52 +0530383 enable_i2c0_pin_mux();
Heiko Schocherf53f2b82013-10-22 11:03:18 +0200384 i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600385 if (read_eeprom() < 0)
Lokesh Vutla89a83bf2013-07-30 10:48:52 +0530386 puts("Could not get board ID.\n");
387
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600388 if (board_is_evm_sk())
Lokesh Vutla89a83bf2013-07-30 10:48:52 +0530389 return &dpll_ddr_evm_sk;
Lokesh Vutla5837b902016-05-16 11:47:24 +0530390 else if (board_is_bone_lt() || board_is_icev2())
Lokesh Vutla89a83bf2013-07-30 10:48:52 +0530391 return &dpll_ddr_bone_black;
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600392 else if (board_is_evm_15_or_later())
Lokesh Vutla89a83bf2013-07-30 10:48:52 +0530393 return &dpll_ddr_evm_sk;
394 else
395 return &dpll_ddr;
396}
397
Heiko Schocherb21f2ac2013-07-30 10:48:54 +0530398void set_uart_mux_conf(void)
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000399{
Tom Rini986d7552014-08-01 09:53:24 -0400400#if CONFIG_CONS_INDEX == 1
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000401 enable_uart0_pin_mux();
Tom Rini986d7552014-08-01 09:53:24 -0400402#elif CONFIG_CONS_INDEX == 2
Andrew Bradford65c51ff2012-10-25 08:21:30 -0400403 enable_uart1_pin_mux();
Tom Rini986d7552014-08-01 09:53:24 -0400404#elif CONFIG_CONS_INDEX == 3
Andrew Bradford65c51ff2012-10-25 08:21:30 -0400405 enable_uart2_pin_mux();
Tom Rini986d7552014-08-01 09:53:24 -0400406#elif CONFIG_CONS_INDEX == 4
Andrew Bradford65c51ff2012-10-25 08:21:30 -0400407 enable_uart3_pin_mux();
Tom Rini986d7552014-08-01 09:53:24 -0400408#elif CONFIG_CONS_INDEX == 5
Andrew Bradford65c51ff2012-10-25 08:21:30 -0400409 enable_uart4_pin_mux();
Tom Rini986d7552014-08-01 09:53:24 -0400410#elif CONFIG_CONS_INDEX == 6
Andrew Bradford65c51ff2012-10-25 08:21:30 -0400411 enable_uart5_pin_mux();
Tom Rini986d7552014-08-01 09:53:24 -0400412#endif
Heiko Schocherb21f2ac2013-07-30 10:48:54 +0530413}
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000414
Heiko Schocherb21f2ac2013-07-30 10:48:54 +0530415void set_mux_conf_regs(void)
416{
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600417 if (read_eeprom() < 0)
Heiko Schocherb21f2ac2013-07-30 10:48:54 +0530418 puts("Could not get board ID.\n");
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000419
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600420 enable_board_pin_mux();
Heiko Schocherb21f2ac2013-07-30 10:48:54 +0530421}
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000422
Lokesh Vutla303b2672013-12-10 15:02:21 +0530423const struct ctrl_ioregs ioregs_evmsk = {
424 .cm0ioctl = MT41J128MJT125_IOCTRL_VALUE,
425 .cm1ioctl = MT41J128MJT125_IOCTRL_VALUE,
426 .cm2ioctl = MT41J128MJT125_IOCTRL_VALUE,
427 .dt0ioctl = MT41J128MJT125_IOCTRL_VALUE,
428 .dt1ioctl = MT41J128MJT125_IOCTRL_VALUE,
429};
430
431const struct ctrl_ioregs ioregs_bonelt = {
432 .cm0ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
433 .cm1ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
434 .cm2ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
435 .dt0ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
436 .dt1ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
437};
438
439const struct ctrl_ioregs ioregs_evm15 = {
440 .cm0ioctl = MT41J512M8RH125_IOCTRL_VALUE,
441 .cm1ioctl = MT41J512M8RH125_IOCTRL_VALUE,
442 .cm2ioctl = MT41J512M8RH125_IOCTRL_VALUE,
443 .dt0ioctl = MT41J512M8RH125_IOCTRL_VALUE,
444 .dt1ioctl = MT41J512M8RH125_IOCTRL_VALUE,
445};
446
447const struct ctrl_ioregs ioregs = {
448 .cm0ioctl = MT47H128M16RT25E_IOCTRL_VALUE,
449 .cm1ioctl = MT47H128M16RT25E_IOCTRL_VALUE,
450 .cm2ioctl = MT47H128M16RT25E_IOCTRL_VALUE,
451 .dt0ioctl = MT47H128M16RT25E_IOCTRL_VALUE,
452 .dt1ioctl = MT47H128M16RT25E_IOCTRL_VALUE,
453};
454
Heiko Schocherb21f2ac2013-07-30 10:48:54 +0530455void sdram_init(void)
456{
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600457 if (read_eeprom() < 0)
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000458 puts("Could not get board ID.\n");
459
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600460 if (board_is_evm_sk()) {
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000461 /*
462 * EVM SK 1.2A and later use gpio0_7 to enable DDR3.
463 * This is safe enough to do on older revs.
464 */
465 gpio_request(GPIO_DDR_VTT_EN, "ddr_vtt_en");
466 gpio_direction_output(GPIO_DDR_VTT_EN, 1);
467 }
468
Lokesh Vutla5837b902016-05-16 11:47:24 +0530469 if (board_is_icev2()) {
470 gpio_request(ICE_GPIO_DDR_VTT_EN, "ddr_vtt_en");
471 gpio_direction_output(ICE_GPIO_DDR_VTT_EN, 1);
472 }
473
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600474 if (board_is_evm_sk())
Lokesh Vutla303b2672013-12-10 15:02:21 +0530475 config_ddr(303, &ioregs_evmsk, &ddr3_data,
Matt Porter65991ec2013-03-15 10:07:03 +0000476 &ddr3_cmd_ctrl_data, &ddr3_emif_reg_data, 0);
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600477 else if (board_is_bone_lt())
Lokesh Vutla303b2672013-12-10 15:02:21 +0530478 config_ddr(400, &ioregs_bonelt,
Tom Rini385bc752013-03-21 04:30:02 +0000479 &ddr3_beagleblack_data,
480 &ddr3_beagleblack_cmd_ctrl_data,
481 &ddr3_beagleblack_emif_reg_data, 0);
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600482 else if (board_is_evm_15_or_later())
Lokesh Vutla303b2672013-12-10 15:02:21 +0530483 config_ddr(303, &ioregs_evm15, &ddr3_evm_data,
Matt Porter65991ec2013-03-15 10:07:03 +0000484 &ddr3_evm_cmd_ctrl_data, &ddr3_evm_emif_reg_data, 0);
Lokesh Vutla5837b902016-05-16 11:47:24 +0530485 else if (board_is_icev2())
486 config_ddr(400, &ioregs_evmsk, &ddr3_icev2_data,
487 &ddr3_icev2_cmd_ctrl_data, &ddr3_icev2_emif_reg_data,
488 0);
Peter Korsgaardeb6cf7b2012-10-18 01:21:12 +0000489 else
Lokesh Vutla303b2672013-12-10 15:02:21 +0530490 config_ddr(266, &ioregs, &ddr2_data,
Matt Porter65991ec2013-03-15 10:07:03 +0000491 &ddr2_cmd_ctrl_data, &ddr2_emif_reg_data, 0);
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000492}
Heiko Schocherb21f2ac2013-07-30 10:48:54 +0530493#endif
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000494
Lokesh Vutla0d144f52016-05-16 11:47:26 +0530495#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
496 (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
497static void request_and_set_gpio(int gpio, char *name)
498{
499 int ret;
500
501 ret = gpio_request(gpio, name);
502 if (ret < 0) {
503 printf("%s: Unable to request %s\n", __func__, name);
504 return;
505 }
506
507 ret = gpio_direction_output(gpio, 0);
508 if (ret < 0) {
509 printf("%s: Unable to set %s as output\n", __func__, name);
510 goto err_free_gpio;
511 }
512
513 gpio_set_value(gpio, 1);
514
515 return;
516
517err_free_gpio:
518 gpio_free(gpio);
519}
520
521#define REQUEST_AND_SET_GPIO(N) request_and_set_gpio(N, #N);
522
523/**
524 * RMII mode on ICEv2 board needs 50MHz clock. Given the clock
525 * synthesizer With a capacitor of 18pF, and 25MHz input clock cycle
526 * PLL1 gives an output of 100MHz. So, configuring the div2/3 as 2 to
527 * give 50MHz output for Eth0 and 1.
528 */
529static struct clk_synth cdce913_data = {
530 .id = 0x81,
531 .capacitor = 0x90,
532 .mux = 0x6d,
533 .pdiv2 = 0x2,
534 .pdiv3 = 0x2,
535};
536#endif
537
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000538/*
539 * Basic board specific setup. Pinmux has been handled already.
540 */
541int board_init(void)
542{
Tom Rini303bfe82013-10-01 12:32:04 -0400543#if defined(CONFIG_HW_WATCHDOG)
544 hw_watchdog_init();
545#endif
546
Tom Rinif3b6a1d2013-08-09 11:22:13 -0400547 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
pekon gupta53b4b322013-11-18 19:03:02 +0530548#if defined(CONFIG_NOR) || defined(CONFIG_NAND)
Ilya Yanok3d9725e2012-11-06 13:06:31 +0000549 gpmc_init();
Steve Kipiszbe9b6f82013-07-18 15:13:03 -0400550#endif
Lokesh Vutla0d144f52016-05-16 11:47:26 +0530551#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD))
552 int rv;
553
554 if (board_is_icev2()) {
555 REQUEST_AND_SET_GPIO(GPIO_PR1_MII_CTRL);
556 REQUEST_AND_SET_GPIO(GPIO_MUX_MII_CTRL);
557 REQUEST_AND_SET_GPIO(GPIO_FET_SWITCH_CTRL);
558 REQUEST_AND_SET_GPIO(GPIO_PHY_RESET);
559
560 rv = setup_clock_synthesizer(&cdce913_data);
561 if (rv) {
562 printf("Clock synthesizer setup failed %d\n", rv);
563 return rv;
564 }
565 }
566#endif
567
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000568 return 0;
569}
570
Tom Rini40271852012-10-24 07:28:17 +0000571#ifdef CONFIG_BOARD_LATE_INIT
572int board_late_init(void)
573{
574#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600575 int rc;
576 char *name = NULL;
Tom Rini4021fd92013-07-18 15:13:01 -0400577
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600578 rc = read_eeprom();
579 if (rc)
Tom Rini4021fd92013-07-18 15:13:01 -0400580 puts("Could not get board ID.\n");
Tom Rini40271852012-10-24 07:28:17 +0000581
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600582 if (board_is_bbg1())
583 name = "BBG1";
584 set_board_info_env(name);
Tom Rini40271852012-10-24 07:28:17 +0000585#endif
586
587 return 0;
588}
589#endif
590
Mugunthan V Ndf7a99f2015-09-07 14:22:18 +0530591#ifndef CONFIG_DM_ETH
592
Ilya Yanok0760a0d2013-02-05 11:36:26 +0000593#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
594 (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000595static void cpsw_control(int enabled)
596{
597 /* VTP can be added here */
598
599 return;
600}
601
602static struct cpsw_slave_data cpsw_slaves[] = {
603 {
604 .slave_reg_ofs = 0x208,
605 .sliver_reg_ofs = 0xd80,
Mugunthan V N4944f372014-02-18 07:31:52 -0500606 .phy_addr = 0,
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000607 },
608 {
609 .slave_reg_ofs = 0x308,
610 .sliver_reg_ofs = 0xdc0,
Mugunthan V N4944f372014-02-18 07:31:52 -0500611 .phy_addr = 1,
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000612 },
613};
614
615static struct cpsw_platform_data cpsw_data = {
Matt Portere24646f2013-03-15 10:07:02 +0000616 .mdio_base = CPSW_MDIO_BASE,
617 .cpsw_base = CPSW_BASE,
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000618 .mdio_div = 0xff,
619 .channels = 8,
620 .cpdma_reg_ofs = 0x800,
621 .slaves = 1,
622 .slave_data = cpsw_slaves,
623 .ale_reg_ofs = 0xd00,
624 .ale_entries = 1024,
625 .host_port_reg_ofs = 0x108,
626 .hw_stats_reg_ofs = 0x900,
Mugunthan V Nff559872013-07-08 16:04:37 +0530627 .bd_ram_ofs = 0x2000,
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000628 .mac_control = (1 << 5),
629 .control = cpsw_control,
630 .host_port_num = 0,
631 .version = CPSW_CTRL_VERSION_2,
632};
Ilya Yanok44a2c072012-11-06 13:48:24 +0000633#endif
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000634
Lokesh Vutla0d144f52016-05-16 11:47:26 +0530635#if ((defined(CONFIG_SPL_ETH_SUPPORT) || defined(CONFIG_SPL_USBETH_SUPPORT)) &&\
636 defined(CONFIG_SPL_BUILD)) || \
637 ((defined(CONFIG_DRIVER_TI_CPSW) || \
638 defined(CONFIG_USB_ETHER) && defined(CONFIG_MUSB_GADGET)) && \
639 !defined(CONFIG_SPL_BUILD))
640
Tom Rini60fcaaa2014-03-26 15:53:12 -0400641/*
642 * This function will:
643 * Read the eFuse for MAC addresses, and set ethaddr/eth1addr/usbnet_devaddr
644 * in the environment
645 * Perform fixups to the PHY present on certain boards. We only need this
646 * function in:
647 * - SPL with either CPSW or USB ethernet support
648 * - Full U-Boot, with either CPSW or USB ethernet
649 * Build in only these cases to avoid warnings about unused variables
650 * when we build an SPL that has neither option but full U-Boot will.
651 */
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000652int board_eth_init(bd_t *bis)
653{
Ilya Yanok44a2c072012-11-06 13:48:24 +0000654 int rv, n = 0;
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000655 uint8_t mac_addr[6];
656 uint32_t mac_hi, mac_lo;
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600657 __maybe_unused struct ti_am_eeprom *header;
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000658
Ilya Yanok0760a0d2013-02-05 11:36:26 +0000659 /* try reading mac address from efuse */
660 mac_lo = readl(&cdev->macid0l);
661 mac_hi = readl(&cdev->macid0h);
662 mac_addr[0] = mac_hi & 0xFF;
663 mac_addr[1] = (mac_hi & 0xFF00) >> 8;
664 mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
665 mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
666 mac_addr[4] = mac_lo & 0xFF;
667 mac_addr[5] = (mac_lo & 0xFF00) >> 8;
668
669#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
670 (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
671 if (!getenv("ethaddr")) {
672 printf("<ethaddr> not set. Validating first E-fuse MAC\n");
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000673
Joe Hershberger8ecdbed2015-04-08 01:41:04 -0500674 if (is_valid_ethaddr(mac_addr))
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000675 eth_setenv_enetaddr("ethaddr", mac_addr);
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000676 }
677
Joel A Fernandesf7488542013-05-07 05:52:55 +0000678#ifdef CONFIG_DRIVER_TI_CPSW
Mugunthan V N0c1d8562014-02-18 07:31:55 -0500679
680 mac_lo = readl(&cdev->macid1l);
681 mac_hi = readl(&cdev->macid1h);
682 mac_addr[0] = mac_hi & 0xFF;
683 mac_addr[1] = (mac_hi & 0xFF00) >> 8;
684 mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
685 mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
686 mac_addr[4] = mac_lo & 0xFF;
687 mac_addr[5] = (mac_lo & 0xFF00) >> 8;
688
689 if (!getenv("eth1addr")) {
Joe Hershberger8ecdbed2015-04-08 01:41:04 -0500690 if (is_valid_ethaddr(mac_addr))
Mugunthan V N0c1d8562014-02-18 07:31:55 -0500691 eth_setenv_enetaddr("eth1addr", mac_addr);
692 }
693
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600694 if (read_eeprom() < 0)
Tom Rini4021fd92013-07-18 15:13:01 -0400695 puts("Could not get board ID.\n");
696
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600697 if (board_is_bone() || board_is_bone_lt() ||
698 board_is_idk()) {
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000699 writel(MII_MODE_ENABLE, &cdev->miisel);
700 cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if =
701 PHY_INTERFACE_MODE_MII;
Lokesh Vutla0d144f52016-05-16 11:47:26 +0530702 } else if (board_is_icev2()) {
703 writel(RMII_MODE_ENABLE | RMII_CHIPCKL_ENABLE, &cdev->miisel);
704 cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RMII;
705 cpsw_slaves[1].phy_if = PHY_INTERFACE_MODE_RMII;
706 cpsw_slaves[0].phy_addr = 1;
707 cpsw_slaves[1].phy_addr = 3;
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000708 } else {
Heiko Schocherc4fea292013-08-19 16:38:56 +0200709 writel((RGMII_MODE_ENABLE | RGMII_INT_DELAY), &cdev->miisel);
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000710 cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if =
711 PHY_INTERFACE_MODE_RGMII;
712 }
713
Ilya Yanok44a2c072012-11-06 13:48:24 +0000714 rv = cpsw_register(&cpsw_data);
715 if (rv < 0)
716 printf("Error %d registering CPSW switch\n", rv);
717 else
718 n += rv;
Joel A Fernandesf7488542013-05-07 05:52:55 +0000719#endif
Tom Rini183943d2013-02-12 14:59:23 -0500720
721 /*
722 *
723 * CPSW RGMII Internal Delay Mode is not supported in all PVT
724 * operating points. So we must set the TX clock delay feature
725 * in the AR8051 PHY. Since we only support a single ethernet
726 * device in U-Boot, we only do this for the first instance.
727 */
728#define AR8051_PHY_DEBUG_ADDR_REG 0x1d
729#define AR8051_PHY_DEBUG_DATA_REG 0x1e
730#define AR8051_DEBUG_RGMII_CLK_DLY_REG 0x5
731#define AR8051_RGMII_TX_CLK_DLY 0x100
732
Nishanth Menon2afa70d2016-02-24 12:30:55 -0600733 if (board_is_evm_sk() || board_is_gp_evm()) {
Tom Rini183943d2013-02-12 14:59:23 -0500734 const char *devname;
735 devname = miiphy_get_current_dev();
736
737 miiphy_write(devname, 0x0, AR8051_PHY_DEBUG_ADDR_REG,
738 AR8051_DEBUG_RGMII_CLK_DLY_REG);
739 miiphy_write(devname, 0x0, AR8051_PHY_DEBUG_DATA_REG,
740 AR8051_RGMII_TX_CLK_DLY);
741 }
Ilya Yanok44a2c072012-11-06 13:48:24 +0000742#endif
Ilya Yanok0760a0d2013-02-05 11:36:26 +0000743#if defined(CONFIG_USB_ETHER) && \
744 (!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT))
Joe Hershberger8ecdbed2015-04-08 01:41:04 -0500745 if (is_valid_ethaddr(mac_addr))
Ilya Yanok0760a0d2013-02-05 11:36:26 +0000746 eth_setenv_enetaddr("usbnet_devaddr", mac_addr);
747
Ilya Yanok44a2c072012-11-06 13:48:24 +0000748 rv = usb_eth_initialize(bis);
749 if (rv < 0)
750 printf("Error %d registering USB_ETHER\n", rv);
751 else
752 n += rv;
753#endif
754 return n;
Peter Korsgaard85ec2db2012-10-18 01:21:09 +0000755}
756#endif
Mugunthan V Ndf7a99f2015-09-07 14:22:18 +0530757
758#endif /* CONFIG_DM_ETH */
Lokesh Vutla89b9f302016-05-16 11:24:24 +0530759
760#ifdef CONFIG_SPL_LOAD_FIT
761int board_fit_config_name_match(const char *name)
762{
763 if (board_is_gp_evm() && !strcmp(name, "am335x-evm"))
764 return 0;
765 else if (board_is_bone() && !strcmp(name, "am335x-bone"))
766 return 0;
767 else if (board_is_bone_lt() && !strcmp(name, "am335x-boneblack"))
768 return 0;
Lokesh Vutla5a954ba2016-05-16 11:24:28 +0530769 else if (board_is_evm_sk() && !strcmp(name, "am335x-evmsk"))
770 return 0;
Lokesh Vutla1edfcaf2016-05-16 11:24:29 +0530771 else if (board_is_bbg1() && !strcmp(name, "am335x-bonegreen"))
772 return 0;
Lokesh Vutla7ecf1962016-05-16 11:47:28 +0530773 else if (board_is_icev2() && !strcmp(name, "am335x-icev2"))
774 return 0;
Lokesh Vutla89b9f302016-05-16 11:24:24 +0530775 else
776 return -1;
777}
778#endif
Andrew F. Davisbd249152016-08-30 14:06:24 -0500779
780#ifdef CONFIG_TI_SECURE_DEVICE
781void board_fit_image_post_process(void **p_image, size_t *p_size)
782{
783 secure_boot_verify_image(p_image, p_size);
784}
785#endif