diff options
author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2024-02-08 12:53:59 +0000 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2024-04-16 16:51:16 +0100 |
commit | 06b4e230547f21d5501a435ddf1efb7f3499f93e (patch) | |
tree | f364cb9272af4a45b56195efe6e4c48a82ef0656 /drivers | |
parent | 9246d6c69080a7547924edebd7aa870a0c8aa91c (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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/phy/phylink.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 718c23126418..8a3728d423e7 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -3631,21 +3631,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, @@ -3686,7 +3677,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 || |