diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2020-03-17 14:52:31 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-03-17 22:51:16 -0700 |
commit | 6cc7cf8125b3d086cd80c96e02edb6f4ab9b20fa (patch) | |
tree | 0b8bb4e86040f450dcff823d9f263367a314901b /include/linux/phy.h | |
parent | 89e3e3ddcb6850d8208743e1c52a7a9dd38e5455 (diff) |
net: mdiobus: add APIs for modifying a MDIO device register
Add APIs for modifying a MDIO device register, similar to the existing
phy_modify() group of functions, but at mdiobus level instead. Adapt
__phy_modify_changed() to use the new mdiobus level helper.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/phy.h')
-rw-r--r-- | include/linux/phy.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h index cb5a2182ba6d..36d9dea04016 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -755,6 +755,25 @@ static inline int __phy_write(struct phy_device *phydev, u32 regnum, u16 val) } /** + * __phy_modify_changed() - Convenience function for modifying a PHY register + * @phydev: a pointer to a &struct phy_device + * @regnum: register number + * @mask: bit mask of bits to clear + * @set: bit mask of bits to set + * + * Unlocked helper function which allows a PHY register to be modified as + * new register value = (old register value & ~mask) | set + * + * Returns negative errno, 0 if there was no change, and 1 in case of change + */ +static inline int __phy_modify_changed(struct phy_device *phydev, u32 regnum, + u16 mask, u16 set) +{ + return __mdiobus_modify_changed(phydev->mdio.bus, phydev->mdio.addr, + regnum, mask, set); +} + +/** * phy_read_mmd - Convenience function for reading a register * from an MMD on a given PHY. * @phydev: The phy_device struct |