net: phy: move marking PHY on SFP module into SFP code
Subsystems (4)
RFC PATCH 1/1 net: phy: move marking PHY on SFP module into SFP code
Move marking the PHY as being on a SFP module into the SFP code between getting the PHY device (and thus initialising the phy_device structure) and registering the discovered device.
This means that PHY drivers can use phy_on_sfp() in their match and get_features methods.
---
Eric Woudstra has a SFP module that has a realtek PHY on that could be driven by the realtek PHY driver - except that the PHY is behind a Rollball access implementation that only supports clause 45 access.
This is a work in progress, but it seems useful in these situations that drivers should know whether the PHY is on a module very early on, so that a particular PHY driver instance can choose whether or not to drive the instance, or maybe use a different PHY driver instance to drive it - thus allowing a separate set of function pointers for the clause-45 only accessable PHY.
Some experimental patches can be found at:
and onward discussion prompted this patch. Ignore the first non-patch C file!
drivers/net/phy/phy_device.c | 2 -- drivers/net/phy/sfp.c | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/phy/phy_device.c +0 -2
@@ -1487,8 +1487,6 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,if (phydev->sfp_bus_attached) dev->sfp_bus = phydev->sfp_bus; -else if (dev->sfp_bus) - phydev->is_on_sfp_module = true; }/* Some Ethernet drivers try to connect to a PHY device before
drivers/net/phy/sfp.c +3 -0
@@ -1763,6 +1763,9 @@ static int sfp_sm_probe_phy(struct sfp *sfp, int addr, bool is_c45)return PTR_ERR (phy); } +/* Mark this PHY as being on a SFP module */ + phy->is_on_sfp_module = true; + err =phy_device_register (phy);if (err) {phy_device_free (phy);
Signature · 1 line
2.30.2