From patchwork Thu Oct 17 11:52:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13839922 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E46C41925B2 for ; Thu, 17 Oct 2024 11:52:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729165970; cv=none; b=DeyORGwYbtJKwJCwU/BL9B4Wkp83/ph7pcpElXpGlDD8BvDT9fQLsEpxj4ydiGKOnTLIp6gjobPdg4UNFaMRvAFVEBIwfEmRFe6l0vH4l7fW35F8kBqTM1rcw1Ct6ptMVLunxBvbdlcgMzhCqBqD+6HJvbNfjyKwsv0RWWbxIHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729165970; c=relaxed/simple; bh=zEIYKI6DPweVf+O4s//ilmaYcEEZaQIYc2uBvuevGGE=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=dxu8jhw3SxClY/T3hmUpsAwoCdLBxIY/mUH55GPGJr5D4m76QAKOo0xKAbl0SzHmiSl+ilCi5DLJAv/KLxf2QAY33gLaZYyI3QfRRAj132v6sQA+xNX5+vgkEof2OKJz7OpIaVvv3+zvPtWHDnKavELatEAkMnJFNkii12ouZiI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=kyLQvg/m; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="kyLQvg/m" 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=i/EZgnM68cHwtEqYZmHM+ZM9Y9YSC9kevP/UprigDZE=; b=kyLQvg/m4IbUR+GngDFFBtqZwY eix0iLJpIJKnRk1MQ0L2tCJQjiSSvhDrnEvKBRsxdVJA+Wclw4lWHBxmG/svZ4P4ECgqvL/i8Go7Y +861ep3+HldZwGHMnetfz+egWEqyaM0HH+c5kxvESsJe5yTshTd0n8fZDVKMzw1lBCe6aEYcIfs36 4+E89rmFobHftchoCsYpwq02Vb5tXCAb3ElzHUxY6RDWETUJ36cXfBqC2FxMYdBarZKl28GSqUjfL KgtvNdUM/SgT2MInNIFCCMvyG0dPJbnbvBebEdCdnRWD39kmUftvn3GJxAIWbBNvEg92R3xN7UTj8 JFGJWqXg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:37936 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.96) (envelope-from ) id 1t1P3X-0006Ua-1I; Thu, 17 Oct 2024 12:52:39 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1t1P3X-000EJx-ES; Thu, 17 Oct 2024 12:52:39 +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 1/7] net: pcs: xpcs: use generic register definitions Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Thu, 17 Oct 2024 12:52:39 +0100 X-Patchwork-Delegate: kuba@kernel.org As a general policy, we refer our generic register definitions over vendor specific definitions. In XPCS, it appears that the register layout follows a BMCR, BMSR and ADVERTISE register definition. We already refer to this BMCR register using several different macros which is confusing. Convert the following register definitions to generic versions: DW_VR_MII_MMD_CTRL => MII_BMCR MDIO_CTRL1 => MII_BMCR AN_CL37_EN => BMCR_ANENABLE SGMII_SPEED_SS6 => BMCR_SPEED1000 SGMII_SPEED_SS13 => BMCR_SPEED100 MDIO_CTRL1_RESET => BMCR_RESET DW_VR_MII_MMD_STS => MII_BMSR DW_VR_MII_MMD_STS_LINK_STS => BMSR_LSTATUS DW_FULL_DUPLEX => ADVERTISE_1000XFULL iDW_HALF_DUPLEX => ADVERTISE_1000XHALF Signed-off-by: Russell King (Oracle) --- drivers/net/pcs/pcs-xpcs.c | 64 ++++++++++++++++++++------------------ drivers/net/pcs/pcs-xpcs.h | 12 ------- 2 files changed, 34 insertions(+), 42 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index c69421e80d19..a5e2d93db285 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -223,8 +223,8 @@ static int xpcs_poll_reset(struct dw_xpcs *xpcs, int dev) int ret, val; ret = read_poll_timeout(xpcs_read, val, - val < 0 || !(val & MDIO_CTRL1_RESET), - 50000, 600000, true, xpcs, dev, MDIO_CTRL1); + val < 0 || !(val & BMCR_RESET), + 50000, 600000, true, xpcs, dev, MII_BMCR); if (val < 0) ret = val; @@ -250,7 +250,7 @@ static int xpcs_soft_reset(struct dw_xpcs *xpcs, return -EINVAL; } - ret = xpcs_write(xpcs, dev, MDIO_CTRL1, MDIO_CTRL1_RESET); + ret = xpcs_write(xpcs, dev, MII_BMCR, BMCR_RESET); if (ret < 0) return ret; @@ -343,7 +343,7 @@ static void xpcs_config_usxgmii(struct dw_xpcs *xpcs, int speed) if (ret < 0) goto out; - ret = xpcs_modify(xpcs, MDIO_MMD_VEND2, MDIO_CTRL1, DW_USXGMII_SS_MASK, + ret = xpcs_modify(xpcs, MDIO_MMD_VEND2, MII_BMCR, DW_USXGMII_SS_MASK, speed_sel | DW_USXGMII_FULL); if (ret < 0) goto out; @@ -646,19 +646,21 @@ static int xpcs_config_aneg_c37_sgmii(struct dw_xpcs *xpcs, * speed/duplex mode change by HW after SGMII AN complete) * 5) VR_MII_MMD_CTRL Bit(12) [AN_ENABLE] = 1b (Enable SGMII AN) * + * Note that VR_MII_MMD_CTRL is MII_BMCR. + * * Note: Since it is MAC side SGMII, there is no need to set * SR_MII_AN_ADV. MAC side SGMII receives AN Tx Config from * PHY about the link state change after C28 AN is completed * between PHY and Link Partner. There is also no need to * trigger AN restart for MAC-side SGMII. */ - mdio_ctrl = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_CTRL); + mdio_ctrl = xpcs_read(xpcs, MDIO_MMD_VEND2, MII_BMCR); if (mdio_ctrl < 0) return mdio_ctrl; - if (mdio_ctrl & AN_CL37_EN) { - ret = xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_CTRL, - mdio_ctrl & ~AN_CL37_EN); + if (mdio_ctrl & BMCR_ANENABLE) { + ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MII_BMCR, + mdio_ctrl & ~BMCR_ANENABLE); if (ret < 0) return ret; } @@ -696,8 +698,8 @@ static int xpcs_config_aneg_c37_sgmii(struct dw_xpcs *xpcs, return ret; if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) - ret = xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_CTRL, - mdio_ctrl | AN_CL37_EN); + ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MII_BMCR, + mdio_ctrl | BMCR_ANENABLE); return ret; } @@ -715,14 +717,16 @@ static int xpcs_config_aneg_c37_1000basex(struct dw_xpcs *xpcs, * be disabled first:- * 1) VR_MII_MMD_CTRL Bit(12)[AN_ENABLE] = 0b * 2) VR_MII_AN_CTRL Bit(2:1)[PCS_MODE] = 00b (1000BASE-X C37) + * + * Note that VR_MII_MMD_CTRL is MII_BMCR. */ - mdio_ctrl = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_CTRL); + mdio_ctrl = xpcs_read(xpcs, MDIO_MMD_VEND2, MII_BMCR); if (mdio_ctrl < 0) return mdio_ctrl; - if (mdio_ctrl & AN_CL37_EN) { - ret = xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_CTRL, - mdio_ctrl & ~AN_CL37_EN); + if (mdio_ctrl & BMCR_ANENABLE) { + ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MII_BMCR, + mdio_ctrl & ~BMCR_ANENABLE); if (ret < 0) return ret; } @@ -760,8 +764,8 @@ static int xpcs_config_aneg_c37_1000basex(struct dw_xpcs *xpcs, return ret; if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) { - ret = xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_CTRL, - mdio_ctrl | AN_CL37_EN); + ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MII_BMCR, + mdio_ctrl | BMCR_ANENABLE); if (ret < 0) return ret; } @@ -780,9 +784,9 @@ static int xpcs_config_2500basex(struct dw_xpcs *xpcs) if (ret < 0) return ret; - return xpcs_modify(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_CTRL, - AN_CL37_EN | SGMII_SPEED_SS6 | SGMII_SPEED_SS13, - SGMII_SPEED_SS6); + return xpcs_modify(xpcs, MDIO_MMD_VEND2, MII_BMCR, + BMCR_ANENABLE | BMCR_SPEED1000 | BMCR_SPEED100, + BMCR_SPEED1000); } static int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface, @@ -972,14 +976,14 @@ static int xpcs_get_state_c37_sgmii(struct dw_xpcs *xpcs, state->link = true; - speed = xpcs_read(xpcs, MDIO_MMD_VEND2, MDIO_CTRL1); + speed = xpcs_read(xpcs, MDIO_MMD_VEND2, MII_BMCR); if (speed < 0) return speed; - speed &= SGMII_SPEED_SS13 | SGMII_SPEED_SS6; - if (speed == SGMII_SPEED_SS6) + speed &= BMCR_SPEED100 | BMCR_SPEED1000; + if (speed == BMCR_SPEED1000) state->speed = SPEED_1000; - else if (speed == SGMII_SPEED_SS13) + else if (speed == BMCR_SPEED100) state->speed = SPEED_100; else if (speed == 0) state->speed = SPEED_10; @@ -988,9 +992,9 @@ static int xpcs_get_state_c37_sgmii(struct dw_xpcs *xpcs, if (duplex < 0) return duplex; - if (duplex & DW_FULL_DUPLEX) + if (duplex & ADVERTISE_1000XFULL) state->duplex = DUPLEX_FULL; - else if (duplex & DW_HALF_DUPLEX) + else if (duplex & ADVERTISE_1000XHALF) state->duplex = DUPLEX_HALF; xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_AN_INTR_STS, 0); @@ -1039,13 +1043,13 @@ static int xpcs_get_state_2500basex(struct dw_xpcs *xpcs, { int ret; - ret = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_STS); + ret = xpcs_read(xpcs, MDIO_MMD_VEND2, MII_BMSR); if (ret < 0) { state->link = 0; return ret; } - state->link = !!(ret & DW_VR_MII_MMD_STS_LINK_STS); + state->link = !!(ret & BMSR_LSTATUS); if (!state->link) return 0; @@ -1109,7 +1113,7 @@ static void xpcs_link_up_sgmii(struct dw_xpcs *xpcs, unsigned int neg_mode, return; val = mii_bmcr_encode_fixed(speed, duplex); - ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MDIO_CTRL1, val); + ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MII_BMCR, val); if (ret) dev_err(&xpcs->mdiodev->dev, "%s: xpcs_write returned %pe\n", __func__, ERR_PTR(ret)); @@ -1141,7 +1145,7 @@ static void xpcs_link_up_1000basex(struct dw_xpcs *xpcs, unsigned int neg_mode, dev_err(&xpcs->mdiodev->dev, "%s: half duplex not supported\n", __func__); - ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MDIO_CTRL1, val); + ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MII_BMCR, val); if (ret) dev_err(&xpcs->mdiodev->dev, "%s: xpcs_write returned %pe\n", __func__, ERR_PTR(ret)); @@ -1164,7 +1168,7 @@ static void xpcs_an_restart(struct phylink_pcs *pcs) { struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs); - xpcs_modify(xpcs, MDIO_MMD_VEND2, MDIO_CTRL1, BMCR_ANRESTART, + xpcs_modify(xpcs, MDIO_MMD_VEND2, MII_BMCR, BMCR_ANRESTART, BMCR_ANRESTART); } diff --git a/drivers/net/pcs/pcs-xpcs.h b/drivers/net/pcs/pcs-xpcs.h index 9a22eed4404d..adc5a0b3c883 100644 --- a/drivers/net/pcs/pcs-xpcs.h +++ b/drivers/net/pcs/pcs-xpcs.h @@ -54,9 +54,6 @@ /* Clause 37 Defines */ /* VR MII MMD registers offsets */ -#define DW_VR_MII_MMD_CTRL 0x0000 -#define DW_VR_MII_MMD_STS 0x0001 -#define DW_VR_MII_MMD_STS_LINK_STS BIT(2) #define DW_VR_MII_DIG_CTRL1 0x8000 #define DW_VR_MII_AN_CTRL 0x8001 #define DW_VR_MII_AN_INTR_STS 0x8002 @@ -93,15 +90,6 @@ #define DW_VR_MII_C37_ANSGM_SP_1000 0x2 #define DW_VR_MII_C37_ANSGM_SP_LNKSTS BIT(4) -/* SR MII MMD Control defines */ -#define AN_CL37_EN BIT(12) /* Enable Clause 37 auto-nego */ -#define SGMII_SPEED_SS13 BIT(13) /* SGMII speed along with SS6 */ -#define SGMII_SPEED_SS6 BIT(6) /* SGMII speed along with SS13 */ - -/* SR MII MMD AN Advertisement defines */ -#define DW_HALF_DUPLEX BIT(6) -#define DW_FULL_DUPLEX BIT(5) - /* VR MII EEE Control 0 defines */ #define DW_VR_MII_EEE_LTX_EN BIT(0) /* LPI Tx Enable */ #define DW_VR_MII_EEE_LRX_EN BIT(1) /* LPI Rx Enable */ From patchwork Thu Oct 17 11:52:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13839923 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C404B1DB956 for ; Thu, 17 Oct 2024 11:52:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729165975; cv=none; b=kVj++tG0x7YJVvvINwXYb1FgJlQYFi76qrD3XxdEV0Ur9sNR0wb6BJdoZdj2ubWMpNJC/xS/hvxMXEZCscMPWMmV7BBgLu9jzjNWbSU0mlLqqaoNc1E3ruhvuRnbw4ZZ1L1bUjseaLPB04DtmV7Ey9R7P4rGgWgO66Qo0X24T0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729165975; c=relaxed/simple; bh=TL49y/TR5+EYAOIxfkdBWRzy+e1WY9PzLKRCQzGM5EQ=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=c1QHo5hycHX7NeFBToMezzQeAH1TDI/1tsdCsad7jSgpA2836HIK1IJwKUc19CFa3U1wYCbWtWHboSy+r35BVlH9jQ5u41cUGap2xRiLLJRsEawLvdKYw/CkfMWQ4AvPouSiJHdrTxNTCxWYjh66ieOXCu2BfYA2AXAOwuJB6jw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=zc+JYEi+; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="zc+JYEi+" 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=805ShzfSqoaYD3ydJf7H6BNZ145Fu0Juhpo7gfaE7+c=; b=zc+JYEi++gFzR/yFw+wvBE8swT PiKRsu1Khi/fL/fl2Kj5F0OaXw7xQe4W3vAEyxV8vmR0rJPJR5lfYH445KnRpVhJAKyP+fJSQl3nS g1IokeBG7gC3KOL37t6NPrPWwdNO8bTsXU23Q5AjaLAvCq1YeTGTGdrhSD3Za2dvR36mpZUDUq6Y2 aWzBa5Rv61/kRda3wpojVP4plLC2A1hrnBGEsWLhD35e52K/ixi4WEr73Vhffy/0YZDGqIRCdMhYa xt61ceZkvGBhpEIFQLtoTNDab+32N0t3Pf1lXvaWbMQjCEZjIwE/5zonxIaxldd/yNTVrYmn/UTWr k4x9bXug==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:37942 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.96) (envelope-from ) id 1t1P3c-0006Uk-1s; Thu, 17 Oct 2024 12:52:45 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1t1P3c-000EK3-J7; Thu, 17 Oct 2024 12:52:44 +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 2/7] net: pcs: xpcs: remove switch() in xpcs_link_up_1000basex() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Thu, 17 Oct 2024 12:52:44 +0100 X-Patchwork-Delegate: kuba@kernel.org Remove an unnecessary switch() statement in xpcs_link_up_1000basex(). The only value this switch statement is interested in is SPEED_1000, all other values lead to an error. Replace this with a simple if() statement. Signed-off-by: Russell King (Oracle) --- drivers/net/pcs/pcs-xpcs.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index a5e2d93db285..183df8f8c50f 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -1127,18 +1127,13 @@ static void xpcs_link_up_1000basex(struct dw_xpcs *xpcs, unsigned int neg_mode, if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) return; - switch (speed) { - case SPEED_1000: - val = BMCR_SPEED1000; - break; - case SPEED_100: - case SPEED_10: - default: - dev_err(&xpcs->mdiodev->dev, "%s: speed = %d\n", + if (speed != SPEED_1000) { + dev_err(&xpcs->mdiodev->dev, "%s: speed %dMbps not supported\n", __func__, speed); return; } + val = BMCR_SPEED1000; if (duplex == DUPLEX_FULL) val |= BMCR_FULLDPLX; else From patchwork Thu Oct 17 11:52:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13839924 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DDE81DA614 for ; Thu, 17 Oct 2024 11:52:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729165980; cv=none; b=PejdR778k1ZqQahebjN1D0rL2RQ1FxMXm5ihbmFh+kI+mV5iEQX6o+EJ68LgCmQuIN7IkLuxuNXMKL+NiV9Lhli1e0QfXFGztbx511wHyYHs199uuZVSCZwkW3VenCqvO21mS8IiWtoEtbOFKn0Rlmu8VqCW1AjCovu7jcGXcmA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729165980; c=relaxed/simple; bh=2yp+Qt3OSbOiwzD7Nfr7hyfD3Ulo3b9jUAM1bXi2zpg=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=QNrBLyKgRVbDB6fqRZrZx7xSx26t68eyc6N+f1D8xjSxLaRtFjTYVtgt/CZdHuYRNGvtIdQfd3AkwtU9qXef0RI1GG1WIxnmp8ywvVAuuQXiqCzgOXJL6V2d/kcTJUT7Zr0wrZIv8vVyENCmkdH73Bl7Vq9Axe/9k5NgoOdcgB4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=kYyyeZRi; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="kYyyeZRi" 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=xiwJtIJgNsWscj+Fc76PN7FObjtVKjifptCZnbrZZbE=; b=kYyyeZRieEirja+E3/uBUofSj3 iFBZ+gsS4edl6LWi9Xmr1yWxr0+PL7fYvStQ35rhaI91Y9hrIV3xcj3AopBHgANaf5UBUv/RjvtJD wGzTvNLtKSgwOSlyLJiBG7PE/1Cg3ahxLnEiJqY5cTWTidRWzCNfUtjWdyRQeUilv/xiLGZlnoQHg v91E/ls0S2G0hPOAYO17aOKdFfnMfnQeAdpAU1KqMwJEWWXMyGtSa+O1R48rULVVAAJED7ovFWQjo 4xo0C4y1QBn+b4Q6zWwUf05xIgxYxc3hh1zD+u318ef/8YS2y6z04BTlb8RgbmBjhyqI0v1aPdNQr YWfw/CsA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:34564 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.96) (envelope-from ) id 1t1P3h-0006Uw-2G; Thu, 17 Oct 2024 12:52:50 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1t1P3h-000EK9-NO; Thu, 17 Oct 2024 12:52:49 +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 3/7] net: pcs: xpcs: rearrange xpcs_link_up_1000basex() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Thu, 17 Oct 2024 12:52:49 +0100 X-Patchwork-Delegate: kuba@kernel.org Rearrange xpcs_link_up_1000basex() to make it more obvious what will happen in the following commit. Signed-off-by: Russell King (Oracle) --- drivers/net/pcs/pcs-xpcs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 183df8f8c50f..3222b8851bff 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -1133,12 +1133,13 @@ static void xpcs_link_up_1000basex(struct dw_xpcs *xpcs, unsigned int neg_mode, return; } + if (duplex != DUPLEX_FULL) + dev_err(&xpcs->mdiodev->dev, "%s: half duplex not supported\n", + __func__); + val = BMCR_SPEED1000; if (duplex == DUPLEX_FULL) val |= BMCR_FULLDPLX; - else - dev_err(&xpcs->mdiodev->dev, "%s: half duplex not supported\n", - __func__); ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MII_BMCR, val); if (ret) From patchwork Thu Oct 17 11:52:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13839925 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AB371DA614 for ; Thu, 17 Oct 2024 11:53:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729165985; cv=none; b=XYTzXwNCi0S2ZDHp42sQpKJREeIlYkaxgIn3syYGMNfTscFOMRM1RwOMWeuMXEBuDI9Xbs8oftDgn9y0QgNqZw8xULpx/tauQNsjcB2EVHE8M3sVfneIZPCsnlvwUH6w9aJHkwTX7cKOGoC6pz64woWv+51oavQ36trhyZUWqEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729165985; c=relaxed/simple; bh=ZReJJ4+8SRatT2h+2ZEKPInEKod6q8AiVsSGne2O2QY=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=RpoOv00Zh82EImz71XIwkMprfy303BmNyOvIVaoLAzlpEwB/pNi4g2ZOATG0yHh9nAynNKn7frr4dl+QBoepLaFJ3RMUXGFMxdZIo9Q6eFTMWwHxKrCd9Oel3b8YL51fbWwyX3PhSX8VUX+Jnf5/sm4/tDo8UFOYi22I2GQMdsY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=o3rZRNmy; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="o3rZRNmy" 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=78v0O6Lf1RTV/V5F8ii++JNttCnVNllCHlWuYu7zyvA=; b=o3rZRNmyAWWA3OGlRZTjxS048f 6ArtnN/kyVhviJGP7TzvKrOpbYJY5o4EWp8Uesdwd44A3J3s994eclLyfCdhBILc8oMEXURHthoOW adNA38B8WgIO5hfsKynt68sw/7ddZ9xg3GQVnDLiSOd6EVyGJs8j/roPGA1AmmXqyMceudWkeOan0 Lti6or5MJm2klEev1vgcI9WhCIwhHeJySoEoIu9FNaTBvzBG+hRQzRBmI+hm6vchkQEdoy9UgnbYI FP9QNk70+F4gptLxIv1DY1P8zyuhcIrdh1tWnPWJHyw03YiBoF6aZaasBh8ihoBFzYOBycKAm7Wr8 yLN2tpIg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:34578 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.96) (envelope-from ) id 1t1P3m-0006VA-2U; Thu, 17 Oct 2024 12:52:55 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1t1P3m-000EKL-Qn; Thu, 17 Oct 2024 12:52:54 +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/7] net: pcs: xpcs: replace open-coded mii_bmcr_encode_fixed() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Thu, 17 Oct 2024 12:52:54 +0100 X-Patchwork-Delegate: kuba@kernel.org We can now see that we have an open-coded version of mii_bmcr_encode_fixed() when this is called with SPEED_1000: val = BMCR_SPEED1000; if (duplex == DUPLEX_FULL) val |= BMCR_FULLDPLX; Replace this with a call to mii_bmcr_encode_fixed(). Signed-off-by: Russell King (Oracle) --- drivers/net/pcs/pcs-xpcs.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 3222b8851bff..5b38f9019f83 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -1137,10 +1137,7 @@ static void xpcs_link_up_1000basex(struct dw_xpcs *xpcs, unsigned int neg_mode, dev_err(&xpcs->mdiodev->dev, "%s: half duplex not supported\n", __func__); - val = BMCR_SPEED1000; - if (duplex == DUPLEX_FULL) - val |= BMCR_FULLDPLX; - + val = mii_bmcr_encode_fixed(speed, duplex); ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MII_BMCR, val); if (ret) dev_err(&xpcs->mdiodev->dev, "%s: xpcs_write returned %pe\n", From patchwork Thu Oct 17 11:52:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13839926 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1719B1DA614 for ; Thu, 17 Oct 2024 11:53:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729165990; cv=none; b=m/faOjSy1xWkuOD9FTLMeDt8e3zGFq1Zlqud25DZUTcrLTd5xO/CNXXCZ85LYbDdcwnF0prPp1HhTusRhDH5LkU3vVCxWpNNitg/68Tbltu7SNZgQxrz+H/X1byYtzlS704s5fUvwSUhdcHyydpZJ/PECsE0yR7N94hISok5x1A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729165990; c=relaxed/simple; bh=UdjbPSC1LonZSLQJWakc0nocLVQ0IrcrtU1UpYKR8VA=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=RiyhRR2ku3TDLnwHUb95e1j7M29oElCt5ueX2lpedEWZ+exmacjUTjYxBWQkVTxBU9tuYQFdz9kIZhWT4TZpmuP+T+zvCS5OpPpa3/ioYuXebIPhctqJNXwexZ1VWWxSTwk6xdymJiSIc4WP/yB+MP8cSVN57EURXi3Ru/JXZWk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=SqqI9RnV; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="SqqI9RnV" 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=zdwXXkdfjq+M0C+NgQ7UV+yKaTbBHvv0leqhyD+68wE=; b=SqqI9RnVOQBA8aQFV+ZCYiSiff wiU45swwauX6hk3h0BxLZx9MVkyBk1uKt3pY8GWJPPvSoRnplQDoCMxAvyl7X75LKRF2E+7FeMUTH Imp7140kPl32pDJveCJan8Oz0m2VasApf2J53eq2vPWbZonvu7XM+dWbRTgy0SLbRxDjoHlmFN0dw bXgUB3FBhaeXHJvZya9IQFUCUzkAlgYidlUbI3GRPtSIz24W1reMC1TFWZTdRc6tgrK0BkzbcHB/p IyoUvof7MbpOGuST71e7MHCWI5u6/EV3uyJH760Hi68U0qp+UBLHeWaQEtLnFwZmlh68q+UXDEUhh DU+yfm1w==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:40506 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.96) (envelope-from ) id 1t1P3s-0006VN-0l; Thu, 17 Oct 2024 12:53:00 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1t1P3r-000EKR-U5; Thu, 17 Oct 2024 12:52:59 +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 5/7] net: pcs: xpcs: combine xpcs_link_up_{1000basex,sgmii}() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Thu, 17 Oct 2024 12:52:59 +0100 X-Patchwork-Delegate: kuba@kernel.org xpcs_link_up_sgmii() and xpcs_link_up_1000basex() are almost identical with the exception of checking the speed and duplex for 1000BASE-X. Combine the two functions. Signed-off-by: Russell King (Oracle) --- drivers/net/pcs/pcs-xpcs.c | 54 ++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 5b38f9019f83..6cc658f8366c 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -1104,41 +1104,32 @@ static void xpcs_get_state(struct phylink_pcs *pcs, } } -static void xpcs_link_up_sgmii(struct dw_xpcs *xpcs, unsigned int neg_mode, - int speed, int duplex) +static void xpcs_link_up_sgmii_1000basex(struct dw_xpcs *xpcs, + unsigned int neg_mode, + phy_interface_t interface, + int speed, int duplex) { - int val, ret; + int ret; if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) return; - val = mii_bmcr_encode_fixed(speed, duplex); - ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MII_BMCR, val); - if (ret) - dev_err(&xpcs->mdiodev->dev, "%s: xpcs_write returned %pe\n", - __func__, ERR_PTR(ret)); -} - -static void xpcs_link_up_1000basex(struct dw_xpcs *xpcs, unsigned int neg_mode, - int speed, int duplex) -{ - int val, ret; - - if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) - return; + if (interface == PHY_INTERFACE_MODE_1000BASEX) { + if (speed != SPEED_1000) { + dev_err(&xpcs->mdiodev->dev, + "%s: speed %dMbps not supported\n", + __func__, speed); + return; + } - if (speed != SPEED_1000) { - dev_err(&xpcs->mdiodev->dev, "%s: speed %dMbps not supported\n", - __func__, speed); - return; + if (duplex != DUPLEX_FULL) + dev_err(&xpcs->mdiodev->dev, + "%s: half duplex not supported\n", + __func__); } - if (duplex != DUPLEX_FULL) - dev_err(&xpcs->mdiodev->dev, "%s: half duplex not supported\n", - __func__); - - val = mii_bmcr_encode_fixed(speed, duplex); - ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MII_BMCR, val); + ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MII_BMCR, + mii_bmcr_encode_fixed(speed, duplex)); if (ret) dev_err(&xpcs->mdiodev->dev, "%s: xpcs_write returned %pe\n", __func__, ERR_PTR(ret)); @@ -1151,10 +1142,11 @@ static void xpcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, if (interface == PHY_INTERFACE_MODE_USXGMII) return xpcs_config_usxgmii(xpcs, speed); - if (interface == PHY_INTERFACE_MODE_SGMII) - return xpcs_link_up_sgmii(xpcs, neg_mode, speed, duplex); - if (interface == PHY_INTERFACE_MODE_1000BASEX) - return xpcs_link_up_1000basex(xpcs, neg_mode, speed, duplex); + + if (interface == PHY_INTERFACE_MODE_SGMII || + interface == PHY_INTERFACE_MODE_1000BASEX) + return xpcs_link_up_sgmii_1000basex(xpcs, neg_mode, interface, + speed, duplex); } static void xpcs_an_restart(struct phylink_pcs *pcs) From patchwork Thu Oct 17 11:53:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13839927 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02EA61D3647 for ; Thu, 17 Oct 2024 11:53:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729165995; cv=none; b=oPj82wYhKFrtJb6b23eCYCqrNVMh3/DqqNZzIxobCECB2uBZhdxFEUSS9pIBXwEQyLSL/yR93SV/Ff6ek5NXRJ671XCRBP+WR8K3WsIL9RfwTnv8JMg53fyWGeSlNnqoF295f41iJBAqMM6kFNw1EunBbLOmWXLv/5FabPy82DY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729165995; c=relaxed/simple; bh=QaXTDL/x2BiaZXOv6kW1i5Mdtl5vC7K//yip5z6+Hkg=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=Rmzk4dJY2WPmhvkDEsIXx+VVJnOogEiAre6nOVC4pG/PTTW0GULzgrSR1S+wCKjbKKwf+RKvXy43DbO1C8WiLErUIlF0uyPFQqXXRT4w7V5sXseYIla84fd3tuIO3Pofvsbgj9Ra2HIcjYO+W11ApTFieBRFMYTcLOCdIT+YW6s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=pEV95E5W; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="pEV95E5W" 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=XEFcEKZY7Ie7CSKsWvGpMF/K9g5xtBfE5FLM83qpORw=; b=pEV95E5WFxoy52RAPTcTMGKqu9 Q2pr9ibKmF9/YBrIDGogCht2i2ew4EVe53b98sxN3Q/7prj+HkrvraLt/Kkk2DMPncR9qNIfBHXro 5w5c6IfblHnTpR5MikCyy8VNjwzGHjSPmwr5QJoBxDXTVTXfUXBhuu7q0zpHyJNDpF9M3H/JwQeqK 7vXOpvSEKVS+640DhW6l7yoEvj7ti/FnRfDZMAbAV7wJNxwVlMqfyQFn9jFcGosTmFWjd7Vy9ElYR ThUx8xgYYkWSWFGMQCYbUS1QxT34Z2Dd9l/0ZIkfxYXMeOXLUxY1wnhTPq/T3kRSt6BDaNzyd59/Q F9i7fHcg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:40522 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.96) (envelope-from ) id 1t1P3x-0006Va-07; Thu, 17 Oct 2024 12:53:05 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1t1P3x-000EKX-1w; Thu, 17 Oct 2024 12:53:05 +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 6/7] net: pcs: xpcs: rename xpcs_config_usxgmii() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Thu, 17 Oct 2024 12:53:05 +0100 X-Patchwork-Delegate: kuba@kernel.org xpcs_config_usxgmii() is only called from the xpcs_link_up() method, so let's name it similarly to the SGMII and 1000BASEX functions. Signed-off-by: Russell King (Oracle) --- drivers/net/pcs/pcs-xpcs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 6cc658f8366c..89ceedc0f18b 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -311,7 +311,7 @@ static int xpcs_read_fault_c73(struct dw_xpcs *xpcs, return 0; } -static void xpcs_config_usxgmii(struct dw_xpcs *xpcs, int speed) +static void xpcs_link_up_usxgmii(struct dw_xpcs *xpcs, int speed) { int ret, speed_sel; @@ -1141,7 +1141,7 @@ static void xpcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs); if (interface == PHY_INTERFACE_MODE_USXGMII) - return xpcs_config_usxgmii(xpcs, speed); + return xpcs_link_up_usxgmii(xpcs, speed); if (interface == PHY_INTERFACE_MODE_SGMII || interface == PHY_INTERFACE_MODE_1000BASEX) From patchwork Thu Oct 17 11:53:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13839928 X-Patchwork-Delegate: kuba@kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA7B91DC1BD for ; Thu, 17 Oct 2024 11:53:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729166000; cv=none; b=MP3HpbRxhT0K8Qotysnx9tcpqGZjgPeqIt/bSmQqSp4iDGQAmsTitIDX4oimhssrmqnLLjpwImsKQync8t2JNSQZvXs/EmXugKYBdWLno5VUM8o/JSofbnNDDHlVaCpTvyEy1kSmbUgNC9JK302ldKA96huC2pxKWabrRHI4tk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729166000; c=relaxed/simple; bh=N413eM8WzS1RGZBJ0Kk5cx0zDDnBNWC987+5dlYrm0w=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=Hs+32IFncySJd0tPqioxSWi0tUlTF08joIsdHV355QS1NQhTZmcMoIKnMAvtC/5j3ZdU1xJvC47zkQwPbY/RggnIRFmihhWqI2TnrZkeabh2poIFZW6fGh49ehxsGt2pONy6hRHmnWUGRa1MFJHNOlwcSM7a+H4D3qgftTqJ0wM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=Q6OjX4mO; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="Q6OjX4mO" 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=X5R1VAyDfzXSwTaI9sm4LYD34gTnjOhvwyd7oFUcx+8=; b=Q6OjX4mORBeYCuP/hq73SxZFKH aRyaPjgKXlTVqMkpteXUG4x5VH85AbqoxMLX2hfwLkeygmcsqkdZmLXVieQ7BKtPfYhnvgIs/Hb33 H35vvCaTVACw8gvcbOuzD+n/DpjSqkPU7Z0WycCXhzXChPBckaRhmKT02fDazxvzyAnWYoF9SAwYs pLa2ZCKuHTZddCX3NRffrcWwEYj0Fn//l2NwNIjJb8jKYNdMQlQ+aOLDk/BcehpXXbEQ58OJPINGh B/p7yP/r3SZuGus3CJvAXF6flIKUoJFJzg8aaRmTHg+hPNlL1Qoc6vKdzdf5Z9z79GQjmGwknQBAf KRz5ye3g==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:42932 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.96) (envelope-from ) id 1t1P42-0006Vn-0k; Thu, 17 Oct 2024 12:53:10 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1t1P42-000EKd-5S; Thu, 17 Oct 2024 12:53:10 +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 7/7] net: pcs: xpcs: remove return statements in void function Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Thu, 17 Oct 2024 12:53:10 +0100 X-Patchwork-Delegate: kuba@kernel.org While using "return" when calling a void returning function inside a function that returns void doesn't cause a compiler warning, it looks weird. Convert the bunch of if() statements to a switch() and remove these return statements. Signed-off-by: Russell King (Oracle) --- drivers/net/pcs/pcs-xpcs.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 89ceedc0f18b..7246a910728d 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -1140,13 +1140,20 @@ static void xpcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, { struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs); - if (interface == PHY_INTERFACE_MODE_USXGMII) - return xpcs_link_up_usxgmii(xpcs, speed); + switch (interface) { + case PHY_INTERFACE_MODE_USXGMII: + xpcs_link_up_usxgmii(xpcs, speed); + break; + + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + xpcs_link_up_sgmii_1000basex(xpcs, neg_mode, interface, speed, + duplex); + break; - if (interface == PHY_INTERFACE_MODE_SGMII || - interface == PHY_INTERFACE_MODE_1000BASEX) - return xpcs_link_up_sgmii_1000basex(xpcs, neg_mode, interface, - speed, duplex); + default: + break; + } } static void xpcs_an_restart(struct phylink_pcs *pcs)