summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2020-03-23 21:01:58 -0700
committerDavid S. Miller <davem@davemloft.net>2020-03-23 21:01:58 -0700
commitf4d3e61b7728e1006cabf337732e43c6a743b070 (patch)
treee06b99e18e5fc5d504803bfad4882c1e81d969aa
parentc31f0ea737e60845392f14ea657cb3abfce83856 (diff)
parent1874b83a39be5009adb65ed541fa846a8cc99224 (diff)
downloadlinux-f4d3e61b7728e1006cabf337732e43c6a743b070.tar.bz2
Merge branch 'net-phy-xpcs-Improvements-for-next'
Jose Abreu says: ==================== net: phy: xpcs: Improvements for -next Misc set of improvements for XPCS. All for net-next. Patch 1/4, returns link error upon 10GKR faults are detected. Patch 2/4, resets XPCS upon probe so that we start from well known state. Patch 3/4, sets Link as down if AutoNeg is enabled but did not finish with success. Patch 4/4, restarts AutoNeg process if previous outcome was not valid. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/phy/mdio-xpcs.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/net/phy/mdio-xpcs.c b/drivers/net/phy/mdio-xpcs.c
index 2f4cdf807160..0d66a8ba7eb6 100644
--- a/drivers/net/phy/mdio-xpcs.c
+++ b/drivers/net/phy/mdio-xpcs.c
@@ -255,8 +255,10 @@ static int xpcs_read_fault(struct mdio_xpcs_args *xpcs,
if (ret < 0)
return ret;
- if (ret & MDIO_PCS_10GBRT_STAT2_ERR)
+ if (ret & MDIO_PCS_10GBRT_STAT2_ERR) {
xpcs_warn(xpcs, state, "Link has errors!\n");
+ return -EFAULT;
+ }
return 0;
}
@@ -431,8 +433,10 @@ static int xpcs_aneg_done(struct mdio_xpcs_args *xpcs,
return ret;
/* Check if Aneg outcome is valid */
- if (!(ret & DW_C73_AN_ADV_SF))
+ if (!(ret & DW_C73_AN_ADV_SF)) {
+ xpcs_config_aneg(xpcs);
return 0;
+ }
return 1;
}
@@ -615,10 +619,12 @@ static int xpcs_get_state(struct mdio_xpcs_args *xpcs,
return xpcs_config(xpcs, state);
}
- if (state->link && state->an_enabled && xpcs_aneg_done(xpcs, state)) {
+ if (state->an_enabled && xpcs_aneg_done(xpcs, state)) {
state->an_complete = true;
xpcs_read_lpa(xpcs, state);
xpcs_resolve_lpa(xpcs, state);
+ } else if (state->an_enabled) {
+ state->link = 0;
} else if (state->link) {
xpcs_resolve_pma(xpcs, state);
}
@@ -686,7 +692,7 @@ static int xpcs_probe(struct mdio_xpcs_args *xpcs, phy_interface_t interface)
match = entry;
if (xpcs_check_features(xpcs, match, interface))
- return 0;
+ return xpcs_soft_reset(xpcs, MDIO_MMD_PCS);
}
}