mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-03-16 23:07:00 +00:00
net: phy: Add phy_modify() accessor
Add read-modify-write unlocked accessor for accessing a PHY register. Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
This commit is contained in:
parent
d7db0e6df3
commit
087baf80ec
2 changed files with 22 additions and 0 deletions
|
@ -1110,3 +1110,23 @@ int phy_get_interface_by_name(const char *str)
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* phy_modify - Convenience function for modifying a given PHY register
|
||||
* @phydev: the phy_device struct
|
||||
* @devad: The MMD to read from
|
||||
* @regnum: register number to write
|
||||
* @mask: bit mask of bits to clear
|
||||
* @set: new value of bits set in mask to write to @regnum
|
||||
*/
|
||||
int phy_modify(struct phy_device *phydev, int devad, int regnum, u16 mask,
|
||||
u16 set)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = phy_read(phydev, devad, regnum);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return phy_write(phydev, devad, regnum, (ret & ~mask) | set);
|
||||
}
|
||||
|
|
|
@ -526,6 +526,8 @@ int phy_config(struct phy_device *phydev);
|
|||
int phy_shutdown(struct phy_device *phydev);
|
||||
int phy_register(struct phy_driver *drv);
|
||||
int phy_set_supported(struct phy_device *phydev, u32 max_speed);
|
||||
int phy_modify(struct phy_device *phydev, int devad, int regnum, u16 mask,
|
||||
u16 set);
|
||||
int genphy_config_aneg(struct phy_device *phydev);
|
||||
int genphy_restart_aneg(struct phy_device *phydev);
|
||||
int genphy_update_link(struct phy_device *phydev);
|
||||
|
|
Loading…
Add table
Reference in a new issue