summaryrefslogtreecommitdiff
path: root/net/mdio-uclass.c
diff options
context:
space:
mode:
authorMatthias Schiffer <[email protected]>2025-09-30 10:05:10 +0200
committerTom Rini <[email protected]>2025-10-10 11:07:44 -0600
commit8db554dcbb2374a2dea130af56d781732070beb7 (patch)
treea680802e57b1b38725cb1144bd30e0db02d15ad2 /net/mdio-uclass.c
parent361731fc39c3257c28efda902344270b7eb1fd4d (diff)
net: mdio-uclass: introduce dm_eth_phy_connect_interface()
dm_eth_phy_connect_interface() is a variant of dm_eth_phy_connect() that allows to set the used PHY mode, in case the MAC driver needs to fix it up. The previously static dm_eth_connect_phy_handle() is renamed and extended for this purpose. Signed-off-by: Matthias Schiffer <[email protected]>
Diffstat (limited to 'net/mdio-uclass.c')
-rw-r--r--net/mdio-uclass.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c
index 4f052ae432c..64af689d2df 100644
--- a/net/mdio-uclass.c
+++ b/net/mdio-uclass.c
@@ -242,8 +242,8 @@ struct phy_device *dm_mdio_phy_connect(struct udevice *mdiodev, int phyaddr,
return phy_connect(pdata->mii_bus, phyaddr, ethdev, interface);
}
-static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev,
- phy_interface_t interface)
+struct phy_device *dm_eth_phy_connect_interface(struct udevice *ethdev,
+ phy_interface_t interface)
{
u32 phy_addr;
struct udevice *mdiodev;
@@ -282,8 +282,10 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev,
phy = dm_mdio_phy_connect(mdiodev, phy_addr, ethdev, interface);
out:
- if (phy)
+ if (phy) {
phy->node = phynode;
+ phy->interface = interface;
+ }
return phy;
}
@@ -292,7 +294,6 @@ out:
struct phy_device *dm_eth_phy_connect(struct udevice *ethdev)
{
phy_interface_t interface;
- struct phy_device *phy;
if (!dev_has_ofnode(ethdev)) {
debug("%s: supplied eth dev has no DT node!\n", ethdev->name);
@@ -303,14 +304,7 @@ struct phy_device *dm_eth_phy_connect(struct udevice *ethdev)
if (interface == PHY_INTERFACE_MODE_NA)
dev_dbg(ethdev, "can't find interface mode, default to NA\n");
- phy = dm_eth_connect_phy_handle(ethdev, interface);
-
- if (!phy)
- return NULL;
-
- phy->interface = interface;
-
- return phy;
+ return dm_eth_phy_connect_interface(ethdev, interface);
}
UCLASS_DRIVER(mdio) = {