[PATCH 3/3] net: eth-uclass: Add driver source possibility
Detlev Casanova
detlev.casanova at collabora.com
Thu Mar 14 15:43:48 CET 2024
Some net driver, like rtl8169, can set/get the MAC address from the
registers and store it in pdata->enetaddr.
When that happens, if there is a mismatch with the environment MAC
address, u-boot will show that the MAC address source is DT. This patch
ensures that the shown source is "driver" instead to avoid confusion.
Signed-off-by: Detlev Casanova <detlev.casanova at collabora.com>
---
net/eth-uclass.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index f194df8512a..6e521955fa5 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -565,9 +565,13 @@ static int eth_post_probe(struct udevice *dev)
priv->state = ETH_STATE_INIT;
priv->running = false;
+ /* Check if the driver has already set a valid MAC address */
+ if (is_valid_ethaddr(pdata->enetaddr)) {
+ source = "driver";
+ }
/* Check if the device has a valid MAC address in device tree */
- if (!eth_dev_get_mac_address(dev, pdata->enetaddr) ||
- !is_valid_ethaddr(pdata->enetaddr)) {
+ else if (!eth_dev_get_mac_address(dev, pdata->enetaddr) ||
+ !is_valid_ethaddr(pdata->enetaddr)) {
/* Check if the device has a MAC address in ROM */
int ret = -1;
if (eth_get_ops(dev)->read_rom_hwaddr) {
--
2.43.2
More information about the U-Boot
mailing list