[U-Boot] [PATCH 2/2] da850evm: read mac address from I2C EEPROM on AM18x EVM

Manjunath Hadli manjunath.hadli at ti.com
Thu Feb 2 14:42:18 CET 2012


add support to read mac address for AM18x EVM manufactured from
Spectrum digital which have mac address stored in I2C EEPROM manfactured
by WINBOND. This patch reads mac address from I2C EEPROM and updates
environment variable if not set. Introduced a config option
CONFIG_MAC_ADDR_IN_EEPROM to where to look for the mac address.

Signed-off-by: Manjunath Hadli <manjunath.hadli at ti.com>
Cc: Tom Rini <trini at ti.com>
---
 board/davinci/da8xxevm/da850evm.c |   12 ++++++++++--
 boards.cfg                        |    2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index dcb22cb..8963243 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -139,11 +139,12 @@ int misc_init_r(void)
 {
 	dspwake();
 
-#ifdef CONFIG_MAC_ADDR_IN_SPIFLASH
+#if defined(CONFIG_MAC_ADDR_IN_SPIFLASH) || defined(CONFIG_MAC_ADDR_IN_EEPROM)
 	uchar buff[8];
-	int ret;
 
 	if (!eth_getenv_enetaddr("ethaddr", buff)) {
+#ifdef CONFIG_MAC_ADDR_IN_SPIFLASH
+		int ret;
 		ret = get_mac_addr(buff);
 		if (ret != 0)
 			return -EINVAL;
@@ -154,6 +155,13 @@ int misc_init_r(void)
 		}
 
 		eth_setenv_enetaddr("ethaddr", buff);
+#else
+		uint8_t enetaddr[8];
+		/* Read Ethernet MAC address from EEPROM */
+		if (dvevm_read_mac_address(enetaddr))
+			/* Set Ethernet MAC address from EEPROM */
+			davinci_sync_env_enetaddr(enetaddr);
+#endif
 	}
 #endif
 	return 0;
diff --git a/boards.cfg b/boards.cfg
index ad6c5b8..2e6d267 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -120,7 +120,7 @@ pm9263                       arm         arm926ejs   pm9263              ronetix
 pm9g45                       arm         arm926ejs   pm9g45              ronetix        at91        pm9g45:AT91SAM9G45
 cam_enc_4xx                  arm         arm926ejs   cam_enc_4xx         ait            davinci     cam_enc_4xx
 da830evm                     arm         arm926ejs   da8xxevm            davinci        davinci
-da850_am18xxevm              arm         arm926ejs   da8xxevm            davinci        davinci     da850evm:DA850_AM18X_EVM
+da850_am18xxevm              arm         arm926ejs   da8xxevm            davinci        davinci     da850evm:DA850_AM18X_EVM,MAC_ADDR_IN_EEPROM,SYS_I2C_EEPROM_ADDR_LEN=2,SYS_I2C_EEPROM_ADDR=0x50
 da850evm                     arm         arm926ejs   da8xxevm            davinci        davinci     da850evm:MAC_ADDR_IN_SPIFLASH
 davinci_dm355evm             arm         arm926ejs   dm355evm            davinci        davinci
 davinci_dm355leopard         arm         arm926ejs   dm355leopard        davinci        davinci
-- 
1.6.2.4



More information about the U-Boot mailing list