Skip to content

Commit a00e0d3

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: phy: add support for querying PHY clock stop capability
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. Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3ba0262 commit a00e0d3

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

drivers/net/phy/phy.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,26 @@ void phy_mac_interrupt(struct phy_device *phydev)
17031703
}
17041704
EXPORT_SYMBOL(phy_mac_interrupt);
17051705

1706+
/**
1707+
* phy_eee_tx_clock_stop_capable() - indicate whether the MAC can stop tx clock
1708+
* @phydev: target phy_device struct
1709+
*
1710+
* Indicate whether the MAC can disable the transmit xMII clock while in LPI
1711+
* state. Returns 1 if the MAC may stop the transmit clock, 0 if the MAC must
1712+
* not stop the transmit clock, or negative error.
1713+
*/
1714+
int phy_eee_tx_clock_stop_capable(struct phy_device *phydev)
1715+
{
1716+
int stat1;
1717+
1718+
stat1 = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_STAT1);
1719+
if (stat1 < 0)
1720+
return stat1;
1721+
1722+
return !!(stat1 & MDIO_PCS_STAT1_CLKSTOP_CAP);
1723+
}
1724+
EXPORT_SYMBOL_GPL(phy_eee_tx_clock_stop_capable);
1725+
17061726
/**
17071727
* phy_eee_rx_clock_stop() - configure PHY receive clock in LPI
17081728
* @phydev: target phy_device struct

include/linux/phy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,6 +2146,7 @@ int phy_unregister_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask);
21462146
int phy_unregister_fixup_for_id(const char *bus_id);
21472147
int phy_unregister_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask);
21482148

2149+
int phy_eee_tx_clock_stop_capable(struct phy_device *phydev);
21492150
int phy_eee_rx_clock_stop(struct phy_device *phydev, bool clk_stop_enable);
21502151
int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable);
21512152
int phy_get_eee_err(struct phy_device *phydev);

0 commit comments

Comments
 (0)