summaryrefslogtreecommitdiff
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>2020-02-28 12:36:58 +0000
commitde1d66333983e0c80b551518ab62f11102969e6a (patch)
treef939256c3b77270fdc25dadb7572fb7c590c2df4
parentbf504f6f8146472fe5eb0323a1601fc6a4dee14e (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 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);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 8fc9583f7fa9..39a4f0c20792 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -521,6 +521,9 @@ struct phy_driver {
int (*suspend)(struct phy_device *phydev);
int (*resume)(struct phy_device *phydev);
+ int (*start)(struct phy_device *phydev);
+ void (*stop)(struct phy_device *phydev);
+
/*
* Configures the advertisement and resets
* autonegotiation if phydev->autoneg is on,