From: Russell King <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: [PATCH net-next 05/14] net: sfp: move phy_start()/phy_stop() to phylink
Date: Mon, 09 Dec 2019 14:07:06 +0000 [thread overview]
Message-ID: <E1ieJgo-0004Of-QQ@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20191209140258.GI25745@shell.armlinux.org.uk>
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.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phylink.c | 22 ++++++++++++++++++++++
drivers/net/phy/sfp.c | 2 --
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index d02eb83ed151..0c204b2e7dab 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1770,6 +1770,26 @@ static int phylink_sfp_module_insert(void *upstream,
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)
{
struct phylink *pl = upstream;
@@ -1805,6 +1825,8 @@ static const struct sfp_upstream_ops sfp_phylink_ops = {
.attach = phylink_sfp_attach,
.detach = phylink_sfp_detach,
.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_down = phylink_sfp_link_down,
.connect_phy = phylink_sfp_connect_phy,
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 23f30dac0f17..d7d2c797c89c 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -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)
{
- phy_stop(sfp->mod_phy);
sfp_remove_phy(sfp->sfp_bus);
phy_device_remove(sfp->mod_phy);
phy_device_free(sfp->mod_phy);
@@ -1427,7 +1426,6 @@ static void sfp_sm_probe_phy(struct sfp *sfp)
}
sfp->mod_phy = phy;
- phy_start(phy);
}
static void sfp_sm_link_up(struct sfp *sfp)
--
2.20.1
next prev parent reply other threads:[~2019-12-09 14:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-09 14:02 [PATCH net-next 00/14] Add support for SFP+ copper modules Russell King - ARM Linux admin
2019-12-09 14:06 ` [PATCH net-next 01/14] net: sfp: remove incomplete 100BASE-FX and 100BASE-LX support Russell King
2019-12-09 14:06 ` [PATCH net-next 02/14] net: sfp: derive interface mode from ethtool link modes Russell King
2019-12-09 14:06 ` [PATCH net-next 03/14] net: sfp: add more extended compliance codes Russell King
2019-12-09 14:07 ` [PATCH net-next 04/14] net: sfp: add module start/stop upstream notifications Russell King
2019-12-09 14:07 ` Russell King [this message]
2019-12-09 14:07 ` [PATCH net-next 06/14] net: mdio-i2c: add support for Clause 45 accesses Russell King
2019-12-09 14:07 ` [PATCH net-next 07/14] net: phylink: re-split __phylink_connect_phy() Russell King
2019-12-09 14:07 ` [PATCH net-next 08/14] net: phylink: support Clause 45 PHYs on SFP+ modules Russell King
2019-12-09 14:07 ` [PATCH net-next 09/14] net: phylink: split link_an_mode configured and current settings Russell King
2019-12-09 14:07 ` [PATCH net-next 10/14] net: phylink: split phylink_sfp_module_insert() Russell King
2019-12-09 14:07 ` [PATCH net-next 11/14] net: phylink: delay MAC configuration for copper SFP modules Russell King
2019-12-09 14:49 ` Russell King - ARM Linux admin
2019-12-09 14:07 ` [PATCH net-next 12/14] net: phylink: make Broadcom BCM84881 based SFPs work Russell King
2019-12-09 14:07 ` [PATCH net-next 13/14] net: phy: add Broadcom BCM84881 PHY driver Russell King
2019-12-09 14:07 ` [PATCH net-next 14/14] net: sfp: add support for Clause 45 PHYs Russell King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1ieJgo-0004Of-QQ@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).