]> git.ipfire.org Git - thirdparty/u-boot.git/blobdiff - drivers/net/designware.c
net: designware: Reset eth phy before phy connect
[thirdparty/u-boot.git] / drivers / net / designware.c
index c8696358d6f7b36b683c53ef9696e799d46818dd..c15fb36ae3fb411b303d0f2bb1b1b57e88b5be01 100644 (file)
@@ -13,6 +13,7 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <eth_phy.h>
 #include <log.h>
 #include <miiphy.h>
 #include <malloc.h>
@@ -576,6 +577,9 @@ static int dw_phy_init(struct dw_eth_dev *priv, void *dev)
        struct phy_device *phydev;
        int ret;
 
+       if (IS_ENABLED(CONFIG_DM_ETH_PHY))
+               eth_phy_set_mdio_bus(dev, NULL);
+
 #if IS_ENABLED(CONFIG_DM_MDIO)
        phydev = dm_eth_phy_connect(dev);
        if (!phydev)
@@ -583,6 +587,9 @@ static int dw_phy_init(struct dw_eth_dev *priv, void *dev)
 #else
        int phy_addr = -1;
 
+       if (IS_ENABLED(CONFIG_DM_ETH_PHY))
+               phy_addr = eth_phy_get_addr(dev);
+
 #ifdef CONFIG_PHY_ADDR
        phy_addr = CONFIG_PHY_ADDR;
 #endif