aboutsummaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorAdam Ford2020-08-18 08:19:02 -0500
committerTom Rini2020-09-30 16:48:18 -0400
commit387cbf096e443705fa66776027273ed257ec6ca3 (patch)
tree6532cc9252b53c541d8c7d91b8c32344aa15daf6 /drivers/net
parent66e036bab503cddd6afbfecc8b7fcd8941d8bd7d (diff)
net: smc911x: Automatically Update ethaddr with MAC
The ethernet controller can read the MAC from EEPROM and display it, but if ethaddr is not set, the ethernet is still unavailable. This patch checks will automatically set the MAC address if it has not already been set. Signed-off-by: Adam Ford <aford173@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/smc911x.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 09372d7f6ba..1fa3667b77c 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <env.h>
#include <command.h>
#include <malloc.h>
#include <net.h>
@@ -185,6 +186,8 @@ static void smc911x_handle_mac_address(struct smc911x_priv *priv)
smc911x_set_mac_csr(priv, ADDRH, addrh);
printf(DRIVERNAME ": MAC %pM\n", m);
+ if (!env_get("ethaddr"))
+ env_set("ethaddr", (const char *)m);
}
static bool smc911x_read_mac_address(struct smc911x_priv *priv)