mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	net: phy: Add phy_support_eee() indicating MAC support EEE
In order for EEE to operate, both the MAC and the PHY need to support it, similar to how pause works. With some exception - a number of PHYs have SmartEEE or AutoGrEEEn support in order to provide some EEE-like power savings with non-EEE capable MACs. Copy the pause concept and add the call phy_support_eee() which the MAC makes after connecting the PHY to indicate it supports EEE. phylib will then advertise EEE when auto-neg is performed. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.kernel.org/r/20240302195306.3207716-6-o.rempel@pengutronix.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
		
							parent
							
								
									3e43b903da
								
							
						
					
					
						commit
						49168d1980
					
				
					 2 changed files with 30 additions and 1 deletions
				
			
		| 
						 | 
					@ -2910,6 +2910,34 @@ void phy_advertise_eee_all(struct phy_device *phydev)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL_GPL(phy_advertise_eee_all);
 | 
					EXPORT_SYMBOL_GPL(phy_advertise_eee_all);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * phy_support_eee - Set initial EEE policy configuration
 | 
				
			||||||
 | 
					 * @phydev: Target phy_device struct
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This function configures the initial policy for Energy Efficient Ethernet
 | 
				
			||||||
 | 
					 * (EEE) on the specified PHY device, influencing that EEE capabilities are
 | 
				
			||||||
 | 
					 * advertised before the link is established. It should be called during PHY
 | 
				
			||||||
 | 
					 * registration by the MAC driver and/or the PHY driver (for SmartEEE PHYs)
 | 
				
			||||||
 | 
					 * if MAC supports LPI or PHY is capable to compensate missing LPI functionality
 | 
				
			||||||
 | 
					 * of the MAC.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The function sets default EEE policy parameters, including preparing the PHY
 | 
				
			||||||
 | 
					 * to advertise EEE capabilities based on hardware support.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * It also sets the expected configuration for Low Power Idle (LPI) in the MAC
 | 
				
			||||||
 | 
					 * driver. If the PHY framework determines that both local and remote
 | 
				
			||||||
 | 
					 * advertisements support EEE, and the negotiated link mode is compatible with
 | 
				
			||||||
 | 
					 * EEE, it will set enable_tx_lpi = true. The MAC driver is expected to act on
 | 
				
			||||||
 | 
					 * this setting by enabling the LPI timer if enable_tx_lpi is set.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void phy_support_eee(struct phy_device *phydev)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						linkmode_copy(phydev->advertising_eee, phydev->supported_eee);
 | 
				
			||||||
 | 
						phydev->eee_cfg.tx_lpi_enabled = true;
 | 
				
			||||||
 | 
						phydev->eee_cfg.eee_enabled = true;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(phy_support_eee);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * phy_support_sym_pause - Enable support of symmetrical pause
 | 
					 * phy_support_sym_pause - Enable support of symmetrical pause
 | 
				
			||||||
 * @phydev: target phy_device struct
 | 
					 * @phydev: target phy_device struct
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -706,7 +706,7 @@ struct phy_device {
 | 
				
			||||||
	__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);
 | 
						__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);
 | 
				
			||||||
	/* used with phy_speed_down */
 | 
						/* used with phy_speed_down */
 | 
				
			||||||
	__ETHTOOL_DECLARE_LINK_MODE_MASK(adv_old);
 | 
						__ETHTOOL_DECLARE_LINK_MODE_MASK(adv_old);
 | 
				
			||||||
	/* used for eee validation */
 | 
						/* used for eee validation and configuration*/
 | 
				
			||||||
	__ETHTOOL_DECLARE_LINK_MODE_MASK(supported_eee);
 | 
						__ETHTOOL_DECLARE_LINK_MODE_MASK(supported_eee);
 | 
				
			||||||
	__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising_eee);
 | 
						__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising_eee);
 | 
				
			||||||
	bool eee_enabled;
 | 
						bool eee_enabled;
 | 
				
			||||||
| 
						 | 
					@ -1973,6 +1973,7 @@ void phy_advertise_supported(struct phy_device *phydev);
 | 
				
			||||||
void phy_advertise_eee_all(struct phy_device *phydev);
 | 
					void phy_advertise_eee_all(struct phy_device *phydev);
 | 
				
			||||||
void phy_support_sym_pause(struct phy_device *phydev);
 | 
					void phy_support_sym_pause(struct phy_device *phydev);
 | 
				
			||||||
void phy_support_asym_pause(struct phy_device *phydev);
 | 
					void phy_support_asym_pause(struct phy_device *phydev);
 | 
				
			||||||
 | 
					void phy_support_eee(struct phy_device *phydev);
 | 
				
			||||||
void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx,
 | 
					void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx,
 | 
				
			||||||
		       bool autoneg);
 | 
							       bool autoneg);
 | 
				
			||||||
void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx);
 | 
					void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue