diff mbox series

[net-next,v4,1/1] net: phy: marvell: make use of fiber autoneg bypass mode

Message ID 20241004212711.422811-1-qingtao.cao@digi.com (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v4,1/1] net: phy: marvell: make use of fiber autoneg bypass mode | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 6 this patch: 6
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 6 this patch: 6
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 5 this patch: 5
netdev/checkpatch warning WARNING: From:/Signed-off-by: email address mismatch: 'From: Qingtao Cao <qingtao.cao.au@gmail.com>' != 'Signed-off-by: Qingtao Cao <qingtao.cao@digi.com>'
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 6 this patch: 6
netdev/source_inline success Was 0 now: 0

Commit Message

Qingtao Cao Oct. 4, 2024, 9:27 p.m. UTC
88E151x supports the SGMII autoneg bypass mode and it defaults to be
enabled. When it is activated, the device assumes a link-up status so
avoid bringing down fibre link in this case

Test case:
1. Two 88E151x are connected with SFP
2. One enables autoneg while the other is 1000BASE-X
3. On the one with autoneg, the link can still be up with this change
   otherwise not

Signed-off-by: Qingtao Cao <qingtao.cao@digi.com>
---
 drivers/net/phy/marvell.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

Russell King (Oracle) Oct. 4, 2024, 9:54 p.m. UTC | #1
On Sat, Oct 05, 2024 at 07:27:11AM +1000, Qingtao Cao wrote:
> 88E151x supports the SGMII autoneg bypass mode and it defaults to be
> enabled. When it is activated, the device assumes a link-up status so
> avoid bringing down fibre link in this case

Please can you stop posting new patches while there is still discussion
going on.

I'm simply going to NAK this patch, because you haven't given any time
for discussion to conclude on your previous offering, and I see no
point in even bothering to read this while the whole subject of
whether AN bypass should be used is still unsettled.

Please wait for discussion to conclude before posting new patches.
diff mbox series

Patch

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 9964bf3dea2f..6d48add9dc0a 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -195,6 +195,9 @@ 
 
 #define MII_88E1510_MSCR_2		0x15
 
+#define MII_88E151X_FSCR2		0x1a
+#define MII_88E151X_FSCR2_BYPASS_STATUS	BIT(5)
+
 #define MII_VCT5_TX_RX_MDI0_COUPLING	0x10
 #define MII_VCT5_TX_RX_MDI1_COUPLING	0x11
 #define MII_VCT5_TX_RX_MDI2_COUPLING	0x12
@@ -1623,12 +1626,24 @@  static void fiber_lpa_mod_linkmode_lpa_t(unsigned long *advertising, u32 lpa)
 static int marvell_read_status_page_an(struct phy_device *phydev,
 				       int fiber, int status)
 {
+	int fscr2;
 	int lpa;
 	int err;
 
 	if (!(status & MII_M1011_PHY_STATUS_RESOLVED)) {
 		phydev->link = 0;
-		return 0;
+		if (!fiber)
+			return 0;
+
+		/* Already on page 1 for fibre */
+		fscr2 = phy_read(phydev, MII_88E151X_FSCR2);
+		if (fscr2 < 0)
+			return fscr2;
+
+		if (!(fscr2 & MII_88E151X_FSCR2_BYPASS_STATUS))
+			return 0;
+
+		phydev->link = 1;
 	}
 
 	if (status & MII_M1011_PHY_STATUS_FULLDUPLEX)