From f84752d0803a6b3a9b42ecdce3e814762debb2fe Mon Sep 17 00:00:00 2001 From: Jose Abreu Date: Fri, 20 Mar 2020 10:53:34 +0100 Subject: net: phy: xpcs: Return error when 10GKR link errors are found For 10GKR rate, when link errors are found we need to return fault status so that XPCS is correctly resumed. Signed-off-by: Jose Abreu Signed-off-by: David S. Miller --- drivers/net/phy/mdio-xpcs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/mdio-xpcs.c b/drivers/net/phy/mdio-xpcs.c index 2f4cdf807160..c04e9bf40180 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; } -- cgit v1.2.3 From aaf99e8d560c9cdeb6b1aa29257835216b58e746 Mon Sep 17 00:00:00 2001 From: Jose Abreu Date: Fri, 20 Mar 2020 10:53:35 +0100 Subject: net: phy: xpcs: Reset XPCS upon probe Reset the XPCS upon probe stage so that we start it from well known state. Signed-off-by: Jose Abreu Signed-off-by: David S. Miller --- drivers/net/phy/mdio-xpcs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/mdio-xpcs.c b/drivers/net/phy/mdio-xpcs.c index c04e9bf40180..54976047dcb9 100644 --- a/drivers/net/phy/mdio-xpcs.c +++ b/drivers/net/phy/mdio-xpcs.c @@ -688,7 +688,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); } } -- cgit v1.2.3 From e1eab7dfa6f3445ee1b1b0e6b7f029437de19ea5 Mon Sep 17 00:00:00 2001 From: Jose Abreu Date: Fri, 20 Mar 2020 10:53:36 +0100 Subject: net: phy: xpcs: Set Link down if AutoNeg is enabled and did not finish Set XPCS Link as down when AutoNeg is enabled but it didn't finish with success. Signed-off-by: Jose Abreu Signed-off-by: David S. Miller --- drivers/net/phy/mdio-xpcs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/mdio-xpcs.c b/drivers/net/phy/mdio-xpcs.c index 54976047dcb9..f10d86b85fbd 100644 --- a/drivers/net/phy/mdio-xpcs.c +++ b/drivers/net/phy/mdio-xpcs.c @@ -617,10 +617,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); } -- cgit v1.2.3 From 1874b83a39be5009adb65ed541fa846a8cc99224 Mon Sep 17 00:00:00 2001 From: Jose Abreu Date: Fri, 20 Mar 2020 10:53:37 +0100 Subject: net: phy: xpcs: Restart AutoNeg if outcome was invalid Restart AutoNeg if we didn't get a valid result from previous run. Signed-off-by: Jose Abreu Signed-off-by: David S. Miller --- drivers/net/phy/mdio-xpcs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/mdio-xpcs.c b/drivers/net/phy/mdio-xpcs.c index f10d86b85fbd..0d66a8ba7eb6 100644 --- a/drivers/net/phy/mdio-xpcs.c +++ b/drivers/net/phy/mdio-xpcs.c @@ -433,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; } -- cgit v1.2.3