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 A84983016E1; Wed, 25 Feb 2026 09:02:07 +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=1772010129; cv=none; b=Ks6xgynjr6U4d5w6FcQoRn0KvSrfj7BRP5VeJ0IU4jmIbhDaTJEQ7cDFAXbgi8/7NoNH1umlknbfGK1JrmTOXl9yoZ9vmkcxf6efb1LB7aF4cDdLs3DdG9UJpy4iqn1jkZyDzwmo8H0mKeF08Hm0W1GUwm5zRxHxY/SxwJZA4Vk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772010129; c=relaxed/simple; bh=vKdt4rq40Y5Khbvd8zfRF313SjSO/zYEU1eQdhH3zRs=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=GC4oyP0EVr3mw5iVinzloojXT7I67+olFHQPCLh+nq7hbCJGV3kT0kFIIMIPn+E3+SQxTMu/9Kyu5+WJ2KmBEJboMiWxRUT9e+1/QxEvOdaoHRKUwoBrLXaFczNZ/75lEWbTqwe1TTf8gyjBhFptAYaX+8w8Z7k36pPwmv0CoZ8= 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=bEBpDHzt; 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="bEBpDHzt" 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=mowyMJmjCIhMn0C2DG7n77SSsLvmJxlX5WvGffL0C9Q=; b=bEBpDHzts68BJ0zXCDw24NM/XI QWAzg4kuuaCd3Zx20ov3yRWzSDTXQr2UI4+mpAzJvPiijuLpgoyhHdnERuYKxWtg5JtoRAxL7ivmy f/hwNfgP2ZolFKsjfajy8d+0mfTPLqbEI2S1w0Zsk9uBT5UYof+8+Oyap2K/nzDjAcu/2jJuKbGPP w2AEwLk5KsLLYoFS4rDxIJI/4OePXoLJRwEqwde1zNTTDXgxa5OoysPyuxxhB0Rexhy6P8F7csU5b BMsVHZdG/zjXkn6J/JZEFJqb7kstCR9oS54153Is3i0q28OTXvLE/e9UwLSIW1LxgV2S4hjIKV36q NcUV7tjg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:45458 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 1vvAmP-000000006FK-3QeP; Wed, 25 Feb 2026 09:02:01 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1vvAmP-0000000AqoT-05Di; Wed, 25 Feb 2026 09:02:01 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Mohd Ayaan Anwar , netdev@vger.kernel.org, Paolo Abeni , Vinod Koul Subject: [PATCH net-next 1/8] net: stmmac: qcom-ethqos: move ethqos_set_serdes_speed() Precedence: bulk X-Mailing-List: netdev@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: Wed, 25 Feb 2026 09:02:01 +0000 Combine ethqos_set_serdes_speed() with ethqos_mac_finish_serdes() to simplify the code. Reviewed-by: Mohd Ayaan Anwar Tested-by: Mohd Ayaan Anwar Signed-off-by: Russell King (Oracle) --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index ad5b5d950fff..57cbe800f652 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -591,14 +591,6 @@ static void ethqos_configure_rgmii(struct qcom_ethqos *ethqos, ethqos_rgmii_macro_init(ethqos, speed); } -static void ethqos_set_serdes_speed(struct qcom_ethqos *ethqos, int speed) -{ - if (ethqos->serdes_speed != speed) { - phy_set_speed(ethqos->serdes_phy, speed); - ethqos->serdes_speed = speed; - } -} - static void ethqos_pcs_set_inband(struct stmmac_priv *priv, bool enable) { stmmac_pcs_ctrl_ane(priv, enable, 0); @@ -683,15 +675,23 @@ static int ethqos_mac_finish_serdes(struct net_device *ndev, void *priv, phy_interface_t interface) { struct qcom_ethqos *ethqos = priv; + int speed, ret = 0; qcom_ethqos_set_sgmii_loopback(ethqos, false); + speed = SPEED_UNKNOWN; if (interface == PHY_INTERFACE_MODE_SGMII) - ethqos_set_serdes_speed(ethqos, SPEED_1000); + speed = SPEED_1000; else if (interface == PHY_INTERFACE_MODE_2500BASEX) - ethqos_set_serdes_speed(ethqos, SPEED_2500); + speed = SPEED_2500; - return 0; + if (speed != SPEED_UNKNOWN && speed != ethqos->serdes_speed) { + ret = phy_set_speed(ethqos->serdes_phy, speed); + if (ret == 0) + ethqos->serdes_speed = speed; + } + + return ret; } static int ethqos_clks_config(void *priv, bool enabled) -- 2.47.3