Received: by 10.192.165.148 with SMTP id m20csp812255imm; Fri, 27 Apr 2018 07:55:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoBSN3Nbol1RdSPQKoH/fpp2jQPaIk9I+xqWLukUP1OH3zqi0vORiUIFDufGIe3qhMbCJ26 X-Received: by 10.98.157.90 with SMTP id i87mr2543970pfd.190.1524840958285; Fri, 27 Apr 2018 07:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524840958; cv=none; d=google.com; s=arc-20160816; b=j4pL5LxIAM4Ud5kLsolv0qmYDcww/tWUT4NczNokap7sQWKPWUWwGG9yXkaRB96LrI xSFkmhjesZEw0gp7uZLscJIXFEMGwPZLZvyP2YLl9bYGXZt3WSiR2WHsaZk7Hfslp5Qd NrV7A0qa6BjLyiYdEhuvjvChMLieJZBLFv9wq+/zVGcwsGQ9CiyPZirHOLjOv3NM7AGt 8YRL4F7lo7jzQnw7YjS5JE/zHFWxfc4Y2VMVbf796rA+dnEKW51llgt09VPMvC6gL6X9 b9UhNolc0u0KlnAlX490+Tomap2z5gyaEJSTlDhhrwIoBFpS6DXml1KWJ5bMtdUkiXDS E0RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=uJFWWSm2LFcWiVnuS2l60bvRzwmx+9n0OzdQTEFhNH4=; b=ceq9GzuwDDPuVDts53PHSj3VeaytzHI3TRX6PAfCL+AQNvum+d1X/msF65yVe5tALx ZrUCDARgg15mplw6Khabk7pIZg+IFP5YJVX535KEOX2zJVynak1DhU3G56sFrDAPLwAL N8J6UWKItaQG3ALS/nS7aJGmJNJE3AqW9c1boAcOxILU9b16RRPFBcidSp+SSQhGb7r9 0ZjpxiC1KKWU6Lm4n/FSmVvMMZ47v+cPNkb8wRl/o2k2p4vbAv4wVrMDwXqmlwMUHggq BTkXOkTxC1rgD1dr804myeQPUQGbBGnqWofprqn7G+ILjje63Czc6Ff89OdnyxnCPWUl iOHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z23-v6si1421781plo.597.2018.04.27.07.55.44; Fri, 27 Apr 2018 07:55:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934351AbeD0OyG (ORCPT + 99 others); Fri, 27 Apr 2018 10:54:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:52786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934182AbeD0OGs (ORCPT ); Fri, 27 Apr 2018 10:06:48 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0B46921864; Fri, 27 Apr 2018 14:06:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B46921864 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Lendacky , "David S. Miller" Subject: [PATCH 4.14 26/80] amd-xgbe: Add pre/post auto-negotiation phy hooks Date: Fri, 27 Apr 2018 15:58:19 +0200 Message-Id: <20180427135734.294800542@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135732.928644313@linuxfoundation.org> References: <20180427135732.928644313@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tom Lendacky [ Upstream commit 4d945663a6a0acf3cbe45940503f2eb9584bfee7 ] Add hooks to the driver auto-negotiation (AN) flow to allow the different phy implementations to perform any steps necessary to improve AN. Signed-off-by: Tom Lendacky Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 16 ++++++++++++++-- drivers/net/ethernet/amd/xgbe/xgbe.h | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c @@ -437,6 +437,9 @@ static void xgbe_an73_disable(struct xgb static void xgbe_an_restart(struct xgbe_prv_data *pdata) { + if (pdata->phy_if.phy_impl.an_pre) + pdata->phy_if.phy_impl.an_pre(pdata); + switch (pdata->an_mode) { case XGBE_AN_MODE_CL73: case XGBE_AN_MODE_CL73_REDRV: @@ -453,6 +456,9 @@ static void xgbe_an_restart(struct xgbe_ static void xgbe_an_disable(struct xgbe_prv_data *pdata) { + if (pdata->phy_if.phy_impl.an_post) + pdata->phy_if.phy_impl.an_post(pdata); + switch (pdata->an_mode) { case XGBE_AN_MODE_CL73: case XGBE_AN_MODE_CL73_REDRV: @@ -637,11 +643,11 @@ static enum xgbe_an xgbe_an73_incompat_l return XGBE_AN_NO_LINK; } - xgbe_an73_disable(pdata); + xgbe_an_disable(pdata); xgbe_switch_mode(pdata); - xgbe_an73_restart(pdata); + xgbe_an_restart(pdata); return XGBE_AN_INCOMPAT_LINK; } @@ -820,6 +826,9 @@ static void xgbe_an37_state_machine(stru pdata->an_result = pdata->an_state; pdata->an_state = XGBE_AN_READY; + if (pdata->phy_if.phy_impl.an_post) + pdata->phy_if.phy_impl.an_post(pdata); + netif_dbg(pdata, link, pdata->netdev, "CL37 AN result: %s\n", xgbe_state_as_string(pdata->an_result)); } @@ -903,6 +912,9 @@ again: pdata->kx_state = XGBE_RX_BPA; pdata->an_start = 0; + if (pdata->phy_if.phy_impl.an_post) + pdata->phy_if.phy_impl.an_post(pdata); + netif_dbg(pdata, link, pdata->netdev, "CL73 AN result: %s\n", xgbe_state_as_string(pdata->an_result)); } --- a/drivers/net/ethernet/amd/xgbe/xgbe.h +++ b/drivers/net/ethernet/amd/xgbe/xgbe.h @@ -833,6 +833,7 @@ struct xgbe_hw_if { /* This structure represents implementation specific routines for an * implementation of a PHY. All routines are required unless noted below. * Optional routines: + * an_pre, an_post * kr_training_pre, kr_training_post */ struct xgbe_phy_impl_if { @@ -875,6 +876,10 @@ struct xgbe_phy_impl_if { /* Process results of auto-negotiation */ enum xgbe_mode (*an_outcome)(struct xgbe_prv_data *); + /* Pre/Post auto-negotiation support */ + void (*an_pre)(struct xgbe_prv_data *); + void (*an_post)(struct xgbe_prv_data *); + /* Pre/Post KR training enablement support */ void (*kr_training_pre)(struct xgbe_prv_data *); void (*kr_training_post)(struct xgbe_prv_data *);