]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
net: phy: add genphy_aneg_done()
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 12 Feb 2014 01:27:36 +0000 (17:27 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Feb 2014 00:08:19 +0000 (19:08 -0500)
In preparation for allowing PHY drivers to potentially override their
auto-negotiation done callback, move the contents of phy_aneg_done() to
genphy_aneg_done() since that function really is the generic
implementation based on the BMSR_ANEGCOMPLETE status.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy.c
drivers/net/phy/phy_device.c
include/linux/phy.h

index 36fc6e16b56986d9a99a56e7c2c459f1b65d9985..db9c543bd2afa7574378a231e0ef27e70be800e8 100644 (file)
@@ -120,9 +120,7 @@ static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts)
  */
 static inline int phy_aneg_done(struct phy_device *phydev)
 {
-       int retval = phy_read(phydev, MII_BMSR);
-
-       return (retval < 0) ? retval : (retval & BMSR_ANEGCOMPLETE);
+       return genphy_aneg_done(phydev);
 }
 
 /* A structure for mapping a particular speed and duplex
index 82514e72b3d8b47538cc8c75a8e52f361d1361c8..4e7db726028f64cec02e09fad751f919dbd78d18 100644 (file)
@@ -865,6 +865,22 @@ int genphy_config_aneg(struct phy_device *phydev)
 }
 EXPORT_SYMBOL(genphy_config_aneg);
 
+/**
+ * genphy_aneg_done - return auto-negotiation status
+ * @phydev: target phy_device struct
+ *
+ * Description: Reads the status register and returns 0 either if
+ *   auto-negotiation is incomplete, or if there was an error.
+ *   Returns BMSR_ANEGCOMPLETE if auto-negotiation is done.
+ */
+int genphy_aneg_done(struct phy_device *phydev)
+{
+       int retval = phy_read(phydev, MII_BMSR);
+
+       return (retval < 0) ? retval : (retval & BMSR_ANEGCOMPLETE);
+}
+EXPORT_SYMBOL(genphy_aneg_done);
+
 static int gen10g_config_aneg(struct phy_device *phydev)
 {
        return 0;
index 565188ca328f31841a4c8b718db2c4fd08238278..c572842c9029f9bdfb113153f76ff34b41a522f9 100644 (file)
@@ -612,6 +612,7 @@ static inline int phy_read_status(struct phy_device *phydev)
 int genphy_setup_forced(struct phy_device *phydev);
 int genphy_restart_aneg(struct phy_device *phydev);
 int genphy_config_aneg(struct phy_device *phydev);
+int genphy_aneg_done(struct phy_device *phydev);
 int genphy_update_link(struct phy_device *phydev);
 int genphy_read_status(struct phy_device *phydev);
 int genphy_suspend(struct phy_device *phydev);