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 <[email protected]>
---
Cc: Joe Hershberger <[email protected]>
Cc: Paul Barker <[email protected]>
Cc: Ramon Fried <[email protected]>
---
 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

Reply via email to