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 BD6DB39524B; Thu, 26 Feb 2026 08:41:31 +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=1772095294; cv=none; b=Td4ZI+d0tDD2beVSL5BXrHQspIN+I658vIZ60OaBwWiI4Dpbv+FQQGk1fHF0M21IIZkvxOrbzZdHIHa0DWoSLdEeiIR14GIvqKfTwTU6bNXw/ZdhPTcJAgzifvaxhEN9XjgCQfN/HaMcNLycdPSbSy3hYXVQJk0nmX4P/S8byVs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772095294; 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=bPVEjDZrWrpdrlLCDfVif5xUX1L84p2K5YtyiwNtnF1X3Ws9V/aQ8Tko1C8ToZjMCXZt60ajHDpWcuULegmKembjT0TmhYEzaHebVkkePDVgiivAsys2KtSgV7vsmEYQcZ0n4s/zYbkezm//YfzYDCHJkKrZN3OJKMp1yImeEIs= 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=obKdMJXe; 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="obKdMJXe" 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=obKdMJXe/8mnt2hbHr3LvYnvXR pqsEItrQ+KugairnHpaLkTBtqa1T00DYAocIKx/e/s5Me6R3ojqf9lyQYxNV80Ovkr0K5EMCKC8zk zVLGDe+vuDLqNxJyX6WH0qmYlcZdxy7wNjyrbhedcCPSc53yllZKCn3V8b05I3wPn/UbxPOnzwkxr tWtlsGozmFQst0l1hgcqF2APjDH9HV/8tNPGpOOj2mx5bWD6Pz2yjt7SYjrCfLUeBAfJJaXTE5doW OupP4mMfPhXHqghFKZeC+R/Icy+TL3rdMbHjiIz1DlQ2ptHq1yNsZ+qyF6A1l6iEN21ct8VJbvYWg qrB2KT6w==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:59150 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 1vvWw2-000000007c9-0fSS; Thu, 26 Feb 2026 08:41:26 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1vvWw1-0000000AtJx-1VwF; Thu, 26 Feb 2026 08:41:25 +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-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Mohd Ayaan Anwar , Neil Armstrong , netdev@vger.kernel.org, Paolo Abeni , Vinod Koul Subject: [PATCH RESEND 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: Thu, 26 Feb 2026 08:41:25 +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