]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: designware: use 'phy_connect' instead of open coded
authorSimon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Mon, 15 Jul 2019 19:53:05 +0000 (21:53 +0200)
committerJoe Hershberger <joe.hershberger@ni.com>
Thu, 25 Jul 2019 18:13:30 +0000 (13:13 -0500)
Using 'phy_connect' instead of 'phy_find_by_mask' and 'phy_connect_dev'
both deduplicates code and adds support for 'fixed-link'.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
drivers/net/designware.c

index 3b6cf5ddb5049fb5fe126c7558463a57d8bf2127..c4fe40b19aa92e0266d3665e29671a10fc1a7a6f 100644 (file)
@@ -480,18 +480,16 @@ static int _dw_free_pkt(struct dw_eth_dev *priv)
 static int dw_phy_init(struct dw_eth_dev *priv, void *dev)
 {
        struct phy_device *phydev;
-       int mask = 0xffffffff, ret;
+       int phy_addr = -1, ret;
 
 #ifdef CONFIG_PHY_ADDR
-       mask = 1 << CONFIG_PHY_ADDR;
+       phy_addr = CONFIG_PHY_ADDR;
 #endif
 
-       phydev = phy_find_by_mask(priv->bus, mask, priv->interface);
+       phydev = phy_connect(priv->bus, phy_addr, dev, priv->interface);
        if (!phydev)
                return -ENODEV;
 
-       phy_connect_dev(phydev, dev);
-
        phydev->supported &= PHY_GBIT_FEATURES;
        if (priv->max_speed) {
                ret = phy_set_supported(phydev, priv->max_speed);