--- zzzz-none-000/linux-4.4.271/include/linux/phy/phy.h 2021-06-03 06:22:09.000000000 +0000 +++ hawkeye-5590-750/linux-4.4.271/include/linux/phy/phy.h 2023-04-19 10:22:30.000000000 +0000 @@ -35,6 +35,8 @@ int (*exit)(struct phy *phy); int (*power_on)(struct phy *phy); int (*power_off)(struct phy *phy); + int (*read)(struct phy *phy, u32 reg); + int (*write)(struct phy *phy, u32 val, u32 reg); struct module *owner; }; @@ -108,6 +110,22 @@ return dev_get_drvdata(&phy->dev); } +static inline int phy_io_read(struct phy *phy, u32 reg) +{ + if (phy && phy->ops->read) + return phy->ops->read(phy, reg); + + return -EINVAL; +} + +static inline int phy_io_write(struct phy *phy, u32 val, u32 reg) +{ + if (phy && phy->ops->write) + return phy->ops->write(phy, val, reg); + + return -EINVAL; +} + #if IS_ENABLED(CONFIG_GENERIC_PHY) int phy_pm_runtime_get(struct phy *phy); int phy_pm_runtime_get_sync(struct phy *phy);