netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Eichenberger <eichest@gmail.com>
To: netdev@vger.kernel.org, andrew@lunn.ch, hkallweit1@gmail.com,
	linux@armlinux.org.uk, francesco.dolcini@toradex.com
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, eichest@gmail.com
Subject: [PATCH net-next v3 2/5] net: phy: c45: add support for 1000BASE-T1 forced setup
Date: Mon, 17 Jul 2023 21:33:47 +0200	[thread overview]
Message-ID: <20230717193350.285003-3-eichest@gmail.com> (raw)
In-Reply-To: <20230717193350.285003-1-eichest@gmail.com>

Add support to force 1000BASE-T1 by setting the correct control bit in
the MDIO_MMD_PMA_PMD_BT1_CTRL register.

Signed-off-by: Stefan Eichenberger <eichest@gmail.com>
---
 drivers/net/phy/phy-c45.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index 93ed072233779..b73c428a15663 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -108,7 +108,7 @@ EXPORT_SYMBOL_GPL(genphy_c45_pma_baset1_setup_master_slave);
  */
 int genphy_c45_pma_setup_forced(struct phy_device *phydev)
 {
-	int ctrl1, ctrl2, ret;
+	int bt1_ctrl, ctrl1, ctrl2, ret;
 
 	/* Half duplex is not supported */
 	if (phydev->duplex != DUPLEX_FULL)
@@ -176,6 +176,15 @@ int genphy_c45_pma_setup_forced(struct phy_device *phydev)
 		ret = genphy_c45_pma_baset1_setup_master_slave(phydev);
 		if (ret < 0)
 			return ret;
+
+		bt1_ctrl = 0;
+		if (phydev->speed == SPEED_1000)
+			bt1_ctrl = MDIO_PMA_PMD_BT1_CTRL_STRAP_B1000;
+
+		ret = phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL,
+				     MDIO_PMA_PMD_BT1_CTRL_STRAP, bt1_ctrl);
+		if (ret < 0)
+			return ret;
 	}
 
 	return genphy_c45_an_disable_aneg(phydev);
-- 
2.39.2


  parent reply	other threads:[~2023-07-17 19:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 19:33 [PATCH net-next v3 0/5] Add a driver for the Marvell 88Q2110 PHY Stefan Eichenberger
2023-07-17 19:33 ` [PATCH net-next v3 1/5] net: phy: add registers to support 1000BASE-T1 Stefan Eichenberger
2023-07-17 21:44   ` Andrew Lunn
2023-07-17 19:33 ` Stefan Eichenberger [this message]
2023-07-17 21:44   ` [PATCH net-next v3 2/5] net: phy: c45: add support for 1000BASE-T1 forced setup Andrew Lunn
2023-07-17 19:33 ` [PATCH net-next v3 3/5] net: phy: c45: add a separate function to read BASE-T1 abilities Stefan Eichenberger
2023-07-17 21:45   ` Andrew Lunn
2023-07-17 19:33 ` [PATCH net-next v3 4/5] net: phy: c45: detect the BASE-T1 speed from the ability register Stefan Eichenberger
2023-07-17 21:45   ` Andrew Lunn
2023-07-17 19:33 ` [PATCH net-next v3 5/5] net: phy: marvell-88q2xxx: add driver for the Marvell 88Q2110 PHY Stefan Eichenberger
2023-07-17 21:54   ` Andrew Lunn
2023-07-18  7:16     ` Stefan Eichenberger
2023-07-18 13:00       ` Andrew Lunn
2023-07-18 10:48   ` Marek Behún

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=20230717193350.285003-3-eichest@gmail.com \
    --to=eichest@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=francesco.dolcini@toradex.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).