]> git.sur5r.net Git - u-boot/blobdiff - drivers/net/phy/phy.c
fdt: add memory bank decoding functions for board setup
[u-boot] / drivers / net / phy / phy.c
index a06115d9f832f5496d509c92c1b7374de7a34297..80bdfb6d9d5dc535ca6e89f7aa7ecaf597eb7189 100644 (file)
@@ -235,7 +235,8 @@ int genphy_update_link(struct phy_device *phydev)
        if (phydev->link && mii_reg & BMSR_LSTATUS)
                return 0;
 
-       if ((mii_reg & BMSR_ANEGCAPABLE) && !(mii_reg & BMSR_ANEGCOMPLETE)) {
+       if ((phydev->autoneg == AUTONEG_ENABLE) &&
+           !(mii_reg & BMSR_ANEGCOMPLETE)) {
                int i = 0;
 
                printf("%s Waiting for PHY auto negotiation to complete",
@@ -247,7 +248,7 @@ int genphy_update_link(struct phy_device *phydev)
                        if (i > PHY_ANEG_TIMEOUT) {
                                printf(" TIMEOUT !\n");
                                phydev->link = 0;
-                               return 0;
+                               return -ETIMEDOUT;
                        }
 
                        if (ctrlc()) {
@@ -291,7 +292,7 @@ int genphy_parse_link(struct phy_device *phydev)
        int mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMSR);
 
        /* We're using autonegotiation */
-       if (phydev->supported & SUPPORTED_Autoneg) {
+       if (phydev->autoneg == AUTONEG_ENABLE) {
                u32 lpa = 0;
                int gblpa = 0;
                u32 estatus = 0;
@@ -430,10 +431,13 @@ int genphy_config(struct phy_device *phydev)
 
 int genphy_startup(struct phy_device *phydev)
 {
-       genphy_update_link(phydev);
-       genphy_parse_link(phydev);
+       int ret;
 
-       return 0;
+       ret = genphy_update_link(phydev);
+       if (ret)
+               return ret;
+
+       return genphy_parse_link(phydev);
 }
 
 int genphy_shutdown(struct phy_device *phydev)
@@ -457,6 +461,9 @@ static LIST_HEAD(phy_drivers);
 
 int phy_init(void)
 {
+#ifdef CONFIG_MV88E61XX_SWITCH
+       phy_mv88e61xx_init();
+#endif
 #ifdef CONFIG_PHY_AQUANTIA
        phy_aquantia_init();
 #endif
@@ -502,6 +509,9 @@ int phy_init(void)
 #ifdef CONFIG_PHY_VITESSE
        phy_vitesse_init();
 #endif
+#ifdef CONFIG_PHY_XILINX
+       phy_xilinx_init();
+#endif
 
        return 0;
 }
@@ -742,6 +752,9 @@ int phy_reset(struct phy_device *phydev)
        int timeout = 500;
        int devad = MDIO_DEVAD_NONE;
 
+       if (phydev->flags & PHY_FLAG_BROKEN_RESET)
+               return 0;
+
 #ifdef CONFIG_PHYLIB_10G
        /* If it's 10G, we need to issue reset through one of the MMDs */
        if (is_10g_interface(phydev->interface)) {
@@ -869,9 +882,7 @@ __weak int board_phy_config(struct phy_device *phydev)
 int phy_config(struct phy_device *phydev)
 {
        /* Invoke an optional board-specific helper */
-       board_phy_config(phydev);
-
-       return 0;
+       return board_phy_config(phydev);
 }
 
 int phy_shutdown(struct phy_device *phydev)