diff options
author | Hannes Petermaier <oe5hpm@oevsv.at> | 2015-02-03 13:22:27 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-03-05 20:13:17 -0500 |
commit | d301425fbfc7a0c13df2a2965a289c829e2b1ba3 (patch) | |
tree | 98621121db936f870af5fe33070d0742999563aa /board/BuR/common | |
parent | fbd5aeda481526c5c23cb913461378423bdb2137 (diff) | |
download | u-boot-imx-d301425fbfc7a0c13df2a2965a289c829e2b1ba3.zip u-boot-imx-d301425fbfc7a0c13df2a2965a289c829e2b1ba3.tar.gz u-boot-imx-d301425fbfc7a0c13df2a2965a289c829e2b1ba3.tar.bz2 |
board/BuR/common: try to setup cpsw mac-address from the devicetree
since we have a dtb blob programmed on the board we try to setup the cpsw
interface with the programmed mac.
If this method fails, we fall back to the device-fuses.
Signed-off-by: Hannes Petermaier <oe5hpm@oevsv.at>
Diffstat (limited to 'board/BuR/common')
-rw-r--r-- | board/BuR/common/common.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c index 7d0e05c..18e1520 100644 --- a/board/BuR/common/common.c +++ b/board/BuR/common/common.c @@ -591,9 +591,9 @@ static struct cpsw_platform_data cpsw_data = { int board_eth_init(bd_t *bis) { int rv = 0; - uint8_t mac_addr[6]; + char mac_addr[6]; + const char *mac = 0; uint32_t mac_hi, mac_lo; - /* try reading mac address from efuse */ mac_lo = readl(&cdev->macid0l); mac_hi = readl(&cdev->macid0h); @@ -607,14 +607,19 @@ int board_eth_init(bd_t *bis) #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \ (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD)) if (!getenv("ethaddr")) { - printf("<ethaddr> not set. Validating first E-fuse MAC ... "); - - if (is_valid_ether_addr(mac_addr)) { - printf("using: %02X:%02X:%02X:%02X:%02X:%02X.\n", - mac_addr[0], mac_addr[1], mac_addr[2], - mac_addr[3], mac_addr[4], mac_addr[5] - ); - eth_setenv_enetaddr("ethaddr", mac_addr); + #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_USE_FDT) + printf("<ethaddr> not set. trying DTB ... "); + mac = dtbmacaddr(0); + #endif + if (!mac) { + printf("<ethaddr> not set. validating E-fuse MAC ... "); + if (is_valid_ether_addr((const u8 *)mac_addr)) + mac = (const char *)mac_addr; + } + + if (mac) { + printf("using: %pM on ", mac); + eth_setenv_enetaddr("ethaddr", (const u8 *)mac); } } writel(MII_MODE_ENABLE, &cdev->miisel); |