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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 718F0C433EF for ; Sat, 18 Jun 2022 10:29:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230266AbiFRK3s (ORCPT ); Sat, 18 Jun 2022 06:29:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233806AbiFRK2w (ORCPT ); Sat, 18 Jun 2022 06:28:52 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6799205DD for ; Sat, 18 Jun 2022 03:28:51 -0700 (PDT) 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=PKHrlzywYFJRT92+/mCW/3kj8IPmNtPkoXii4nZOAa0=; b=1mz5CLVR5wSWTV3MJxI8Mvs7Bn OSkmb7bZ/Znujirwqai5iggBthBPmEDqD448zLBUWTcy4nspjphLGtVCget9Z/nx+2WRGxMn6OtNK PpH1xw8GMUwrQtcU0DTHhyJandaPDb6prqcSnP/Cw4VdnI8yuytFcCzL0XE5T9muEL8y0O82KXkpd II2ZgyDJcg1WMZuRPAHEhwoUEBsCuPBt+HXHezGvnMOQKUZhljk3OqD4Vg9oF7hrHaNAwMSGTDZ3r jP+bsW64AW+ZMPMNAHUa0hAJDTiWEDOO3nGCd2A2u3BPiXh5rw64FsVgvJZUGlHiPRBJtUgsxkVj6 3BvuU/3A==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:44610 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 1o2VhA-0004BL-4T; Sat, 18 Jun 2022 11:28:48 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1o2Vh9-0026CA-Hv; Sat, 18 Jun 2022 11:28:47 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next 4/4] net: pcs: pcs-xpcs: use mii_bmcr_encode_fixed() MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Sat, 18 Jun 2022 11:28:47 +0100 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Use the newly introduced mii_bmcr_encode_fixed() for the xpcs driver. Signed-off-by: Russell King (Oracle) --- drivers/net/pcs/pcs-xpcs.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index a5d520e34ea3..ab0af1d2531f 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -1081,23 +1081,7 @@ static void xpcs_link_up_sgmii(struct dw_xpcs *xpcs, unsigned int mode, if (phylink_autoneg_inband(mode)) return; - switch (speed) { - case SPEED_1000: - val = BMCR_SPEED1000; - break; - case SPEED_100: - val = BMCR_SPEED100; - break; - case SPEED_10: - val = BMCR_SPEED10; - break; - default: - return; - } - - if (duplex == DUPLEX_FULL) - val |= BMCR_FULLDPLX; - + val = mii_bmcr_encode_fixed(speed, duplex); ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MDIO_CTRL1, val); if (ret) pr_err("%s: xpcs_write returned %pe\n", __func__, ERR_PTR(ret)); -- 2.30.2