[U-Boot] [PATCH 6/7] ARM: k2g: setup PRU ethernet MAC addresses

Roger Quadros rogerq at ti.com
Thu Jan 26 14:07:28 CET 2017


PRU ethernet MAC address range is present in the
board EEPROM. Parse it and setup eth?addr
environment variables.

Signed-off-by: Roger Quadros <rogerq at ti.com>
---
 board/ti/ks2_evm/board_k2g.c | 19 +++++++++++++++++++
 include/configs/k2g_evm.h    |  4 ++++
 2 files changed, 23 insertions(+)

diff --git a/board/ti/ks2_evm/board_k2g.c b/board/ti/ks2_evm/board_k2g.c
index 40edbaa..64a62e0 100644
--- a/board/ti/ks2_evm/board_k2g.c
+++ b/board/ti/ks2_evm/board_k2g.c
@@ -12,6 +12,7 @@
 #include <asm/arch/psc_defs.h>
 #include <asm/arch/mmc_host_def.h>
 #include "mux-k2g.h"
+#include "../common/board_detect.h"
 
 #define SYS_CLK		24000000
 
@@ -149,6 +150,24 @@ int board_early_init_f(void)
 }
 #endif
 
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+	__maybe_unused int rc;
+
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_TI_I2C_BOARD_DETECT)
+	rc = ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS,
+			CONFIG_EEPROM_CHIP_ADDRESS);
+	if (rc)
+		printf("ti_i2c_eeprom_init failed %d\n", rc);
+
+	board_ti_set_ethaddr(1);
+#endif
+
+	return 0;
+}
+#endif
+
 #ifdef CONFIG_SPL_BUILD
 void spl_init_keystone_plls(void)
 {
diff --git a/include/configs/k2g_evm.h b/include/configs/k2g_evm.h
index 81da8ff..f37dbfd 100644
--- a/include/configs/k2g_evm.h
+++ b/include/configs/k2g_evm.h
@@ -53,6 +53,10 @@
 /* NAND Configuration */
 #define CONFIG_SYS_NAND_PAGE_2K
 
+/* Board Detection EEPROM */
+#define CONFIG_EEPROM_BUS_ADDRESS	0
+#define CONFIG_EEPROM_CHIP_ADDRESS	0x50
+
 /* Network */
 #define CONFIG_KSNET_NETCP_V1_5
 #define CONFIG_KSNET_CPSW_NUM_PORTS	2
-- 
2.7.4



More information about the U-Boot mailing list