summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-08-26 12:19:35 +0100
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2024-02-27 15:37:58 +0000
commitebe31c496d3917d9864193a3aeef367ce8e1ee7b (patch)
tree3f2d1f49e9a6f3ea5d53b004ee8023717e1fbe88
parent52c4fa30fac75c21e20f2ef74f58847eb2546b5d (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.c7
-rw-r--r--include/linux/phy.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index ea280b0d843c..d4433129aa3c 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1513,6 +1513,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);
@@ -1545,6 +1549,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 4fcd35a65ed2..e13780933b56 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -976,6 +976,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,