From patchwork Mon Jan 27 15:07:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madalin Bucur (OSS)" X-Patchwork-Id: 1229893 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=oss.nxp.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 485tR30Lcbz9sRR for ; Tue, 28 Jan 2020 02:07:59 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729473AbgA0PH6 (ORCPT ); Mon, 27 Jan 2020 10:07:58 -0500 Received: from inva020.nxp.com ([92.121.34.13]:42224 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729146AbgA0PH5 (ORCPT ); Mon, 27 Jan 2020 10:07:57 -0500 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id CFE9F1A0353; Mon, 27 Jan 2020 16:07:55 +0100 (CET) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id C35891A017A; Mon, 27 Jan 2020 16:07:55 +0100 (CET) Received: from fsr-fed2164-101.ea.freescale.net (fsr-fed2164-101.ea.freescale.net [10.171.82.91]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 75D4A205A3; Mon, 27 Jan 2020 16:07:55 +0100 (CET) From: Madalin Bucur To: davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com, netdev@vger.kernel.org, ykaukab@suse.de, Madalin Bucur Subject: [PATCH v2 1/2] net: phy: aquantia: add rate_adaptation indication Date: Mon, 27 Jan 2020 17:07:50 +0200 Message-Id: <1580137671-22081-2-git-send-email-madalin.bucur@oss.nxp.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1580137671-22081-1-git-send-email-madalin.bucur@oss.nxp.com> References: <1580137671-22081-1-git-send-email-madalin.bucur@oss.nxp.com> Reply-to: madalin.bucur@oss.nxp.com X-Virus-Scanned: ClamAV using ClamSMTP Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Some PHYs are able to perform rate adaptation between the system interface and the line interfaces. When such a PHY is deployed, the ethernet driver should not limit the modes supported or advertised by the PHY. This patch introduces the bit that allows checking for this feature in the phy_device structure and its use for the Aquantia PHYs that have this capability. Signed-off-by: Madalin Bucur --- drivers/net/phy/aquantia_main.c | 3 +++ include/linux/phy.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_main.c index 975789d9349d..36fdd523b758 100644 --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c @@ -209,6 +209,9 @@ static int aqr_config_aneg(struct phy_device *phydev) u16 reg; int ret; + /* add here as this is called for all devices */ + phydev->rate_adaptation = 1; + if (phydev->autoneg == AUTONEG_DISABLE) return genphy_c45_pma_setup_forced(phydev); diff --git a/include/linux/phy.h b/include/linux/phy.h index dd4a91f1feaa..2a5c202333fc 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -387,6 +387,9 @@ struct phy_device { /* Interrupts are enabled */ unsigned interrupts:1; + /* Rate adaptation in the PHY */ + unsigned rate_adaptation:1; + enum phy_state state; u32 dev_flags; From patchwork Mon Jan 27 15:07:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madalin Bucur (OSS)" X-Patchwork-Id: 1229894 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=oss.nxp.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 485tR56fWsz9sRR for ; Tue, 28 Jan 2020 02:08:01 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729501AbgA0PIB (ORCPT ); Mon, 27 Jan 2020 10:08:01 -0500 Received: from inva021.nxp.com ([92.121.34.21]:40826 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729399AbgA0PH6 (ORCPT ); Mon, 27 Jan 2020 10:07:58 -0500 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 40A922177D8; Mon, 27 Jan 2020 16:07:57 +0100 (CET) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 33B7321779C; Mon, 27 Jan 2020 16:07:57 +0100 (CET) Received: from fsr-fed2164-101.ea.freescale.net (fsr-fed2164-101.ea.freescale.net [10.171.82.91]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id DA1A6205A3; Mon, 27 Jan 2020 16:07:56 +0100 (CET) From: Madalin Bucur To: davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com, netdev@vger.kernel.org, ykaukab@suse.de, Madalin Bucur Subject: [PATCH v2 2/2] dpaa_eth: support all modes with rate adapting PHYs Date: Mon, 27 Jan 2020 17:07:51 +0200 Message-Id: <1580137671-22081-3-git-send-email-madalin.bucur@oss.nxp.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1580137671-22081-1-git-send-email-madalin.bucur@oss.nxp.com> References: <1580137671-22081-1-git-send-email-madalin.bucur@oss.nxp.com> Reply-to: madalin.bucur@oss.nxp.com X-Virus-Scanned: ClamAV using ClamSMTP Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Stop removing modes that are not supported on the system interface when the connected PHY is capable of rate adaptation. This addresses an issue with the LS1046ARDB board 10G interface no longer working with an 1G link partner after autonegotiation support was added for the Aquantia PHY on board in commit 09c4c57f7bc4 ("net: phy: aquantia: add support for auto-negotiation configuration") Before this commit the values advertised by the PHY were not influenced by the dpaa_eth driver removal of system-side unsupported modes as the aqr_config_aneg() was basically a no-op. After this commit, the modes removed by the dpaa_eth driver were no longer advertised thus autonegotiation with 1G link partners failed. Reported-by: Mian Yousaf Kaukab Signed-off-by: Madalin Bucur --- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index a301f0095223..d3eb235450e5 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -2471,9 +2471,13 @@ static int dpaa_phy_init(struct net_device *net_dev) return -ENODEV; } - /* Remove any features not supported by the controller */ - ethtool_convert_legacy_u32_to_link_mode(mask, mac_dev->if_support); - linkmode_and(phy_dev->supported, phy_dev->supported, mask); + if (mac_dev->phy_if != PHY_INTERFACE_MODE_XGMII || + !phy_dev->rate_adaptation) { + /* Remove any features not supported by the controller */ + ethtool_convert_legacy_u32_to_link_mode(mask, + mac_dev->if_support); + linkmode_and(phy_dev->supported, phy_dev->supported, mask); + } phy_support_asym_pause(phy_dev);