diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2019-08-26 12:19:35 +0100 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2025-04-04 14:40:05 +0100 |
commit | d7ef39e05c9480c061da237ccc6cf309f01f244b (patch) | |
tree | b68c2a7fc8541166ac8db1d8e14bd113d7de05be | |
parent | f702cdcaaa57a54ea63745d67c90945abc6e10eb (diff) |
net: phy: provide phy driver start/stop hooks
Provide phy driver start/stop hooks so that the PHY driver knows when
the network driver is starting or stopping. This will be used for the
Marvell 10G driver so that we can sanely refuse to start if the PHYs
firmware is not present, and also so that we can sanely support SFPs
behind the PHY.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | drivers/net/phy/phy.c | 7 | ||||
-rw-r--r-- | include/linux/phy.h | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index d0c1718e2b16..b78bd086b1bc 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1643,6 +1643,10 @@ void phy_stop(struct phy_device *phydev) phy_process_state_change(phydev, old_state); state_work = _phy_state_machine(phydev); + + if (phydev->drv->stop) + phydev->drv->stop(phydev); + mutex_unlock(&phydev->lock); _phy_state_machine_post_work(phydev, state_work); @@ -1675,6 +1679,9 @@ void phy_start(struct phy_device *phydev) goto out; } + if (phydev->drv->start && phydev->drv->start(phydev)) + goto out; + if (phydev->sfp_bus) sfp_upstream_start(phydev->sfp_bus); diff --git a/include/linux/phy.h b/include/linux/phy.h index 8415b10e68fc..f6e5a698f02a 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1019,6 +1019,9 @@ struct phy_driver { /** @resume: Resume the hardware, restoring state if needed */ int (*resume)(struct phy_device *phydev); + int (*start)(struct phy_device *phydev); + void (*stop)(struct phy_device *phydev); + /** * @config_aneg: Configures the advertisement and resets * autonegotiation if phydev->autoneg is on, |