[PATCH 2/3] net: sh_eth: Use PHY MDIO address from DT if available
Marek Vasut
marek.vasut+renesas at mailbox.org
Sun Jan 21 18:29:34 CET 2024
In case the PHY is fully described in DT, use PHY MDIO address
from DT directly instead of always using auto-detection. This
also fixes the behavior of 'mdio list' in such DT setup, which
now prints the PHY connected to the MAC correctly.
Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
---
Cc: Joe Hershberger <joe.hershberger at ni.com>
Cc: Paul Barker <paul.barker.ct at bp.renesas.com>
Cc: Ramon Fried <rfried.dev at gmail.com>
---
drivers/net/ravb.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ravb.c b/drivers/net/ravb.c
index 0bcd6cfd3f3..e1f61f514c8 100644
--- a/drivers/net/ravb.c
+++ b/drivers/net/ravb.c
@@ -12,6 +12,7 @@
#include <clk.h>
#include <cpu_func.h>
#include <dm.h>
+#include <eth_phy.h>
#include <errno.h>
#include <log.h>
#include <miiphy.h>
@@ -309,9 +310,14 @@ static int ravb_phy_config(struct udevice *dev)
struct ravb_priv *eth = dev_get_priv(dev);
struct eth_pdata *pdata = dev_get_plat(dev);
struct phy_device *phydev;
+ int phy_addr;
int reg;
- phydev = phy_connect(eth->bus, -1, dev, pdata->phy_interface);
+ phy_addr = eth_phy_get_addr(dev);
+ if (phy_addr < 0)
+ phy_addr = -1;
+
+ phydev = phy_connect(eth->bus, phy_addr, dev, pdata->phy_interface);
if (!phydev)
return -ENODEV;
--
2.43.0
More information about the U-Boot
mailing list