From 5ce377d42e14fc2e7d9bbb1156697d9dbc3d664e Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 18 Nov 2014 11:34:58 +0100 Subject: 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. --- board/toradex/common/configblock.c | 11 +++++++++++ include/configs/colibri_vf.h | 1 + 2 files changed, 12 insertions(+) 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 -- cgit v1.2.3