summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2024-02-08 12:53:59 +0000
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2024-02-27 15:38:04 +0000
commitcb1c10f82bdcd5b54b9c9937530b282d3aecf848 (patch)
tree139f2c893c004c69ebfb615444aa79e643e364a9
parent84b1678518ccafdb53b7ccf86e3d05a739718cd5 (diff)
net: phylink: switch to use phy_query_inband() for copper SFP modules
Use phy_query_inband() with the initial mode when configuring copper SFP modules to determine whether we should use inband or PHY mode. This allows us to remove the BCM84881 specific detection from phylink, and instead rely on the PHY driver giving us this detail. We can use a simple check here - if the PHY reports that the inband information is valid, but sets no other bits, then inband is definitely not supported. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-rw-r--r--drivers/net/phy/phylink.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index c1a31f0cea61..066d60f185d5 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -3555,21 +3555,12 @@ static void phylink_sfp_link_up(void *upstream)
phylink_enable_and_run_resolve(pl, PHYLINK_DISABLE_LINK);
}
-/* The Broadcom BCM84881 in the Methode DM7052 is unable to provide a SGMII
- * or 802.3z control word, so inband will not work.
- */
-static bool phylink_phy_no_inband(struct phy_device *phy)
-{
- return phy->is_c45 && phy_id_compare(phy->c45_ids.device_ids[1],
- 0xae025150, 0xfffffff0);
-}
-
static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
{
DECLARE_PHY_INTERFACE_MASK(interfaces);
struct phylink *pl = upstream;
phy_interface_t interface;
- int ret;
+ int link_inband, ret;
/*
* This is the new way of dealing with flow control for PHYs,
@@ -3610,7 +3601,14 @@ static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
phylink_dbg(pl, "copper SFP: chosen %s interface\n",
phy_modes(interface));
- if (phylink_phy_no_inband(phy))
+ link_inband = phy_query_inband(phy, interface);
+ phylink_dbg(pl, "copper SFP: PHY link in-band modes 0x%x\n",
+ link_inband);
+
+ /* If the link inband is valid but the PHY doesn't support
+ * inband, then we have to use PHY mode. E.g. BCM84881.
+ */
+ if (link_inband == LINK_INBAND_VALID)
pl->sfp_link_an_mode = MLO_AN_PHY;
if (pl->cur_link_an_mode != pl->sfp_link_an_mode ||