[PATCH 1/3] net: give a different name to rtl8169 interfaces
ETIENNE DUBLE
etienne.duble at imag.fr
Mon Jun 24 14:40:14 CEST 2024
This commit implements the .bind member function,
and gives a different name to interfaces:
"RTL8169#0", "RTL8169#1", etc.
This was tested on a FriendlyElec Nanopi R5C board,
which has two RTL-8125B interfaces managed by this
driver. Since they were given the same name, it
was previously not possible to select the 2nd one
using ethact or ethprime environment variables.
Signed-off-by: Etienne Dublé <etienne.duble at imag.fr>
---
drivers/net/rtl8169.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index 93e83661ce..b30d51731f 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -1091,6 +1091,16 @@ static int rtl8169_eth_probe(struct udevice *dev)
return 0;
}
+static int rtl8169_eth_bind(struct udevice *dev)
+{
+ static int card_number;
+ char name[16];
+
+ sprintf(name, "RTL8169#%u", card_number++);
+
+ return device_set_name(dev, name);
+}
+
static const struct eth_ops rtl8169_eth_ops = {
.start = rtl8169_eth_start,
.send = rtl8169_eth_send,
@@ -1108,6 +1118,7 @@ U_BOOT_DRIVER(eth_rtl8169) = {
.name = "eth_rtl8169",
.id = UCLASS_ETH,
.of_match = rtl8169_eth_ids,
+ .bind = rtl8169_eth_bind,
.probe = rtl8169_eth_probe,
.ops = &rtl8169_eth_ops,
.priv_auto = sizeof(struct rtl8169_private),
--
2.34.1
More information about the U-Boot
mailing list