From patchwork Tue May 23 15:55:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13252594 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E1FE7C7EE26 for ; Tue, 23 May 2023 15:55:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KxS7MIi4Ymro+hqKnoH+oaJEX/U/RZJECcVT+wArAvo=; b=tanweKIhZSPAUO bsteGuAxwuxYABlQlMT8UbHzrBTVaJ+FiCQysKH2cCaOv4fqNu/sC09emVt7n4cZ3DZfnddZIfzZZ 9AWEAPK5lE+Qv6z7B3bwf2mu+MJYAl6GeRt3jQoympQxunkljblnPwbs49JTv3ApP4MeKn86+4th8 orlgQTi5WuP/Z7Lne2/bFIasTyoxfiAaDzCA6lGfEMOp9TJGDd0l2Q0kT96EYgQrTj831VBOmpzP6 dhW5Jp3bf/3bb/VUl0FfwrV5zZfSOlxeB2oY8WV7GE9UnR4nh0rmqywSO05szuGzC6sd/Zv4LkBq6 YFimXCpMO5W9GS+4+pcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1UM3-00Ahqu-00; Tue, 23 May 2023 15:55:19 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1UM0-00AhpV-1h for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2023 15:55:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/XIV4iGMvF+zPG7M5r8oz2u9hfTFMe/LH8v4Fk7CU9Q=; b=C4Map5Q/yZWUr8kDKXo3HYolFx 3QJ+PaJmN+VgGfvh7c1HJSqBeaPB1kPG68RT7YkWWcIL3fG87kkbKHCtnVugSLy5xb19fUvg7+uJP 6NA3UYJhruMobxVD1mep4QAjYt20TrBmQpsryNAkUnPfE9YJLI68mr52GZ+kWFF1plfVVFPkrcuoD zF3OZhZLZA/StdDgt5eCtFl7D0E6ByvdCEAV1W7uik+0tousGk8S1+yDJEOLsNcwndkUnYHmdUGVc N0OwGO768hzsKWFkg2ipBqk0P8ajrlW2ZpHTxcs2egy108FgylzC3NydywyRDpTTIP7u+5Rr5wUhf hxfe1uZg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:40358 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q1ULu-0000iI-Jl; Tue, 23 May 2023 16:55:10 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1q1ULu-007FSb-0e; Tue, 23 May 2023 16:55:10 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Daniel Machon , "David S. Miller" , Eric Dumazet , Florian Fainelli , Horatiu Vultur , Ioana Ciornei , Jakub Kicinski , Lars Povlsen , linux-arm-kernel@lists.infradead.org, Madalin Bucur , Marcin Wojtas , Michal Simek , netdev@vger.kernel.org, Paolo Abeni , Radhey Shyam Pandey , Sean Anderson , Steen Hegelund , Taras Chornyi , Thomas Petazzoni , UNGLinuxDriver@microchip.com, Vladimir Oltean Subject: [PATCH RFC net-next 1/9] net: phylink: add phylink_pcs_neg_mode() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 23 May 2023 16:55:10 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230523_085516_567468_B3772680 X-CRM114-Status: GOOD ( 16.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Signed-off-by: Russell King (Oracle) --- include/linux/phylink.h | 76 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 0cf07d7d11b8..e3cb0b4eed1d 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -21,6 +21,18 @@ enum { MLO_AN_FIXED, /* Fixed-link mode */ MLO_AN_INBAND, /* In-band protocol */ + /* PCS "negotiation" mode. + * PHYLINK_PCS_NEG_NONE - protocol has no inband capability + * PHYLINK_PCS_NEG_OUTBAND - some out of band or fixed link setting + * PHYLINK_PCS_NEG_INBAND_DISABLED - inband mode disabled, e.g. + * 1000base-X with autoneg off + * PHYLINK_PCS_NEG_INBAND_ENABLED - inband mode enabled + */ + PHYLINK_PCS_NEG_NONE = 0, + PHYLINK_PCS_NEG_OUTBAND, + PHYLINK_PCS_NEG_INBAND_DISABLED, + PHYLINK_PCS_NEG_INBAND_ENABLED, + /* MAC_SYM_PAUSE and MAC_ASYM_PAUSE are used when configuring our * autonegotiation advertisement. They correspond to the PAUSE and * ASM_DIR bits defined by 802.3, respectively. @@ -79,6 +91,70 @@ static inline bool phylink_autoneg_inband(unsigned int mode) return mode == MLO_AN_INBAND; } +/** + * phylink_pcs_neg_mode() - helper to determine PCS inband mode + * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. + * @interface: interface mode to be used + * @advertising: adertisement ethtool link mode mask + * + * Determines the negotiation mode to be used by the PCS, and returns + * one of: + * %PHYLINK_PCS_NEG_NONE: interface mode does not support inband + * %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY) + * will be used. + * %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg disabled + * %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled + * + * Note: this is for cases where the PCS itself is involved in negotiation + * (e.g. Clause 37, SGMII and similar) not Clause 73. + */ +static inline unsigned int phylink_pcs_neg_mode(unsigned int mode, + phy_interface_t interface, + const unsigned long *advertising) +{ + unsigned int neg_mode; + + switch (interface) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_QSGMII: + case PHY_INTERFACE_MODE_QUSGMII: + case PHY_INTERFACE_MODE_USXGMII: + /* These protocols are designed for use with a PHY which + * communicates its negotiation result back to the MAC via + * inband communication. Note: there exist PHYs that run + * with SGMII but do not send the inband data. + */ + if (!phylink_autoneg_inband(mode)) + neg_mode = PHYLINK_PCS_NEG_OUTBAND; + else + neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; + break; + + case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_2500BASEX: + /* 1000base-X is designed for use media-side for Fibre + * connections, and thus the Autoneg bit needs to be + * taken into account. We also do this for 2500base-X + * as well, but drivers may not support this, so may + * need to override this. + */ + if (!phylink_autoneg_inband(mode)) + neg_mode = PHYLINK_PCS_NEG_OUTBAND; + else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, + advertising)) + neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; + else + neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED; + break; + + default: + neg_mode = PHYLINK_PCS_NEG_NONE; + break; + } + + return neg_mode; +} + /** * struct phylink_link_state - link state structure * @advertising: ethtool bitmask containing advertised link modes From patchwork Tue May 23 15:55:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13252595 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9711AC7EE23 for ; Tue, 23 May 2023 15:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LIbFeekTOZ0xfLqjyLTRgUIdNOqXHjXIXSOtXCOa9G4=; b=CBVcf5F2xuL8lM f/PD9UowhLJE0N6VOC4db/3llGPV/OBaupQuk70sBeQo53mRVK5uEDevq50y+/AxmV8Tp1BhkQ4eN JaW9kmaIl/s/3/73Jj7m9/ik5AtozQtlm6cR2n1dl8aal/FChHX1c30xfzbIakyEbG+hUVc63ZruL C4kjgiPGIpuN6RkwZY7ergkefJ6gwIMsIz9dcFHBBdkY7cvDwICnEVkETid0iqHhzeq3+hDlURdi/ zDXTOdnVj0/sTly9b9S0KxoL8bSbGtB4oaBOYV9RoWuYQi/PkqOwnt9RrYhLn4rXLaQXaeXvs33o/ a+UVWAcFTw90LzI4Wl2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1UMB-00AhvZ-1W; Tue, 23 May 2023 15:55:27 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1UM3-00Ahqq-0j for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2023 15:55:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=e6Cp+0hj/xnZdKBUJQ6BlOLE00n2YnYZgM7os/Ly5KQ=; b=wNmA1sha+0R+7rbTRElnIzv/QX dKizn2LZnFbF6nekoogWyaixGXvl0BekTHIhLwE5rFCyQUnL2QDFRdH/cu1CmGgMP+VkNo/KRne1b wptXBs0NgJOODhV1DUWotn7m03+6B+X38sZE+ba9/ccCTb757WrBzQk5BYqZyFvasaUZky0KpUKve G+StRiCme6tPn79RkXvQo2bZNyLqRxjx9fBkXiSsZzXxkUPuJLXGUCH2GZjdItDCSoGP5TUmfwXFj vyv0PnaaEbGyKMycTpvIOfSyDyY6UxOo84qk0Vx+ZLBNLfKlNxFULMxMA3eZwT35ZuruBmsaB2sVo gTCnHnJA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:46140 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q1ULz-0000ia-NQ; Tue, 23 May 2023 16:55:15 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1q1ULz-007FSi-3j; Tue, 23 May 2023 16:55:15 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Daniel Machon , "David S. Miller" , Eric Dumazet , Florian Fainelli , Horatiu Vultur , Ioana Ciornei , Jakub Kicinski , Lars Povlsen , linux-arm-kernel@lists.infradead.org, Madalin Bucur , Marcin Wojtas , Michal Simek , netdev@vger.kernel.org, Paolo Abeni , Radhey Shyam Pandey , Sean Anderson , Steen Hegelund , Taras Chornyi , Thomas Petazzoni , UNGLinuxDriver@microchip.com, Vladimir Oltean Subject: [PATCH RFC net-next 2/9] net: phylink: use phylink_pcs_neg_mode() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 23 May 2023 16:55:15 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230523_085519_269940_9B718EA3 X-CRM114-Status: GOOD ( 11.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use phylink_pcs_neg_mode() for phylink_mii_c22_pcs_config(). This results in no functional change. Signed-off-by: Russell King (Oracle) --- drivers/net/phy/phylink.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 530bfafd4f81..c800bdcddeb8 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -3522,6 +3522,7 @@ int phylink_mii_c22_pcs_config(struct mdio_device *pcs, unsigned int mode, phy_interface_t interface, const unsigned long *advertising) { + unsigned int neg_mode; bool changed = 0; u16 bmcr; int ret, adv; @@ -3535,15 +3536,13 @@ int phylink_mii_c22_pcs_config(struct mdio_device *pcs, unsigned int mode, changed = ret; } - /* Ensure ISOLATE bit is disabled */ - if (mode == MLO_AN_INBAND && - (interface == PHY_INTERFACE_MODE_SGMII || - interface == PHY_INTERFACE_MODE_QSGMII || - linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, advertising))) + neg_mode = phylink_pcs_neg_mode(mode, interface, advertising); + if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) bmcr = BMCR_ANENABLE; else bmcr = 0; + /* Configure the inband state. Ensure ISOLATE bit is disabled */ ret = mdiodev_modify(pcs, MII_BMCR, BMCR_ANENABLE | BMCR_ISOLATE, bmcr); if (ret < 0) return ret; From patchwork Tue May 23 15:55:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13252596 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F83CC7EE2D for ; Tue, 23 May 2023 15:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=z/yvOlR2jVedpcxOs7Fz7A2bqRTk6FjI1MFx9WtEUGk=; b=LryT5Cw9NbdNoI EnS7U/Gfe4SrJg18B1agoTaIixGEF6EfH/zgSlKOPHdAWrgmRzd5syce8/gbef6CO1XfJP8GzfaGG 2thE+YOvhDFgAwvLHRtPV13Kv9BjZXE/UEvQBL0w5rNnKGQsEo3IVMen/2Rzq313Siz4Lnm8As0i/ TouM07j/Ifiz2z42KjP9S47mfoqwFtNwGjnPAHzpIFFrLR5I0UmTWGTRU4Lx8C4PiFkBxKTunWWED mr4uS9csLzp7f4Utm6j1tHDmy8jE50fL49qrIfCileZcukD0k17pKnEjYUVZLOaSo1AWRPS+FyO1f +EDkdZHAOiydijXx5BHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1UMB-00Ahvw-39; Tue, 23 May 2023 15:55:27 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1UM8-00AhtC-1B for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2023 15:55:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=F4o/J5FzymS1KheJW/oauXNnuAkkjjUwab7Wsigr0g8=; b=BXHTiXcpUDPnCXYxnxn5doQyhu UP550vRS/sRnVj1nV1DjQVpS+fmuvW1gyUN9ffg+nQJikzW9G8z2UzOLK4YkNjAnK9kAmWmmTf/Ya WlPuV5Zvgp7cAWlCOq7sfAn6zhXjzCpwAtVIfzGelpl0JUfzc0eZCtuOgILQ4byuH6pEyLBonfJ4Z E9mAKv7KUHA8NuWGmxdtxe5hgbWv6P8O3L1U3cGSbD9qeJ3SHNCkdIcbqngURNkogLntR+ZIywNxJ G2UBo8DwC5PtByqbPMh15cqCsZ6GeGQJMlIJiD4YiqVYk9I+zzk1LXSTZ2jYiccfq9AlSaYh9oysc jBrdJM3g==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:46156 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q1UM4-0000iy-Qf; Tue, 23 May 2023 16:55:20 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1q1UM4-007FSo-74; Tue, 23 May 2023 16:55:20 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Daniel Machon , "David S. Miller" , Eric Dumazet , Florian Fainelli , Horatiu Vultur , Ioana Ciornei , Jakub Kicinski , Lars Povlsen , linux-arm-kernel@lists.infradead.org, Madalin Bucur , Marcin Wojtas , Michal Simek , netdev@vger.kernel.org, Paolo Abeni , Radhey Shyam Pandey , Sean Anderson , Steen Hegelund , Taras Chornyi , Thomas Petazzoni , UNGLinuxDriver@microchip.com, Vladimir Oltean Subject: [PATCH RFC net-next 3/9] net: phylink: pass aneg_mode into phylink_mii_c22_pcs_config() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 23 May 2023 16:55:20 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230523_085524_548899_FC03876C X-CRM114-Status: GOOD ( 17.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Pass the aneg_mode into phylink_mii_c22_pcs_config() in preparation to moving it up as a parameter passed to the pcs_config() method. In doing so, we no longer need to pass the MLO_AN_* mode to this function. Signed-off-by: Russell King (Oracle) --- .../net/ethernet/freescale/fman/fman_dtsec.c | 7 +++++-- .../net/ethernet/xilinx/xilinx_axienet_main.c | 5 ++++- drivers/net/pcs/pcs-lynx.c | 18 ++++++++++++------ drivers/net/phy/phylink.c | 9 ++++----- include/linux/phylink.h | 5 +++-- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index d528ca681b6f..e6a5a7f03dbe 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -769,9 +769,12 @@ static int dtsec_pcs_config(struct phylink_pcs *pcs, unsigned int mode, bool permit_pause_to_mac) { struct fman_mac *dtsec = pcs_to_dtsec(pcs); + unsigned int neg_mode; - return phylink_mii_c22_pcs_config(dtsec->tbidev, mode, interface, - advertising); + neg_mode = phylink_pcs_neg_mode(mode, interface, advertising); + + return phylink_mii_c22_pcs_config(dtsec->tbidev, interface, + advertising, neg_mode); } static void dtsec_pcs_an_restart(struct phylink_pcs *pcs) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 3e310b55bce2..380a4db686b7 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -1639,6 +1639,7 @@ static int axienet_pcs_config(struct phylink_pcs *pcs, unsigned int mode, struct mdio_device *pcs_phy = pcs_to_axienet_local(pcs)->pcs_phy; struct net_device *ndev = pcs_to_axienet_local(pcs)->ndev; struct axienet_local *lp = netdev_priv(ndev); + unsigned int neg_mode; int ret; if (lp->switch_x_sgmii) { @@ -1653,7 +1654,9 @@ static int axienet_pcs_config(struct phylink_pcs *pcs, unsigned int mode, } } - ret = phylink_mii_c22_pcs_config(pcs_phy, mode, interface, advertising); + neg_mode = phylink_pcs_neg_mode(mode, interface, advertising); + ret = phylink_mii_c22_pcs_config(pcs_phy, interface, advertising, + neg_mode); if (ret < 0) netdev_warn(ndev, "Failed to configure PCS: %d\n", ret); diff --git a/drivers/net/pcs/pcs-lynx.c b/drivers/net/pcs/pcs-lynx.c index 622c3de3f3a8..5a0de1fcb833 100644 --- a/drivers/net/pcs/pcs-lynx.c +++ b/drivers/net/pcs/pcs-lynx.c @@ -119,9 +119,10 @@ static void lynx_pcs_get_state(struct phylink_pcs *pcs, state->link, state->an_complete); } -static int lynx_pcs_config_giga(struct mdio_device *pcs, unsigned int mode, +static int lynx_pcs_config_giga(struct mdio_device *pcs, phy_interface_t interface, - const unsigned long *advertising) + const unsigned long *advertising, + unsigned int neg_mode) { int link_timer_ns; u32 link_timer; @@ -139,8 +140,9 @@ static int lynx_pcs_config_giga(struct mdio_device *pcs, unsigned int mode, if (interface == PHY_INTERFACE_MODE_1000BASEX) { if_mode = 0; } else { + /* SGMII and QSGMII */ if_mode = IF_MODE_SGMII_EN; - if (mode == MLO_AN_INBAND) + if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) if_mode |= IF_MODE_USE_SGMII_AN; } @@ -150,7 +152,8 @@ static int lynx_pcs_config_giga(struct mdio_device *pcs, unsigned int mode, if (err) return err; - return phylink_mii_c22_pcs_config(pcs, mode, interface, advertising); + return phylink_mii_c22_pcs_config(pcs, interface, advertising, + neg_mode); } static int lynx_pcs_config_usxgmii(struct mdio_device *pcs, unsigned int mode, @@ -177,13 +180,16 @@ static int lynx_pcs_config(struct phylink_pcs *pcs, unsigned int mode, bool permit) { struct lynx_pcs *lynx = phylink_pcs_to_lynx(pcs); + unsigned int neg_mode; + + neg_mode = phylink_pcs_neg_mode(mode, interface, advertising); switch (ifmode) { case PHY_INTERFACE_MODE_1000BASEX: case PHY_INTERFACE_MODE_SGMII: case PHY_INTERFACE_MODE_QSGMII: - return lynx_pcs_config_giga(lynx->mdio, mode, ifmode, - advertising); + return lynx_pcs_config_giga(lynx->mdio, ifmode, advertising, + neg_mode); case PHY_INTERFACE_MODE_2500BASEX: if (phylink_autoneg_inband(mode)) { dev_err(&lynx->mdio->dev, diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index c800bdcddeb8..03e4ff8bf289 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -3509,20 +3509,20 @@ EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_encode_advertisement); /** * phylink_mii_c22_pcs_config() - configure clause 22 PCS * @pcs: a pointer to a &struct mdio_device. - * @mode: link autonegotiation mode * @interface: the PHY interface mode being configured * @advertising: the ethtool advertisement mask + * @neg_mode: PCS negotiation mode * * Configure a Clause 22 PCS PHY with the appropriate negotiation * parameters for the @mode, @interface and @advertising parameters. * Returns negative error number on failure, zero if the advertisement * has not changed, or positive if there is a change. */ -int phylink_mii_c22_pcs_config(struct mdio_device *pcs, unsigned int mode, +int phylink_mii_c22_pcs_config(struct mdio_device *pcs, phy_interface_t interface, - const unsigned long *advertising) + const unsigned long *advertising, + unsigned int neg_mode) { - unsigned int neg_mode; bool changed = 0; u16 bmcr; int ret, adv; @@ -3536,7 +3536,6 @@ int phylink_mii_c22_pcs_config(struct mdio_device *pcs, unsigned int mode, changed = ret; } - neg_mode = phylink_pcs_neg_mode(mode, interface, advertising); if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) bmcr = BMCR_ANENABLE; else diff --git a/include/linux/phylink.h b/include/linux/phylink.h index e3cb0b4eed1d..8510c922b3f4 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -727,9 +727,10 @@ void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs, struct phylink_link_state *state); int phylink_mii_c22_pcs_encode_advertisement(phy_interface_t interface, const unsigned long *advertising); -int phylink_mii_c22_pcs_config(struct mdio_device *pcs, unsigned int mode, +int phylink_mii_c22_pcs_config(struct mdio_device *pcs, phy_interface_t interface, - const unsigned long *advertising); + const unsigned long *advertising, + unsigned int neg_mode); void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs); void phylink_resolve_c73(struct phylink_link_state *state); From patchwork Tue May 23 15:55:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13252597 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E1308C7EE23 for ; Tue, 23 May 2023 15:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N6ttcClFH5AwiHNpV34gh506IF33zL4FV5sWXhwRAFY=; b=ylBb4TWPnM6hfr eRIiQr2cQS6qTjvJEO78ggVZ1zIqO1t4BixTkTo+yg/pQNEj87Qt54iD+0N1YnBIuoj5Gt57yX3cx XiySRypRSPLSqvONK9q7WY3cXIpP0IvMwLdReHNMleSRa/Wa3XCBaYQX+92VNfwHMZhnkdVwXxhV4 DW9BC9YO+rKjhBK6OmJpOmVNgKzAgDl/LM4hKctKgbYwxw5rDil3NeZqtxDadwHYxxcZrGtzS4a51 WqzUMKZdu59N4vb92UUMHtTbBvvpd8ZHVFezyp4Byvx/Fty4KQH0mjM04+JQISTgFt1TU+SjCjOIB HXMWUMI7gSplEoeQdjAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1UMN-00Ai0Y-2o; Tue, 23 May 2023 15:55:39 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1UMD-00AhwM-1E for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2023 15:55:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=gs0gqFaUOBGvlNDsIWPf3JDZ4gaOrGJ3l+VkU1960CI=; b=rq0TiXpqq451igMCcsVhR4rYin SZ5kshBYULb6Z68EZqOd0pi64XemWDeI12IT0bbmIXzrskmw/OUTYMBClBU0c5gKxSqHGSkSUvUq4 SC4UV1M1o4W3SyGmhjkUsZwMdHMiPDRiLLBuxqJ8hb9kHhTrcW5/9Tk/LJfpyHDUOMaibPiwbV1dp bYS2dU0c90mLxJ24l7m0WQ9D5vRUogRfD0nXbP8DRz9twvRFkb0lwvOHJF4XNg4QEm5wr5TcHJGa1 hUKCt9Xk35Jmly+GAS0QQs7/+9onot6A7Q6CfAZ07hymP72PcO34gFA6Vx7l1f4vh5kqOck3VIB7c avtpcVeQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:48976 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q1UM9-0000jW-Tf; Tue, 23 May 2023 16:55:25 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1q1UM9-007FSu-A0; Tue, 23 May 2023 16:55:25 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Daniel Machon , "David S. Miller" , Eric Dumazet , Florian Fainelli , Horatiu Vultur , Ioana Ciornei , Jakub Kicinski , Lars Povlsen , linux-arm-kernel@lists.infradead.org, Madalin Bucur , Marcin Wojtas , Michal Simek , netdev@vger.kernel.org, Paolo Abeni , Radhey Shyam Pandey , Sean Anderson , Steen Hegelund , Taras Chornyi , Thomas Petazzoni , UNGLinuxDriver@microchip.com, Vladimir Oltean Subject: [PATCH RFC net-next 4/9] net: qca8k: switch PCS driver to use phylink_pcs_neg_mode() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 23 May 2023 16:55:25 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230523_085529_420043_5129C239 X-CRM114-Status: GOOD ( 11.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the newly introduced phylink_pcs_neg_mode() to configure whether inband-AN should be used. Signed-off-by: Russell King (Oracle) --- drivers/net/dsa/qca/qca8k-8xxx.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 6d5ac7588a69..acede9f3c253 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -1500,6 +1500,7 @@ static int qca8k_pcs_config(struct phylink_pcs *pcs, unsigned int mode, { struct qca8k_priv *priv = pcs_to_qca8k_pcs(pcs)->priv; int cpu_port_index, ret, port; + unsigned int neg_mode; u32 reg, val; port = pcs_to_qca8k_pcs(pcs)->port; @@ -1519,15 +1520,15 @@ static int qca8k_pcs_config(struct phylink_pcs *pcs, unsigned int mode, return -EINVAL; } + neg_mode = phylink_pcs_neg_mode(mode, interface, advertising); + /* Enable/disable SerDes auto-negotiation as necessary */ - ret = qca8k_read(priv, QCA8K_REG_PWS, &val); + val = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED ? + 0 : QCA8K_PWS_SERDES_AEN_DIS; + + ret = qca8k_rmw(priv, QCA8K_REG_PWS, QCA8K_PWS_SERDES_AEN_DIS, val); if (ret) return ret; - if (phylink_autoneg_inband(mode)) - val &= ~QCA8K_PWS_SERDES_AEN_DIS; - else - val |= QCA8K_PWS_SERDES_AEN_DIS; - qca8k_write(priv, QCA8K_REG_PWS, val); /* Configure the SGMII parameters */ ret = qca8k_read(priv, QCA8K_REG_SGMII_CTRL, &val); From patchwork Tue May 23 15:55:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13252598 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D5F9C7EE26 for ; Tue, 23 May 2023 15:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nCfWLbAOSE+fRz81KqO+qFB46WH0m0anLqCnBj3pBYQ=; b=i3WiL8ydtRSAey W7lRjqdUE4WiAyh3H21mMT3ECoHHz78JBP0s+G36JakGILkO3eRPAL1zHpiCW9lpE+iWkKHlQSVlK 1ZN7BMTlTrNOuDLokAaWXnBz5OSJFT5vndv3yxwxddF59bnpqJ7Y0mjE1uxNz64TPvqug/E/CMl+2 wMSGznENu3gS8YEpmUwHXCilO6S5//slYjQ5IK7SPonXbH2oEjgW5zk+GdO6sJ7+nzjHyTObEX95c /LoSD9RFKES36semdhUJwxfyL6RcWtnGhJxEHENyfiXIlTKWu4YJs8pTNTVXqlVPuoSZcMCONfZUV Z1LSaOk9L5DRnCKovQ/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1UMb-00Ai8H-1b; Tue, 23 May 2023 15:55:53 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1UMI-00Ahyh-2L for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2023 15:55:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=n9eDO+1ygvDE+gdpZgXbwnZiXkHIBqMNSiOE0viq9CY=; b=uVspDpPDe210Q2JkdLWxqwglwj WYH4VJap27Or+g8xdgKrjXkg69nxEMvD3/ObLMrbSTawbmMg2kxVQdDSVqWFYwZTqF33N9wwlUxsN m9FTUgUVoUBLUD1ZVPBf61oDcClH7Bp4o00oEKCj/NyUx3wkZTrxr5imUuYxsedqCe2UXpFcrbwdv ErcfLHToR/613vDqYbY0xy/wEZ5Iz64W3ykr4ZBVHh0UITGWJrsO1VTO2ejW+zrDJrEj4c1gwqQHv AgYwwDWvP9DhgC8g7lNWjdV2JnffYNOe6xQP94eCsHBgPJYxX7khv2TRxl79Uh6KP7tImAZEnyn8R EK21zD5g==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:48978 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q1UMF-0000k2-1J; Tue, 23 May 2023 16:55:31 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1q1UME-007FT0-Dw; Tue, 23 May 2023 16:55:30 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Daniel Machon , "David S. Miller" , Eric Dumazet , Florian Fainelli , Horatiu Vultur , Ioana Ciornei , Jakub Kicinski , Lars Povlsen , linux-arm-kernel@lists.infradead.org, Madalin Bucur , Marcin Wojtas , Michal Simek , netdev@vger.kernel.org, Paolo Abeni , Radhey Shyam Pandey , Sean Anderson , Steen Hegelund , Taras Chornyi , Thomas Petazzoni , UNGLinuxDriver@microchip.com, Vladimir Oltean Subject: [PATCH RFC net-next 5/9] net: mvneta: switch PCS driver to use phylink_pcs_neg_mode() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 23 May 2023 16:55:30 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230523_085534_763154_C9981FB7 X-CRM114-Status: GOOD ( 12.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the newly introduced phylink_pcs_neg_mode() to configure whether inband-AN should be used. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/marvell/mvneta.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index e2abc00d0472..d669276639b1 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -4009,6 +4009,7 @@ static int mvneta_pcs_config(struct phylink_pcs *pcs, { struct mvneta_port *pp = mvneta_pcs_to_port(pcs); u32 mask, val, an, old_an, changed; + unsigned int neg_mode; mask = MVNETA_GMAC_INBAND_AN_ENABLE | MVNETA_GMAC_INBAND_RESTART_AN | @@ -4016,7 +4017,9 @@ static int mvneta_pcs_config(struct phylink_pcs *pcs, MVNETA_GMAC_AN_FLOW_CTRL_EN | MVNETA_GMAC_AN_DUPLEX_EN; - if (phylink_autoneg_inband(mode)) { + neg_mode = phylink_pcs_neg_mode(mode, interface, advertising); + + if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) { mask |= MVNETA_GMAC_CONFIG_MII_SPEED | MVNETA_GMAC_CONFIG_GMII_SPEED | MVNETA_GMAC_CONFIG_FULL_DUPLEX; From patchwork Tue May 23 15:55:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13252599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6CDA4C7EE26 for ; Tue, 23 May 2023 15:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bhc3Moa6VVMWLxTM1IGjS3LGOrfTOOgKFoZe69AN4Dg=; b=IoM1ZFPsHUsbNj ATx8bR4Wqn/5XTFin8NeVyOCuWmzDb8Qljz26CIQJgV+6XOa6OeIez71u8o79levWwza6ze2icQDX BpSyxi5WLuj/OfNCZaDwio7kfxDE+YB2sEOzyWQ7y/DaeNBA/USIdevjXc9O7UzW4C1j3D+BFl7x8 946n/GFRtjUsrCkLJTP6cwZ3V5y7gQpkySmashlJXDuVzhPEFuLZfus5RSD3ZLkbM5b6WKXgRmwXR 01bF1xoxOPaJRvIXrNU2/e0DC0XnmpYuW3Ni3RrIbzPXM8g+b12XRalkq10bBIV4EaBv+309ovYIf xXJ0rlWr5ae9N1txvaYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1UMi-00AiBs-1E; Tue, 23 May 2023 15:56:00 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1UMO-00Ai0V-0i for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2023 15:55:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Re/UlqW6vaDwmOO85PqS9von2XbZJGwxkkQjyPtySbM=; b=brgoOQRhSmtLV+dIIJ7laMe+jc xPKBNSMFpg1nJn/3gy3RVOjOxJMcGp2WPSdD+y4NHAUppa0bwBpnHSfo4HRWU1kWsYAANBCnR64rz Y5CfsjaA9EHoeRxQOeDiAEbhZofqSmFO6afx1ARC9rW25FiNZUEO4jQVCM7Q/9VP5SYXDGsCBwDYo 220UzZBab/W2h7BbdYe2wr3A63qmJKKdRJt+pvhdF1TtPyTidUYvbkEOcvtE94FMzH71o5vldjRPs JOIWjAvYX+XrvR2QrB1nNm2ILTOclr8seZIZwxY5ODoahms5T4BsCcBmVtP3y/L8bgapfquIMrAlz JHENwInQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:46874 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q1UMK-0000kX-59; Tue, 23 May 2023 16:55:36 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1q1UMJ-007FT7-HH; Tue, 23 May 2023 16:55:35 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Daniel Machon , "David S. Miller" , Eric Dumazet , Florian Fainelli , Horatiu Vultur , Ioana Ciornei , Jakub Kicinski , Lars Povlsen , linux-arm-kernel@lists.infradead.org, Madalin Bucur , Marcin Wojtas , Michal Simek , netdev@vger.kernel.org, Paolo Abeni , Radhey Shyam Pandey , Sean Anderson , Steen Hegelund , Taras Chornyi , Thomas Petazzoni , UNGLinuxDriver@microchip.com, Vladimir Oltean Subject: [PATCH RFC net-next 6/9] net: mvpp2: switch PCS driver to use phylink_pcs_neg_mode() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 23 May 2023 16:55:35 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230523_085540_259936_5226DD22 X-CRM114-Status: GOOD ( 11.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the newly introduced phylink_pcs_neg_mode() to configure whether inband-AN should be used. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index adc953611913..9ec806d6cd20 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -6239,6 +6239,7 @@ static int mvpp2_gmac_pcs_config(struct phylink_pcs *pcs, unsigned int mode, { struct mvpp2_port *port = mvpp2_pcs_gmac_to_port(pcs); u32 mask, val, an, old_an, changed; + unsigned int neg_mode; mask = MVPP2_GMAC_IN_BAND_AUTONEG_BYPASS | MVPP2_GMAC_IN_BAND_AUTONEG | @@ -6246,7 +6247,8 @@ static int mvpp2_gmac_pcs_config(struct phylink_pcs *pcs, unsigned int mode, MVPP2_GMAC_FLOW_CTRL_AUTONEG | MVPP2_GMAC_AN_DUPLEX_EN; - if (phylink_autoneg_inband(mode)) { + neg_mode = phylink_pcs_neg_mode(mode, interface, advertising); + if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) { mask |= MVPP2_GMAC_CONFIG_MII_SPEED | MVPP2_GMAC_CONFIG_GMII_SPEED | MVPP2_GMAC_CONFIG_FULL_DUPLEX; From patchwork Tue May 23 15:55:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13252601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9FA5AC7EE2D for ; Tue, 23 May 2023 15:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=f5sDyG/TKkarVyHhDOmZuMPEu/aa4HJm0j+lWFmvegk=; b=LNsAIU9CzWdBu0 0rguz9emAGbiSs6nYoyn/aoA/nKgh7MpmIALEJbWFFNqqAFZoDpqVyAHCErj08BMFGmHIXZtozZ4q 5hSma+Lo2DakMXYmFbrg1bloBe240LZECTayRwsWgWfWR+/r+SiHNb7n6pMad6YotJfmxH8GdZ2WU w6FGLLhY59v3/WGMGxZ43rGCRfN5cnUVSN7K+D9FVer7fmasnajXkzLHBjR7+rtGnbXtPUC9fAU3K CBZkaEYisGBhq/YV21gvC/ZVy2TPeSEXh/aJJKkcmXjmSonCdLeKB2+WhcVpQxjrr5kiFZDxdRYnL 4a87N8ObkJSFc6c66yjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1UMj-00AiCU-0O; Tue, 23 May 2023 15:56:01 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1UMS-00Ai3K-2j for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2023 15:55:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=nAKHJkTbZDzNX1B/hzv5a6k8k/EBeltxSBdWV5zZtJk=; b=j1NEbFSBxJKiqxyUzC2eun3Bo3 xzoKeuaiWYvvd8CDzPnhunoNYdhmyNCHfsRzbvkIgL1/LaxlSm1ZmrNNRBJsBdK2p0kAEDcqEE9nh 9xqGPIQPlQlcOI5o/pQyrpU5UD1X/qZGRJ8e6SyieSzgrlXhcl4xO+sRHZJ7tUw5ozGpw1AC528H1 CAm8pUbPwKTQlGuP/eZ+/k9u9Fq+rMIsWk9JEm+ENU5t8uMHr90fwGwIy5afz4JNVFNUK1omGSjLY QI/I1A92Zgcmk3SGY/nQRoulSrr0pJAR/BZgmBHpAeFRx+lbl+/iUFRW0zw2UoBPfe4KG2w4iXEep xCI9z3ag==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:46878 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q1UMP-0000ky-9E; Tue, 23 May 2023 16:55:41 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1q1UMO-007FTD-Kv; Tue, 23 May 2023 16:55:40 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Daniel Machon , "David S. Miller" , Eric Dumazet , Florian Fainelli , Horatiu Vultur , Ioana Ciornei , Jakub Kicinski , Lars Povlsen , linux-arm-kernel@lists.infradead.org, Madalin Bucur , Marcin Wojtas , Michal Simek , netdev@vger.kernel.org, Paolo Abeni , Radhey Shyam Pandey , Sean Anderson , Steen Hegelund , Taras Chornyi , Thomas Petazzoni , UNGLinuxDriver@microchip.com, Vladimir Oltean Subject: [PATCH RFC net-next 7/9] net: prestera: switch PCS driver to use phylink_pcs_neg_mode() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 23 May 2023 16:55:40 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230523_085544_891846_0869AF16 X-CRM114-Status: GOOD ( 11.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the newly introduced phylink_pcs_neg_mode() to configure whether inband-AN should be used. Signed-off-by: Russell King (Oracle) Acked-by: Elad Nachman --- drivers/net/ethernet/marvell/prestera/prestera_main.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c index 9d504142e51a..2a26f96fbed2 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c @@ -308,38 +308,36 @@ static int prestera_pcs_config(struct phylink_pcs *pcs, { struct prestera_port *port = prestera_pcs_to_port(pcs); struct prestera_port_mac_config cfg_mac; + unsigned int neg_mode; int err; + neg_mode = phylink_pcs_neg_mode(mode, interface, advertising); + err = prestera_port_cfg_mac_read(port, &cfg_mac); if (err) return err; cfg_mac.admin = true; cfg_mac.fec = PRESTERA_PORT_FEC_OFF; + cfg_mac.inband = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED; switch (interface) { case PHY_INTERFACE_MODE_10GBASER: cfg_mac.speed = SPEED_10000; - cfg_mac.inband = 0; cfg_mac.mode = PRESTERA_MAC_MODE_SR_LR; break; case PHY_INTERFACE_MODE_2500BASEX: cfg_mac.speed = SPEED_2500; cfg_mac.duplex = DUPLEX_FULL; - cfg_mac.inband = test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, - advertising); cfg_mac.mode = PRESTERA_MAC_MODE_SGMII; break; case PHY_INTERFACE_MODE_SGMII: - cfg_mac.inband = 1; cfg_mac.mode = PRESTERA_MAC_MODE_SGMII; break; case PHY_INTERFACE_MODE_1000BASEX: default: cfg_mac.speed = SPEED_1000; cfg_mac.duplex = DUPLEX_FULL; - cfg_mac.inband = test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, - advertising); cfg_mac.mode = PRESTERA_MAC_MODE_1000BASE_X; break; } From patchwork Tue May 23 15:55:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13252600 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 75D89C7EE23 for ; Tue, 23 May 2023 15:56:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5WGvY5Q+po/05ocqAMWC409fnMazTmZPYrETTQjLjK0=; b=gAO8lTJLflai1o 85ZYanoU8Y5waMDD5ty8IFbMoOMtMGeAqMhAg+L6zVBYMDwHUdrozV+AUX/BT9dygfsWblpwT7vrZ KQyzSqVDnTnFWcpD92K1xVWye/C6PSNizROt+7XyFr7k/NnLY0Y6BkZgLbuy+4AgaVLotk521qKm3 jYNC+YLSj5mQZ3QljAvFuHdUgkuba5u6rLOIPy+AqWusTEgZx43eqQC8Emj3+eIH2g/r62xCo2wDH s+CLvo5/NW668CfmhM5c9vMmhwVZs7YdT1fLyc/x0o0+s47sstjk4T4spySJejAojG4+BLwSTfgOg cuhjmLvqwu8nFZ9y3JOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1UMk-00AiD5-0i; Tue, 23 May 2023 15:56:02 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1UMY-00Ai5z-0J for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2023 15:55:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=FVOoKlcE9wbWI4c+QH+jePyQLl9O41VBGHtZioJCPsQ=; b=wizhLKf3/3+tPK6Z1OYi84b2os DQSOPSSfBjUj8bwXwofOD7sa6gRLE8yxSvG+KKgp3Nc8Rs7nXXzUrOJljvjC2vBFkofPnNCkor97E LAbSdHkM6rsMeXWQut/kLsSl3aSLDtu1vb0Xk4G0Afsx/O8Smwy4vMEv2NnWpjkAvdWQzdWvNyWly sgAsP/87ADszKiRMgusL76iQaihboqkDGtdc1iKexFRLFDhrlxZNzl1eYRwyBvcoHCOHYhqc7AuIE NyYSAk+WglhO6x9nPr8LygscAE5PSFG2deJlQtT8BNcRvBUwEFMuh7HQZPOc5QbGjQBJ6IX8XtUzV HydRRHGg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:51716 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q1UMU-0000lT-LD; Tue, 23 May 2023 16:55:46 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1q1UMT-007FTJ-Ov; Tue, 23 May 2023 16:55:45 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Daniel Machon , "David S. Miller" , Eric Dumazet , Florian Fainelli , Horatiu Vultur , Ioana Ciornei , Jakub Kicinski , Lars Povlsen , linux-arm-kernel@lists.infradead.org, Madalin Bucur , Marcin Wojtas , Michal Simek , netdev@vger.kernel.org, Paolo Abeni , Radhey Shyam Pandey , Sean Anderson , Steen Hegelund , Taras Chornyi , Thomas Petazzoni , UNGLinuxDriver@microchip.com, Vladimir Oltean Subject: [PATCH RFC net-next 8/9] net: lan966x: switch PCS driver to use phylink_pcs_neg_mode() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 23 May 2023 16:55:45 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230523_085550_137175_E2934157 X-CRM114-Status: GOOD ( 10.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the newly introduced phylink_pcs_neg_mode() to configure whether inband-AN should be used. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c b/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c index c5f9803e6e63..29bbd642cec8 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c @@ -103,12 +103,16 @@ static int lan966x_pcs_config(struct phylink_pcs *pcs, { struct lan966x_port *port = lan966x_pcs_to_port(pcs); struct lan966x_port_config config; + unsigned int neg_mode; int ret; + neg_mode = phylink_pcs_neg_mode(mode, interface, advertising); + config = port->config; config.portmode = interface; - config.inband = phylink_autoneg_inband(mode); - config.autoneg = phylink_test(advertising, Autoneg); + config.inband = neg_mode == PHYLINK_PCS_NEG_INBAND_DISABLED || + neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED; + config.autoneg = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED; config.advertising = advertising; ret = lan966x_port_pcs_set(port, &config); From patchwork Tue May 23 15:55:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13252602 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03E78C7EE23 for ; Tue, 23 May 2023 15:56:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hJuihzHxyK2ew6X7BFNvPZQxs+MrAGsfPwKEzmqeep0=; b=ZqqQNN2jZTvXMR ruT6ggiK1Nr/AAqO98iI8mo+k4vE5yROmjfAzteeZJEwojjV1JdGQBH94AZQN5iKBwXJlY0uU6k22 8rp4IcM20m2609EpKAxw5VukgoQYgMVSDzPQxJmpYZfz1ukrcg/uZEjxd8Jk/9t248rgmKPgICfbO YuK4fr392thaR0Uy9VBrb1me/OAJ0NsYO+wq3VnCl4wAFxTU+L99zn7FDghiakqLKVdh8NGWdviTR nBeNK7KYhg4fhMY4mRLQdCXCEStOsSNJvodsDQko8yiWE2tU0lI5FqffxELd6rvjslBxNVhOCAdTQ L+HJh407nCnDMzfCcq/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1UMl-00AiEb-2W; Tue, 23 May 2023 15:56:03 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1UMd-00Ai8q-0K for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2023 15:55:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=0jV/WMXtxsUL1nMGjvM9X2gfxx/ocKxcVudIC4DejDg=; b=st0JuY6YAwF95TnfOSiNnH6Psn D/uVc/1E9uKDN4njXnw68BmfrazDLwzKLueDDim0aAPHKAaMRcMinsmL6DMrk2cdCI1yRAvLkGb3K sjPe4005BnFA+8ZPlRWiKUtKqcGwCaAhEax76J6zRW6hHmAHVhtExB6CXe2asMVtYfu255BqoI6KP gEH3p1sJCxHTU+J24P71o4+MMGnsmG7vWIffQXcdWv8Zw5hqFZfCHxgFwZDtHHPcmzod1XidrkkOF CiVj4CbNDB+hZ/l3IIe8Z+Kctf9eH0cwpQ/bf1qSB6Sf4WzdMRd25wWmUBpwwhIrXbGdNiuAsXR2S LKf+jJxQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:51728 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q1UMZ-0000m2-Fp; Tue, 23 May 2023 16:55:51 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1q1UMY-007FTP-SG; Tue, 23 May 2023 16:55:50 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Daniel Machon , "David S. Miller" , Eric Dumazet , Florian Fainelli , Horatiu Vultur , Ioana Ciornei , Jakub Kicinski , Lars Povlsen , linux-arm-kernel@lists.infradead.org, Madalin Bucur , Marcin Wojtas , Michal Simek , netdev@vger.kernel.org, Paolo Abeni , Radhey Shyam Pandey , Sean Anderson , Steen Hegelund , Taras Chornyi , Thomas Petazzoni , UNGLinuxDriver@microchip.com, Vladimir Oltean Subject: [PATCH RFC net-next 9/9] net: sparx5: switch PCS driver to use phylink_pcs_neg_mode() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 23 May 2023 16:55:50 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230523_085555_147956_08D28408 X-CRM114-Status: GOOD ( 11.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the newly introduced phylink_pcs_neg_mode() to configure whether inband-AN should be used. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c b/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c index bb97d27a1da4..87bdec185383 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c @@ -99,13 +99,17 @@ static int sparx5_pcs_config(struct phylink_pcs *pcs, { struct sparx5_port *port = sparx5_pcs_to_port(pcs); struct sparx5_port_config conf; + unsigned int neg_mode; int ret = 0; + neg_mode = phylink_pcs_neg_mode(mode, interface, advertising); + conf = port->conf; conf.power_down = false; conf.portmode = interface; - conf.inband = phylink_autoneg_inband(mode); - conf.autoneg = phylink_test(advertising, Autoneg); + conf.inband = neg_mode == PHYLINK_PCS_NEG_INBAND_DISABLED || + neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED; + conf.autoneg = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED; conf.pause_adv = 0; if (phylink_test(advertising, Pause)) conf.pause_adv |= ADVERTISE_1000XPAUSE;