From patchwork Tue Nov 26 12:52:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13885878 X-Patchwork-Delegate: kuba@kernel.org 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 7BCA21CDFBE for ; Tue, 26 Nov 2024 12:53:04 +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=1732625586; cv=none; b=dr7MKcf0mc1+NMTcrKQ4fF4zWaGzkTDpN6NQx/8jMkfSXoi1NyxiE7Swdf33wC/FC5FlIyH+W+lkvivPo/z+ahqLYu5pzrB6yPrZVJ/V2ZA1Ihckd7QkWQlz9qJoeCuqB/IIPD4puCRNuQsI13frSI7Et7hRCGyoRn9aomWK6DQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732625586; c=relaxed/simple; bh=eOGjb4z8bBAVrceWQSPTeUb+5qhCMV3JA8jkHpITAO8=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=grFyP+NiA9FbaGMEgJo2p4kkLMCDp5W0vneM5rYW4iH+D6Z8WumK3XlUS6QVNrP8m1A9kWW+J+HrhoBEQ50b9YHN0Uz+0P2QmdliD5lkhX+HxcoBw/5r71M8GUK2g7IxsTqZrJu/iMWZwpynM1zhjREgNQkED9GnCaFYvz5DOgM= 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=lZLC1NwU; 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="lZLC1NwU" 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=j/WHhBv4xxgr6XWS8+/JmuNDDhZZJPZcPHo5FRq2Fs4=; b=lZLC1NwUbkqrR8bgsgVE5vp7I/ NAaHMrqMiAwDBnW/NxnO4o5QAw7BX8eMrRjJdtrlsWF/CMsRlqKcuOe4d5ONdci5t7OtXgAgapVGL LqnydNucmVhx/5HQqIhiS06tBbkxj0p7YknOvpUE/nHESEFDFAe/GbzMuKS/z2WfDjkKJ5oA7X54k GWeK1R7uN3L5lFRnLrFw6EOtStGvtx9LUJp6gw7y6e2BwPriS0ELL1a3jp0G2QfZyO4anw3AqiidI 6IHhrKM8cU+dR6fPtCjOH4u6vMXms8fvl3yjkAXk7Xj9vAhcoWW3gBDQcM9+8o/IN7HGbrvTrKC3z EZguWCZQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:58812 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.96) (envelope-from ) id 1tFv3l-0006tc-1C; Tue, 26 Nov 2024 12:52:53 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tFv3j-005yi3-W2; Tue, 26 Nov 2024 12:52:52 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , Bryan Whitehead , "David S. Miller" , Eric Dumazet , Florian Fainelli , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Marcin Wojtas , Maxime Coquelin , netdev@vger.kernel.org, Oleksij Rempel , Paolo Abeni , UNGLinuxDriver@microchip.com Subject: [PATCH RFC net-next 08/23] net: phy: add support for querying PHY clock stop capability Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 26 Nov 2024 12:52:51 +0000 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Add support for querying whether the PHY allows the transmit xMII clock to be stopped while in LPI mode. This will be used by phylink to pass to the MAC driver so it can configure the generation of the xMII clock appropriately. Signed-off-by: Russell King (Oracle) --- drivers/net/phy/phy.c | 20 ++++++++++++++++++++ include/linux/phy.h | 1 + 2 files changed, 21 insertions(+) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 8caef54a60e0..21e0fc9a6f09 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1587,6 +1587,26 @@ void phy_mac_interrupt(struct phy_device *phydev) } EXPORT_SYMBOL(phy_mac_interrupt); +/** + * phy_eee_tx_clock_stop_capable() - indicate whether the MAC can stop tx clock + * @phydev: target phy_device struct + * + * Indicate whether the MAC can disable the transmit xMII clock while in LPI + * state. Returns 1 if the MAC may stop the transmit clock, 0 if the MAC must + * not stop the transmit clock, or negative error. + */ +int phy_eee_tx_clock_stop_capable(struct phy_device *phydev) +{ + int stat1; + + stat1 = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_STAT1); + if (stat1 < 0) + return stat1; + + return !!(stat1 & MDIO_PCS_STAT1_CLKSTOP_CAP); +} +EXPORT_SYMBOL_GPL(phy_eee_tx_clock_stop_capable); + /** * phy_init_eee - init and check the EEE feature * @phydev: target phy_device struct diff --git a/include/linux/phy.h b/include/linux/phy.h index 09a47116994c..d0491cdf54b6 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -2038,6 +2038,7 @@ int phy_unregister_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask); int phy_unregister_fixup_for_id(const char *bus_id); int phy_unregister_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask); +int phy_eee_tx_clock_stop_capable(struct phy_device *phydev); int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable); int phy_get_eee_err(struct phy_device *phydev); int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_keee *data);