]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: phylink: introduce helpers for replaying link callbacks
authorVladimir Oltean <vladimir.oltean@nxp.com>
Mon, 19 Jan 2026 12:19:52 +0000 (14:19 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 22 Jan 2026 03:50:54 +0000 (19:50 -0800)
commit96969b132bf1a5b875ab84fcb41a5c4972c3be9e
tree4ea688d354e7ac5ce61af8c3e0f07a28a2298873
parent7bf588dc62a05c1866efe098e1b188fd879aa2cf
net: phylink: introduce helpers for replaying link callbacks

Some drivers of MAC + tightly integrated PCS (example: SJA1105 + XPCS
covered by same reset domain) need to perform resets at runtime.

The reset is triggered by the MAC driver, and it needs to restore its
and the PCS' registers, all invisible to phylink.

However, there is a desire to simplify the API through which the MAC and
the PCS interact, so this becomes challenging.

Phylink holds all the necessary state to help with this operation, and
can offer two helpers which walk the MAC and PCS drivers again through
the callbacks required during a destructive reset operation. The
procedure is as follows:

Before reset, MAC driver calls phylink_replay_link_begin():
- Triggers phylink mac_link_down() and pcs_link_down() methods

After reset, MAC driver calls phylink_replay_link_end():
- Triggers phylink mac_config() -> pcs_config() -> mac_link_up() ->
  pcs_link_up() methods.

MAC and PCS registers are restored with no other custom driver code.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/20260119121954.1624535-3-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/phylink.c
include/linux/phylink.h