netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phy: phylink: fix SFP interface autodetection
@ 2018-09-17 14:19 Baruch Siach
  2018-09-17 15:12 ` Russell King - ARM Linux
  0 siblings, 1 reply; 5+ messages in thread
From: Baruch Siach @ 2018-09-17 14:19 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli
  Cc: netdev, Russell King, Antoine Tenart, Gregory CLEMENT,
	Baruch Siach

When the switching to the SFP detected link mode update the main
link_interface field as well. Otherwise, the link fails to come up when
the configured 'phy-mode' defers from the SFP detected mode.

This fixes 1GB SFP module link up on eth3 of the Macchiatobin board that
is configured in the DT to "2500base-x" phy-mode.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 drivers/net/phy/phylink.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 3ba5cf2a8a5f..3ece48c86841 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1631,6 +1631,7 @@ static int phylink_sfp_module_insert(void *upstream,
 	if (pl->link_an_mode != MLO_AN_INBAND ||
 	    pl->link_config.interface != config.interface) {
 		pl->link_config.interface = config.interface;
+		pl->link_interface = config.interface;
 		pl->link_an_mode = MLO_AN_INBAND;
 
 		changed = true;
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] net: phy: phylink: fix SFP interface autodetection
@ 2018-09-22 19:09 Baruch Siach
  2018-09-22 19:18 ` Russell King - ARM Linux
  0 siblings, 1 reply; 5+ messages in thread
From: Baruch Siach @ 2018-09-22 19:09 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli
  Cc: netdev, Russell King, Antoine Tenart, Gregory CLEMENT,
	Baruch Siach

When connecting a PHY to phylink use the detected interface. Otherwise,
the link fails to come up when the configured 'phy-mode' differs from
the SFP detected mode.

This fixes 1GB SFP module link up on eth3 of the Macchiatobin board that
is configured in the DT to "2500base-x" phy-mode.

Fixes: 9525ae83959b6 ("phylink: add phylink infrastructure")
Suggested-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 drivers/net/phy/phylink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 3ba5cf2a8a5f..aa745decc81d 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -738,7 +738,7 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
 
 	if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED ||
 		    (pl->link_an_mode == MLO_AN_INBAND &&
-		     phy_interface_mode_is_8023z(pl->link_interface))))
+		     phy_interface_mode_is_8023z(pl->link_config.interface))))
 		return -EINVAL;
 
 	if (pl->phydev)
@@ -750,7 +750,7 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
 		pl->link_config.interface = pl->link_interface;
 	}
 
-	ret = phy_attach_direct(pl->netdev, phy, 0, pl->link_interface);
+	ret = phy_attach_direct(pl->netdev, phy, 0, pl->link_config.interface);
 	if (ret)
 		return ret;
 
-- 
2.19.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-09-23  1:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-17 14:19 [PATCH] net: phy: phylink: fix SFP interface autodetection Baruch Siach
2018-09-17 15:12 ` Russell King - ARM Linux
2018-09-17 15:39   ` Baruch Siach
  -- strict thread matches above, loose matches on Subject: below --
2018-09-22 19:09 Baruch Siach
2018-09-22 19:18 ` Russell King - ARM Linux

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).