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>2022-06-21 10:57:39 +0100
commita1147f49b95c73cc90b2d5372f3619c3af4b0866 (patch)
tree2ed468c2f185d2f0d4eab336bbe9b6d027d76cec
parent87232ebda7ee5593c9cdf59ae2fb425a3953b933 (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.c5
-rw-r--r--include/linux/phy.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index f122026c4682..5c043b6ddb2f 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1056,6 +1056,8 @@ void phy_stop(struct phy_device *phydev)
sfp_upstream_stop(phydev->sfp_bus);
phydev->state = PHY_HALTED;
+ if (phydev->drv->stop)
+ phydev->drv->stop(phydev);
mutex_unlock(&phydev->lock);
@@ -1089,6 +1091,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 a99d41070984..6e74a71b68fd 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -803,6 +803,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,