]> git.sur5r.net Git - u-boot/blobdiff - drivers/net/phy/phy.c
Merge git://git.denx.de/u-boot-sunxi
[u-boot] / drivers / net / phy / phy.c
index 23c82bb36e93ed0e70f50af532e659ab6612a68f..5be51d73ce623cc7e8f66c7ab7171e781f68bc49 100644 (file)
@@ -248,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()) {
@@ -431,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)
@@ -458,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
@@ -482,8 +488,11 @@ int phy_init(void)
 #ifdef CONFIG_PHY_MARVELL
        phy_marvell_init();
 #endif
-#ifdef CONFIG_PHY_MICREL
-       phy_micrel_init();
+#ifdef CONFIG_PHY_MICREL_KSZ8XXX
+       phy_micrel_ksz8xxx_init();
+#endif
+#ifdef CONFIG_PHY_MICREL_KSZ90X1
+       phy_micrel_ksz90x1_init();
 #endif
 #ifdef CONFIG_PHY_NATSEMI
        phy_natsemi_init();
@@ -506,7 +515,12 @@ int phy_init(void)
 #ifdef CONFIG_PHY_XILINX
        phy_xilinx_init();
 #endif
-
+#ifdef CONFIG_PHY_MSCC
+       phy_mscc_init();
+#endif
+#ifdef CONFIG_PHY_FIXED
+       phy_fixed_init();
+#endif
        return 0;
 }
 
@@ -845,9 +859,24 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
                struct eth_device *dev, phy_interface_t interface)
 #endif
 {
-       struct phy_device *phydev;
+       struct phy_device *phydev = NULL;
+#ifdef CONFIG_PHY_FIXED
+       int sn;
+       const char *name;
+       sn = fdt_first_subnode(gd->fdt_blob, dev_of_offset(dev));
+       while (sn > 0) {
+               name = fdt_get_name(gd->fdt_blob, sn, NULL);
+               if (name != NULL && strcmp(name, "fixed-link") == 0) {
+                       phydev = phy_device_create(bus,
+                                                  sn, PHY_FIXED_ID, interface);
+                       break;
+               }
+               sn = fdt_next_subnode(gd->fdt_blob, sn);
+       }
+#endif
+       if (phydev == NULL)
+               phydev = phy_find_by_mask(bus, 1 << addr, interface);
 
-       phydev = phy_find_by_mask(bus, 1 << addr, interface);
        if (phydev)
                phy_connect_dev(phydev, dev);
        else
@@ -876,9 +905,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)