All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: [PATCH net-next v2 12/14] net: phylink: make Broadcom BCM84881 based SFPs work
Date: Mon, 09 Dec 2019 15:19:28 +0000	[thread overview]
Message-ID: <E1ieKoq-0004vp-2C@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20191209151553.GP25745@shell.armlinux.org.uk>

The Broadcom BCM84881 does not appear to send the SGMII control word
when operating in SGMII mode, which causes network adapters to fail
to link with the PHY, or decide to operate at fixed 1G speed, even if
the PHY negotiated 100M.

Work around this by detecting the Broadcom BCM84881 and switch to phy
mode rather than inband mode.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/phylink.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index c3eda3800357..66b4357ccbda 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1842,10 +1842,20 @@ static void phylink_sfp_link_up(void *upstream)
 	phylink_run_resolve(pl);
 }
 
+/* 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->c45_ids.device_ids[1] & 0xfffffff0) == 0xae025150;
+}
+
 static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
 {
 	struct phylink *pl = upstream;
 	phy_interface_t interface;
+	u8 mode;
 	int ret;
 
 	/*
@@ -1857,9 +1867,13 @@ static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
 	 */
 	phy_support_asym_pause(phy);
 
+	if (phylink_phy_no_inband(phy))
+		mode = MLO_AN_PHY;
+	else
+		mode = MLO_AN_INBAND;
+
 	/* Do the initial configuration */
-	ret = phylink_sfp_config(pl, ML_AN_INBAND, phy->supported,
-				 phy->advertising);
+	ret = phylink_sfp_config(pl, mode, phy->supported, phy->advertising);
 	if (ret < 0)
 		return ret;
 
-- 
2.20.1


  parent reply	other threads:[~2019-12-09 15:19 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-09 15:15 [PATCH net-next v2 00/14] Add support for SFP+ copper modules Russell King - ARM Linux admin
2019-12-09 15:18 ` [PATCH net-next v2 01/14] net: sfp: remove incomplete 100BASE-FX and 100BASE-LX support Russell King
2019-12-10 16:52   ` Andrew Lunn
2019-12-09 15:18 ` [PATCH net-next v2 02/14] net: sfp: derive interface mode from ethtool link modes Russell King
2019-12-10 16:53   ` Andrew Lunn
2019-12-09 15:18 ` [PATCH net-next v2 03/14] net: sfp: add more extended compliance codes Russell King
2019-12-10 16:57   ` Andrew Lunn
2019-12-10 17:21     ` Russell King - ARM Linux admin
2019-12-09 15:18 ` [PATCH net-next v2 04/14] net: sfp: add module start/stop upstream notifications Russell King
2019-12-10 16:59   ` Andrew Lunn
2019-12-09 15:18 ` [PATCH net-next v2 05/14] net: sfp: move phy_start()/phy_stop() to phylink Russell King
2019-12-10 17:00   ` Andrew Lunn
2019-12-09 15:18 ` [PATCH net-next v2 06/14] net: mdio-i2c: add support for Clause 45 accesses Russell King
2019-12-10 17:05   ` Andrew Lunn
2019-12-09 15:19 ` [PATCH net-next v2 07/14] net: phylink: re-split __phylink_connect_phy() Russell King
2019-12-10 17:06   ` Andrew Lunn
2019-12-09 15:19 ` [PATCH net-next v2 08/14] net: phylink: support Clause 45 PHYs on SFP+ modules Russell King
2019-12-10 17:07   ` Andrew Lunn
2019-12-09 15:19 ` [PATCH net-next v2 09/14] net: phylink: split link_an_mode configured and current settings Russell King
2019-12-10 17:09   ` Andrew Lunn
2019-12-09 15:19 ` [PATCH net-next v2 10/14] net: phylink: split phylink_sfp_module_insert() Russell King
2019-12-10 17:10   ` Andrew Lunn
2019-12-09 15:19 ` [PATCH net-next v2 11/14] net: phylink: delay MAC configuration for copper SFP modules Russell King
2019-12-10 17:14   ` Andrew Lunn
2019-12-09 15:19 ` Russell King [this message]
2019-12-10 17:32   ` [PATCH net-next v2 12/14] net: phylink: make Broadcom BCM84881 based SFPs work Florian Fainelli
2019-12-09 15:19 ` [PATCH net-next v2 13/14] net: phy: add Broadcom BCM84881 PHY driver Russell King
2019-12-10 17:34   ` Florian Fainelli
2019-12-10 17:58     ` Russell King - ARM Linux admin
2019-12-10 18:46       ` Russell King - ARM Linux admin
2019-12-19  0:55         ` Russell King - ARM Linux admin
2019-12-19  0:57           ` Florian Fainelli
2019-12-09 15:19 ` [PATCH net-next v2 14/14] net: sfp: add support for Clause 45 PHYs Russell King
2019-12-10 17:21   ` Andrew Lunn
2019-12-11  1:23 ` [PATCH net-next v2 00/14] Add support for SFP+ copper modules David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1ieKoq-0004vp-2C@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.