ethernet:gmac: fix the bug of connection failure with PHY because of wrong phy_addr
authorroger <cz@rock-chips.com>
Mon, 22 Sep 2014 06:30:24 +0000 (14:30 +0800)
committerroger <cz@rock-chips.com>
Mon, 22 Sep 2014 06:30:24 +0000 (14:30 +0800)
drivers/net/ethernet/rockchip/gmac/stmmac_main.c
drivers/net/ethernet/rockchip/gmac/stmmac_mdio.c

index 6ce9fee67db29b255d98438c3467a69b6b5fd8bd..4338bb0d824678d22abffae06b653fb83fa9bf25 100755 (executable)
@@ -91,7 +91,7 @@ static int debug = -1;
 module_param(debug, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Message Level (-1: default, 0: no output, 16: all)");
 
-int phyaddr = 1;
+int phyaddr = -1;
 module_param(phyaddr, int, S_IRUGO);
 MODULE_PARM_DESC(phyaddr, "Physical device address");
 
@@ -2785,6 +2785,8 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
        /* Verify driver arguments */
        stmmac_verify_args();
 
+       priv->plat->phy_addr = -1;
+
        /* Override with kernel parameters if supplied XXX CRS XXX
         * this needs to have multiple instances
         */
index 4b148e9c217c9f710c1f57d735f9f950c88d1608..84ac35ebc0162680eb3ea6faff344d6c81847dc4 100755 (executable)
@@ -211,6 +211,8 @@ int stmmac_mdio_register(struct net_device *ndev)
                         */
                        if (priv->plat->phy_addr == -1)
                                priv->plat->phy_addr = addr;
+                       else if (priv->plat->phy_addr == 0)
+                               priv->plat->phy_addr = addr;
 
                        act = (priv->plat->phy_addr == addr);
                        switch (phydev->irq) {
@@ -229,6 +231,10 @@ int stmmac_mdio_register(struct net_device *ndev)
                                ndev->name, phydev->phy_id, addr,
                                irq_str, dev_name(&phydev->dev),
                                act ? " active" : "");
+                       if ((phydev->drv) && phydev->drv->name) {
+                               pr_info("PHY driver name: %s", phydev->drv->name);
+                       }
+
                        found = 1;
                }
        }