]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - drivers/net/phy/phy.c
TX6 Release 2013-04-22
[karo-tx-uboot.git] / drivers / net / phy / phy.c
index 8da7688d704e529c7869b7db682f4c03b8ecd414..0f4f8d2108a72c1d19fd73480b029baf0051ab14 100644 (file)
@@ -43,7 +43,7 @@
  *   what is supported.  Returns < 0 on error, 0 if the PHY's advertisement
  *   hasn't changed, and > 0 if it has changed.
  */
-int genphy_config_advert(struct phy_device *phydev)
+static int genphy_config_advert(struct phy_device *phydev)
 {
        u32 advertise;
        int oldadv, adv;
@@ -118,7 +118,7 @@ int genphy_config_advert(struct phy_device *phydev)
  * Description: Configures MII_BMCR to force speed/duplex
  *   to the values in phydev. Assumes that the values are valid.
  */
-int genphy_setup_forced(struct phy_device *phydev)
+static int genphy_setup_forced(struct phy_device *phydev)
 {
        int err;
        int ctl = 0;
@@ -444,6 +444,9 @@ int phy_init(void)
 #ifdef CONFIG_PHY_REALTEK
        phy_realtek_init();
 #endif
+#ifdef CONFIG_PHY_SMSC
+       phy_smsc_init();
+#endif
 #ifdef CONFIG_PHY_TERANETICS
        phy_teranetics_init();
 #endif
@@ -462,7 +465,7 @@ int phy_register(struct phy_driver *drv)
        return 0;
 }
 
-int phy_probe(struct phy_device *phydev)
+static int phy_probe(struct phy_device *phydev)
 {
        int err = 0;
 
@@ -485,7 +488,7 @@ static struct phy_driver *generic_for_interface(phy_interface_t interface)
        return &genphy_driver;
 }
 
-struct phy_driver *get_phy_driver(struct phy_device *phydev,
+static struct phy_driver *get_phy_driver(struct phy_device *phydev,
                                phy_interface_t interface)
 {
        struct list_head *entry;
@@ -502,8 +505,9 @@ struct phy_driver *get_phy_driver(struct phy_device *phydev,
        return generic_for_interface(interface);
 }
 
-struct phy_device *phy_device_create(struct mii_dev *bus, int addr, int phy_id,
-                                       phy_interface_t interface)
+static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
+                                           int phy_id,
+                                           phy_interface_t interface)
 {
        struct phy_device *dev;
 
@@ -546,7 +550,7 @@ struct phy_device *phy_device_create(struct mii_dev *bus, int addr, int phy_id,
  * Description: Reads the ID registers of the PHY at @addr on the
  *   @bus, stores it in @phy_id and returns zero on success.
  */
-int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id)
+static int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id)
 {
        int phy_reg;
 
@@ -578,8 +582,8 @@ int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id)
  * Description: Reads the ID registers of the PHY at @addr on the
  *   @bus, then allocates and returns the phy_device to represent it.
  */
-struct phy_device *get_phy_device(struct mii_dev *bus, int addr,
-                               phy_interface_t interface)
+static struct phy_device *get_phy_device(struct mii_dev *bus, int addr,
+                                        phy_interface_t interface)
 {
        u32 phy_id = 0x1fffffff;
        int i;
@@ -609,10 +613,9 @@ struct phy_device *get_phy_device(struct mii_dev *bus, int addr,
 
                /* If the phy_id is mostly Fs, there is no device there */
                if ((phy_id & 0x1fffffff) != 0x1fffffff)
-                       break;
+                       return phy_device_create(bus, addr, phy_id, interface);
        }
-
-       return phy_device_create(bus, addr, phy_id, interface);
+       return NULL;
 }
 
 int phy_reset(struct phy_device *phydev)
@@ -720,16 +723,21 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
        return phydev;
 }
 
+/*
+ * Start the PHY.  Returns 0 on success, or a negative error code.
+ */
 int phy_startup(struct phy_device *phydev)
 {
        if (phydev->drv->startup)
-               phydev->drv->startup(phydev);
+               return phydev->drv->startup(phydev);
 
        return 0;
 }
 
 static int __board_phy_config(struct phy_device *phydev)
 {
+       if (phydev->drv->config)
+               return phydev->drv->config(phydev);
        return 0;
 }
 
@@ -738,9 +746,6 @@ int board_phy_config(struct phy_device *phydev)
 
 int phy_config(struct phy_device *phydev)
 {
-       if (phydev->drv->config)
-               phydev->drv->config(phydev);
-
        /* Invoke an optional board-specific helper */
        board_phy_config(phydev);