diff mbox series

[U-Boot,3/3] ARM: omap3: evm: Refactor 'board_eth_init'

Message ID 20171216201450.5770-4-woods.technical@gmail.com
State Accepted
Commit 836e67ee66b938289feeb6ef774e245a56add21b
Delegated to: Tom Rini
Headers show
Series ARM: omap3: evm: Add OF_CONTROL support | expand

Commit Message

Derald Woods Dec. 16, 2017, 8:14 p.m. UTC
This commit clears 'ethaddr' before calling 'smc911x_initialize' to
allow the SROM MAC address to be assigned properly.

Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
---
 board/ti/evm/evm.c | 24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

Comments

Tom Rini Jan. 2, 2018, 12:47 a.m. UTC | #1
On Sat, Dec 16, 2017 at 02:14:50PM -0600, Derald D. Woods wrote:

> This commit clears 'ethaddr' before calling 'smc911x_initialize' to
> allow the SROM MAC address to be assigned properly.
> 
> Signed-off-by: Derald D. Woods <woods.technical@gmail.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index 4d5ddff1e1..3a9680ffec 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -299,26 +299,12 @@  static void reset_net_chip(void)
 
 int board_eth_init(bd_t *bis)
 {
-	int rc = 0;
 #if defined(CONFIG_SMC911X)
-#define STR_ENV_ETHADDR	"ethaddr"
-
-	struct eth_device *dev;
-	uchar eth_addr[6];
-
-	rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
-
-	if (!eth_env_get_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
-		dev = eth_get_dev_by_index(0);
-		if (dev) {
-			eth_env_set_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
-		} else {
-			printf("omap3evm: Couldn't get eth device\n");
-			rc = -1;
-		}
-	}
-#endif /* CONFIG_SMC911X */
-	return rc;
+	env_set("ethaddr", NULL);
+	return smc911x_initialize(0, CONFIG_SMC911X_BASE);
+#else
+	return 0;
+#endif
 }
 #endif /* CONFIG_CMD_NET */