[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221118000124.2754581-8-vladimir.oltean@nxp.com>
Date: Fri, 18 Nov 2022 02:01:23 +0200
From: Vladimir Oltean <vladimir.oltean@....com>
To: netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Russell King <linux@...linux.org.uk>,
Florian Fainelli <f.fainelli@...il.com>,
UNGLinuxDriver@...rochip.com,
bcm-kernel-feedback-list@...adcom.com,
Madalin Bucur <madalin.bucur@....nxp.com>,
Camelia Groza <camelia.groza@....com>,
Claudiu Manoil <claudiu.manoil@....com>,
Ioana Ciornei <ioana.ciornei@....com>,
Maxim Kochetkov <fido_max@...ox.ru>,
Sean Anderson <sean.anderson@...o.com>,
Antoine Tenart <atenart@...nel.org>,
Michael Walle <michael@...le.cc>,
Raag Jadav <raagjadav@...il.com>,
Siddharth Vadapalli <s-vadapalli@...com>,
Ong Boon Leong <boon.leong.ong@...el.com>,
Colin Foster <colin.foster@...advantage.com>,
Marek Behun <marek.behun@....cz>
Subject: [PATCH v4 net-next 7/8] net: phy: at803x: validate in-band autoneg for AT8031/AT8033
Allow drivers which migrate from phylib to phylink and have old device
tree blobs to work with the AR8031/AT8033 on-board PHY in the SGMII
SERDES side mode.
This would allow DT breakage like the one fixed by commit df392aefe96b
("arm64: dts: fsl-ls1028a-kontron-sl28: specify in-band mode for ENETC")
to be avoided in the future.
We know from experimentation with NXP SoCs that the PHY doesn't pass
traffic if in-band autoneg is enabled but fails to complete. We also
know that it is in principle possible to disable in-band autoneg in the
PHY. This would require disabling autoneg in the fiber page, and then
keeping the fiber and copper page speeds in sync, as explained by
Michael Walle here:
https://patchwork.kernel.org/project/netdevbpf/patch/20210212172341.3489046-2-olteanv@gmail.com/
But since the PHY driver does not currently handle the complexity of
keeping those speeds in sync, we can safely say that no MAC attached to
the AT8031/AT8033 in SGMII mode has in-band autoneg disabled.
I have no motivation to add support for disabled in-band autoneg. I just
need the driver to report that it requires this enabled, which will
make phylink promote a MLO_AN_PHY connection to MLO_AN_INBAND. This is
enough to keep everyone happy.
These PHYs also support RGMII, and for that mode, we report that in-band
AN is unknown, which means that phylink will not change the mode from
the device tree. Since commit d73ffc08824d ("net: phylink: allow
RGMII/RTBI in-band status"), RGMII in-band status is a thing, and I
don't want to meddle with that unless I have a reason for it.
Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
---
v3->v4:
- s/inband_aneg/an_inband/
- drop unnecessary support for PHY_AN_INBAND_OFF
drivers/net/phy/at803x.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 349b7b1dbbf2..2ef6ac92fecb 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -1355,6 +1355,15 @@ static int at803x_config_aneg(struct phy_device *phydev)
return __genphy_config_aneg(phydev, ret);
}
+static int at803x_validate_an_inband(struct phy_device *phydev,
+ phy_interface_t interface)
+{
+ if (interface == PHY_INTERFACE_MODE_SGMII)
+ return PHY_AN_INBAND_ON;
+
+ return PHY_AN_INBAND_UNKNOWN;
+}
+
static int at803x_get_downshift(struct phy_device *phydev, u8 *d)
{
int val;
@@ -2076,6 +2085,7 @@ static struct phy_driver at803x_driver[] = {
.set_tunable = at803x_set_tunable,
.cable_test_start = at803x_cable_test_start,
.cable_test_get_status = at803x_cable_test_get_status,
+ .validate_an_inband = at803x_validate_an_inband,
}, {
/* Qualcomm Atheros AR8032 */
PHY_ID_MATCH_EXACT(ATH8032_PHY_ID),
--
2.34.1
Powered by blists - more mailing lists