]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
net: gem: Do not probe phy if phy-handle is not setup
authorMichal Simek <michal.simek@xilinx.com>
Thu, 1 May 2014 07:23:08 +0000 (09:23 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 1 May 2014 09:57:58 +0000 (11:57 +0200)
Driver doesn't support automatic phy detection
as macb driver that's why don't crash when phy is not found.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Tested-by: Nathan Rossi <nathan.rossi@xilinx.com>
drivers/net/ethernet/xilinx/xilinx_emacps.c

index de8f31d5a1d9bb352caa93eace85b3ade26f629f..ebdfdabd05a36e97b049ed1aaea596c534d5f80d 100644 (file)
@@ -758,13 +758,17 @@ static int xemacps_mii_probe(struct net_device *ndev)
        struct net_local *lp = netdev_priv(ndev);
        struct phy_device *phydev = NULL;
 
-       if (lp->phy_node) {
-               phydev = of_phy_connect(lp->ndev,
-                                       lp->phy_node,
-                                       &xemacps_adjust_link,
-                                       0,
-                                       lp->phy_interface);
+       if (!lp->phy_node) {
+               dev_info(&lp->pdev->dev, "%s: no PHY setup\n", ndev->name);
+               return 0;
        }
+
+       phydev = of_phy_connect(lp->ndev,
+                               lp->phy_node,
+                               &xemacps_adjust_link,
+                               0,
+                               lp->phy_interface);
+
        if (!phydev) {
                dev_err(&lp->pdev->dev, "%s: no PHY found\n", ndev->name);
                return -1;
@@ -845,8 +849,11 @@ static int xemacps_mii_init(struct net_local *lp)
        of_address_to_resource(npp, 0, &res);
        snprintf(lp->mii_bus->id, MII_BUS_ID_SIZE, "%.8llx",
                 (unsigned long long)res.start);
-       if (of_mdiobus_register(lp->mii_bus, np))
-               goto err_out_free_mdio_irq;
+
+       if (lp->phy_node) {
+               if (of_mdiobus_register(lp->mii_bus, np))
+                       goto err_out_free_mdio_irq;
+       }
 
        return 0;