Expose the direct mdiobus read and write functions. These will be needed to refactor the SIOCGMIIREG and SIOCSMIIREG IOCTLs to fallback to indirect C45 access if needed. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx> --- drivers/net/phy/phy-core.c | 10 ++++++---- include/linux/phy.h | 12 ++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c index 1f98b6a96c15..2845294053eb 100644 --- a/drivers/net/phy/phy-core.c +++ b/drivers/net/phy/phy-core.c @@ -542,8 +542,8 @@ static void mmd_phy_indirect(struct mii_bus *bus, int phy_addr, int devad, devad | MII_MMD_CTRL_NOINCR); } -static int mmd_phy_read(struct mii_bus *bus, int phy_addr, bool is_c45, - int devad, u32 regnum) +int mmd_phy_read(struct mii_bus *bus, int phy_addr, bool is_c45, + int devad, u32 regnum) { if (is_c45) return __mdiobus_c45_read(bus, phy_addr, devad, regnum); @@ -552,9 +552,10 @@ static int mmd_phy_read(struct mii_bus *bus, int phy_addr, bool is_c45, /* Read the content of the MMD's selected register */ return __mdiobus_read(bus, phy_addr, MII_MMD_DATA); } +EXPORT_SYMBOL(mmd_phy_read); -static int mmd_phy_write(struct mii_bus *bus, int phy_addr, bool is_c45, - int devad, u32 regnum, u16 val) +int mmd_phy_write(struct mii_bus *bus, int phy_addr, bool is_c45, + int devad, u32 regnum, u16 val) { if (is_c45) return __mdiobus_c45_write(bus, phy_addr, devad, regnum, val); @@ -563,6 +564,7 @@ static int mmd_phy_write(struct mii_bus *bus, int phy_addr, bool is_c45, /* Write the data into MMD's selected register */ return __mdiobus_write(bus, phy_addr, MII_MMD_DATA, val); } +EXPORT_SYMBOL(mmd_phy_write); /** * __phy_read_mmd - Convenience function for reading a register diff --git a/include/linux/phy.h b/include/linux/phy.h index a98bc91a0cde..10af3e3711fa 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1402,6 +1402,18 @@ int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum); __ret; \ }) +/* + * mmd_phy_read - Convenience function for direct mdiobus read. + */ +int mmd_phy_read(struct mii_bus *bus, int phy_addr, bool is_c45, int devad, + u32 regnum); + +/* + * mmd_phy_write - Convenience function for direct mdiobus write. + */ +int mmd_phy_write(struct mii_bus *bus, int phy_addr, bool is_c45, + int devad, u32 regnum, u16 val); + /* * __phy_read_mmd - Convenience function for reading a register * from an MMD on a given PHY. -- 2.46.0