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 52125FC5911 for ; Thu, 26 Feb 2026 08:41:40 +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=F5Wu5vEhaM6cJnnui4plh+MLa6IftwEVZwpX+W48EVg=; b=kl5FYSiRYwzGV9 TSErLX8iUDT5VA4OMLZTEWiTbiRhZhUgXvE89JG5qwl+g4WGuowVvKJl3XUJPuGA3NemcmepTD3Z0 Chf7/gInb712cAoPkIeNfL5S2ZQeb6rq5/BEDrjQsGkjTQPclHGgixYMI6zJkqpUtYT7jsTAM3X2c d3UZtmw202yQLhIE/MDNjMrF55ljU7prKDQJfJ1rFHZBzdF1UzfhYzztATh0sPu5KbkeqnzJTiNsd DSbfR4zWSU3iXu7NTJMrJU/XE+DYUJQrzp9YkkJDSMD7QFWzHVYgnB/d29ESOEt8kIcij6I7S1S71 iikfirHr0vIXXcrmH7sg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vvWwG-00000005fnx-00Js; Thu, 26 Feb 2026 08:41:40 +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 1vvWwC-00000005fkb-3rDp; Thu, 26 Feb 2026 08:41:38 +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=fP1P1+Yo0Nfs/hb6nLV5PGcdAzZpo7xkO0kQFv/EXTE=; b=Luon7nRbmT1rNofMsNpI5FUMw/ 0vVUAClMo7FEZ0CH8BJ9Obka9fDHcdoA1i98fz01HgBx+QnS3C7TJn/QNtOvgtgdxbNBnEbzAWmYG b/quUof3aawRoQRjoiMGSbAQUK8s/IBlYcRSpqzQufN7ZLKLvktV8nd9x9O9xERFsB57Lqt/wc5lz QebPAnv3dFIb1RGhadsIKBUwLDSlGxF1t7KKhZF89l+2993o/Y4BH6hmSVlPEfoOjBu4KFlBz9/LO RxRKoNs+Tm0P6lMJucXQTIEzA3sQxwgfMsdYlN6valTTZqRwiwAXC1P2cnV2d3mehH0s0lJtYon3O TPiFpepg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:58296 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 1vvWw7-000000007cL-0xin; Thu, 26 Feb 2026 08:41:31 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1vvWw6-0000000AtK4-20vx; Thu, 26 Feb 2026 08:41:30 +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 2/8] phy: qcom-sgmii-eth: add .set_mode() and .validate() methods MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Thu, 26 Feb 2026 08:41:30 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260226_004136_959491_09963E3E X-CRM114-Status: GOOD ( 13.78 ) 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 qcom-sgmii-eth is an Ethernet SerDes supporting only Ethernet mode using SGMII, 1000BASE-X and 2500BASE-X. Add an implementation of the .set_mode() method, which can be used instead of or as well as the .set_speed() method. The Ethernet interface modes mentioned above all have a fixed data rate, so setting the mode is sufficient to fully specify the operating parameters. Add an implementation of the .validate() method, which will be necessary to allow discovery of the SerDes capabilities for platform independent SerDes support in the stmmac network driver. Reviewed-by: Vladimir Oltean Reviewed-by: Bartosz Golaszewski Acked-by: Vinod Koul Tested-by: Mohd Ayaan Anwar Signed-off-by: Russell King (Oracle) --- drivers/phy/qualcomm/phy-qcom-sgmii-eth.c | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c b/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c index 5b1c82459c12..4ea3dce7719f 100644 --- a/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c +++ b/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -286,6 +287,37 @@ static int qcom_dwmac_sgmii_phy_power_off(struct phy *phy) return 0; } +static int qcom_dwmac_sgmii_phy_speed(enum phy_mode mode, int submode) +{ + if (mode != PHY_MODE_ETHERNET) + return -EINVAL; + + if (submode == PHY_INTERFACE_MODE_SGMII || + submode == PHY_INTERFACE_MODE_1000BASEX) + return SPEED_1000; + + if (submode == PHY_INTERFACE_MODE_2500BASEX) + return SPEED_2500; + + return -EINVAL; +} + +static int qcom_dwmac_sgmii_phy_set_mode(struct phy *phy, enum phy_mode mode, + int submode) +{ + struct qcom_dwmac_sgmii_phy_data *data = phy_get_drvdata(phy); + int speed; + + speed = qcom_dwmac_sgmii_phy_speed(mode, submode); + if (speed < 0) + return speed; + + if (speed != data->speed) + data->speed = speed; + + return qcom_dwmac_sgmii_phy_calibrate(phy); +} + static int qcom_dwmac_sgmii_phy_set_speed(struct phy *phy, int speed) { struct qcom_dwmac_sgmii_phy_data *data = phy_get_drvdata(phy); @@ -296,10 +328,21 @@ static int qcom_dwmac_sgmii_phy_set_speed(struct phy *phy, int speed) return qcom_dwmac_sgmii_phy_calibrate(phy); } +static int qcom_dwmac_sgmii_phy_validate(struct phy *phy, enum phy_mode mode, + int submode, + union phy_configure_opts *opts) +{ + int ret = qcom_dwmac_sgmii_phy_speed(mode, submode); + + return ret < 0 ? ret : 0; +} + static const struct phy_ops qcom_dwmac_sgmii_phy_ops = { .power_on = qcom_dwmac_sgmii_phy_power_on, .power_off = qcom_dwmac_sgmii_phy_power_off, + .set_mode = qcom_dwmac_sgmii_phy_set_mode, .set_speed = qcom_dwmac_sgmii_phy_set_speed, + .validate = qcom_dwmac_sgmii_phy_validate, .calibrate = qcom_dwmac_sgmii_phy_calibrate, .owner = THIS_MODULE, }; -- 2.47.3 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy