Skip to contentSkip to conversation

net: smc911x: Automatically Update ethaddr with MAC

PATCH New Adam Ford 2 participants 3 messages Aug 16, 2020 – Aug 17, 2020 Network drivers

lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/1 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.

drivers/net/smc911x.c +3 -0
index 9c5dc46483..f028bfba18 100644
@@ -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("fdt_file", (const char *)m);
 }
 
 static bool smc911x_read_mac_address(struct smc911x_priv *priv)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 net: smc911x: Automatically Update ethaddr with MAC

Quoted 21 lines · Adam Ford

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.

drivers/net/smc911x.c +1 -0
index 9c5dc46483..f028bfba18 100644
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <command.h>
 #include <malloc.h>
 #include <net.h>

drivers/net/smc911x.c static void smc911x_handle_mac_address(struct smc911x_priv *priv) · line 190

Quoted 5 lines
drivers/net/smc911x.c +2 -0
@@ -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("fdt_file", (const char *)m);

Um, clearly a thinko here and you meant ethaddr and not fdt_file? :)

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200817/c2d61b5a/attachment.sig>
author
#2 lore raw

PATCH 1/1 net: smc911x: Automatically Update ethaddr with MAC

Quoted 26 lines · Tom Rini
Quoted 23 lines · Adam Ford

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.

drivers/net/smc911x.c +1 -0
index 9c5dc46483..f028bfba18 100644
@@ -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);
 
Quoted 5 lines

drivers/net/smc911x.c static void smc911x_handle_mac_address(struct smc911x_priv *priv) · line 190

Quoted 3 lines
drivers/net/smc911x.c +2 -0
      printf(DRIVERNAME ": MAC %pM\n", m);
+     if (!env_get("ethaddr"))
+             env_set("fdt_file", (const char *)m);

Um, clearly a thinko here and you meant ethaddr and not fdt_file? :)

You are right. (facepalm, egg on my face)

I'll submit a V2 later today.

adam

Quoted 3 lines

--
Tom