Commit 4882057a authored by Russell King's avatar Russell King Committed by David S. Miller

net: sfp: move phy_start()/phy_stop() to phylink

Move phy_start() and phy_stop() into the module_start and module_stop
notifications in phylink, rather than having them in the SFP code.
This gives phylink responsibility for controlling the PHY, rather
than having SFP start and stop the PHY state machine.
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 74c551ca
...@@ -1767,6 +1767,26 @@ static int phylink_sfp_module_insert(void *upstream, ...@@ -1767,6 +1767,26 @@ static int phylink_sfp_module_insert(void *upstream,
return ret; return ret;
} }
static int phylink_sfp_module_start(void *upstream)
{
struct phylink *pl = upstream;
/* If this SFP module has a PHY, start the PHY now. */
if (pl->phydev)
phy_start(pl->phydev);
return 0;
}
static void phylink_sfp_module_stop(void *upstream)
{
struct phylink *pl = upstream;
/* If this SFP module has a PHY, stop it. */
if (pl->phydev)
phy_stop(pl->phydev);
}
static void phylink_sfp_link_down(void *upstream) static void phylink_sfp_link_down(void *upstream)
{ {
struct phylink *pl = upstream; struct phylink *pl = upstream;
...@@ -1802,6 +1822,8 @@ static const struct sfp_upstream_ops sfp_phylink_ops = { ...@@ -1802,6 +1822,8 @@ static const struct sfp_upstream_ops sfp_phylink_ops = {
.attach = phylink_sfp_attach, .attach = phylink_sfp_attach,
.detach = phylink_sfp_detach, .detach = phylink_sfp_detach,
.module_insert = phylink_sfp_module_insert, .module_insert = phylink_sfp_module_insert,
.module_start = phylink_sfp_module_start,
.module_stop = phylink_sfp_module_stop,
.link_up = phylink_sfp_link_up, .link_up = phylink_sfp_link_up,
.link_down = phylink_sfp_link_down, .link_down = phylink_sfp_link_down,
.connect_phy = phylink_sfp_connect_phy, .connect_phy = phylink_sfp_connect_phy,
......
...@@ -1396,7 +1396,6 @@ static void sfp_sm_mod_next(struct sfp *sfp, unsigned int state, ...@@ -1396,7 +1396,6 @@ static void sfp_sm_mod_next(struct sfp *sfp, unsigned int state,
static void sfp_sm_phy_detach(struct sfp *sfp) static void sfp_sm_phy_detach(struct sfp *sfp)
{ {
phy_stop(sfp->mod_phy);
sfp_remove_phy(sfp->sfp_bus); sfp_remove_phy(sfp->sfp_bus);
phy_device_remove(sfp->mod_phy); phy_device_remove(sfp->mod_phy);
phy_device_free(sfp->mod_phy); phy_device_free(sfp->mod_phy);
...@@ -1427,7 +1426,6 @@ static void sfp_sm_probe_phy(struct sfp *sfp) ...@@ -1427,7 +1426,6 @@ static void sfp_sm_probe_phy(struct sfp *sfp)
} }
sfp->mod_phy = phy; sfp->mod_phy = phy;
phy_start(phy);
} }
static void sfp_sm_link_up(struct sfp *sfp) static void sfp_sm_link_up(struct sfp *sfp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment