[U-Boot] [PATCH 09/12] da850: read MAC address from I2C EEPROM on AM18xx EVM

nagabhushana.netagunte at ti.com nagabhushana.netagunte at ti.com
Tue Aug 2 17:43:09 CEST 2011


From: Nagabhushana Netagunte <nagabhushana.netagunte at ti.com>

The AM18xx EVM contains MAC address in I2C EEPROM compared
da850/omap-l138 Logic PD EVM which maintains in SPI flash. So this
patch tries to read MAC address from I2C EEPROM, in failure case reads
from SPI flash assuming board to be da850/omap-l138 Logic PDS EVM.

Signed-off-by: Manjunathappa, Prakash <prakash.pm at ti.com>
Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte at ti.com>
---
 board/davinci/da8xxevm/da850evm.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index eb9c915..64ff566 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -494,10 +494,16 @@ int misc_init_r(void)
 	printf("ARM Clock : %d Hz\n", clk_get(DAVINCI_ARM_CLKID));
 
 	if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
-		/* Set Ethernet MAC address from EEPROM */
-		ret = get_mac_addr_spi(addr);
-		if (ret != 0)
-			return -EINVAL;
+		/* Read Ethernet MAC address from EEPROM */
+		if (dvevm_read_mac_address(addr)) {
+			/* Set Ethernet MAC address from EEPROM */
+			davinci_sync_env_enetaddr(addr);
+		} else {
+			/* Set Ethernet MAC address from SPI flash */
+			ret = get_mac_addr_spi(addr);
+			if (ret != 0)
+				return -EINVAL;
+		}
 
 		if (is_multicast_ether_addr(addr) || is_zero_ether_addr(addr)) {
 			printf("Invalid MAC address read.\n");
-- 
1.6.2.4



More information about the U-Boot mailing list