[U-Boot] [PATCH 6/6] da850: read MAC address from I2C EEPROM on AM18xx EVM
nagabhushana.netagunte at ti.com
nagabhushana.netagunte at ti.com
Fri Sep 30 13:24:27 CEST 2011
From: Nagabhushana Netagunte <nagabhushana.netagunte at ti.com>
The AM18xx EVM contains MAC address in I2C EEPROM. Introduced
a new macro CONFIG_MAC_ADDR_IN_EEPROM to where to look for mac
address. This patch reads MAC address from I2C EEPROM and updates
environment variable.
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 | 9 ++++++++-
include/configs/da850_am18xxevm.h | 7 +++++++
2 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index 31ab0d6..bcdaf2b 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -267,8 +267,9 @@ 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)
if (!eth_getenv_enetaddr("ethaddr", buff)) {
+#ifdef CONFIG_MAC_ADDR_IN_SPIFLASH
ret = get_mac_addr(buff);
if (ret != 0)
return -EINVAL;
@@ -282,6 +283,12 @@ int misc_init_r(void)
sprintf((char *)enetaddr, "%pM", buff);
eth_setenv_enetaddr("ethaddr", enetaddr);
+#else
+ /* 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/include/configs/da850_am18xxevm.h b/include/configs/da850_am18xxevm.h
index 29d580b..b525f14 100644
--- a/include/configs/da850_am18xxevm.h
+++ b/include/configs/da850_am18xxevm.h
@@ -93,6 +93,12 @@
#define CONFIG_SYS_I2C_EXPANDER_ADDR 0x20
/*
+ * I2C EEPROM definitions EEPROM chip
+ */
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
+#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
+
+/*
* Flash & Environment
*/
#ifdef CONFIG_USE_NAND
@@ -173,6 +179,7 @@
#define CONFIG_SYS_LONGHELP
#define CONFIG_CRC32_VERIFY
#define CONFIG_MX_CYCLIC
+#define CONFIG_MAC_ADDR_IN_EEPROM
/*
* Linux Information
--
1.6.2.4
More information about the U-Boot
mailing list