From 65de36f5eae1c540115bf8f705f853718e9b6451 Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org>
Date: Mon, 5 Jan 2026 16:38:29 +0000
Subject: [PATCH 3/5] net: phy: move mmd_phy_read and mmd_phy_write to phylib.h

Helper functions mmd_phy_read and mmd_phy_write are useful for PHYs
which require custom MMD access functions for some but not all MMDs.
Move mmd_phy_read and mmd_phy_write function prototypes from
phylib-internal.h to phylib.h to make them available for PHY drivers.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/79169cd624a3572d426e42c7b13cd2654a35d0cb.1767630451.git.daniel@makrotopia.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Note that this patch replaces the commit above as neither phylink.h nor
phylink-internal.h exist in Linux 6.12.
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -2022,6 +2022,11 @@ int genphy_c45_an_config_eee_aneg(struct
 /* The gen10g_* functions are the old Clause 45 stub */
 int gen10g_config_aneg(struct phy_device *phydev);
 
+int mmd_phy_read(struct mii_bus *bus, int phy_addr, bool is_c45,
+		 int devad, u32 regnum);
+int mmd_phy_write(struct mii_bus *bus, int phy_addr, bool is_c45,
+		  int devad, u32 regnum, u16 val);
+
 static inline int phy_read_status(struct phy_device *phydev)
 {
 	if (!phydev->drv)
