diff options
| author | David S. Miller <davem@davemloft.net> | 2018-01-16 12:25:11 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2018-01-16 12:25:11 -0500 |
| commit | ccc27fcb8b594973daa6b84bb2fbef672c580651 (patch) | |
| tree | 435fea93fa29006e32c973692427c05e97747889 /include | |
| parent | 79d891c1bbb6573cef31dbc2030fba61cfa1df6d (diff) | |
| parent | 032f4700814346ff935531a9dfa8ecfaeeb38c07 (diff) | |
| download | talos-obmc-linux-ccc27fcb8b594973daa6b84bb2fbef672c580651.tar.gz talos-obmc-linux-ccc27fcb8b594973daa6b84bb2fbef672c580651.zip | |
Merge branch 'phy-add-helpers-for-setting-clearing-bits-in-PHY-registers'
Heiner Kallweit says:
====================
phy: add helpers for setting/clearing bits in PHY registers
Based on the recent introduction of phy_modify add helpers for setting
and clearing bits in PHY registers. First user is phylib.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/phy.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h index 47715a3115b0..5a0c3e53e7c2 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -765,6 +765,55 @@ int __phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set); int phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set); /** + * __phy_set_bits - Convenience function for setting bits in a PHY register + * @phydev: the phy_device struct + * @regnum: register number to write + * @val: bits to set + * + * The caller must have taken the MDIO bus lock. + */ +static inline int __phy_set_bits(struct phy_device *phydev, u32 regnum, u16 val) +{ + return __phy_modify(phydev, regnum, 0, val); +} + +/** + * __phy_clear_bits - Convenience function for clearing bits in a PHY register + * @phydev: the phy_device struct + * @regnum: register number to write + * @val: bits to clear + * + * The caller must have taken the MDIO bus lock. + */ +static inline int __phy_clear_bits(struct phy_device *phydev, u32 regnum, + u16 val) +{ + return __phy_modify(phydev, regnum, val, 0); +} + +/** + * phy_set_bits - Convenience function for setting bits in a PHY register + * @phydev: the phy_device struct + * @regnum: register number to write + * @val: bits to set + */ +static inline int phy_set_bits(struct phy_device *phydev, u32 regnum, u16 val) +{ + return phy_modify(phydev, regnum, 0, val); +} + +/** + * phy_clear_bits - Convenience function for clearing bits in a PHY register + * @phydev: the phy_device struct + * @regnum: register number to write + * @val: bits to clear + */ +static inline int phy_clear_bits(struct phy_device *phydev, u32 regnum, u16 val) +{ + return phy_modify(phydev, regnum, val, 0); +} + +/** * phy_interrupt_is_valid - Convenience function for testing a given PHY irq * @phydev: the phy_device struct * |

