From: Detlev Casanova <detlev.casanova@collabora.com>
To: u-boot@lists.denx.de
Cc: Joe Hershberger <joe.hershberger@ni.com>,
Ramon Fried <rfried.dev@gmail.com>, Tom Rini <trini@konsulko.com>,
Philipp Tomsich <philipp.tomsich@vrull.eu>,
Kever Yang <kever.yang@rock-chips.com>,
Marek Vasut <marek.vasut+renesas@mailbox.org>,
Jonas Karlman <jonas@kwiboo.se>, Simon Glass <sjg@chromium.org>,
Fabio Estevam <festevam@denx.de>,
Detlev Casanova <detlev.casanova@collabora.com>
Subject: [PATCH 3/3] net: eth-uclass: Add driver source possibility
Date: Thu, 14 Mar 2024 10:43:48 -0400 [thread overview]
Message-ID: <20240314144403.491850-4-detlev.casanova@collabora.com> (raw)
In-Reply-To: <20240314144403.491850-1-detlev.casanova@collabora.com>
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@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
prev parent reply other threads:[~2024-03-14 14:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-14 14:43 [PATCH 0/3] net: Add a CONFIG_NET_BOARD_ETHADDR Detlev Casanova
2024-03-14 14:43 ` [PATCH 1/3] " Detlev Casanova
2024-03-14 17:36 ` Marek Vasut
2024-03-14 14:43 ` [PATCH 2/3] rockchip: Add a board_gen_ethaddr() function Detlev Casanova
2024-03-14 17:37 ` Marek Vasut
2024-03-14 18:38 ` Jonas Karlman
2024-04-02 15:38 ` Detlev Casanova
2024-03-14 14:43 ` Detlev Casanova [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240314144403.491850-4-detlev.casanova@collabora.com \
--to=detlev.casanova@collabora.com \
--cc=festevam@denx.de \
--cc=joe.hershberger@ni.com \
--cc=jonas@kwiboo.se \
--cc=kever.yang@rock-chips.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=philipp.tomsich@vrull.eu \
--cc=rfried.dev@gmail.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox