diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2014-02-11 20:27:36 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-12 19:08:19 -0500 |
commit | a9fa6e6ac29709e7a623b60695c172da675df045 (patch) | |
tree | 902ffd99a28a5f3a82495afd7711a479e0bd5e4f /drivers/net/phy/phy_device.c | |
parent | 766d1d388e6e6bfda99a00d68ac9247a1c25a0d9 (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/net/phy/phy_device.c')
-rw-r--r-- | drivers/net/phy/phy_device.c | 16 |
1 files changed, 16 insertions, 0 deletions
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 | } |
866 | EXPORT_SYMBOL(genphy_config_aneg); | 866 | EXPORT_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 | */ | ||
876 | int 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 | } | ||
882 | EXPORT_SYMBOL(genphy_aneg_done); | ||
883 | |||
868 | static int gen10g_config_aneg(struct phy_device *phydev) | 884 | static int gen10g_config_aneg(struct phy_device *phydev) |
869 | { | 885 | { |
870 | return 0; | 886 | return 0; |