summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2014-11-18 11:34:58 +0100
committerStefan Agner <stefan.agner@toradex.com>2014-11-18 12:37:44 +0100
commit5ce377d42e14fc2e7d9bbb1156697d9dbc3d664e (patch)
tree1d415eb11ace597f76bb544200740fb898563274
parent7031ed747021815dd8303d8a70b8c070ba709c56 (diff)
colibri_vf: calculate and set secondary MAC address
In order to support dual ethernet configurations, a second MAC address is needed. Toradex assignes two addresses for each module, one address is the serial number, and the second is the serial number with an offset of 0x100000.
-rw-r--r--board/toradex/common/configblock.c11
-rw-r--r--include/configs/colibri_vf.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/board/toradex/common/configblock.c b/board/toradex/common/configblock.c
index bd76b845a8..825cb0c10f 100644
--- a/board/toradex/common/configblock.c
+++ b/board/toradex/common/configblock.c
@@ -163,6 +163,17 @@ int read_trdx_cfg_block(void)
if (!eth_getenv_enetaddr("ethaddr", ethaddr))
eth_setenv_enetaddr("ethaddr", cfg_block_ethaddr);
+#ifdef CONFIG_TRDX_CFG_BLOCK_2ND_ETHADDR
+ if (!eth_getenv_enetaddr("eth1addr", ethaddr)) {
+ /*
+ * Secondary MAC address is allocated from a block
+ * 0x100000 higher then the first MAC address
+ */
+ cfg_block_ethaddr[3] += 0x10;
+ eth_setenv_enetaddr("eth1addr", cfg_block_ethaddr);
+ }
+#endif
+
return 0;
}
#endif /* CONFIG_TRDX_CFG_BLOCK */
diff --git a/include/configs/colibri_vf.h b/include/configs/colibri_vf.h
index 87aa617a57..76564acc4e 100644
--- a/include/configs/colibri_vf.h
+++ b/include/configs/colibri_vf.h
@@ -115,6 +115,7 @@
#define CONFIG_TRDX_CFG_BLOCK_IS_IN_NAND
#define CONFIG_TRDX_CFG_BLOCK_OFFSET 0x800
#define CONFIG_TRDX_CFG_BLOCK_SIZE 2048
+#define CONFIG_TRDX_CFG_BLOCK_2ND_ETHADDR
#define CONFIG_REVISION_TAG
#define CONFIG_SERIAL_TAG