All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: netdev@vger.kernel.org
Cc: Antoine Tenart <atenart@kernel.org>,
	Michael Walle <michael@walle.cc>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Russell King - ARM Linux admin <linux@armlinux.org.uk>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	Maxim Kochetkov <fido_max@inbox.ru>,
	Bjarni Jonasson <bjarni.jonasson@microchip.com>,
	Steen Hegelund <steen.hegelund@microchip.com>,
	UNGLinuxDriver@microchip.com,
	bcm-kernel-feedback-list@broadcom.com,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Claudiu Beznea <claudiu.beznea@microchip.com>
Subject: [RFC PATCH v3 net-next 3/6] net: phy: bcm84881: move the in-band capability check where it belongs
Date: Wed, 22 Sep 2021 21:14:43 +0300	[thread overview]
Message-ID: <20210922181446.2677089-4-vladimir.oltean@nxp.com> (raw)
In-Reply-To: <20210922181446.2677089-1-vladimir.oltean@nxp.com>

Now that there is a generic interface through which phylink can query
PHY drivers whether they support various forms of in-band autoneg, use
that and delete the special case from phylink.c.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/phy/bcm84881.c | 10 ++++++++++
 drivers/net/phy/phylink.c  | 17 ++---------------
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/net/phy/bcm84881.c b/drivers/net/phy/bcm84881.c
index 9717a1626f3f..5c0e4f85fc4e 100644
--- a/drivers/net/phy/bcm84881.c
+++ b/drivers/net/phy/bcm84881.c
@@ -223,6 +223,15 @@ static int bcm84881_read_status(struct phy_device *phydev)
 	return genphy_c45_read_mdix(phydev);
 }
 
+/* The Broadcom BCM84881 in the Methode DM7052 is unable to provide a SGMII
+ * or 802.3z control word, so inband will not work.
+ */
+static int bcm84881_validate_inband_aneg(struct phy_device *phydev,
+					 phy_interface_t interface)
+{
+	return PHY_INBAND_ANEG_OFF;
+}
+
 static struct phy_driver bcm84881_drivers[] = {
 	{
 		.phy_id		= 0xae025150,
@@ -234,6 +243,7 @@ static struct phy_driver bcm84881_drivers[] = {
 		.config_aneg	= bcm84881_config_aneg,
 		.aneg_done	= bcm84881_aneg_done,
 		.read_status	= bcm84881_read_status,
+		.validate_inband_aneg = bcm84881_validate_inband_aneg,
 	},
 };
 
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index f9a7c999821b..358246775ad1 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -2185,15 +2185,6 @@ int phylink_speed_up(struct phylink *pl)
 }
 EXPORT_SYMBOL_GPL(phylink_speed_up);
 
-/* 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 void phylink_sfp_attach(void *upstream, struct sfp_bus *bus)
 {
 	struct phylink *pl = upstream;
@@ -2252,14 +2243,10 @@ static int phylink_sfp_config(struct phylink *pl, struct phy_device *phy,
 	if (phy) {
 		ret = phy_validate_inband_aneg(phy, iface);
 		if (ret == PHY_INBAND_ANEG_UNKNOWN) {
-			if (phylink_phy_no_inband(phy))
-				mode = MLO_AN_PHY;
-			else
-				mode = MLO_AN_INBAND;
+			mode = MLO_AN_INBAND;
 
 			phylink_dbg(pl,
-				    "PHY driver does not report in-band autoneg capability, assuming %s\n",
-				    phylink_autoneg_inband(mode) ? "true" : "false");
+				    "PHY driver does not report in-band autoneg capability, assuming true\n");
 		} else if (ret & PHY_INBAND_ANEG_ON) {
 			mode = MLO_AN_INBAND;
 		} else {
-- 
2.25.1


  parent reply	other threads:[~2021-09-22 18:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22 18:14 [RFC PATCH v3 net-next 0/6] Let phylink manage in-band AN for the PHY Vladimir Oltean
2021-09-22 18:14 ` [RFC PATCH v3 net-next 1/6] net: phylink: pass the phy argument to phylink_sfp_config Vladimir Oltean
2021-09-22 18:14 ` [RFC PATCH v3 net-next 2/6] net: phylink: introduce a generic method for querying PHY in-band autoneg capability Vladimir Oltean
2021-09-22 21:22   ` Russell King (Oracle)
2021-09-22 21:31     ` Vladimir Oltean
2021-09-22 21:48       ` Vladimir Oltean
2021-09-22 23:03         ` Russell King (Oracle)
2021-09-22 23:50           ` Vladimir Oltean
2021-09-23  8:19             ` Russell King (Oracle)
2021-09-23  9:58               ` Vladimir Oltean
2021-09-23 10:20                 ` Russell King (Oracle)
2021-09-22 18:14 ` Vladimir Oltean [this message]
2021-09-22 18:14 ` [RFC PATCH v3 net-next 4/6] net: phylink: explicitly configure in-band autoneg for PHYs that support it Vladimir Oltean
2021-09-22 18:14 ` [RFC PATCH v3 net-next 5/6] net: phy: mscc: configure in-band auto-negotiation for VSC8514 Vladimir Oltean
2021-09-22 18:14 ` [RFC PATCH v3 net-next 6/6] net: phy: at803x: configure in-band auto-negotiation for AR8031/AR8033 Vladimir Oltean

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=20210922181446.2677089-4-vladimir.oltean@nxp.com \
    --to=vladimir.oltean@nxp.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=atenart@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bjarni.jonasson@microchip.com \
    --cc=claudiu.beznea@microchip.com \
    --cc=f.fainelli@gmail.com \
    --cc=fido_max@inbox.ru \
    --cc=hkallweit1@gmail.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=linux@armlinux.org.uk \
    --cc=michael@walle.cc \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=steen.hegelund@microchip.com \
    /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.