]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/net/ucc_geth.c
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
[mv-sheeva.git] / drivers / net / ucc_geth.c
index a110326dce6f8682d24206fec681a03a0084ab59..933fcfbf35e1ea332e29081b6ab84bd64a2fca5e 100644 (file)
@@ -2009,6 +2009,9 @@ static void ucc_geth_stop(struct ucc_geth_private *ugeth)
        /* Disable Rx and Tx */
        clrbits32(&ug_regs->maccfg1, MACCFG1_ENABLE_RX | MACCFG1_ENABLE_TX);
 
+       phy_disconnect(ugeth->phydev);
+       ugeth->phydev = NULL;
+
        ucc_geth_memclean(ugeth);
 }
 
@@ -3345,6 +3348,14 @@ static int ucc_geth_open(struct net_device *dev)
                return -EINVAL;
        }
 
+       err = init_phy(dev);
+       if (err) {
+               if (netif_msg_ifup(ugeth))
+                       ugeth_err("%s: Cannot initialize PHY, aborting.",
+                                 dev->name);
+               return err;
+       }
+
        err = ucc_struct_init(ugeth);
        if (err) {
                if (netif_msg_ifup(ugeth))
@@ -3381,13 +3392,6 @@ static int ucc_geth_open(struct net_device *dev)
                                   &ugeth->ug_regs->macstnaddr1,
                                   &ugeth->ug_regs->macstnaddr2);
 
-       err = init_phy(dev);
-       if (err) {
-               if (netif_msg_ifup(ugeth))
-                       ugeth_err("%s: Cannot initialize PHY, aborting.", dev->name);
-               goto out_err;
-       }
-
        phy_start(ugeth->phydev);
 
        err = ugeth_enable(ugeth, COMM_DIR_RX_AND_TX);
@@ -3430,9 +3434,6 @@ static int ucc_geth_close(struct net_device *dev)
 
        free_irq(ugeth->ug_info->uf_info.irq, ugeth->dev);
 
-       phy_disconnect(ugeth->phydev);
-       ugeth->phydev = NULL;
-
        netif_stop_queue(dev);
 
        return 0;
@@ -3647,15 +3648,16 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
                mdio = of_get_parent(phy);
 
                if (mdio == NULL)
-                       return -1;
+                       return -ENODEV;
 
                err = of_address_to_resource(mdio, 0, &res);
-               of_node_put(mdio);
-
-               if (err)
-                       return -1;
 
+               if (err) {
+                       of_node_put(mdio);
+                       return err;
+               }
                fsl_pq_mdio_bus_name(bus_name, mdio);
+               of_node_put(mdio);
                snprintf(ug_info->phy_bus_id, sizeof(ug_info->phy_bus_id),
                        "%s:%02x", bus_name, *prop);
        }