aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2014-02-11 20:27:36 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-12 19:08:19 -0500
commita9fa6e6ac29709e7a623b60695c172da675df045 (patch)
tree902ffd99a28a5f3a82495afd7711a479e0bd5e4f /drivers
parent766d1d388e6e6bfda99a00d68ac9247a1c25a0d9 (diff)
net: phy: add genphy_aneg_done()
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/phy/phy.c4
-rw-r--r--drivers/net/phy/phy_device.c16
2 files changed, 17 insertions, 3 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 36fc6e16b569..db9c543bd2af 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -120,9 +120,7 @@ static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts)
120 */ 120 */
121static inline int phy_aneg_done(struct phy_device *phydev) 121static inline int phy_aneg_done(struct phy_device *phydev)
122{ 122{
123 int retval = phy_read(phydev, MII_BMSR); 123 return genphy_aneg_done(phydev);
124
125 return (retval < 0) ? retval : (retval & BMSR_ANEGCOMPLETE);
126} 124}
127 125
128/* A structure for mapping a particular speed and duplex 126/* A structure for mapping a particular speed and duplex
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 82514e72b3d8..4e7db726028f 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -865,6 +865,22 @@ int genphy_config_aneg(struct phy_device *phydev)
865} 865}
866EXPORT_SYMBOL(genphy_config_aneg); 866EXPORT_SYMBOL(genphy_config_aneg);
867 867
868/**
869 * genphy_aneg_done - return auto-negotiation status
870 * @phydev: target phy_device struct
871 *
872 * Description: Reads the status register and returns 0 either if
873 * auto-negotiation is incomplete, or if there was an error.
874 * Returns BMSR_ANEGCOMPLETE if auto-negotiation is done.
875 */
876int genphy_aneg_done(struct phy_device *phydev)
877{
878 int retval = phy_read(phydev, MII_BMSR);
879
880 return (retval < 0) ? retval : (retval & BMSR_ANEGCOMPLETE);
881}
882EXPORT_SYMBOL(genphy_aneg_done);
883
868static int gen10g_config_aneg(struct phy_device *phydev) 884static int gen10g_config_aneg(struct phy_device *phydev)
869{ 885{
870 return 0; 886 return 0;