[U-Boot] [PATCH v2 6/6] da850: read MAC address from I2C EEPROM on AM18xx EVM
manjunath.hadli at ti.com
manjunath.hadli at ti.com
Sat Oct 8 11:28:38 CEST 2011
From: Manjunath Hadli <manjunath.hadli 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: Manjunath Hadli <manjunath.hadli at ti.com>
---
board/davinci/da8xxevm/da850evm.c | 10 +++++++++-
include/configs/da850_am18xxevm.h | 7 +++++++
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index e5f5b3a..e3aef8c 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -261,13 +261,15 @@ static void dspwake(void)
int misc_init_r(void)
{
+ uint8_t enetaddr[8];
uchar buff[8];
int ret;
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;
@@ -278,6 +280,12 @@ int misc_init_r(void)
}
eth_setenv_enetaddr("ethaddr", buff);
+#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..df0c1cc 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