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);