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 CD5AC394464; Wed, 25 Feb 2026 10:59:47 +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=1772017189; cv=none; b=nZ9ieJx7X+oEvm607rnN8eyTAdSDpx/EHg69BTCxXy8crCfwSSHSC7SSUvB2mTBJLXiFrw3UwG6031JEiSGavJ9xCX2ipE+RD7rR/WhcIHDqXBYs/cccPjZIgG4o1Q+itpUej6/D7LJd/B8pWKmPEKr22uR/yZLUkTo45elSBWY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772017189; c=relaxed/simple; bh=6UWwDJPEm6p9+TG+A3sSr+9+7BO6o9jKa0qULkFa+Ek=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=AtLyzEcQ7LnQnYVTWrx9wTVt7Fl4vArnIJfwBP/ZYL1BtIMjjCsC7PPEbpaTN4zPLap/+AF0r2Z/uwvlHbvyJFnGVreCXJ6lQj9WIrVj8njEhwcHYjgz129hnKeCiMaSGTIzjQRG4A9GDFciNvZvkHtqazpz6ZLeK+AZzXo4s2M= 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=n3B2I/Q2; 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="n3B2I/Q2" 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=cM+IAFXmSKopVgHfXTRKf2XMWAdVS6hW6dOIV+GYWP4=; b=n3B2I/Q2hPOynbtoZdQj/qLyoz AU6kkVhgtcX8GzruM758vB0ozJRrZL9HUJ9m6SS0d6dcYr7jNL+TBaJEoxVwAKAnT2ZG5h5JoZm4H qFD9d8Aw9bY8HnLVYrdT5xEpAcun9O0l3sory25ED3rh0E8YUvpuG9xx0wbZZnVrm6NxKqdy9nx9D Qzth09H5n0bkW3l35oR+bXH9qFr81oTYCyDrRC09x1gfqk/xcuVGGeDn9lWlfYCTkxZEfHMgY7mZi 1vYMeFjYaRlWdcY4H9EkbkvZZP5cuuk5EbmL1katEg+jLe6ERw4gNcunNpUcgw1PR+DKLThG2A92B mJLouPhw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:47020 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 1vvCcG-000000006W0-1pRi; Wed, 25 Feb 2026 10:59:40 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1vvCcE-0000000ArLT-1COQ; Wed, 25 Feb 2026 10:59:38 +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 net-next 7/8] phy: qcom-sgmii-eth: relax order of .power_on() vs .set_mode*() 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 10:59:38 +0000 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) --- Resending as netdev (and others) were missing. 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