summaryrefslogtreecommitdiff
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-08-26 12:19:35 +0100
committerRussell King <rmk+kernel@armlinux.org.uk>2019-12-09 09:06:43 +0000
commit0cadc562fee3eacedf9c3775b03d9aa5e355d3ea (patch)
tree117cae759957aeebb1b6976ad024a88b6aa323cf /drivers/net/phy/phy.c
parentbef73d1fb67ab4dba8c5a714db578b9082820305 (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>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 80be4d691e5b..2534b4169613 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -786,6 +786,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);
@@ -819,6 +821,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);