From: Stefan Eichenberger <eichest@gmail.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, robh@kernel.org,
krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
lxu@maxlinear.com, andrew@lunn.ch, hkallweit1@gmail.com,
linux@armlinux.org.uk, michael@walle.cc
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH 2/2] net: phy: mxl-gpy: add new device tree property to disable SGMII autoneg
Date: Tue, 16 Apr 2024 14:10:32 +0200 [thread overview]
Message-ID: <20240416121032.52108-3-eichest@gmail.com> (raw)
In-Reply-To: <20240416121032.52108-1-eichest@gmail.com>
Add a new device tree property to disable SGMII autonegotiation and
instead use the option to match the SGMII speed to what was negotiated
on the twisted pair interface (tpi). This allows us to disable SGMII
autonegotiation on Ethernet controllers that are not compatible with
this mode.
Signed-off-by: Stefan Eichenberger <eichest@gmail.com>
---
drivers/net/phy/mxl-gpy.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/mxl-gpy.c b/drivers/net/phy/mxl-gpy.c
index b2d36a3a96f1..4147b4c29eaf 100644
--- a/drivers/net/phy/mxl-gpy.c
+++ b/drivers/net/phy/mxl-gpy.c
@@ -114,6 +114,7 @@ struct gpy_priv {
* is enabled.
*/
u64 lb_dis_to;
+ bool sgmii_match_tpi_speed;
};
static const struct {
@@ -262,8 +263,17 @@ static int gpy_mbox_read(struct phy_device *phydev, u32 addr)
static int gpy_config_init(struct phy_device *phydev)
{
+ struct gpy_priv *priv = phydev->priv;
int ret;
+ /* Disalbe SGMII Autoneg if we want to match SGMII to TPI speed */
+ if (priv->sgmii_match_tpi_speed) {
+ ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
+ VSPEC1_SGMII_CTRL_ANEN, 0);
+ if (ret < 0)
+ return ret;
+ }
+
/* Mask all interrupts */
ret = phy_write(phydev, PHY_IMASK, 0);
if (ret)
@@ -304,6 +314,9 @@ static int gpy_probe(struct phy_device *phydev)
if (!device_property_present(dev, "maxlinear,use-broken-interrupts"))
phydev->dev_flags |= PHY_F_NO_IRQ;
+ priv->sgmii_match_tpi_speed =
+ device_property_present(dev, "maxlinear,sgmii-match-tpi-speed");
+
fw_version = phy_read(phydev, PHY_FWV);
if (fw_version < 0)
return fw_version;
@@ -516,6 +529,7 @@ static int gpy_update_mdix(struct phy_device *phydev)
static int gpy_update_interface(struct phy_device *phydev)
{
+ struct gpy_priv *priv = phydev->priv;
int ret;
/* Interface mode is fixed for USXGMII and integrated PHY */
@@ -529,6 +543,8 @@ static int gpy_update_interface(struct phy_device *phydev)
switch (phydev->speed) {
case SPEED_2500:
phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
+ if (!gpy_sgmii_aneg_en(phydev))
+ break;
ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
VSPEC1_SGMII_CTRL_ANEN, 0);
if (ret < 0) {
@@ -542,7 +558,7 @@ static int gpy_update_interface(struct phy_device *phydev)
case SPEED_100:
case SPEED_10:
phydev->interface = PHY_INTERFACE_MODE_SGMII;
- if (gpy_sgmii_aneg_en(phydev))
+ if (gpy_sgmii_aneg_en(phydev) || priv->sgmii_match_tpi_speed)
break;
/* Enable and restart SGMII ANEG for 10/100/1000Mbps link speed
* if ANEG is disabled (in 2500-BaseX mode).
--
2.40.1
next prev parent reply other threads:[~2024-04-16 12:10 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 12:10 [RFC PATCH 0/2] mxl-gpy: add option to match SGMII speed to the TPI speed Stefan Eichenberger
2024-04-16 12:10 ` [RFC PATCH 1/2] dt-bindings: net: phy: gpy2xx: add sgmii-match-tpi-speed property Stefan Eichenberger
2024-04-16 12:10 ` Stefan Eichenberger [this message]
2024-04-16 13:46 ` [RFC PATCH 2/2] net: phy: mxl-gpy: add new device tree property to disable SGMII autoneg Andrew Lunn
2024-04-16 15:43 ` Stefan Eichenberger
2024-04-16 15:48 ` Russell King (Oracle)
2024-04-16 16:00 ` Russell King (Oracle)
2024-04-16 16:02 ` Andrew Lunn
2024-04-16 16:24 ` Russell King (Oracle)
2024-04-16 17:23 ` Stefan Eichenberger
2024-04-16 18:12 ` Russell King (Oracle)
2024-04-17 7:22 ` Stefan Eichenberger
2024-04-18 15:01 ` Russell King (Oracle)
2024-04-24 14:58 ` Russell King (Oracle)
2024-04-24 15:56 ` Stefan Eichenberger
2024-04-24 18:13 ` Russell King (Oracle)
2024-04-25 11:24 ` Stefan Eichenberger
2024-04-25 14:30 ` Russell King (Oracle)
2024-04-25 15:51 ` Stefan Eichenberger
2024-04-25 16:30 ` Russell King (Oracle)
2024-04-25 17:33 ` Stefan Eichenberger
2024-04-25 20:15 ` Russell King (Oracle)
2024-05-02 13:44 ` Stefan Eichenberger
2024-05-02 14:14 ` Russell King (Oracle)
2024-05-03 16:35 ` Stefan Eichenberger
2024-05-03 22:41 ` Russell King (Oracle)
2024-05-06 12:29 ` Stefan Eichenberger
2024-04-23 13:23 ` Simon Horman
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=20240416121032.52108-3-eichest@gmail.com \
--to=eichest@gmail.com \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lxu@maxlinear.com \
--cc=michael@walle.cc \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh@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 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).