From patchwork Mon Feb 10 10:53:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13967669 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 E9F041D515B for ; Mon, 10 Feb 2025 10:54:05 +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=1739184847; cv=none; b=VWMcbb1LR43pbMU5AFXi8Zb5OUMLCzsP/HraV5MHQeyuL6kkkSsugc5VJhaap83G48bPS2t+2LVvVC08OOO0ZT5g0L08NMfVlblmW+hX9nyWdIsxstpFy0goz3NEMjJKzrkTyuVqksGprOafsSFdpyIuTdQj+CA2UVLDG2FUNs4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739184847; c=relaxed/simple; bh=9zcrminkBJIkeIfYSeCwqEcLknqlz9U9BpYU/7WSVb0=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=phFLw6I5qKnPUPGzZFR8rdPkQzXhkpLnMDFBDIJKndbl8aevWBvROWECOQRwXhd9V6gNoKPcdoPZDycx8bP2bxIhdM4vpxbXNpvg/t+YUKlCMwGNiIG4JOioIpifEh+CsZ2wbtHICvqDIvw//ez5nE2BuJuCNjZPoE8tDNKKtM0= 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=NVZVOAu2; 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="NVZVOAu2" 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=jXHt/5Eoh9udL8jpygkO/9L3xb0nJ0bR2NLfWApVjKY=; b=NVZVOAu2F9GcCHcf1iMmevJYjg WdIrjH+xP2XlUDw09zzNfDeDwrhDBRLqlF7S+W8Xmh45KGtGBfuh78xPEK4Y5c1Mu/yJPy+7Vs+2i Uy3fGcrQd7cw/EKG4MuFOc1qtll0mE+BrIdMgi4T9oCBeY9L/tFF3j2TY6eu+UxPnu7XDoBZPBvGA Ui/8fckvxZ6yqiFtCyR6sPWZv+Tj/jmmJc2f+xVMtCpzdlHA+Hu7WHpOBakqfcrBWcKX/ke9uLrNQ mepMtKSiQAFAOEdVXZKrEXPQ00+SupQahwrwoH2JnKuho+DCnsIUb9xHHf1P7gSW90vsOeJkslyz5 ciOefFzg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:52020 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 1thRQN-0006VJ-1J; Mon, 10 Feb 2025 10:53:59 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1thRQ3-003w6u-RH; Mon, 10 Feb 2025 10:53:39 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next 1/8] net: phylink: add support for notifying PCS about EEE 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: Mon, 10 Feb 2025 10:53:39 +0000 X-Patchwork-Delegate: kuba@kernel.org There are hooks in the stmmac driver into XPCS to control the EEE settings when LPI is configured at the MAC. This bypasses the layering. To allow this to be removed from the stmmac driver, add two new methods for PCS to inform them when the LPI/EEE enablement state changes at the MAC. Signed-off-by: Russell King (Oracle) --- drivers/net/phy/phylink.c | 25 ++++++++++++++++++++++--- include/linux/phylink.h | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 214b62fba991..840af19488d8 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1073,6 +1073,18 @@ static void phylink_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, pcs->ops->pcs_link_up(pcs, neg_mode, interface, speed, duplex); } +static void phylink_pcs_disable_eee(struct phylink_pcs *pcs) +{ + if (pcs && pcs->ops->pcs_disable_eee) + pcs->ops->pcs_disable_eee(pcs); +} + +static void phylink_pcs_enable_eee(struct phylink_pcs *pcs) +{ + if (pcs && pcs->ops->pcs_enable_eee) + pcs->ops->pcs_enable_eee(pcs); +} + /* Query inband for a specific interface mode, asking the MAC for the * PCS which will be used to handle the interface mode. */ @@ -1601,6 +1613,8 @@ static void phylink_deactivate_lpi(struct phylink *pl) phylink_dbg(pl, "disabling LPI\n"); pl->mac_ops->mac_disable_tx_lpi(pl->config); + + phylink_pcs_disable_eee(pl->pcs); } } @@ -1617,13 +1631,18 @@ static void phylink_activate_lpi(struct phylink *pl) phylink_dbg(pl, "LPI timer %uus, tx clock stop %u\n", pl->mac_tx_lpi_timer, pl->mac_tx_clk_stop); + phylink_pcs_enable_eee(pl->pcs); + err = pl->mac_ops->mac_enable_tx_lpi(pl->config, pl->mac_tx_lpi_timer, pl->mac_tx_clk_stop); - if (!err) - pl->mac_enable_tx_lpi = true; - else + if (err) { + phylink_pcs_disable_eee(pl->pcs); phylink_err(pl, "%ps() failed: %pe\n", pl->mac_ops->mac_enable_tx_lpi, ERR_PTR(err)); + return; + } + + pl->mac_enable_tx_lpi = true; } static void phylink_link_up(struct phylink *pl, diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 898b00451bbf..a692d638568f 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -477,6 +477,10 @@ struct phylink_pcs { * @pcs_an_restart: restart 802.3z BaseX autonegotiation. * @pcs_link_up: program the PCS for the resolved link configuration * (where necessary). + * @pcs_disable_eee: optional notification to PCS that EEE has been disabled + * at the MAC. + * @pcs_enable_eee: optional notification to PCS that EEE will be enabled at + * the MAC. * @pcs_pre_init: configure PCS components necessary for MAC hardware * initialization e.g. RX clock for stmmac. */ @@ -500,6 +504,8 @@ struct phylink_pcs_ops { void (*pcs_an_restart)(struct phylink_pcs *pcs); void (*pcs_link_up)(struct phylink_pcs *pcs, unsigned int neg_mode, phy_interface_t interface, int speed, int duplex); + void (*pcs_disable_eee)(struct phylink_pcs *pcs); + void (*pcs_enable_eee)(struct phylink_pcs *pcs); int (*pcs_pre_init)(struct phylink_pcs *pcs); }; @@ -625,6 +631,22 @@ void pcs_an_restart(struct phylink_pcs *pcs); void pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, phy_interface_t interface, int speed, int duplex); +/** + * pcs_disable_eee() - Disable EEE at the PCS + * @pcs: a pointer to a &struct phylink_pcs + * + * Optional method informing the PCS that EEE has been disabled at the MAC. + */ +void pcs_disable_eee(struct phylink_pcs *pcs); + +/** + * pcs_enable_eee() - Enable EEE at the PCS + * @pcs: a pointer to a &struct phylink_pcs + * + * Optional method informing the PCS that EEE is about to be enabled at the MAC. + */ +void pcs_enable_eee(struct phylink_pcs *pcs); + /** * pcs_pre_init() - Configure PCS components necessary for MAC initialization * @pcs: a pointer to a &struct phylink_pcs. From patchwork Mon Feb 10 10:53:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13967670 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 808ED1DED72 for ; Mon, 10 Feb 2025 10:54:11 +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=1739184853; cv=none; b=prGEOnoif8UTkQmmBLpQEZT+QE1a2bRjkyFBDO/J2fNWBNQkK7zHpP4n2Uj1a4HPMa0t/rWnCXGJfqtlAcdC7sQS9s6MPeZAfhGuVe1sVQzc6XQm33UR2njDrvvlMVey/iwRlsS9oJCvMF4XkT/Ggb+GbtwM/5aQ1Q6JkL/maao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739184853; c=relaxed/simple; bh=0VvPI/xcOP3dSr66kt38THT0vszHfpHXRt6d6Ak+ztI=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=TwVscphNstkXTiXPMofxCWzw3BQHfFbibQzUXIwSJ01y4b8NU28ThZSgq3HB2ZOLrY4IQo7HLiMsswDWfOihL6rNyif2r09GkQFZntVJmY8aQ24TqZxi3vKZbSixXc5efpg6G7gLV/PBnkBGLcIdNKqHc3AN3cd3POLd3kJ94Es= 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=hNMs4234; 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="hNMs4234" 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=03AhbylEG7HNdpH6NjqbpJVFcId319ILq77ziepvCyQ=; b=hNMs4234mNpFZh5NoXhDRhs4dx dMG7sdhgggFOSffYCVrZ0cOgQyPLN2FGSGJ+bkHbbbWat8JuzbGz0KTVdmRhaTqANZKY9Z6BcyiEZ eYEq7NBx47P1UbM6hy07Sxr3iO+LvgVq1uJCMJ6L2xXMUlm5jPdaX7bHi3FR/klHg1+x9KPoDrYN/ lFoDkOhjn6XCpAC1Pb6xvGOnkQ6QB3coTrZiFrgnJtPnKS9ucSFEUTj2pCtQy/t51XgDUshshOj0r j3fnoRQJ1YhWzkquGHXdL5cn9RU1ZG8ohTeC3ME6FaqGhuw8OjxeuHLZAt3z+J2c8xLYTzfONFc2Q wtQ2hW1g==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:38704 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 1thRQS-0006VW-22; Mon, 10 Feb 2025 10:54:04 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1thRQ8-003w70-VT; Mon, 10 Feb 2025 10:53:45 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next 2/8] net: xpcs: add function to configure EEE clock multiplying factor 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: Mon, 10 Feb 2025 10:53:44 +0000 X-Patchwork-Delegate: kuba@kernel.org Add a function to separate out the EEE clock multiplying factor. This will be called by the stmmac driver to configure this value. It would have been better had the driver used the CLK API to retrieve this clock, get its rate and calculate the appropriate multiplier, but that door has closed. Signed-off-by: Russell King (Oracle) --- drivers/net/pcs/pcs-xpcs.c | 14 ++++++++++++++ drivers/net/pcs/pcs-xpcs.h | 1 + include/linux/pcs/pcs-xpcs.h | 1 + 3 files changed, 16 insertions(+) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 1faa37f0e7b9..91ce4b13df32 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -1193,6 +1193,20 @@ static void xpcs_an_restart(struct phylink_pcs *pcs) BMCR_ANRESTART); } +/** + * xpcs_config_eee_mult_fact() - set the EEE clock multiplying factor + * @xpcs: pointer to a &struct dw_xpcs instance + * @mult_fact: the multiplying factor + * + * Configure the EEE clock multiplying factor. This value should be such that + * clk_eee_time_period * (mult_fact + 1) is within the range 80 to 120ns. + */ +void xpcs_config_eee_mult_fact(struct dw_xpcs *xpcs, u8 mult_fact) +{ + xpcs->eee_mult_fact = mult_fact; +} +EXPORT_SYMBOL_GPL(xpcs_config_eee_mult_fact); + static int xpcs_read_ids(struct dw_xpcs *xpcs) { int ret; diff --git a/drivers/net/pcs/pcs-xpcs.h b/drivers/net/pcs/pcs-xpcs.h index adc5a0b3c883..39d3f517b557 100644 --- a/drivers/net/pcs/pcs-xpcs.h +++ b/drivers/net/pcs/pcs-xpcs.h @@ -122,6 +122,7 @@ struct dw_xpcs { struct phylink_pcs pcs; phy_interface_t interface; bool need_reset; + u8 eee_mult_fact; }; int xpcs_read(struct dw_xpcs *xpcs, int dev, u32 reg); diff --git a/include/linux/pcs/pcs-xpcs.h b/include/linux/pcs/pcs-xpcs.h index 733f4ddd2ef1..749d40a9a086 100644 --- a/include/linux/pcs/pcs-xpcs.h +++ b/include/linux/pcs/pcs-xpcs.h @@ -52,6 +52,7 @@ struct phylink_pcs *xpcs_to_phylink_pcs(struct dw_xpcs *xpcs); int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface); int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable); +void xpcs_config_eee_mult_fact(struct dw_xpcs *xpcs, u8 mult_fact); struct dw_xpcs *xpcs_create_mdiodev(struct mii_bus *bus, int addr); struct dw_xpcs *xpcs_create_fwnode(struct fwnode_handle *fwnode); void xpcs_destroy(struct dw_xpcs *xpcs); From patchwork Mon Feb 10 10:53:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13967671 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 46C851E3DC4 for ; Mon, 10 Feb 2025 10:54:16 +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=1739184859; cv=none; b=WMk8jqgldSGBKiFNWk0ni9WmZdUcsiGA1Bh+qg4TjOAPNMC+7u1fNY3tFhqEnATKSLPnT5yw2ji0EwXjFaBC+C8u5krq4WdRno9ulh8AJzFoUyqr7t+GEinnQZAF4NB/MzJ/CPgmzthxaC4Mbx27KfOyU0+JyLiV+rtuC5lSxeQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739184859; c=relaxed/simple; bh=Sn/MEUMsk2TVTj/tfMTfKw4YYi1N2qB0G/JoTzTjh4c=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=CA58qKPdM6DoOqlUpiRCRu0rRXS03Mm8rL1GT9YbLtGX644yc7SKxQ2TC5HPfd59nWNP2oZpdqiIBoMDPVDrRT8Jn0hHBbjo9b1EqUvZbvQJJKpedbAyYr/x/t4HNaw1UGFQs9eEUYY8n2XwF4TGv6Y84BVjGJKJcWOUnz3qAQo= 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=vX4SdZRc; 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="vX4SdZRc" 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=EBcD+jSZTJ87ExoztZaJ1Ni32E6UJjFerwHmJRvv+KY=; b=vX4SdZRckIpwiVehwiL8ayoJTf /wu+ImWEw1MIIAPDc3l8gpGEDDvSHXQMrQiCBcSE65z2n5aX9VFPmPmWnHC0L4y7lHpTdevhGy+uF rZJ+0IcccngHq9natEFmM0OHZ9AKwV6UHGUz+CHTJyEkyGU79LQTNuhaK5HBzQDEw0q19qDH79zgG mpTElpQJYb3rJPXNF0+km3/40VhfwqOcEQy6a3/yxvt1Pt0LYWWSW9U0TvqqoL9GJywVUf40heH02 2Q1rGoPC13mOhgOvlaXB8jg1rEtcituBs3CL332oSVbD6eCPnkzxjrWVMGUbaRtlyhH0rewGeZKoJ iuORQECA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:38714 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 1thRQX-0006Vm-28; Mon, 10 Feb 2025 10:54:09 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1thRQE-003w76-3C; Mon, 10 Feb 2025 10:53:50 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next 3/8] net: stmmac: call xpcs_config_eee_mult_fact() 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: Mon, 10 Feb 2025 10:53:50 +0000 X-Patchwork-Delegate: kuba@kernel.org Arrange for stmmac to call the new xpcs_config_eee_mult_fact() function to configure the EEE clock multiplying factor. This will allow the removal of the xpcs_config_eee() calls in the next patch. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 0c7d81ddd440..7c0a4046bbe3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -524,6 +524,8 @@ int stmmac_pcs_setup(struct net_device *ndev) if (ret) return dev_err_probe(priv->device, ret, "No xPCS found\n"); + xpcs_config_eee_mult_fact(xpcs, priv->plat->mult_fact_100ns); + priv->hw->xpcs = xpcs; return 0; From patchwork Mon Feb 10 10:53:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13967672 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 E18B21DF26B for ; Mon, 10 Feb 2025 10:54:21 +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=1739184863; cv=none; b=u5+PDyxVU59Qi0RybS+xjwmBUmdXN3QfKtt/VUWMjg58UNFG7thCmgc0ztNFHeBGkPfhy72XTqnvWpt+0djJDBakdgp3z+LO3WpofFFLHNLJ7EgPN2OugZY5ORAiq1KEfCCEtlbryp/u1cxWrfRbrXzlD6Py7yVBMaxtCeF9pDA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739184863; c=relaxed/simple; bh=vXR39ghh4tWgswm+U72ok9hQIyWzqcGr1WmyeNh0KtU=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=atFXMQveF553kYePcVKhl0zC3xdPjCcXPxxtu8bhp7GTvLoMUCmR4zQhZVhrOpvFPwtLhII0aEqCgC9m0oEdUVegCW+Kk1nFmY4mOxlqxPPcYkIXqaWF+mrdGQLAVwZkHDbwLeQz8lKrJB5uhxGtHGy2HqFBcJfsjhVSLD9lafo= 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=JpAZyLck; 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="JpAZyLck" 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=yWW2R/eIUnaCG5KFk31L8+3OD/t74tjs9HU32ej/AvQ=; b=JpAZyLckK548hoeVwBF637KIyj ZHNJdPHoLPSWjAQ17dcGbDtJQNXg66p8AiEl/kNpGYWNSV8bCzELstrBL+qvPTDe4neSMi5lkJkFA 1q/TQHJnu/Jq1FhLrr+6vSlfC3R1bJNc0GFwx2+O6i7nn4cEvc2Bdw+UalqjbWBcrJshViwaiNJ3o fEUlDh4rCgDccBBUXNKjzEBWPDSOpjQ0LJkpi6a3BpSpb5hgTT1K6BbgbVeKFaKznsIsjcutxRHw0 wfomRmbwW8G/XnqWl7wIECWS0/lWes2CZ+tAF39DmR3OUAw2qEbXWljx6RkcobSjU3l39PlYPkf6s 0IV47JOg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:48426 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 1thRQc-0006W1-2U; Mon, 10 Feb 2025 10:54:14 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1thRQJ-003w7C-6v; Mon, 10 Feb 2025 10:53:55 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next 4/8] net: xpcs: convert to phylink managed EEE 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: Mon, 10 Feb 2025 10:53:55 +0000 X-Patchwork-Delegate: kuba@kernel.org Convert XPCS to use the new pcs_disable_eee() and pcs_enable_eee() methods. Since stmmac is the only user of xpcs_config_eee(), we can make this a no-op along with this change. Signed-off-by: Russell King (Oracle) --- drivers/net/pcs/pcs-xpcs.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 91ce4b13df32..1f312b5589a3 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -602,7 +602,8 @@ static void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces) __set_bit(compat->interface, interfaces); } -int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable) +static int __xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, + int enable) { u16 mask, val; int ret; @@ -630,6 +631,11 @@ int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable) DW_VR_MII_EEE_TRN_LPI, enable ? DW_VR_MII_EEE_TRN_LPI : 0); } + +int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable) +{ + return 0; +} EXPORT_SYMBOL_GPL(xpcs_config_eee); static void xpcs_pre_config(struct phylink_pcs *pcs, phy_interface_t interface) @@ -1193,6 +1199,20 @@ static void xpcs_an_restart(struct phylink_pcs *pcs) BMCR_ANRESTART); } +static void xpcs_disable_eee(struct phylink_pcs *pcs) +{ + struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs); + + __xpcs_config_eee(xpcs, 0, false); +} + +static void xpcs_enable_eee(struct phylink_pcs *pcs) +{ + struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs); + + __xpcs_config_eee(xpcs, xpcs->eee_mult_fact, true); +} + /** * xpcs_config_eee_mult_fact() - set the EEE clock multiplying factor * @xpcs: pointer to a &struct dw_xpcs instance @@ -1355,6 +1375,8 @@ static const struct phylink_pcs_ops xpcs_phylink_ops = { .pcs_get_state = xpcs_get_state, .pcs_an_restart = xpcs_an_restart, .pcs_link_up = xpcs_link_up, + .pcs_disable_eee = xpcs_disable_eee, + .pcs_enable_eee = xpcs_enable_eee, }; static int xpcs_identify(struct dw_xpcs *xpcs) From patchwork Mon Feb 10 10:54:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13967673 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 7C0CA1DFE18 for ; Mon, 10 Feb 2025 10:54:26 +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=1739184868; cv=none; b=Yx3vYte6GI6C2dXW68BmoHV0NQLijJyjPhDp4VfTLCxttoBwy4MZ2bw2zjkJx+IrdOz+5Gs+ozrX2W0jHbQ3ma+t/F9+sAwJZGkPBZFvkymH6ZT7POgTsP+lHiGmhvu+CtVW8KdS6jp77KfKLhsdeqZPtzPUUFVW0uiHRn5uAlc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739184868; c=relaxed/simple; bh=50LzgtK24bUtzJoh7LuTX6+iUSXjSrkKf94Nub1yn3g=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=C76wljn431vlHjllvRrTVQDShty51ZVzBg/W9oEe3dgQDzOEmDITzCwE/x8V86nSJqQTaRseK+N6fXnXQCeB9k+ig+x2KltzqVZIfdMXj3AWtC6y4W45e1Te7EJEeW5sXX4+KkaAgOShLKIBa3yGIByn8JN59AdOt+fTBZWkpdE= 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=TYpTedd2; 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="TYpTedd2" 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=ELqbi+gpufx0/yKmKxb0he5MB5h1Oc7NMvQUCKuJaVA=; b=TYpTedd21CZ6jBLg3V5dD3+HSa qgu4+FBV/vgxPPur1vSkX1Vmo2eu8ptRqW5mwdO+GP6n5IhFvghpxxjWSEFS+w0es/Qqb0sXYdCLm Zew+RYmfT2V2TaDZRH70rmfJfUS+Mx81MdaMbLAcbZ1j30NDuiYFgKVtewgYcP0OgumxhLM31d969 osBtwEfS9Gp9XTtbNlyg/wPySSF3PBOyGP/0PIFoVvONn9wHJE9Ma01QfrODPvkafqk13rjBDkXzi MDW38i5QlrFUClG+j+7PMGO+9i5RVXil0uyoMWextRWyPOReuA1yIO6E90BtnqZo1Dvv0G+nqSent zbCTJt2Q==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:48442 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 1thRQh-0006WH-37; Mon, 10 Feb 2025 10:54:20 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1thRQO-003w7I-Ap; Mon, 10 Feb 2025 10:54:00 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next 5/8] net: stmmac: remove calls to xpcs_config_eee() 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: Mon, 10 Feb 2025 10:54:00 +0000 X-Patchwork-Delegate: kuba@kernel.org Remove the explicit calls to xpcs_config_eee() from the stmmac driver, preferring instead for phylink to manage the EEE configuration at the PCS. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 3b77597ada52..526df6fd732b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1046,10 +1046,6 @@ static void stmmac_mac_disable_tx_lpi(struct phylink_config *config) priv->tx_path_in_lpi_mode = false; stmmac_set_eee_timer(priv, priv->hw, 0, STMMAC_DEFAULT_TWT_LS); - if (priv->hw->xpcs) - xpcs_config_eee(priv->hw->xpcs, priv->plat->mult_fact_100ns, - false); - mutex_unlock(&priv->lock); } @@ -1068,9 +1064,6 @@ static int stmmac_mac_enable_tx_lpi(struct phylink_config *config, u32 timer, stmmac_set_eee_timer(priv, priv->hw, STMMAC_DEFAULT_LIT_LS, STMMAC_DEFAULT_TWT_LS); - if (priv->hw->xpcs) - xpcs_config_eee(priv->hw->xpcs, priv->plat->mult_fact_100ns, - true); /* Try to cnfigure the hardware timer. */ ret = stmmac_set_lpi_mode(priv, priv->hw, STMMAC_LPI_TIMER, From patchwork Mon Feb 10 10:54:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13967675 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 6A91C1DFE18 for ; Mon, 10 Feb 2025 10:54: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=1739184873; cv=none; b=ZIzb0T1hR7r3EVY/LC+H3AElyH4dRbukDBHyWmuP/NrEYCdCbQ5WPt04UkKQNBU+t1Ntks5lBF2hVGcoy5LQaUM/x7iEPlqeWMYqGDpg920nZuHI2sJXwZHdCZ9CMxOFI5VuRbL9kkoxNMN3xja4xOVL6Ns+shnUnt6Op0V2pd4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739184873; c=relaxed/simple; bh=1BHe094AG80R20DlfxTgsAkD26DnDmTqKqyftUdquZY=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=lq8/4a9urPx+pmu1VNoBU/oezP16ZTz/VQY5Cc0ptiBG4LQ7i8h2mT8mZYrLoAkhdQZdgNeUUcO4IViGFhvViTDTPq0upnik2ggdF/xXNZrKyWdK9POm60IO+SFvc+19d0uxCLdGgk63Evx5ifFJvQ2wtlMWe3DtdvbM8L7l/rg= 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=rWdK/lS7; 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="rWdK/lS7" 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=6rfnXHnjbMDiB1789GYEEadHIP4lGhQCiXiqIwLjLMI=; b=rWdK/lS7AVCPrMFjgiWGWpmLq9 HO7u3jx9D7Ucee/3UFZDywpNb+HquCfNRFXfPU2MpL2l8Jeqv3SY399efN5K7/rtgjFdytLGkW8Rg ppfNcjxzPup11DSdviXH/b/03Av/ftjgxxL9AJJRzXqXfs1nTII9GHa0+tRUb/yg/dG8nlaxPzgzb FFIFFrNuiJrqJmfwWNAKeHZclK3vqTr/I+qk2tVpKeUKYtofaH/p15bXqyRigpKTef+jRxFAzxzHU U+Y1XWcCQ4PvOyChqdQCq0u/P53g1QNAwVYdC5pwb7A+2ONeDv3kWPfdHf1bjUve0h72UYZjNqsiu 3Ai4mYEg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:52128 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 1thRQm-0006WZ-3A; Mon, 10 Feb 2025 10:54:25 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1thRQT-003w7O-Ec; Mon, 10 Feb 2025 10:54:05 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next 6/8] net: xpcs: remove xpcs_config_eee() from global scope 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: Mon, 10 Feb 2025 10:54:05 +0000 X-Patchwork-Delegate: kuba@kernel.org Make xpcs_config_eee() private to the XPCS driver, called only from the phylink pcs_disable_eee() and pcs_enable_eee() methods. Signed-off-by: Russell King (Oracle) --- drivers/net/pcs/pcs-xpcs.c | 14 ++++---------- include/linux/pcs/pcs-xpcs.h | 2 -- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 1f312b5589a3..6a28a4eae21c 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -602,8 +602,8 @@ static void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces) __set_bit(compat->interface, interfaces); } -static int __xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, - int enable) +static int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, + int enable) { u16 mask, val; int ret; @@ -632,12 +632,6 @@ static int __xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, enable ? DW_VR_MII_EEE_TRN_LPI : 0); } -int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable) -{ - return 0; -} -EXPORT_SYMBOL_GPL(xpcs_config_eee); - static void xpcs_pre_config(struct phylink_pcs *pcs, phy_interface_t interface) { struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs); @@ -1203,14 +1197,14 @@ static void xpcs_disable_eee(struct phylink_pcs *pcs) { struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs); - __xpcs_config_eee(xpcs, 0, false); + xpcs_config_eee(xpcs, 0, false); } static void xpcs_enable_eee(struct phylink_pcs *pcs) { struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs); - __xpcs_config_eee(xpcs, xpcs->eee_mult_fact, true); + xpcs_config_eee(xpcs, xpcs->eee_mult_fact, true); } /** diff --git a/include/linux/pcs/pcs-xpcs.h b/include/linux/pcs/pcs-xpcs.h index 749d40a9a086..e40f554ff717 100644 --- a/include/linux/pcs/pcs-xpcs.h +++ b/include/linux/pcs/pcs-xpcs.h @@ -50,8 +50,6 @@ struct dw_xpcs; struct phylink_pcs *xpcs_to_phylink_pcs(struct dw_xpcs *xpcs); int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface); -int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, - int enable); void xpcs_config_eee_mult_fact(struct dw_xpcs *xpcs, u8 mult_fact); struct dw_xpcs *xpcs_create_mdiodev(struct mii_bus *bus, int addr); struct dw_xpcs *xpcs_create_fwnode(struct fwnode_handle *fwnode); From patchwork Mon Feb 10 10:54:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13967676 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 0333A1E412A for ; Mon, 10 Feb 2025 10:54:36 +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=1739184879; cv=none; b=MkvJw8K8uQXbNoXC5EKhK33Dm3JC5Ude+GCN2BHg+7pNHtagbq8VqqS2kIc30jjVOyqdAXfkPPH2QotCxE0/CuN023qTsJpOgc7wF0R9yox9pzyHTDzkldqBzXWbLlhhK2Q680LmanlP+1h6obuK3bUQmcK980XL2rlhuadIbS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739184879; c=relaxed/simple; bh=nbgxpj0FpG6244JGxtTAv08/AJLwWyI+yts9EPSfmo4=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=T8VAHIsC4AMm510+X8T4+zpkSL7kSRmRTdsTj7cyYVoyXui4xpZxOACFxjc5x4yaTo3VaSbNRSvJAmq4+uYkOjeqTX+OkahpGS2eN2MLPI1B+RMOg+jpjFob+7rmno6WzElcysH/fantgHl4QwI3lOUP0L/2goKfkad2ohoeurQ= 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=IIPUEr4L; 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="IIPUEr4L" 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=QjfjNKm/xo2FxoguYUayqpH53OkqmwqZ6YW5PTiaRAA=; b=IIPUEr4L3IgtOhBNXZtGenJJVI eQo3OKeAEn1hUThqzRoxL8uBoQ2liFLUK4UIbUAwf2g0KyZSp62IYr8glaGYynSZgqi1K+SgJB/b9 jc8R95hLyNCtGLjmJTaR7xnldCBI4WWT7dPVYg/rFIsKbJ3sHfBewzHwle4vFNxwtzoTr/395NY84 5rNBxjc0WtzHIqOvG8qTBUkvzoYR4b7GhfzR2Vc8MEgmgZze10S8e8m3wJslEgSD/t2C37mSlNczy dNgTXuht0j4ELoIH+We2ggRMKwikDQ7QvVrz83qMHICSHPKWbTubvfFRdLemtDGqjSjE0RyeEKcyc ZHVsLThA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:52130 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 1thRQs-0006Wp-0W; Mon, 10 Feb 2025 10:54:30 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1thRQY-003w7U-IG; Mon, 10 Feb 2025 10:54:10 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next 7/8] net: xpcs: clean up xpcs_config_eee() 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: Mon, 10 Feb 2025 10:54:10 +0000 X-Patchwork-Delegate: kuba@kernel.org There is now no need to pass the mult_fact into xpcs_config_eee(), so let's remove that argument and use xpcs->eee_mult_fact directly. While changing the function signature, as we pass true/false for enable, use "bool" instead of "int" for this. Signed-off-by: Russell King (Oracle) --- drivers/net/pcs/pcs-xpcs.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 6a28a4eae21c..cae6e8377191 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -602,8 +602,7 @@ static void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces) __set_bit(compat->interface, interfaces); } -static int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, - int enable) +static int xpcs_config_eee(struct dw_xpcs *xpcs, bool enable) { u16 mask, val; int ret; @@ -618,7 +617,7 @@ static int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, DW_VR_MII_EEE_TX_QUIET_EN | DW_VR_MII_EEE_RX_QUIET_EN | DW_VR_MII_EEE_TX_EN_CTRL | DW_VR_MII_EEE_RX_EN_CTRL | FIELD_PREP(DW_VR_MII_EEE_MULT_FACT_100NS, - mult_fact_100ns); + xpcs->eee_mult_fact); else val = 0; @@ -1197,14 +1196,14 @@ static void xpcs_disable_eee(struct phylink_pcs *pcs) { struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs); - xpcs_config_eee(xpcs, 0, false); + xpcs_config_eee(xpcs, false); } static void xpcs_enable_eee(struct phylink_pcs *pcs) { struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs); - xpcs_config_eee(xpcs, xpcs->eee_mult_fact, true); + xpcs_config_eee(xpcs, true); } /** From patchwork Mon Feb 10 10:54:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13967677 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 1E81C1E5702 for ; Mon, 10 Feb 2025 10:54:41 +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=1739184884; cv=none; b=B+LbvpAakLVLWpOKh5oyWAbY33MBLEqTW9DIhmduCmMH6GBXXTtErk47bRU/ALOMj/oeHPvgeHkum4PCQ7fGM6vIG9V0nvmcx33ubBEHcm8dC7pgs1CsRNsKBuEYxZMFEWaYO9QNIwhCXJvhrQeg4sSj/CsqHDTQ6k+yozdQVSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739184884; c=relaxed/simple; bh=sTuYXbySmbjcVjNbfEfYlCDFF9wIlooim/PWT8qCq6Y=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=VR+4rwwApFDWttPhNw+RqY13OUSYl6Emsdc63UB+Jp74pL+oBSCycpbwqOQFKFnKmuBcr+FE01RrhXu016Ica7yGYCPJC/9Vjm6DITJlA/Qh7EEfRNstS20zlpBqiwjhisVxc9RHm+Vc7fSP51/uScSCNjfbbr/NLwfuMnh9Di8= 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=QP//V3t1; 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="QP//V3t1" 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=IYHYMMQNyPankXBbRMqXeOpq9/s7Dc9NDhL2nVI10Tc=; b=QP//V3t18OO0hFgu+zzzoHQOkZ kOJSfDPLML7lHNFcjzf7zWpDNgGZBWYzKACMuQE5fCBK7m4sQamOecnzjT5yuYZm9rohYBAOxGGPs 33rUny1NaW6Smkd3+wJ/wGu3wWXXetgN855Cl0uLnzNqg3v7XYuJALkg2ccqYpngXRVWViY2l9OHi G1sZmjaBUoeI1zbG7spCvBzsRF2Czxhqr00T5m416n3fM8f0jVEZ/1ebpQUj9jGhAbVaTAo/eaG3y Ai0MPfhvc8OhWzYE129eQizMaoqW5KIYf5+sA4VjijdRmcehweX+zPtYVoQdEE7CvNkeNyTvNFOrF gdbDSBCA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:47894 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 1thRQx-0006X5-15; Mon, 10 Feb 2025 10:54:35 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1thRQd-003w7a-MM; Mon, 10 Feb 2025 10:54:15 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next 8/8] net: xpcs: group EEE code together 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: Mon, 10 Feb 2025 10:54:15 +0000 X-Patchwork-Delegate: kuba@kernel.org Move xpcs_config_eee() with the other EEE-related functions. Signed-off-by: Russell King (Oracle) --- drivers/net/pcs/pcs-xpcs.c | 58 +++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index cae6e8377191..ee0c1a27f06c 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -602,35 +602,6 @@ static void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces) __set_bit(compat->interface, interfaces); } -static int xpcs_config_eee(struct dw_xpcs *xpcs, bool enable) -{ - u16 mask, val; - int ret; - - mask = DW_VR_MII_EEE_LTX_EN | DW_VR_MII_EEE_LRX_EN | - DW_VR_MII_EEE_TX_QUIET_EN | DW_VR_MII_EEE_RX_QUIET_EN | - DW_VR_MII_EEE_TX_EN_CTRL | DW_VR_MII_EEE_RX_EN_CTRL | - DW_VR_MII_EEE_MULT_FACT_100NS; - - if (enable) - val = DW_VR_MII_EEE_LTX_EN | DW_VR_MII_EEE_LRX_EN | - DW_VR_MII_EEE_TX_QUIET_EN | DW_VR_MII_EEE_RX_QUIET_EN | - DW_VR_MII_EEE_TX_EN_CTRL | DW_VR_MII_EEE_RX_EN_CTRL | - FIELD_PREP(DW_VR_MII_EEE_MULT_FACT_100NS, - xpcs->eee_mult_fact); - else - val = 0; - - ret = xpcs_modify(xpcs, MDIO_MMD_VEND2, DW_VR_MII_EEE_MCTRL0, mask, - val); - if (ret < 0) - return ret; - - return xpcs_modify(xpcs, MDIO_MMD_VEND2, DW_VR_MII_EEE_MCTRL1, - DW_VR_MII_EEE_TRN_LPI, - enable ? DW_VR_MII_EEE_TRN_LPI : 0); -} - static void xpcs_pre_config(struct phylink_pcs *pcs, phy_interface_t interface) { struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs); @@ -1192,6 +1163,35 @@ static void xpcs_an_restart(struct phylink_pcs *pcs) BMCR_ANRESTART); } +static int xpcs_config_eee(struct dw_xpcs *xpcs, bool enable) +{ + u16 mask, val; + int ret; + + mask = DW_VR_MII_EEE_LTX_EN | DW_VR_MII_EEE_LRX_EN | + DW_VR_MII_EEE_TX_QUIET_EN | DW_VR_MII_EEE_RX_QUIET_EN | + DW_VR_MII_EEE_TX_EN_CTRL | DW_VR_MII_EEE_RX_EN_CTRL | + DW_VR_MII_EEE_MULT_FACT_100NS; + + if (enable) + val = DW_VR_MII_EEE_LTX_EN | DW_VR_MII_EEE_LRX_EN | + DW_VR_MII_EEE_TX_QUIET_EN | DW_VR_MII_EEE_RX_QUIET_EN | + DW_VR_MII_EEE_TX_EN_CTRL | DW_VR_MII_EEE_RX_EN_CTRL | + FIELD_PREP(DW_VR_MII_EEE_MULT_FACT_100NS, + xpcs->eee_mult_fact); + else + val = 0; + + ret = xpcs_modify(xpcs, MDIO_MMD_VEND2, DW_VR_MII_EEE_MCTRL0, mask, + val); + if (ret < 0) + return ret; + + return xpcs_modify(xpcs, MDIO_MMD_VEND2, DW_VR_MII_EEE_MCTRL1, + DW_VR_MII_EEE_TRN_LPI, + enable ? DW_VR_MII_EEE_TRN_LPI : 0); +} + static void xpcs_disable_eee(struct phylink_pcs *pcs) { struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);