[PATCH net-next v4 1/1] net: phy: marvell: make use of fiber autoneg bypass mode
From: Qingtao Cao
Date: Fri Oct 04 2024 - 17:27:43 EST
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@xxxxxxxx>
---
drivers/net/phy/marvell.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
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)
--
2.34.1