aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/phy.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/phy.h')
-rw-r--r--include/linux/phy.h21
1 files changed, 5 insertions, 16 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 3b051f761450..127fcc9c3778 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -48,6 +48,7 @@ extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_features) __ro_after_init;
48extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_fibre_features) __ro_after_init; 48extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_fibre_features) __ro_after_init;
49extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_all_ports_features) __ro_after_init; 49extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_gbit_all_ports_features) __ro_after_init;
50extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_features) __ro_after_init; 50extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_features) __ro_after_init;
51extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_fec_features) __ro_after_init;
51extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_init; 52extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_init;
52 53
53#define PHY_BASIC_FEATURES ((unsigned long *)&phy_basic_features) 54#define PHY_BASIC_FEATURES ((unsigned long *)&phy_basic_features)
@@ -56,6 +57,7 @@ extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_ini
56#define PHY_GBIT_FIBRE_FEATURES ((unsigned long *)&phy_gbit_fibre_features) 57#define PHY_GBIT_FIBRE_FEATURES ((unsigned long *)&phy_gbit_fibre_features)
57#define PHY_GBIT_ALL_PORTS_FEATURES ((unsigned long *)&phy_gbit_all_ports_features) 58#define PHY_GBIT_ALL_PORTS_FEATURES ((unsigned long *)&phy_gbit_all_ports_features)
58#define PHY_10GBIT_FEATURES ((unsigned long *)&phy_10gbit_features) 59#define PHY_10GBIT_FEATURES ((unsigned long *)&phy_10gbit_features)
60#define PHY_10GBIT_FEC_FEATURES ((unsigned long *)&phy_10gbit_fec_features)
59#define PHY_10GBIT_FULL_FEATURES ((unsigned long *)&phy_10gbit_full_features) 61#define PHY_10GBIT_FULL_FEATURES ((unsigned long *)&phy_10gbit_full_features)
60 62
61extern const int phy_10_100_features_array[4]; 63extern const int phy_10_100_features_array[4];
@@ -467,8 +469,8 @@ struct phy_device {
467 * only works for PHYs with IDs which match this field 469 * only works for PHYs with IDs which match this field
468 * name: The friendly name of this PHY type 470 * name: The friendly name of this PHY type
469 * phy_id_mask: Defines the important bits of the phy_id 471 * phy_id_mask: Defines the important bits of the phy_id
470 * features: A list of features (speed, duplex, etc) supported 472 * features: A mandatory list of features (speed, duplex, etc)
471 * by this PHY 473 * supported by this PHY
472 * flags: A bitfield defining certain other features this PHY 474 * flags: A bitfield defining certain other features this PHY
473 * supports (like interrupts) 475 * supports (like interrupts)
474 * 476 *
@@ -672,26 +674,13 @@ phy_lookup_setting(int speed, int duplex, const unsigned long *mask,
672size_t phy_speeds(unsigned int *speeds, size_t size, 674size_t phy_speeds(unsigned int *speeds, size_t size,
673 unsigned long *mask); 675 unsigned long *mask);
674 676
675static inline bool __phy_is_started(struct phy_device *phydev)
676{
677 WARN_ON(!mutex_is_locked(&phydev->lock));
678
679 return phydev->state >= PHY_UP;
680}
681
682/** 677/**
683 * phy_is_started - Convenience function to check whether PHY is started 678 * phy_is_started - Convenience function to check whether PHY is started
684 * @phydev: The phy_device struct 679 * @phydev: The phy_device struct
685 */ 680 */
686static inline bool phy_is_started(struct phy_device *phydev) 681static inline bool phy_is_started(struct phy_device *phydev)
687{ 682{
688 bool started; 683 return phydev->state >= PHY_UP;
689
690 mutex_lock(&phydev->lock);
691 started = __phy_is_started(phydev);
692 mutex_unlock(&phydev->lock);
693
694 return started;
695} 684}
696 685
697void phy_resolve_aneg_linkmode(struct phy_device *phydev); 686void phy_resolve_aneg_linkmode(struct phy_device *phydev);