From mboxrd@z Thu Jan 1 00:00:00 1970 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 26E352E1742; Thu, 16 Oct 2025 15:02:09 +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=1760626930; cv=none; b=a3yKkP44zndsGmPtk/yTadsrBTpNULnBvhGr+MIXx3xOkslBC8FrItGAvEBnAz8101I9GNUpU8YjspAMzZjmH05vranfbKLUra1wdU9Eum5EAYB77eTeB6GoUzBMGBE0zcmNpUqo3Y4HiDJZ8vYgIQ5cfXRpsXiAYW6H+lODitU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760626930; c=relaxed/simple; bh=qAMFXjV5Wygod75EJcG5GjSFzUgCajUCdp/7cq0fS60=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=muIcrkI0YoUqK8vry2vcuQiaroOSydjho08P9vK2i6w7z09i7F3/BfOUuFjfcRVQ/ZlRY9Dgx44Udw6bf2aKsNXtPcM357L5SlEzhHqtZ1TijseFjni4oP5D1pdBdMp3wuWGv8nkcNn+q2Mc7cCrzpxuqI65ZkcoB9Tjmf7dbEc= 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=JY1QJQX6; 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="JY1QJQX6" 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=0yEtuL6Yu0FKqib6cgRo1k9CMeFeuQV0Wr+Nu8JvdTY=; b=JY1QJQX68k8QQTQtHSOalCgCME 9LWOr0HwQFGrM1Ox96A77gID9gq0sG70YDK4Il9ANVwgowZQdh2Iuo81GcSf6dsCcgDTyP4riowWG p1c/WUyo2vBmhGHLXFaZxJEhXALRdb+/xhHHENN4AY7Pon32/wpB+2SvWH5zx2B4C0afBy6c5q3bU BVm0MtS23pj3cSxvHvnLOq8xCKXL2f1FpTrh1fTLula8MeVdXkho7HghGKUuCgfABaA9Pji6ueW7i AlxElsZNvj/uU1xt2Y19M+2+avee7X+/Ds9g2/zZGLDkegvFU7hEJ1tBBSrek2Ojd2ZYSDHcmWtuf OVRRDfOw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:41228 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.98.2) (envelope-from ) id 1v9P6s-000000006Ro-2y2U; Thu, 16 Oct 2025 15:37:43 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1v9P6d-0000000Aolw-1T7d; Thu, 16 Oct 2025 15:37:27 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Abhishek Chauhan , Alexandre Torgue , Alexis Lothore , Andrew Lunn , Boon Khai Ng , Daniel Machon , "David S. Miller" , Drew Fustini , Emil Renner Berthing , Eric Dumazet , Faizal Rahim , Furong Xu <0x1207@gmail.com>, Inochi Amaoto , Jacob Keller , Jakub Kicinski , "Jan Petrous (OSS)" , Jisheng Zhang , Kees Cook , Kunihiko Hayashi , Lad Prabhakar , Ley Foon Tan , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Matthew Gerlach , Maxime Chevallier , Maxime Coquelin , Michal Swiatkowski , netdev@vger.kernel.org, Oleksij Rempel , Paolo Abeni , Rohan G Thomas , Shenwei Wang , Simon Horman , Song Yoong Siang , Swathi K S , Tiezhu Yang , Vinod Koul , Vladimir Oltean , Vladimir Oltean , Yu-Chun Lin Subject: [PATCH net-next v2 09/14] net: stmmac: simplify stmmac_check_pcs_mode() Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Thu, 16 Oct 2025 15:37:27 +0100 Now that we only support one mode, simplify stmmac_check_pcs_mode(). Reviewed-by: Andrew Lunn Signed-off-by: Russell King (Oracle) --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 013a2f3684c7..611197cfa34f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1086,22 +1086,23 @@ static const struct phylink_mac_ops stmmac_phylink_mac_ops = { static void stmmac_check_pcs_mode(struct stmmac_priv *priv) { int interface = priv->plat->phy_interface; + int speed = priv->plat->mac_port_sel_speed; if (priv->dma_cap.pcs && interface == PHY_INTERFACE_MODE_SGMII) { netdev_dbg(priv->dev, "PCS SGMII support enabled\n"); priv->hw->pcs = STMMAC_PCS_SGMII; - } - - /* PS and related bits will be programmed according to the speed */ - if (priv->hw->pcs) { - int speed = priv->plat->mac_port_sel_speed; - if ((speed == SPEED_10) || (speed == SPEED_100) || - (speed == SPEED_1000)) { + switch (speed) { + case SPEED_10: + case SPEED_100: + case SPEED_1000: priv->hw->ps = speed; - } else { + break; + + default: dev_warn(priv->device, "invalid port speed\n"); priv->hw->ps = 0; + break; } } } -- 2.47.3