4 * Board functions for TI AM43XX based boards
6 * Copyright (C) 2013, Texas Instruments, Incorporated - http://www.ti.com/
8 * SPDX-License-Identifier: GPL-2.0+
13 #include <asm/errno.h>
15 #include <asm/arch/clock.h>
16 #include <asm/arch/sys_proto.h>
17 #include <asm/arch/mux.h>
20 DECLARE_GLOBAL_DATA_PTR;
23 * Read header information from EEPROM into global structure.
25 static int read_eeprom(struct am43xx_board_id *header)
27 /* Check if baseboard eeprom is available */
28 if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) {
29 printf("Could not probe the EEPROM at 0x%x\n",
30 CONFIG_SYS_I2C_EEPROM_ADDR);
34 /* read the eeprom using i2c */
35 if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)header,
36 sizeof(struct am43xx_board_id))) {
37 printf("Could not read the EEPROM\n");
41 if (header->magic != 0xEE3355AA) {
43 * read the eeprom using i2c again,
44 * but use only a 1 byte address
46 if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 1, (uchar *)header,
47 sizeof(struct am43xx_board_id))) {
48 printf("Could not read the EEPROM at 0x%x\n",
49 CONFIG_SYS_I2C_EEPROM_ADDR);
53 if (header->magic != 0xEE3355AA) {
54 printf("Incorrect magic number (0x%x) in EEPROM\n",
60 strncpy(am43xx_board_name, (char *)header->name, sizeof(header->name));
61 am43xx_board_name[sizeof(header->name)] = 0;
66 #ifdef CONFIG_SPL_BUILD
68 const struct dpll_params dpll_ddr = {
69 -1, -1, -1, -1, -1, -1, -1};
71 const struct dpll_params *get_dpll_ddr_params(void)
76 void set_uart_mux_conf(void)
78 enable_uart0_pin_mux();
81 void set_mux_conf_regs(void)
83 enable_board_pin_mux();
93 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
98 #ifdef CONFIG_BOARD_LATE_INIT
99 int board_late_init(void)
101 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
102 char safe_string[HDR_NAME_LEN + 1];
103 struct am43xx_board_id header;
105 if (read_eeprom(&header) < 0)
106 puts("Could not get board ID.\n");
108 /* Now set variables based on the header. */
109 strncpy(safe_string, (char *)header.name, sizeof(header.name));
110 safe_string[sizeof(header.name)] = 0;
111 setenv("board_name", safe_string);
113 strncpy(safe_string, (char *)header.version, sizeof(header.version));
114 safe_string[sizeof(header.version)] = 0;
115 setenv("board_rev", safe_string);