]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/net/cpsw.c
Merge branch 'u-boot/master'
[karo-tx-uboot.git] / drivers / net / cpsw.c
index 9bab71a212d94e08f7c010573819773e1afbd30b..bd5fba21cee5651ef3c8d9bb830fab2f6475ef3d 100644 (file)
@@ -568,9 +568,14 @@ static void cpsw_set_slave_mac(struct cpsw_slave *slave,
 static void cpsw_slave_update_link(struct cpsw_slave *slave,
                                   struct cpsw_priv *priv, int *link)
 {
-       struct phy_device *phy = priv->phydev;
+       struct phy_device *phy;
        u32 mac_control = 0;
 
+       phy = priv->phydev;
+
+       if (!phy)
+               return;
+
        phy_startup(phy);
        *link = phy->link;
 
@@ -651,7 +656,7 @@ static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv)
 
        cpsw_ale_add_mcast(priv, NetBcastAddr, 1 << slave_port);
 
-       priv->phy_mask |= 1 << slave->data->phy_id;
+       priv->phy_mask |= 1 << slave->data->phy_addr;
 }
 
 static struct cpdma_desc *cpdma_desc_alloc(struct cpsw_priv *priv)
@@ -909,7 +914,7 @@ static int cpsw_recv(struct eth_device *dev)
        void *buffer;
        int len;
 
-       cpsw_update_link(priv);
+       cpsw_check_link(priv);
 
        while (cpdma_process(priv, &priv->rx_chan, &buffer, &len) >= 0) {
                invalidate_dcache_range((unsigned long)buffer,
@@ -936,17 +941,16 @@ static int cpsw_phy_init(struct eth_device *dev, struct cpsw_slave *slave)
 {
        struct cpsw_priv *priv = (struct cpsw_priv *)dev->priv;
        struct phy_device *phydev;
-       u32 supported = (SUPPORTED_10baseT_Half |
-                       SUPPORTED_10baseT_Full |
-                       SUPPORTED_100baseT_Half |
-                       SUPPORTED_100baseT_Full |
-                       SUPPORTED_1000baseT_Full);
+       u32 supported = PHY_GBIT_FEATURES;
 
        phydev = phy_connect(priv->bus,
-                       CONFIG_PHY_ADDR,
+                       slave->data->phy_addr,
                        dev,
                        slave->data->phy_if);
 
+       if (!phydev)
+               return -1;
+
        phydev->supported &= supported;
        phydev->advertising = phydev->supported;