diff options
| author | Paul Barker <[email protected]> | 2025-02-28 12:47:52 +0000 |
|---|---|---|
| committer | Marek Vasut <[email protected]> | 2025-03-19 03:38:51 +0100 |
| commit | 985dc81a1d962a04ad1084bc4fe912492c8fe463 (patch) | |
| tree | 1a003d534e66a1bece017a90ed5c3ff5df2f360a /include | |
| parent | 667ab63f931bc16b38c1ce87f57a4914c1c7bcfa (diff) | |
net: phy: Port set/clear bits from Linux
To simply porting phy drivers from Linux to U-Boot, define
phy_set_bits() and phy_clear_bits() functions with a similar API to
those used in Linux.
The U-Boot versions of these functions include the `devad` argument
which is not present in the Linux versions, to keep them aligned with
the other phy functions in U-Boot.
Reviewed-by: Marek Vasut <[email protected]>
Signed-off-by: Paul Barker <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/phy.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/phy.h b/include/phy.h index 36785031eeb..36354aaf774 100644 --- a/include/phy.h +++ b/include/phy.h @@ -334,6 +334,30 @@ int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); /** + * phy_set_bits - Convenience function for setting bits in a PHY register + * @phydev: the phy_device struct + * @devad: The MMD to read from + * @regnum: register number to write + * @val: bits to set + */ +static inline int phy_set_bits(struct phy_device *phydev, int devad, u32 regnum, u16 val) +{ + return phy_modify(phydev, devad, regnum, 0, val); +} + +/** + * phy_clear_bits - Convenience function for clearing bits in a PHY register + * @phydev: the phy_device struct + * @devad: The MMD to write to + * @regnum: register number to write + * @val: bits to clear + */ +static inline int phy_clear_bits(struct phy_device *phydev, int devad, u32 regnum, u16 val) +{ + return phy_modify(phydev, devad, regnum, val, 0); +} + +/** * U_BOOT_PHY_DRIVER() - Declare a new U-Boot driver * @__name: name of the driver */ |
