From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0FAA8FC5910 for ; Thu, 26 Feb 2026 08:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id: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-Owner; bh=geMdRVmP18lGH2Py8bsLJNoBmI9RxJwFZl9Ga7wKMWM=; b=y4/Q7/+wdFYkuf rSyJVks8IKK37Iurwo+mOeAPAAW4VdCOSnTyoURYCv9dqp77R1NsbsfOU8fPbNLT1Pm5Dqrqlo16q zDCZqaWRzde3you06+ugEkQcw+kr5l5nrlyve1Gfmr2HFhvrkXt0IPNvx7nJ9N7jKwrpen90pRjmZ EBM1P6a8vW0V5W2FkNFHCsTwrKlTK3olb6ZGHgrTNsJZ9FMm20WR7tfpn9t9f19ys48ewEvNYHUFQ +wRDk4MVkK3wKDNfad4LNmHkRcEyMlZY7/NNTo63XcLb10WbeEV1R+F2KIINUZZcm6fam0zkUPYic 6lYwiCTeNyJK0my4iW8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vvWwr-00000005gCY-06fL; Thu, 26 Feb 2026 08:42:17 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vvWwm-00000005g6p-1Tu0; Thu, 26 Feb 2026 08:42:14 +0000 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=GxfcZEUseWSWgXEfUJ/x192G0PkidFc23RUS1GJAT+I=; b=ZWxUVQmxZtj0PYfmKHdtELJoa0 eOLqvCIsT4UOgvfEJ73mxfcL8ttmw7nTPQ9Q3gtHuSHFLw7ctbIpsrKbmWWhfJPOZK8Pd/QSWa+aD OInKr2n3AeqOUVHr0iAH564puxzEbceT3Z8sDrKb7BW0oBO9d5LipoWCozXBAmVKvQNEtIcgoWcOd sYvU0BBMN4X9EFLNgUxj8VauHVosgGgD9M8flugbfORNbTA7C8RaOUQqU9/G6wCabJpEYOjVzdNaW aZbeMvig+xSiP8+ANxYe4MW6AosM+Bg8ytL6LxpyZxtRGzHEA5kgeqEZgUp6SIYsx/mCJvMhRr4Nd RnBnrCGw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:53008 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 1vvWwX-000000007du-1lpB; Thu, 26 Feb 2026 08:41:57 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1vvWwW-0000000AtKb-06Q2; Thu, 26 Feb 2026 08:41:56 +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 7/8] phy: qcom-sgmii-eth: relax order of .power_on() vs .set_mode*() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Thu, 26 Feb 2026 08:41:56 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260226_004212_394759_42FCE0D1 X-CRM114-Status: GOOD ( 11.45 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Allow any order of the .power_on() and .set_mode*() methods as per the recent discussion. This means phy_power_on() with this SerDes will now restore the previous setup without requiring a subsequent phy_set_mode*() call. Tested-by: Mohd Ayaan Anwar Signed-off-by: Russell King (Oracle) --- drivers/phy/qualcomm/phy-qcom-sgmii-eth.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c b/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c index 6332ff291fdf..f48faa2929a6 100644 --- a/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c +++ b/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c @@ -271,8 +271,17 @@ static int qcom_dwmac_sgmii_phy_calibrate(struct phy *phy) static int qcom_dwmac_sgmii_phy_power_on(struct phy *phy) { struct qcom_dwmac_sgmii_phy_data *data = phy_get_drvdata(phy); + int ret; + + ret = clk_prepare_enable(data->refclk); + if (ret < 0) + return ret; - return clk_prepare_enable(data->refclk); + ret = qcom_dwmac_sgmii_phy_calibrate(phy); + if (ret < 0) + clk_disable_unprepare(data->refclk); + + return ret; } static int qcom_dwmac_sgmii_phy_power_off(struct phy *phy) @@ -318,6 +327,9 @@ static int qcom_dwmac_sgmii_phy_set_mode(struct phy *phy, enum phy_mode mode, if (submode != data->interface) data->interface = submode; + if (phy->power_count == 0) + return 0; + return qcom_dwmac_sgmii_phy_calibrate(phy); } -- 2.47.3 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy