[U-Boot] [PATCH v3 5/5] da850evm: read MAC address from I2C EEPROM on AM18x EVM
manjunath.hadli at ti.com
manjunath.hadli at ti.com
Tue Oct 11 09:06:40 CEST 2011
From: Manjunath Hadli <manjunath.hadli at ti.com>
The AM18x 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_am18xevm.h | 7 +++++++
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index 6aa76cb..f3e50f7 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_am18xevm.h b/include/configs/da850_am18xevm.h
index ee574da..7f88424 100644
--- a/include/configs/da850_am18xevm.h
+++ b/include/configs/da850_am18xevm.h
@@ -92,6 +92,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
@@ -172,6 +178,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